Skip to content

Commit ef978a7

Browse files
committed
Address review comments
1 parent 73f1112 commit ef978a7

File tree

2 files changed

+9
-17
lines changed

2 files changed

+9
-17
lines changed

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

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,23 +26,21 @@ class CodeTester(sources: List[SourceWithPositions], actions: List[Action]) {
2626
*
2727
* @param range The range over which to hover.
2828
* @param expected The expected result.
29-
* @return This `CodeTester` after performing the action.
3029
*
3130
* @see dotty.tools.languageserver.util.actions.CodeHover
3231
*/
33-
def hover(range: CodeRange, expected: String): CodeTester =
32+
def hover(range: CodeRange, expected: String): this.type =
3433
doAction(new CodeHover(range, expected))
3534

3635
/**
3736
* Perform a jump to definition over `range`, verifies that the results are `expected`.
3837
*
3938
* @param range The range of positions from which run `jump to definition`.
4039
* @param expected The expected positions to jump to.
41-
* @return This `CodeTester` after performing the action.
4240
*
4341
* @see dotty.tools.languageserver.util.actions.CodeDefinition
4442
*/
45-
def definition(range: CodeRange, expected: Seq[CodeRange]): CodeTester =
43+
def definition(range: CodeRange, expected: Seq[CodeRange]): this.type =
4644
doAction(new CodeDefinition(range, expected))
4745

4846
/**
@@ -51,11 +49,10 @@ class CodeTester(sources: List[SourceWithPositions], actions: List[Action]) {
5149
*
5250
* @param range The range of positions to highlight.
5351
* @param expected The expected ranges and the kind of symbols that should be highlighted.
54-
* @return This `CodeTester` after performing the action.
5552
*
5653
* @see dotty.tools.languageserver.util.actions.CodeDefinition
5754
*/
58-
def highlight(range: CodeRange, expected: (CodeRange, DocumentHighlightKind)*): CodeTester =
55+
def highlight(range: CodeRange, expected: (CodeRange, DocumentHighlightKind)*): this.type =
5956
doAction(new CodeDocumentHighlight(range, expected))
6057

6158
/**
@@ -64,11 +61,10 @@ class CodeTester(sources: List[SourceWithPositions], actions: List[Action]) {
6461
* @param range The range of positions from which search for references.
6562
* @param expected The expected positions of the references
6663
* @param withDecl When set, include the declaration of the symbol under `range` in the results.
67-
* @return This `CodeTester` after performing the action.
6864
*
6965
* @see dotty.tools.languageserver.util.actions.CodeReferences
7066
*/
71-
def references(range: CodeRange, expected: List[CodeRange], withDecl: Boolean = false): CodeTester =
67+
def references(range: CodeRange, expected: List[CodeRange], withDecl: Boolean = false): this.type =
7268
doAction(new CodeReferences(range, expected, withDecl))
7369

7470
/**
@@ -77,11 +73,10 @@ class CodeTester(sources: List[SourceWithPositions], actions: List[Action]) {
7773
*
7874
* @param marker The position from which to ask for completions.
7975
* @param expected The expected completion results.
80-
* @return This `CodeTester` after performing the action.
8176
*
8277
* @see dotty.tools.languageserver.util.actions.CodeCompletion
8378
*/
84-
def completion(marker: CodeMarker, expected: Set[(String, CompletionItemKind, String)]): CodeTester =
79+
def completion(marker: CodeMarker, expected: Set[(String, CompletionItemKind, String)]): this.type =
8580
doAction(new CodeCompletion(marker, expected))
8681

8782
/**
@@ -91,11 +86,10 @@ class CodeTester(sources: List[SourceWithPositions], actions: List[Action]) {
9186
* @param marker The position from which to ask for renaming.
9287
* @param newName The new name to give to the symbol.
9388
* @param expected The expected positions to change.
94-
* @return This `CodeTester` after performing the action.
9589
*
9690
* @see dotty.tools.languageserver.util.actions.CodeRename
9791
*/
98-
def rename(marker: CodeMarker, newName: String, expected: Set[CodeRange]): CodeTester =
92+
def rename(marker: CodeMarker, newName: String, expected: Set[CodeRange]): this.type =
9993
doAction(new CodeRename(marker, newName, expected)) // TODO apply changes to the sources and positions
10094

10195
/**
@@ -104,11 +98,10 @@ class CodeTester(sources: List[SourceWithPositions], actions: List[Action]) {
10498
*
10599
* @param marker The marker defining the source file from which to query.
106100
* @param expected The expected symbols to be found.
107-
* @return This `CodeTester` after performing the action.
108101
*
109102
* @see dotty.tools.languageserver.util.actions.CodeDocumentSymbol
110103
*/
111-
def documentSymbol(marker: CodeMarker, expected: SymInfo*): CodeTester =
104+
def documentSymbol(marker: CodeMarker, expected: SymInfo*): this.type =
112105
doAction(new CodeDocumentSymbol(marker, expected))
113106

114107
/**
@@ -117,11 +110,10 @@ class CodeTester(sources: List[SourceWithPositions], actions: List[Action]) {
117110
*
118111
* @param query The query used to find symbols.
119112
* @param expected The expected symbols to be found.
120-
* @return This `CodeTester` after performing the action.
121113
*
122114
* @see dotty.tools.languageserver.util.actions.CodeSymbol
123115
*/
124-
def symbol(query: String, symbols: SymInfo*): CodeTester =
116+
def symbol(query: String, symbols: SymInfo*): this.type =
125117
doAction(new CodeSymbol(query, symbols))
126118

127119
private def doAction(action: Action): this.type = {

language-server/test/dotty/tools/languageserver/util/actions/CodeCompletion.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class CodeCompletion(override val marker: CodeMarker,
2121

2222
override def execute(): Exec[Unit] = {
2323
val result = server.completion(marker.toTextDocumentPositionParams).get()
24-
assertTrue(s"Completion results where not 'right': $result", result.isRight)
24+
assertTrue(s"Completion results were not 'right': $result", result.isRight)
2525
assertFalse(s"Completion results were 'incomplete': $result", result.getRight.isIncomplete)
2626
val completionResults = result.getRight.getItems.asScala.toSet.map { item =>
2727
(item.getLabel, item.getKind, item.getDetail)

0 commit comments

Comments
 (0)