disable lsp4e go to symbol in workspace keybinding altogether as long as there is no fix in LSP4E
This commit is contained in:
@@ -10,6 +10,13 @@
|
||||
*******************************************************************************/
|
||||
package org.springframework.tooling.boot.java.ls;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.jface.bindings.Binding;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
import org.eclipse.ui.keys.IBindingService;
|
||||
import org.eclipse.ui.plugin.AbstractUIPlugin;
|
||||
import org.osgi.framework.BundleContext;
|
||||
|
||||
@@ -22,6 +29,8 @@ import org.osgi.framework.BundleContext;
|
||||
public class BootJavaLanguageServerPlugin extends AbstractUIPlugin {
|
||||
|
||||
public static final String ID = "org.springframework.tooling.boot.java.ls";
|
||||
|
||||
private static final Object LSP4E_COMMAND_SYMBOL_IN_WORKSPACE = "org.eclipse.lsp4e.symbolinworkspace";
|
||||
|
||||
// The shared instance
|
||||
private static BootJavaLanguageServerPlugin plugin;
|
||||
@@ -34,6 +43,8 @@ public class BootJavaLanguageServerPlugin extends AbstractUIPlugin {
|
||||
public void start(BundleContext context) throws Exception {
|
||||
plugin = this;
|
||||
super.start(context);
|
||||
|
||||
deactivateDuplicateKeybindings();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -46,4 +57,42 @@ public class BootJavaLanguageServerPlugin extends AbstractUIPlugin {
|
||||
return plugin;
|
||||
}
|
||||
|
||||
private void deactivateDuplicateKeybindings() {
|
||||
IBindingService service = PlatformUI.getWorkbench().getService(IBindingService.class);
|
||||
if (service != null) {
|
||||
List<Binding> newBindings = new ArrayList<>();
|
||||
Binding[] bindings = service.getBindings();
|
||||
|
||||
for (Binding binding : bindings) {
|
||||
String commandId = null;
|
||||
|
||||
if (binding != null && binding.getParameterizedCommand() != null && binding.getParameterizedCommand().getCommand() != null) {
|
||||
commandId = binding.getParameterizedCommand().getCommand().getId();
|
||||
|
||||
if (commandId == null) {
|
||||
newBindings.add(binding);
|
||||
}
|
||||
else if (!commandId.equals(LSP4E_COMMAND_SYMBOL_IN_WORKSPACE)) {
|
||||
newBindings.add(binding);
|
||||
}
|
||||
}
|
||||
else {
|
||||
newBindings.add(binding);
|
||||
}
|
||||
}
|
||||
|
||||
PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
service.savePreferences(service.getActiveScheme(),
|
||||
newBindings.toArray(new Binding[newBindings.size()]));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user