From b3f0dc9a8bf2b1823f84ef143c9fe72eda9a50f1 Mon Sep 17 00:00:00 2001 From: Toine Hartman Date: Mon, 23 Dec 2024 15:26:16 +0100 Subject: [PATCH] Clean up code. --- .../vscode/lsp/rascal/RascalTextDocumentService.java | 4 +++- .../rascalmpl/vscode/lsp/rascal/RascalWorkspaceService.java | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/rascal-lsp/src/main/java/org/rascalmpl/vscode/lsp/rascal/RascalTextDocumentService.java b/rascal-lsp/src/main/java/org/rascalmpl/vscode/lsp/rascal/RascalTextDocumentService.java index d161daf9..69c2b660 100644 --- a/rascal-lsp/src/main/java/org/rascalmpl/vscode/lsp/rascal/RascalTextDocumentService.java +++ b/rascal-lsp/src/main/java/org/rascalmpl/vscode/lsp/rascal/RascalTextDocumentService.java @@ -302,7 +302,9 @@ private ITree getCursorFromPosition(ISourceLocation file, ITree moduleTree, Posi // Find all trees containing the cursor, in ascending order of size IList focusList = TreeSearch.computeFocusList(moduleTree, rascalCursorPos.getLine(), rascalCursorPos.getCharacter()); List sortNames = focusList.stream() - .map(tree -> ProductionAdapter.getSortName(TreeAdapter.getProduction((ITree) tree))) + .map(ITree.class::cast) + .map(TreeAdapter::getProduction) + .map(ProductionAdapter::getSortName) .collect(Collectors.toList()); int qNameIdx = sortNames.indexOf("QualifiedName"); diff --git a/rascal-lsp/src/main/java/org/rascalmpl/vscode/lsp/rascal/RascalWorkspaceService.java b/rascal-lsp/src/main/java/org/rascalmpl/vscode/lsp/rascal/RascalWorkspaceService.java index 84dae0f0..85b53887 100644 --- a/rascal-lsp/src/main/java/org/rascalmpl/vscode/lsp/rascal/RascalWorkspaceService.java +++ b/rascal-lsp/src/main/java/org/rascalmpl/vscode/lsp/rascal/RascalWorkspaceService.java @@ -88,6 +88,6 @@ public void didRenameFiles(RenameFilesParams params) { .map(f -> Locations.toLoc(f.getUri())) .collect(Collectors.toSet()) , getExecuter() - ).thenAccept(folders -> ((RascalTextDocumentService) docService).didRenameFiles(params, folders)); + ).thenAccept(folders -> docService.didRenameFiles(params, folders)); } }