Skip to content

Commit

Permalink
Server publishes CompletionCapabilities
Browse files Browse the repository at this point in the history
  • Loading branch information
manuEbg committed Jul 4, 2021
1 parent 602d478 commit ff3a23d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main/java/Server/MopeLSPServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public DiagnosticHandler getDiagnosticHandler(){

@Override
public CompletableFuture<InitializeResult> initialize(InitializeParams params) {
InitializeResult result = new InitializeResult(new ServerCapabilities());
InitializeResult result = new InitializeResult(MopeServerCapabilities.getCapabilities());

logger.info("Server->initialize triggerd");
compiler.connect();
Expand Down Expand Up @@ -96,4 +96,6 @@ public void publishDiagnosticsToAllClients(PublishDiagnosticsParams params){
c.publishDiagnostics(params);
}
}


}
20 changes: 20 additions & 0 deletions src/main/java/Server/MopeServerCapabilities.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package Server;

import org.eclipse.lsp4j.CompletionOptions;
import org.eclipse.lsp4j.ServerCapabilities;

import java.util.List;

public class MopeServerCapabilities {
public static ServerCapabilities getCapabilities(){
ServerCapabilities capabilities = new ServerCapabilities();
addCompletionCapabilities(capabilities);
return capabilities;
}
private static void addCompletionCapabilities(ServerCapabilities cap){
CompletionOptions completion = new CompletionOptions();
completion.setTriggerCharacters(List.of("."));
completion.setResolveProvider(false);
cap.setCompletionProvider(completion);
}
}

0 comments on commit ff3a23d

Please sign in to comment.