From e0b7c411c09b65f057370e24aa131d760e2d57a4 Mon Sep 17 00:00:00 2001 From: Toine Hartman Date: Mon, 5 Aug 2024 10:47:26 +0200 Subject: [PATCH] Improve error on except constructor rename. --- rascal-lsp/src/main/rascal/lang/rascal/lsp/refactor/Rename.rsc | 3 +++ .../src/main/rascal/lang/rascal/lsp/refactor/WorkspaceInfo.rsc | 1 + 2 files changed, 4 insertions(+) diff --git a/rascal-lsp/src/main/rascal/lang/rascal/lsp/refactor/Rename.rsc b/rascal-lsp/src/main/rascal/lang/rascal/lsp/refactor/Rename.rsc index 1c527be12..0db15066c 100644 --- a/rascal-lsp/src/main/rascal/lang/rascal/lsp/refactor/Rename.rsc +++ b/rascal-lsp/src/main/rascal/lang/rascal/lsp/refactor/Rename.rsc @@ -277,6 +277,8 @@ tuple[Cursor, WorkspaceInfo] getCursor(WorkspaceInfo ws, Tree cursorT) { , // Module name declaration, where the cursor location is in the module header , + // Nonterminal constructor names in exception productions + , } }; @@ -320,6 +322,7 @@ tuple[Cursor, WorkspaceInfo] getCursor(WorkspaceInfo ws, Tree cursorT) { } if (cur.l.scheme == "unknown") throw unsupportedRename("Could not retrieve information for \'\' at ."); + if (cur.kind is exceptConstructor) throw unsupportedRename("Constructors can not be renamed from except productions."); return ; } diff --git a/rascal-lsp/src/main/rascal/lang/rascal/lsp/refactor/WorkspaceInfo.rsc b/rascal-lsp/src/main/rascal/lang/rascal/lsp/refactor/WorkspaceInfo.rsc index a3c391df3..81b1630a8 100644 --- a/rascal-lsp/src/main/rascal/lang/rascal/lsp/refactor/WorkspaceInfo.rsc +++ b/rascal-lsp/src/main/rascal/lang/rascal/lsp/refactor/WorkspaceInfo.rsc @@ -53,6 +53,7 @@ data CursorKind | typeParam() | collectionField() | moduleName() + | exceptConstructor() ; data Cursor