added missing pieces to register boot ls for general xml file usage and get notified for changes to xml files

This commit is contained in:
Martin Lippert
2019-01-21 17:39:12 +01:00
parent b97a27992f
commit 228c3d3939
5 changed files with 23 additions and 3 deletions

View File

@@ -14,6 +14,10 @@
contentType="org.eclipse.jdt.core.javaSource"
id="org.eclipse.languageserver.languages.springboot">
</contentTypeMapping>
<contentTypeMapping
contentType="org.eclipse.core.runtime.xml"
id="org.eclipse.languageserver.languages.springboot">
</contentTypeMapping>
<contentTypeMapping
contentType="org.springframework.boot.ide.properties.application.properties"
id="org.eclipse.languageserver.languages.springboot"

View File

@@ -120,6 +120,7 @@ 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:**/*.xml"),
FileSystems.getDefault().getPathMatcher("glob:**/*.gradle"),
FileSystems.getDefault().getPathMatcher("glob:**/*.java"),
FileSystems.getDefault().getPathMatcher("glob:**/*.json"),

View File

@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2017, 2018 Pivotal, Inc.
* Copyright (c) 2017, 2019 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
@@ -190,8 +190,17 @@ public class STS4LanguageClientImpl extends LanguageClientImpl implements STS4La
}
}
@SuppressWarnings("unchecked")
private static void addBootRangeHighlightSupport(IEditorPart editor, ISourceViewer sourceViewer) {
if (editor instanceof AbstractDecoratedTextEditor) {
addBootRangeHighlightSupport((AbstractDecoratedTextEditor)editor, sourceViewer);
}
// else if () {
// // TODO: XML multi page editor handling for highlight support of XML source editor
// }
}
@SuppressWarnings("unchecked")
private static void addBootRangeHighlightSupport(AbstractDecoratedTextEditor editor, ISourceViewer sourceViewer) {
try {
Field f = AbstractDecoratedTextEditor.class.getDeclaredField("fSourceViewerDecorationSupport");
f.setAccessible(true);

View File

@@ -10,7 +10,6 @@
*******************************************************************************/
package org.springframework.ide.vscode.commons.util;
import java.io.File;
import java.util.List;
import java.util.function.Consumer;

View File

@@ -152,6 +152,9 @@ public class SpringSymbolIndex {
getWorkspaceService().getFileObserver().onFileCreated(globPattern, (file) -> {
createDocument(new TextDocumentIdentifier(file).getUri());
});
getWorkspaceService().getFileObserver().onFileChanged(globPattern, (file) -> {
updateDocument(new TextDocumentIdentifier(file).getUri(), null);
});
}
public void shutdown() {
@@ -259,6 +262,10 @@ public class SpringSymbolIndex {
Optional<IJavaProject> maybeProject = projectFinder.find(new TextDocumentIdentifier(docURI));
if (maybeProject.isPresent()) {
try {
if (content == null) {
content = FileUtils.readFileToString(new File(new URI(docURI)));
}
UpdateItem updateItem = new UpdateItem(maybeProject.get(), docURI, content, indexer);
futures.add(CompletableFuture.runAsync(updateItem, this.updateQueue));
}