Java artifacts for buildship30 plugin. Fix semantic tokens refresh.

This commit is contained in:
aboyko
2024-04-30 10:28:02 -04:00
parent 77cac434db
commit 4ca41cf0e0
4 changed files with 19 additions and 1 deletions

View File

@@ -1,5 +1,7 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
plugin.properties,\
plugin.xml,\
about.html

View File

@@ -386,6 +386,7 @@ public final class SimpleLanguageServer implements Sts4LanguageServer, SpringInd
log.debug("hasExecuteCommandSupport = "+hasExecuteCommandSupport);
getTextDocumentService().clientCapabilities = params.getCapabilities().getTextDocument();
getWorkspaceService().clientCapabilities = params.getCapabilities().getWorkspace();
InitializeResult result = new InitializeResult();

View File

@@ -28,7 +28,9 @@ import org.eclipse.lsp4j.DidChangeWorkspaceFoldersParams;
import org.eclipse.lsp4j.ExecuteCommandParams;
import org.eclipse.lsp4j.FileChangeType;
import org.eclipse.lsp4j.FileEvent;
import org.eclipse.lsp4j.SemanticTokensWorkspaceCapabilities;
import org.eclipse.lsp4j.SymbolInformation;
import org.eclipse.lsp4j.WorkspaceClientCapabilities;
import org.eclipse.lsp4j.WorkspaceFolder;
import org.eclipse.lsp4j.WorkspaceFoldersChangeEvent;
import org.eclipse.lsp4j.WorkspaceSymbol;
@@ -61,6 +63,7 @@ public class SimpleWorkspaceService implements WorkspaceService {
private ListenerList<DidChangeWorkspaceFoldersParams> workspaceFolderListeners = new ListenerList<>();
WorkspaceClientCapabilities clientCapabilities;
public SimpleWorkspaceService(SimpleLanguageServer server) {
this.fileObserver = new SimpleServerFileObserver(server);
@@ -191,5 +194,15 @@ public class SimpleWorkspaceService implements WorkspaceService {
workspaceRoots.addAll(workspaceFolders);
log.debug("workspaceFolders = {}", workspaceFolders);
}
public boolean supportsSemanticTokensRefresh() {
if (clientCapabilities != null) {
SemanticTokensWorkspaceCapabilities semanticTokensCapability = clientCapabilities.getSemanticTokens();
if (semanticTokensCapability != null) {
return semanticTokensCapability.getRefreshSupport() != null && semanticTokensCapability.getRefreshSupport().booleanValue();
}
}
return false;
}
}

View File

@@ -37,7 +37,9 @@ public final class JpqlSupportState {
private synchronized void setEnabled(boolean enabled) {
if (this.enabled != enabled) {
this.enabled = enabled;
server.getAsync().execute(() -> server.getClient().refreshSemanticTokens());
if (server.getWorkspaceService().supportsSemanticTokensRefresh()) {
server.getAsync().execute(() -> server.getClient().refreshSemanticTokens());
}
}
}
}