Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Presentation #125

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/main/java/Server/Compiler/ModelicaDiagnostic.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/Server/CompletionProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<CompletionItem> complete(CompletionParams params, ICompilerAdapter compiler) throws FileNotFoundException {
Expand Down Expand Up @@ -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--;
}
Expand Down
8 changes: 6 additions & 2 deletions src/main/java/Server/DiagnosticHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<ModelicaDiagnostic> 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);
Expand All @@ -41,7 +43,9 @@ public void addDiagnostics(List<ModelicaDiagnostic> diagnostics){
}

public void clearDiagnostics(){
Diagnostics.clear();
for(String key : Diagnostics.keySet()){
Diagnostics.get(key).clear();
}
}

}