-
Notifications
You must be signed in to change notification settings - Fork 3
/
AcceleoWorkspaceService.java
110 lines (94 loc) · 3.35 KB
/
AcceleoWorkspaceService.java
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
/*******************************************************************************
* Copyright (c) 2020, 2023 Obeo.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v20.html
*
* Contributors:
* Obeo - initial API and implementation
*******************************************************************************/
package org.eclipse.acceleo.aql.ls.services.workspace;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.CompletableFuture;
import org.eclipse.acceleo.aql.ls.AcceleoLanguageServer;
import org.eclipse.lsp4j.DidChangeConfigurationParams;
import org.eclipse.lsp4j.DidChangeWatchedFilesParams;
import org.eclipse.lsp4j.DidChangeWorkspaceFoldersParams;
import org.eclipse.lsp4j.ExecuteCommandParams;
import org.eclipse.lsp4j.SymbolInformation;
import org.eclipse.lsp4j.WorkspaceSymbol;
import org.eclipse.lsp4j.WorkspaceSymbolParams;
import org.eclipse.lsp4j.jsonrpc.messages.Either;
import org.eclipse.lsp4j.services.LanguageClient;
import org.eclipse.lsp4j.services.LanguageClientAware;
import org.eclipse.lsp4j.services.WorkspaceService;
public class AcceleoWorkspaceService implements WorkspaceService, LanguageClientAware {
/**
* The owning {@link AcceleoLanguageServer} of this service.
*/
private final AcceleoLanguageServer server;
/**
* The current client.
*/
private LanguageClient languageClient;
/**
* The current {@link AcceleoWorkspace}.
*/
private final AcceleoWorkspace acceleoWorkspace;
/**
* Creates a new {@link AcceleoWorkspaceService}.
*
* @param acceleoLanguageServer
* the (non-{@code null}) owning {@link AcceleoLanguageServer}.
*/
public AcceleoWorkspaceService(AcceleoLanguageServer acceleoLanguageServer) {
this.server = Objects.requireNonNull(acceleoLanguageServer);
this.acceleoWorkspace = this.server.connectWorkspace();
}
@Override
public void connect(LanguageClient newLanguageClient) {
this.languageClient = newLanguageClient;
}
/**
* Disconnects from the {@link LanguageClient}.
*/
public void disconnect() {
this.languageClient = null;
}
/**
* Provides the current {@link AcceleoWorkspace}.
*
* @return the (non-{@code null}) current {@link AcceleoWorkspace}.
*/
public AcceleoWorkspace getWorkspace() {
return this.acceleoWorkspace;
}
@Override
public void didChangeConfiguration(DidChangeConfigurationParams params) {
// TODO Auto-generated method stub
System.out.println(params);
}
@Override
public void didChangeWatchedFiles(DidChangeWatchedFilesParams params) {
// TODO Auto-generated method stub
System.out.println(params);
}
@Override
public void didChangeWorkspaceFolders(DidChangeWorkspaceFoldersParams params) {
// TODO Auto-generated method stub
WorkspaceService.super.didChangeWorkspaceFolders(params);
}
@Override
public CompletableFuture<Object> executeCommand(ExecuteCommandParams params) {
// TODO Auto-generated method stub
return WorkspaceService.super.executeCommand(params);
}
@Override
public CompletableFuture<Either<List<? extends SymbolInformation>, List<? extends WorkspaceSymbol>>> symbol(
WorkspaceSymbolParams params) {
// TODO Auto-generated method stub
return WorkspaceService.super.symbol(params);
}
}