-
Notifications
You must be signed in to change notification settings - Fork 211
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Quickfix sorting. Preferred fix. Wording for RequestMapping quickfixes
- Loading branch information
Showing
10 changed files
with
183 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
84 changes: 84 additions & 0 deletions
84
...ing.boot.ls/src/org/springframework/tooling/boot/ls/markers/DelegateMarkerResolution.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
|
||
} |
30 changes: 30 additions & 0 deletions
30
...ls/src/org/springframework/tooling/boot/ls/markers/LSPBootCodeActionMarkerResolution.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters