Skip to content

Commit 3533e18

Browse files
committed
Inline function.
1 parent b1bf2ab commit 3533e18

2 files changed

Lines changed: 4 additions & 7 deletions

File tree

rascal-lsp/src/main/java/org/rascalmpl/vscode/lsp/rascal/RascalTextDocumentService.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,8 @@ public CompletableFuture<Either3<Range, PrepareRenameResult, PrepareRenameDefaul
366366
IList focus = TreeSearch.computeFocusList(tr, rascalCursorPos.getLine(), rascalCursorPos.getCharacter());
367367
return findQualifiedNameUnderCursor(focus);
368368
})
369-
.thenApply(cur -> DocumentChanges.locationToRange(this, TreeAdapter.getLocation(cur)))
369+
.thenApply(TreeAdapter::getLocation)
370+
.thenApply(loc -> Locations.toRange(loc, columns))
370371
.thenApply(Either3::forFirst);
371372
}
372373

rascal-lsp/src/main/java/org/rascalmpl/vscode/lsp/util/DocumentChanges.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@ public static List<TextEdit> translateTextEdits(final IBaseTextDocumentService d
101101
return edits.stream()
102102
.map(IConstructor.class::cast)
103103
.map(c -> {
104-
var range = locationToRange(docService, (ISourceLocation) c.get("range"));
104+
var loc = (ISourceLocation) c.get("range");
105+
var range = Locations.toRange(loc, docService.getColumnMap(loc));
105106
var replacement = ((IString) c.get("replacement")).getValue();
106107
// Check annotation
107108
var kw = c.asWithKeywordParameters();
@@ -125,11 +126,6 @@ public static List<TextEdit> translateTextEdits(final IBaseTextDocumentService d
125126
.collect(Collectors.toList());
126127
}
127128

128-
public static Range locationToRange(final IBaseTextDocumentService docService, ISourceLocation loc) {
129-
LineColumnOffsetMap columnMap = docService.getColumnMap(loc);
130-
return Locations.toRange(loc, columnMap);
131-
}
132-
133129
private static String getFileURI(IConstructor edit, String label) {
134130
return ((ISourceLocation) edit.get(label)).getURI().toString();
135131
}

0 commit comments

Comments
 (0)