delete document-related symbols if java file gets deleted
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2017 Pivotal, Inc.
|
||||
* Copyright (c) 2017, 2018 Pivotal, Inc.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
@@ -109,7 +109,8 @@ public class DelegatingStreamConnectionProvider implements StreamConnectionProvi
|
||||
// Add resource listener
|
||||
ResourcesPlugin.getWorkspace().addResourceChangeListener(fResourceListener = new ResourceListener(languageServer, Arrays.asList(
|
||||
FileSystems.getDefault().getPathMatcher("glob:**/pom.xml"),
|
||||
FileSystems.getDefault().getPathMatcher("glob:**/*.gradle")
|
||||
FileSystems.getDefault().getPathMatcher("glob:**/*.gradle"),
|
||||
FileSystems.getDefault().getPathMatcher("glob:**/*.java")
|
||||
)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,6 +189,8 @@ public class BootJavaLanguageServer extends SimpleLanguageServer {
|
||||
RegistrationParams registrationParams = new RegistrationParams(Collections.singletonList(registration));
|
||||
getClient().registerCapability(registrationParams);
|
||||
|
||||
this.indexer.serverInitialized();
|
||||
|
||||
// TODO: due to a missing message from lsp4e this "initialized" is not called in
|
||||
// the LSP4E case
|
||||
// if this gets fixed, the code should move here (from "initialize" above)
|
||||
|
||||
@@ -140,6 +140,13 @@ public class SpringIndexer {
|
||||
}
|
||||
}
|
||||
|
||||
public void serverInitialized() {
|
||||
List<String> globPattern = Arrays.asList("**/*.java");
|
||||
server.getWorkspaceService().getFileObserver().onFileDeleted(globPattern, (file) -> {
|
||||
deleteDocument(new TextDocumentIdentifier(file).getUri());
|
||||
});
|
||||
}
|
||||
|
||||
public CompletableFuture<Void> initialize(Collection<WorkspaceFolder> workspaceRoots) {
|
||||
synchronized(this) {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user