Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,10 @@
import com.intellij.openapi.vfs.VirtualFile;
import com.redhat.devtools.intellij.quarkus.telemetry.TelemetryEventName;
import com.redhat.devtools.intellij.quarkus.telemetry.TelemetryManager;
import com.redhat.devtools.intellij.qute.psi.QuteCommandConstants;
import com.redhat.devtools.lsp4ij.server.JavaProcessCommandBuilder;
import com.redhat.devtools.lsp4ij.server.OSProcessStreamConnectionProvider;
import com.redhat.devtools.lsp4ij.server.ProcessStreamConnectionProvider;
import com.redhat.devtools.intellij.qute.settings.UserDefinedQuteSettings;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.nio.file.Path;
import java.util.Arrays;
Expand Down Expand Up @@ -63,7 +61,10 @@ public Object getInitializationOptions(VirtualFile rootUri) {
Map<String, Object> extendedClientCapabilities = new HashMap<>();
Map<String, Object> commands = new HashMap<>();
Map<String, Object> commandsKind = new HashMap<>();
commandsKind.put("valueSet", Arrays.asList("qute.command.java.definition", "qute.command.configuration.update" , "qute.command.open.uri"));
commandsKind.put("valueSet", Arrays.asList(QuteCommandConstants.OPEN_URI,
QuteCommandConstants.JAVA_DEFINITION,
QuteCommandConstants.COMMAND_CONFIGURATION_UPDATE,
QuteCommandConstants.COMMAND_SHOW_REFERENCES));
commands.put("commandsKind", commandsKind);
extendedClientCapabilities.put("commands", commands);
extendedClientCapabilities.put("shouldLanguageServerExitOnShutdown", Boolean.TRUE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@
*/
public class QuteCommandConstants {

public static final String QUTE_COMMAND_OPEN_URI = "qute.command.open.uri";
public static final String OPEN_URI = "qute.command.open.uri";
public static final String JAVA_DEFINITION = "qute.command.java.definition";
public static final String COMMAND_CONFIGURATION_UPDATE = "qute.command.configuration.update";
public static final String COMMAND_SHOW_REFERENCES = "qute.command.show.references";

public static final String QUTE_COMMAND_GENERATE_TEMPLATE_FILE = "qute.command.generate.template.file";
public static final String GENERATE_TEMPLATE_FILE = "qute.command.generate.template.file";

private QuteCommandConstants() {

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*******************************************************************************
* Copyright (c) 2022 Red Hat, Inc.
* Distributed under license by Red Hat, Inc. All rights reserved.
* This program is made available under the terms of the
* Eclipse Public License v2.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v20.html
*
* Contributors:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
package com.redhat.devtools.intellij.qute.psi.core.command;

import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.project.Project;
import com.redhat.devtools.lsp4ij.LSPIJUtils;
import com.redhat.devtools.lsp4ij.commands.LSPCommand;
import com.redhat.devtools.lsp4ij.usages.LSPUsageType;
import com.redhat.devtools.lsp4ij.usages.LSPUsagesManager;
import org.jetbrains.annotations.NotNull;

import java.awt.event.MouseEvent;

public class QuteShowReferencesAction extends QuteAction {

@Override
protected void commandPerformed(@NotNull LSPCommand command, @NotNull AnActionEvent e) {
Project project = e.getProject();
if (project == null) {
return;
}

// Call "Find Usages" in popup mode.
LSPUsagesManager.getInstance(project).findShowUsagesInPopup(locations,
LSPUsageType.References,
dataContext,
(MouseEvent) e.getInputEvent());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ protected void collectTemplateLink(String basePath, PsiElement fieldOrMethod, Ps
? MessageFormat.format(QUTE_COMMAND_OPEN_URI_WITH_FRAGMENT_MESSAGE, fragmentId, templateUri)
: MessageFormat.format(QUTE_COMMAND_OPEN_URI_MESSAGE, templateUri);
command = new Command(title, //
QuteCommandConstants.QUTE_COMMAND_OPEN_URI,
QuteCommandConstants.OPEN_URI,
Arrays.asList(LSPIJUtils.toUriAsString(templateFile)));
} else {
List<DataModelParameter> parameters = createParameters(fieldOrMethod);
Expand All @@ -84,7 +84,7 @@ protected void collectTemplateLink(String basePath, PsiElement fieldOrMethod, Ps
info.setTemplateFileUri(getVirtualFileUrl(utils.getModule(), templateUri));
info.setTemplateFilePath(templateUri);
command = new Command(MessageFormat.format(QUTE_COMMAND_GENERATE_TEMPLATE_MESSAGE, templateUri), //
QuteCommandConstants.QUTE_COMMAND_GENERATE_TEMPLATE_FILE, Arrays.asList(info));
QuteCommandConstants.GENERATE_TEMPLATE_FILE, Arrays.asList(info));
}
TextRange tr = fieldOrMethod.getTextRange();
Range range = utils.toRange(typeRoot, tr.getStartOffset(), tr.getLength());
Expand Down
9 changes: 7 additions & 2 deletions src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -779,20 +779,25 @@
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="/META-INF/lsp4ij-qute.xml"
xpointer="xpointer(/idea-plugin/*)"/>
<actions>
<!-- Custom LSP client command for MicroProfile LS -->
<action id="microprofile.command.open.uri"
class="com.redhat.devtools.intellij.lsp4mp4ij.psi.core.command.MicroprofileOpenURIAction"
text="MicroprofileOpenURIAction"/>
<action id="microprofile.command.configuration.update"
class="com.redhat.devtools.intellij.lsp4mp4ij.psi.core.command.MicroprofileUpdateConfigurationAction"
text="MicroprofileUpdateConfigurationAction"/>

<!-- Custom LSP client command for Qute LS -->
<action id="qute.command.open.uri"
class="com.redhat.devtools.intellij.qute.psi.core.command.QuteOpenURIAction"/>
<action id="qute.command.generate.template.file"
class="com.redhat.devtools.intellij.qute.psi.core.command.QuteGenerateTemplateAction"/>
<action id="qute.command.java.definition"
class="com.redhat.devtools.intellij.qute.psi.core.command.QuteJavaDefinitionAction"/>
<action id="qute.command.configuration.update"
class="com.redhat.devtools.intellij.qute.psi.core.command.QuteUpdateConfigurationAction"/>
<action id="qute.command.show.references"
class="com.redhat.devtools.intellij.qute.psi.core.command.QuteShowReferencesAction"/>
<action id="qute.command.generate.template.file"
class="com.redhat.devtools.intellij.qute.psi.core.command.QuteGenerateTemplateAction"/>

</actions>
</idea-plugin>
Loading