diff --git a/src/main/java/Server/Compiler/ModelicaDiagnostic.java b/src/main/java/Server/Compiler/ModelicaDiagnostic.java index 805fc83..323f366 100644 --- a/src/main/java/Server/Compiler/ModelicaDiagnostic.java +++ b/src/main/java/Server/Compiler/ModelicaDiagnostic.java @@ -116,10 +116,10 @@ private void _parseErrorRange(String start, String end){ - startP.setLine(Integer.parseInt(startRange[0])); - startP.setCharacter(Integer.parseInt(startRange[1])); - endP.setLine(Integer.parseInt(endRange[0])); - endP.setCharacter(Integer.parseInt(endRange[1])); + startP.setLine(Integer.parseInt(startRange[0]) - 1); + startP.setCharacter(Integer.parseInt(startRange[1]) -1); + endP.setLine(Integer.parseInt(endRange[0])-1); + endP.setCharacter(Integer.parseInt(endRange[1])-1); errorRange.setStart(startP); errorRange.setEnd(endP); diff --git a/src/main/java/Server/CompletionProvider.java b/src/main/java/Server/CompletionProvider.java index 0b2095e..c2659b7 100644 --- a/src/main/java/Server/CompletionProvider.java +++ b/src/main/java/Server/CompletionProvider.java @@ -27,7 +27,7 @@ public class CompletionProvider { /** * These Characters mark the beginning of a possible symbol */ - private static final char[] limiter = {'\t',' ', ';', '\n'}; + private static final char[] limiter = {'\t',' ', ';', '\n',}; private static final Logger logger = LoggerFactory.getLogger(CompletionProvider.class); public static List complete(CompletionParams params, ICompilerAdapter compiler) throws FileNotFoundException { @@ -100,7 +100,7 @@ private static String findCompletableSymbol(String URI, int line, int col) throw char current; while(col >= 0){ current = selectedLine.charAt(col); - if(Arrays.asList(limiter).contains(current) ) break; + if(Arrays.asList(limiter).contains(current) || Character.isSpaceChar(current)) break; builder.append(current); col--; } diff --git a/src/main/java/Server/DiagnosticHandler.java b/src/main/java/Server/DiagnosticHandler.java index ffaa7a7..8ae7a82 100644 --- a/src/main/java/Server/DiagnosticHandler.java +++ b/src/main/java/Server/DiagnosticHandler.java @@ -19,16 +19,18 @@ public DiagnosticHandler(MopeLSPServer server){ } public void publishDiagnostics(){ + for(String location : Diagnostics.keySet()){ var params = new PublishDiagnosticsParams(); params.setUri(location); params.setDiagnostics(Diagnostics.get(location)); server.publishDiagnosticsToAllClients(params); } + } public void addDiagnostics(List diagnostics){ - if(diagnostics.isEmpty()) return; + if(diagnostics.isEmpty()) {publishDiagnostics(); return;} for(ModelicaDiagnostic dia : diagnostics){ if(Diagnostics.containsKey(dia.getUri())) Diagnostics.get(dia.getUri()).add(dia); @@ -41,7 +43,9 @@ public void addDiagnostics(List diagnostics){ } public void clearDiagnostics(){ - Diagnostics.clear(); + for(String key : Diagnostics.keySet()){ + Diagnostics.get(key).clear(); + } } }