disable XML content-assist if overall XML support is disabled via user configuration

This commit is contained in:
Martin Lippert
2019-05-03 13:09:00 +02:00
parent e94ed2c21b
commit db780c0479
4 changed files with 24 additions and 4 deletions

View File

@@ -24,6 +24,8 @@ import org.eclipse.jface.text.contentassist.IContextInformation;
import org.eclipse.lsp4e.operations.completion.LSContentAssistProcessor;
import org.eclipse.wst.sse.ui.contentassist.CompletionProposalInvocationContext;
import org.eclipse.wst.sse.ui.contentassist.IAsyncCompletionProposalComputer;
import org.springframework.tooling.boot.ls.BootLanguageServerPlugin;
import org.springframework.tooling.boot.ls.Constants;
/**
* @author Martin Lippert
@@ -42,6 +44,10 @@ public class XMLContentAssistProposalComputer implements IAsyncCompletionProposa
@Override
public List<ICompletionProposal> computeCompletionProposals(CompletionProposalInvocationContext context, IProgressMonitor monitor) {
if (!BootLanguageServerPlugin.getDefault().getPreferenceStore().getBoolean(Constants.PREF_SUPPORT_SPRING_XML_CONFIGS)) {
return Collections.emptyList();
}
CompletableFuture<ICompletionProposal[]> future = CompletableFuture.supplyAsync(() -> {
return lsContentAssistProcessor.computeCompletionProposals(context.getViewer(), context.getInvocationOffset());
});
@@ -56,6 +62,10 @@ public class XMLContentAssistProposalComputer implements IAsyncCompletionProposa
@Override
public List<IContextInformation> computeContextInformation(CompletionProposalInvocationContext context, IProgressMonitor monitor) {
if (!BootLanguageServerPlugin.getDefault().getPreferenceStore().getBoolean(Constants.PREF_SUPPORT_SPRING_XML_CONFIGS)) {
return Collections.emptyList();
}
IContextInformation[] contextInformation = lsContentAssistProcessor.computeContextInformation(context.getViewer(), context.getInvocationOffset());
return Arrays.asList(contextInformation);
}