forked from redhat-developer/lsp4ij
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
finx: Run/Debug with contextual menu
Fixes redhat-developer#760 Signed-off-by: azerr <[email protected]>
- Loading branch information
1 parent
9bb7c8d
commit 92d2c48
Showing
11 changed files
with
214 additions
and
32 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
63 changes: 63 additions & 0 deletions
63
src/main/java/com/redhat/devtools/lsp4ij/dap/configurations/DAPRunConfigurationProvider.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,63 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2025 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.lsp4ij.dap.configurations; | ||
|
||
import com.intellij.execution.actions.ConfigurationContext; | ||
import com.intellij.execution.actions.LazyRunConfigurationProducer; | ||
import com.intellij.execution.configurations.ConfigurationFactory; | ||
import com.intellij.openapi.util.Ref; | ||
import com.intellij.psi.PsiElement; | ||
import com.redhat.devtools.lsp4ij.dap.descriptors.DebugAdapterDescriptorFactoryRegistry; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
/** | ||
* Default Debug Adapter Protocol (DAP) run configuration provider. | ||
*/ | ||
public class DAPRunConfigurationProvider extends LazyRunConfigurationProducer<DAPRunConfiguration> { | ||
|
||
@Override | ||
public @NotNull ConfigurationFactory getConfigurationFactory() { | ||
return DAPRunConfigurationType.getInstance().getConfigurationFactories()[0]; | ||
} | ||
|
||
@Override | ||
protected boolean setupConfigurationFromContext(@NotNull DAPRunConfiguration configuration, | ||
@NotNull ConfigurationContext context, | ||
@NotNull Ref<PsiElement> sourceElement) { | ||
var location = context.getLocation(); | ||
if (location == null) { | ||
return false; | ||
} | ||
var file = location.getVirtualFile(); | ||
if (file == null) { | ||
return false; | ||
} | ||
var project= location.getProject(); | ||
if (project.isDisposed()) { | ||
return false; | ||
} | ||
return DebugAdapterDescriptorFactoryRegistry.getInstance().prepareConfiguration(configuration, file, project); | ||
} | ||
|
||
@Override | ||
public boolean isConfigurationFromContext(@NotNull DAPRunConfiguration configuration, | ||
@NotNull ConfigurationContext context) { | ||
var location = context.getLocation(); | ||
if (location == null) { | ||
return false; | ||
} | ||
var file = location.getVirtualFile(); | ||
if (file == null) { | ||
return false; | ||
} | ||
return configuration.canDebug(file); | ||
} | ||
} |
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
Oops, something went wrong.