2 Commits

Author SHA1 Message Date
Ruben
7e6e968b0f feat: do not show 100 times the insert 2025-09-22 18:22:05 +02:00
Ruben
dded453ba3 feat: update jar and Version 2025-09-22 15:42:25 +02:00
3 changed files with 35 additions and 28 deletions

View File

@@ -3,7 +3,7 @@
"name": "java-tx-language-extension", "name": "java-tx-language-extension",
"displayName": "Java-TX Language Extension", "displayName": "Java-TX Language Extension",
"description": "The Language Extension for Java-TX with Typehints and Syntax Checks", "description": "The Language Extension for Java-TX with Typehints and Syntax Checks",
"version": "0.0.9", "version": "0.0.11",
"engines": { "engines": {
"vscode": "^1.94.0" "vscode": "^1.94.0"
}, },

View File

@@ -105,6 +105,7 @@ public class CodeActionHandler {
String documentUri = params.getTextDocument().getUri(); String documentUri = params.getTextDocument().getUri();
Range rangeOfInsert = params.getRange(); Range rangeOfInsert = params.getRange();
if (typeResolver.getInserts() != null) {
//All Diagnostics that are in range of the hover -> All Diagnostics of the selected Variable and thus all Types of the Variable //All Diagnostics that are in range of the hover -> All Diagnostics of the selected Variable and thus all Types of the Variable
Map<String, List<PlaceholderVariable>> typeInsertsOverlapping = getOverlapping(typeResolver.getInserts(), rangeOfInsert.getStart().getLine() + 1, rangeOfInsert.getStart().getCharacter(), rangeOfInsert.getEnd().getCharacter()); Map<String, List<PlaceholderVariable>> typeInsertsOverlapping = getOverlapping(typeResolver.getInserts(), rangeOfInsert.getStart().getLine() + 1, rangeOfInsert.getStart().getCharacter(), rangeOfInsert.getEnd().getCharacter());
logService.log("Inserts are:"); logService.log("Inserts are:");
@@ -135,7 +136,10 @@ public class CodeActionHandler {
CodeAction action = new CodeAction("Insert " + conversionHelper.cleanType(typeInsert.getInsertString())); CodeAction action = new CodeAction("Insert " + conversionHelper.cleanType(typeInsert.getInsertString()));
action.setKind(CodeActionKind.QuickFix); action.setKind(CodeActionKind.QuickFix);
action.setEdit(edit); action.setEdit(edit);
if(!actions.stream().map(el -> el.getRight().getTitle()).toList().contains(action.getTitle())){
actions.add(Either.forRight(action)); actions.add(Either.forRight(action));
}
} catch (Exception e) { } catch (Exception e) {
logService.log("Error creating Actions, returning empty List. The Error was: " + e.getMessage(), MessageType.Error); logService.log("Error creating Actions, returning empty List. The Error was: " + e.getMessage(), MessageType.Error);
} }
@@ -144,6 +148,9 @@ public class CodeActionHandler {
return actions; return actions;
} }
return new ArrayList<>();
}
public List<Either<Command, CodeAction>> handleCodeAction(CodeActionParams params) { public List<Either<Command, CodeAction>> handleCodeAction(CodeActionParams params) {
String documentUri = params.getTextDocument().getUri(); String documentUri = params.getTextDocument().getUri();