Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ object EndMarker:
def getPosition(df: NamedDefTree, pos: SourcePosition, sourceText: String)(
implicit ct: Context
): Option[SourcePosition] =
val name = df.name.toString()
val name = df.name.toString().stripSuffix("$")
val endMarkerLine =
sourceText.slice(df.span.start, df.span.end).split('\n').last
val index = endMarkerLine.length() - name.length()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -534,3 +534,14 @@ class PcRenameSuite extends BasePcRenameSuite:
|""".stripMargin,
wrap = false
)

@Test def `local-object-with-end-rename` =
check(
"""|def bar =
| object <<fo@@o>>:
| def aaa = ???
| end <<foo>>
| 1
|""".stripMargin,
wrap = false
)
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ class SemanticTokensSuite extends BaseSemanticTokensSuite:
| } = new:
| def <<scalameta>>/*method,definition*/ = "4.0"
| <<V>>/*variable,readonly*/.<<scalameta>>/*method*/
|end StructuralTypes
|end <<StructuralTypes>>/*class,definition*/
|""".stripMargin
)

Expand Down Expand Up @@ -431,4 +431,13 @@ class SemanticTokensSuite extends BaseSemanticTokensSuite:
| <<usage>>/*method*/[<<Option>>/*class,abstract*/[<<Int>>/*class,abstract*/]](<<_>>/*parameter,readonly*/.<<typeArg>>/*method*/[<<Some>>/*class*/[<<Int>>/*class,abstract*/]].<<value>>/*variable,readonly*/.<<inferredTypeArg>>/*method*/[<<String>>/*type*/]("str"))
|}
|""".stripMargin
)
)

@Test def `local-object-with-end-i7246` =
check(
"""|def <<bar>>/*method,definition*/ =
| object <<foo>>/*class*/:
| def <<aaa>>/*method,definition*/ = <<???>>/*method*/
| end <<foo>>/*class,definition*/
|""".stripMargin
)