Skip to content

Commit e8d5cc3

Browse files
committed
feat: click on insert section codelens must show references
Signed-off-by: azerr <[email protected]>
1 parent ac64890 commit e8d5cc3

File tree

4 files changed

+19
-7
lines changed

4 files changed

+19
-7
lines changed

src/main/java/com/redhat/devtools/intellij/qute/lsp/QuteServer.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import com.intellij.openapi.vfs.VirtualFile;
1919
import com.redhat.devtools.intellij.quarkus.telemetry.TelemetryEventName;
2020
import com.redhat.devtools.intellij.quarkus.telemetry.TelemetryManager;
21+
import com.redhat.devtools.intellij.qute.psi.QuteCommandConstants;
2122
import com.redhat.devtools.lsp4ij.server.JavaProcessCommandBuilder;
2223
import com.redhat.devtools.lsp4ij.server.OSProcessStreamConnectionProvider;
2324
import com.redhat.devtools.lsp4ij.server.ProcessStreamConnectionProvider;
@@ -63,7 +64,10 @@ public Object getInitializationOptions(VirtualFile rootUri) {
6364
Map<String, Object> extendedClientCapabilities = new HashMap<>();
6465
Map<String, Object> commands = new HashMap<>();
6566
Map<String, Object> commandsKind = new HashMap<>();
66-
commandsKind.put("valueSet", Arrays.asList("qute.command.java.definition", "qute.command.configuration.update" , "qute.command.open.uri"));
67+
commandsKind.put("valueSet", Arrays.asList(QuteCommandConstants.OPEN_URI,
68+
QuteCommandConstants.JAVA_DEFINTION,
69+
QuteCommandConstants.COMMAND_CONFIGURATION_UPDATE,
70+
QuteCommandConstants.COMMAND_SHOW_REFERENCES));
6771
commands.put("commandsKind", commandsKind);
6872
extendedClientCapabilities.put("commands", commands);
6973
extendedClientCapabilities.put("shouldLanguageServerExitOnShutdown", Boolean.TRUE);

src/main/java/com/redhat/devtools/intellij/qute/psi/QuteCommandConstants.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,12 @@
1919
*/
2020
public class QuteCommandConstants {
2121

22-
public static final String QUTE_COMMAND_OPEN_URI = "qute.command.open.uri";
22+
public static final String OPEN_URI = "qute.command.open.uri";
23+
public static final String JAVA_DEFINTION = "qute.command.java.definition";
24+
public static final String COMMAND_CONFIGURATION_UPDATE = "qute.command.configuration.update";
25+
public static final String COMMAND_SHOW_REFERENCES = "qute.command.show.references";
2326

24-
public static final String QUTE_COMMAND_GENERATE_TEMPLATE_FILE = "qute.command.generate.template.file";
27+
public static final String GENERATE_TEMPLATE_FILE = "qute.command.generate.template.file";
2528

2629
private QuteCommandConstants() {
2730

src/main/java/com/redhat/devtools/intellij/qute/psi/internal/java/QuteJavaCodeLensCollector.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ protected void collectTemplateLink(String basePath, PsiElement fieldOrMethod, Ps
7474
? MessageFormat.format(QUTE_COMMAND_OPEN_URI_WITH_FRAGMENT_MESSAGE, fragmentId, templateUri)
7575
: MessageFormat.format(QUTE_COMMAND_OPEN_URI_MESSAGE, templateUri);
7676
command = new Command(title, //
77-
QuteCommandConstants.QUTE_COMMAND_OPEN_URI,
77+
QuteCommandConstants.OPEN_URI,
7878
Arrays.asList(LSPIJUtils.toUriAsString(templateFile)));
7979
} else {
8080
List<DataModelParameter> parameters = createParameters(fieldOrMethod);
@@ -84,7 +84,7 @@ protected void collectTemplateLink(String basePath, PsiElement fieldOrMethod, Ps
8484
info.setTemplateFileUri(getVirtualFileUrl(utils.getModule(), templateUri));
8585
info.setTemplateFilePath(templateUri);
8686
command = new Command(MessageFormat.format(QUTE_COMMAND_GENERATE_TEMPLATE_MESSAGE, templateUri), //
87-
QuteCommandConstants.QUTE_COMMAND_GENERATE_TEMPLATE_FILE, Arrays.asList(info));
87+
QuteCommandConstants.GENERATE_TEMPLATE_FILE, Arrays.asList(info));
8888
}
8989
TextRange tr = fieldOrMethod.getTextRange();
9090
Range range = utils.toRange(typeRoot, tr.getStartOffset(), tr.getLength());

src/main/resources/META-INF/plugin.xml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -779,20 +779,25 @@
779779
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="/META-INF/lsp4ij-qute.xml"
780780
xpointer="xpointer(/idea-plugin/*)"/>
781781
<actions>
782+
<!-- Custom LSP client command for MicroProfile LS -->
782783
<action id="microprofile.command.open.uri"
783784
class="com.redhat.devtools.intellij.lsp4mp4ij.psi.core.command.MicroprofileOpenURIAction"
784785
text="MicroprofileOpenURIAction"/>
785786
<action id="microprofile.command.configuration.update"
786787
class="com.redhat.devtools.intellij.lsp4mp4ij.psi.core.command.MicroprofileUpdateConfigurationAction"
787788
text="MicroprofileUpdateConfigurationAction"/>
789+
790+
<!-- Custom LSP client command for Qute LS -->
788791
<action id="qute.command.open.uri"
789792
class="com.redhat.devtools.intellij.qute.psi.core.command.QuteOpenURIAction"/>
790-
<action id="qute.command.generate.template.file"
791-
class="com.redhat.devtools.intellij.qute.psi.core.command.QuteGenerateTemplateAction"/>
792793
<action id="qute.command.java.definition"
793794
class="com.redhat.devtools.intellij.qute.psi.core.command.QuteJavaDefinitionAction"/>
794795
<action id="qute.command.configuration.update"
795796
class="com.redhat.devtools.intellij.qute.psi.core.command.QuteUpdateConfigurationAction"/>
797+
<action id="qute.command.show.references"
798+
class="com.redhat.devtools.lsp4ij.commands.editor.ShowReferencesAction"/>
799+
<action id="qute.command.generate.template.file"
800+
class="com.redhat.devtools.intellij.qute.psi.core.command.QuteGenerateTemplateAction"/>
796801

797802
</actions>
798803
</idea-plugin>

0 commit comments

Comments
 (0)