forked from LucasBullen/LSP4J_Tutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEclipseConLanguageServer.java
More file actions
60 lines (45 loc) · 1.88 KB
/
EclipseConLanguageServer.java
File metadata and controls
60 lines (45 loc) · 1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
package org.eclipsecon.exercise2;
import java.util.concurrent.CompletableFuture;
import org.eclipse.lsp4j.InitializeParams;
import org.eclipse.lsp4j.InitializeResult;
import org.eclipse.lsp4j.ServerCapabilities;
import org.eclipse.lsp4j.TextDocumentSyncKind;
import org.eclipse.lsp4j.services.LanguageClient;
import org.eclipse.lsp4j.services.LanguageServer;
import org.eclipse.lsp4j.services.TextDocumentService;
import org.eclipse.lsp4j.services.WorkspaceService;
public class EclipseConLanguageServer implements LanguageServer {
private TextDocumentService textService;
private WorkspaceService workspaceService;
LanguageClient client;
public EclipseConLanguageServer() {
/*Here the Text Document Server is initialized*/
textService = new EclipseConTextDocumentService(this);
workspaceService = new EclipseConWorkspaceService();
}
public CompletableFuture<InitializeResult> initialize(InitializeParams params) {
final InitializeResult res = new InitializeResult(new ServerCapabilities());
res.getCapabilities().setCodeActionProvider(Boolean.TRUE);
res.getCapabilities().setDefinitionProvider(Boolean.TRUE);
res.getCapabilities().setHoverProvider(Boolean.TRUE);
res.getCapabilities().setReferencesProvider(Boolean.TRUE);
res.getCapabilities().setTextDocumentSync(TextDocumentSyncKind.Full);
res.getCapabilities().setDocumentSymbolProvider(Boolean.TRUE);
/* Add the Completion Provider capability to the Initialize Result below*/
return CompletableFuture.supplyAsync(() -> res);
}
public CompletableFuture<Object> shutdown() {
return CompletableFuture.supplyAsync(() -> Boolean.TRUE);
}
public void exit() {
}
public TextDocumentService getTextDocumentService() {
return this.textService;
}
public WorkspaceService getWorkspaceService() {
return this.workspaceService;
}
public void setRemoteProxy(LanguageClient remoteProxy) {
this.client = remoteProxy;
}
}