Quickfix sorting. Preferred fix. Wording for RequestMapping quickfixes
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
id="org.eclipse.languageserver.languages.springboot"
|
||||
label="Spring Boot Language Server"
|
||||
lastDocumentDisconnectedTimeout="2147483647"
|
||||
markerType="org.springframework.tooling.boot.ls.diagnostic"
|
||||
serverInterface="org.springframework.ide.vscode.commons.protocol.spring.SpringIndexLanguageServer"
|
||||
singleton="true">
|
||||
</server>
|
||||
@@ -752,6 +753,21 @@
|
||||
class="org.springframework.tooling.boot.ls.Startup">
|
||||
</startup>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.ui.ide.markerResolution">
|
||||
<markerResolutionGenerator
|
||||
class="org.springframework.tooling.boot.ls.markers.LSPBootCodeActionMarkerResolution"
|
||||
markerType="org.springframework.tooling.boot.ls.diagnostic">
|
||||
</markerResolutionGenerator>
|
||||
</extension>
|
||||
<extension
|
||||
id="diagnostic"
|
||||
name="Spring Boot"
|
||||
point="org.eclipse.core.resources.markers">
|
||||
<super
|
||||
type="org.eclipse.core.resources.problemmarker">
|
||||
</super>
|
||||
</extension>
|
||||
<!--
|
||||
<extension
|
||||
point="org.eclipse.wildwebdeveloper.xml.lemminxExtension">
|
||||
|
||||
@@ -17,6 +17,7 @@ import java.util.List;
|
||||
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
|
||||
import org.eclipse.core.runtime.preferences.InstanceScope;
|
||||
import org.eclipse.jface.bindings.Binding;
|
||||
import org.eclipse.jface.resource.ImageRegistry;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
import org.eclipse.ui.keys.IBindingService;
|
||||
import org.eclipse.ui.plugin.AbstractUIPlugin;
|
||||
@@ -32,6 +33,8 @@ import org.springframework.tooling.boot.ls.prefs.LiveInformationPreferencePage;
|
||||
*/
|
||||
public class BootLanguageServerPlugin extends AbstractUIPlugin {
|
||||
|
||||
public static final String SPRING_ICON = "SPRING_ICON";
|
||||
|
||||
public static String PLUGIN_ID = "org.springframework.tooling.boot.ls";
|
||||
|
||||
private static final Object LSP4E_COMMAND_SYMBOL_IN_WORKSPACE = "org.eclipse.lsp4e.symbolinworkspace";
|
||||
@@ -108,4 +111,12 @@ public class BootLanguageServerPlugin extends AbstractUIPlugin {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initializeImageRegistry(ImageRegistry reg) {
|
||||
super.initializeImageRegistry(reg);
|
||||
reg.put(SPRING_ICON, imageDescriptorFromPlugin(PLUGIN_ID, "icons/spring_obj.gif"));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2023 VMware, 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
|
||||
* https://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* VMware, Inc. - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.springframework.tooling.boot.ls.markers;
|
||||
|
||||
import org.eclipse.core.resources.IMarker;
|
||||
import org.eclipse.jdt.ui.text.java.IJavaCompletionProposal;
|
||||
import org.eclipse.jface.text.IDocument;
|
||||
import org.eclipse.jface.text.contentassist.IContextInformation;
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
import org.eclipse.swt.graphics.Point;
|
||||
import org.eclipse.ui.IMarkerResolution;
|
||||
import org.eclipse.ui.IMarkerResolutionRelevance;
|
||||
import org.springframework.tooling.boot.ls.BootLanguageServerPlugin;
|
||||
|
||||
public class DelegateMarkerResolution implements IMarkerResolution, IMarkerResolutionRelevance, IJavaCompletionProposal {
|
||||
|
||||
final private IMarkerResolution delegate;
|
||||
|
||||
final private int relevance;
|
||||
|
||||
public DelegateMarkerResolution(IMarkerResolution res, int relevance) {
|
||||
this.delegate = res;
|
||||
this.relevance = relevance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLabel() {
|
||||
return delegate.getLabel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(IMarker marker) {
|
||||
delegate.run(marker);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply(IDocument document) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Point getSelection(IDocument document) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAdditionalProposalInfo() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayString() {
|
||||
return getLabel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Image getImage() {
|
||||
return BootLanguageServerPlugin.getDefault().getImageRegistry().get(BootLanguageServerPlugin.SPRING_ICON);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IContextInformation getContextInformation() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRelevance() {
|
||||
return relevance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRelevanceForResolution() {
|
||||
return relevance;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2023 VMware, 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
|
||||
* https://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* VMware, Inc. - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.springframework.tooling.boot.ls.markers;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import org.eclipse.core.resources.IMarker;
|
||||
import org.eclipse.lsp4e.operations.codeactions.LSPCodeActionMarkerResolution;
|
||||
import org.eclipse.ui.IMarkerResolution;
|
||||
|
||||
public class LSPBootCodeActionMarkerResolution extends LSPCodeActionMarkerResolution {
|
||||
|
||||
@Override
|
||||
public IMarkerResolution[] getResolutions(IMarker marker) {
|
||||
IMarkerResolution[] res = super.getResolutions(marker);
|
||||
AtomicInteger relevance = new AtomicInteger(res.length);
|
||||
return Arrays.stream(res).map(r -> new DelegateMarkerResolution(r, relevance.getAndDecrement()))
|
||||
.toArray(IMarkerResolution[]::new);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user