Skip to content

Commit 2e5211e

Browse files
committed
Use SymbolKind in SymInfo
1 parent f8498b7 commit 2e5211e

File tree

4 files changed

+14
-11
lines changed

4 files changed

+14
-11
lines changed
Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,25 @@
11
package dotty.tools.languageserver
22

33
import org.junit.Test
4+
import org.eclipse.lsp4j.SymbolKind
45

56
import dotty.tools.languageserver.util.Code._
67

8+
79
class DocumentSymbolTest {
810

911
@Test def documentSymbol0: Unit =
10-
code"class ${m1}Foo$m2".withSource.documentSymbol(m1, (m1 to m2).symInfo("Foo", "Class"))
12+
code"class ${m1}Foo$m2".withSource.documentSymbol(m1, (m1 to m2).symInfo("Foo", SymbolKind.Class))
1113

1214
@Test def documentSymbol1: Unit =
1315
code"class ${m1}Foo$m2; class ${m3}Bar$m4".withSource
14-
.documentSymbol(m1, (m1 to m2).symInfo("Foo", "Class"), (m3 to m4).symInfo("Bar", "Class"))
16+
.documentSymbol(m1, (m1 to m2).symInfo("Foo", SymbolKind.Class), (m3 to m4).symInfo("Bar", SymbolKind.Class))
1517

1618
@Test def documentSymbol3: Unit = {
1719
withSources(
1820
code"class ${m1}Foo$m2",
1921
code"class ${m3}Bar$m4"
20-
) .documentSymbol(m1, (m1 to m2).symInfo("Foo", "Class"))
21-
.documentSymbol(m3, (m3 to m4).symInfo("Bar", "Class"))
22+
) .documentSymbol(m1, (m1 to m2).symInfo("Foo", SymbolKind.Class))
23+
.documentSymbol(m3, (m3 to m4).symInfo("Bar", SymbolKind.Class))
2224
}
2325
}

language-server/test/dotty/tools/languageserver/SymbolTest.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package dotty.tools.languageserver
22

33
import org.junit.Test
4+
import org.eclipse.lsp4j.SymbolKind
45

56
import dotty.tools.languageserver.util.Code._
67

@@ -21,7 +22,7 @@ class SymbolTest {
2122
| class Bar
2223
|}
2324
"""
24-
) .symbol("Foo", Foo.range.symInfo("Foo", "Class"), fooFoo.range.symInfo("Foo", "Class", "foo"))
25-
.symbol("Bar", Bar.range.symInfo("Bar", "Class"))
25+
) .symbol("Foo", Foo.range.symInfo("Foo", SymbolKind.Class), fooFoo.range.symInfo("Foo", SymbolKind.Class, "foo"))
26+
.symbol("Bar", Bar.range.symInfo("Bar", SymbolKind.Class))
2627
}
2728
}

language-server/test/dotty/tools/languageserver/util/CodeRange.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ case class CodeRange(start: CodeMarker, end: CodeMarker) {
3030

3131
def withCode(text: String): CodeInRange = CodeInRange(text, this)
3232

33-
def symInfo(name: String, kind: String, container: String = null): SymInfo =
33+
def symInfo(name: String, kind: SymbolKind, container: String = null): SymInfo =
3434
new SymInfo(name, kind, this, container)
3535

3636
def toRange: PosCtx[Range] = {
@@ -45,4 +45,4 @@ case class CodeRange(start: CodeMarker, end: CodeMarker) {
4545

4646
def show: PosCtx[String] =
4747
s"[start=${start.show}, end=${end.show}]"
48-
}
48+
}

language-server/test/dotty/tools/languageserver/util/SymInfo.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ package dotty.tools.languageserver.util
33
import dotty.tools.languageserver.util.PositionContext._
44
import org.eclipse.lsp4j._
55

6-
class SymInfo(name: String, kind: String, range: CodeRange, container: String) {
6+
class SymInfo(name: String, kind: SymbolKind, range: CodeRange, container: String) {
77
def toSymInformation: PosCtx[SymbolInformation] =
8-
new SymbolInformation(name, SymbolKind.valueOf(kind), range.toLocation, container)
8+
new SymbolInformation(name, kind, range.toLocation, container)
99

1010
def show: PosCtx[String] =
1111
s"SymInfo($name, $kind, ${range.show}, $container)"
1212
override def toString: String =
1313
s"SymInfo($name, $kind, $range, $container)"
14-
}
14+
}

0 commit comments

Comments
 (0)