Skip to content

Commit f98cf74

Browse files
oderskynicolasstucki
authored andcommitted
Apply renamings to language server
1 parent 7ffdc2f commit f98cf74

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

language-server/src/dotty/tools/languageserver/DottyLanguageServer.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import scala.io.Codec
1818

1919
import dotc._
2020
import ast.{Trees, tpd}
21-
import core._, core.Decorators.{sourcePos => _, _}
21+
import core._, core.Decorators._
2222
import Annotations.AnnotInfo
2323
import Comments._, Constants._, Contexts._, Flags._, Names._, NameOps._, Symbols._, SymDenotations._, Trees._, Types._
2424
import classpath.ClassPathEntries
@@ -388,7 +388,7 @@ class DottyLanguageServer extends LanguageServer
388388
val refs =
389389
path match {
390390
// Selected a renaming in an import node
391-
case Thicket(_ :: (rename: Ident) :: Nil) :: (_: Import) :: rest if rename.pos.contains(pos.pos) =>
391+
case Thicket(_ :: (rename: Ident) :: Nil) :: (_: Import) :: rest if rename.span.contains(pos.span) =>
392392
findRenamedReferences(uriTrees, syms, rename.name)
393393

394394
// Selected a reference that has been renamed
@@ -545,7 +545,7 @@ class DottyLanguageServer extends LanguageServer
545545
val trees = driver.openedTrees(uri)
546546
val path = Interactive.pathTo(trees, pos).dropWhile(!_.isInstanceOf[Apply])
547547

548-
val (paramN, callableN, alternatives) = Signatures.callInfo(path, pos.pos)
548+
val (paramN, callableN, alternatives) = Signatures.callInfo(path, pos.span)
549549
val signatureInfos = alternatives.flatMap(Signatures.toSignature)
550550

551551
new SignatureHelp(signatureInfos.map(signatureToSignatureInformation).asJava, callableN, paramN)
@@ -754,7 +754,7 @@ object DottyLanguageServer {
754754
* @return The position in the actual source file (before wrapping).
755755
*/
756756
private def toUnwrappedPosition(position: SourcePosition): SourcePosition = {
757-
new SourcePosition(position.source, position.pos, position.outer) {
757+
new SourcePosition(position.source, position.span, position.outer) {
758758
override def startLine: Int = position.startLine - 1
759759
override def endLine: Int = position.endLine - 1
760760
}

language-server/src/dotty/tools/languageserver/worksheet/Worksheet.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ object Worksheet {
4040
template.body.flatMap {
4141
case statement: DefTree if statement.symbol.is(Synthetic) =>
4242
None
43-
case statement if seen.add(bounds(statement.pos)) =>
43+
case statement if seen.add(bounds(statement.span)) =>
4444
Some(query(statement, tree.source))
4545
case _ =>
4646
None
@@ -66,12 +66,12 @@ object Worksheet {
6666
* @param sourcefile The sourcefile of the worksheet.
6767
*/
6868
private def query(tree: Tree, sourcefile: SourceFile): (Int, String) = {
69-
val line = sourcefile.offsetToLine(tree.pos.end)
70-
val source = sourcefile.content.slice(tree.pos.start, tree.pos.end).mkString
69+
val line = sourcefile.offsetToLine(tree.span.end)
70+
val source = sourcefile.content.slice(tree.span.start, tree.span.end).mkString
7171
(line, source)
7272
}
7373

74-
private def bounds(pos: Span): (Int, Int) = (pos.start, pos.end)
74+
private def bounds(span: Span): (Int, Int) = (span.start, span.end)
7575

7676
}
7777

0 commit comments

Comments
 (0)