-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Chrome debugger integration #252
Closed
AObuchow
wants to merge
4
commits into
eclipse-wildwebdeveloper:master
from
AObuchow:Chrome_debugger-integration
Closed
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,8 +43,23 @@ | |
<outputDirectory>${project.build.directory}/vscode</outputDirectory> | ||
</configuration> | ||
</execution> | ||
<execution> | ||
<id>fetch-chrome-debug-adapter</id> | ||
<phase>generate-resources</phase> | ||
<goals> | ||
<goal>wget</goal> | ||
</goals> | ||
<configuration> | ||
<url>https://marketplace.visualstudio.com/_apis/public/gallery/publishers/msjsdiag/vsextensions/debugger-for-chrome/4.11.7/vspackage</url> | ||
<outputFileName>chromeDebugAdapter.zip</outputFileName> | ||
<unpack>true</unpack> | ||
<outputDirectory>${project.build.directory}/chrome-debug-adapter</outputDirectory> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
|
||
|
||
<plugin> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>exec-maven-plugin</artifactId> | ||
|
@@ -65,6 +80,7 @@ | |
<arg>../target/vscode/VSCode-linux-x64/resources/app/extensions/html-language-features/server</arg> | ||
<arg>../target/vscode/VSCode-linux-x64/resources/app/extensions/css-language-features/server</arg> | ||
<arg>../target/vscode/VSCode-linux-x64/resources/app/extensions/ms-vscode.node-debug2</arg> | ||
<arg>../target/chrome-debug-adapter/extension/</arg> | ||
</arguments> | ||
<workingDirectory>language-servers/</workingDirectory> | ||
</configuration> | ||
|
@@ -92,12 +108,16 @@ | |
<arg>vscode-json-languageserver@1.2.1</arg> | ||
<arg>yaml-language-server@0.5.2</arg> | ||
<arg>firefox-debugadapter@2.0.1</arg> | ||
<arg>debugger-for-chrome-4.11.7.tgz</arg> | ||
</arguments> | ||
<workingDirectory>language-servers/</workingDirectory> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No need for those extra lines. |
||
|
||
|
||
<plugin> | ||
<groupId>com.google.code.maven-replacer-plugin</groupId> | ||
<artifactId>replacer</artifactId> | ||
|
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
87 changes: 87 additions & 0 deletions
87
...wildwebdeveloper/src/org/eclipse/wildwebdeveloper/InitializeLaunchConfigurations.java.rej
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,87 @@ | ||
--- org.eclipse.wildwebdeveloper/src/org/eclipse/wildwebdeveloper/InitializeLaunchConfigurations.java | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems like some garbage file |
||
+++ org.eclipse.wildwebdeveloper/src/org/eclipse/wildwebdeveloper/InitializeLaunchConfigurations.java | ||
@@ -48,18 +48,9 @@ public static String getNodeJsLocation() { | ||
} | ||
} | ||
|
||
- String res = "/path/to/node"; | ||
- String[] command = new String[] { "/bin/bash", "-c", "which node" }; | ||
- if (Platform.getOS().equals(Platform.OS_WIN32)) { | ||
- command = new String[] { "cmd", "/c", "where node" }; | ||
- } | ||
- | ||
- try (BufferedReader reader = new BufferedReader( | ||
- new InputStreamReader(Runtime.getRuntime().exec(command).getInputStream()));) { | ||
- res = reader.readLine(); | ||
- } catch (IOException e) { | ||
- Activator.getDefault().getLog().log( | ||
- new Status(IStatus.ERROR, Activator.getDefault().getBundle().getSymbolicName(), e.getMessage(), e)); | ||
+ String res = which("node"); | ||
+ if (res == null) { | ||
+ res = "/path/to/node"; | ||
} | ||
|
||
// Try default install path as last resort | ||
@@ -79,6 +70,22 @@ public static String getNodeJsLocation() { | ||
return null; | ||
} | ||
|
||
+ public static String which(String progrgam) { | ||
+ String res = null; | ||
+ String[] command = new String[] { "/bin/bash", "-c", "which " + progrgam}; | ||
+ if (Platform.getOS().equals(Platform.OS_WIN32)) { | ||
+ command = new String[] { "cmd", "/c", "where " + progrgam }; | ||
+ } | ||
+ try (BufferedReader reader = new BufferedReader( | ||
+ new InputStreamReader(Runtime.getRuntime().exec(command).getInputStream()));) { | ||
+ res = reader.readLine(); | ||
+ } catch (IOException e) { | ||
+ Activator.getDefault().getLog().log( | ||
+ new Status(IStatus.ERROR, Activator.getDefault().getBundle().getSymbolicName(), e.getMessage(), e)); | ||
+ } | ||
+ return res; | ||
+ } | ||
+ | ||
private static void validateNodeVersion(String nodeJsLocation) { | ||
|
||
String nodeVersion = null; | ||
@@ -105,30 +112,30 @@ private static void validateNodeVersion(String nodeJsLocation) { | ||
} | ||
|
||
private static void warnNodeJSMissing() { | ||
- Display.getDefault().asyncExec(() -> { | ||
+ Display.getDefault().asyncExec(() -> | ||
MessageDialog.openWarning(Display.getCurrent().getActiveShell(), "Missing node.js", | ||
"Could not find node.js. This will result in editors missing key features.\n" | ||
- + "Please make sure node.js is installed and that your PATH environment variable contains the location to the `node` executable."); | ||
- }); | ||
+ + "Please make sure node.js is installed and that your PATH environment variable contains the location to the `node` executable.") | ||
+ ); | ||
} | ||
|
||
private static void warnNodeJSVersionUnsupported(String version) { | ||
- Display.getDefault().asyncExec(() -> { | ||
+ Display.getDefault().asyncExec(() -> | ||
MessageDialog.openWarning(Display.getCurrent().getActiveShell(), "Node.js " + version + " is not supported", | ||
"Node.js " + version + " is not supported. This will result in editors missing key features.\n" | ||
+ "Please make sure a supported version of node.js is installed and that your PATH environment variable contains the location to the `node` executable.\n" | ||
+ "Supported major versions are: " + SUPPORT_NODEJS_MAJOR_VERSIONS.stream() | ||
- .map(i -> String.valueOf(i)).collect(Collectors.joining(", "))); | ||
- }); | ||
+ .map(String::valueOf).collect(Collectors.joining(", "))) | ||
+ ); | ||
} | ||
|
||
private static void warnNodeJSVersionCouldNotBeDetermined() { | ||
- Display.getDefault().asyncExec(() -> { | ||
+ Display.getDefault().asyncExec(() -> | ||
MessageDialog.openWarning(Display.getCurrent().getActiveShell(), "Node.js version could not be determined", | ||
"Node.js version could not be determined. Please make sure a supported version of node.js is installed, editors may be missing key features otherwise.\n" | ||
+ "Supported major versions are: " + SUPPORT_NODEJS_MAJOR_VERSIONS.stream() | ||
- .map(i -> String.valueOf(i)).collect(Collectors.joining(", "))); | ||
- }); | ||
+ .map(String::valueOf).collect(Collectors.joining(", "))) | ||
+ ); | ||
} | ||
|
||
|
69 changes: 69 additions & 0 deletions
69
...clipse.wildwebdeveloper/src/org/eclipse/wildwebdeveloper/debug/AbstractDebugDelegate.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,69 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2019 Red Hat Inc. and others. | ||
* | ||
* This program and the accompanying materials are made | ||
* available under the terms of the Eclipse Public License 2.0 | ||
* which is available at https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Andrew Obuchowicz (Red Hat Inc.) | ||
*******************************************************************************/ | ||
package org.eclipse.wildwebdeveloper.debug; | ||
|
||
import java.io.File; | ||
import java.util.Collections; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
import org.eclipse.core.runtime.CoreException; | ||
import org.eclipse.core.runtime.IProgressMonitor; | ||
import org.eclipse.core.runtime.IStatus; | ||
import org.eclipse.core.runtime.Status; | ||
import org.eclipse.debug.core.DebugPlugin; | ||
import org.eclipse.debug.core.ILaunch; | ||
import org.eclipse.debug.core.ILaunchConfiguration; | ||
import org.eclipse.debug.core.ILaunchManager; | ||
import org.eclipse.jface.dialogs.ErrorDialog; | ||
import org.eclipse.lsp4e.debug.DSPPlugin; | ||
import org.eclipse.lsp4e.debug.launcher.DSPLaunchDelegate; | ||
import org.eclipse.swt.widgets.Display; | ||
import org.eclipse.wildwebdeveloper.Activator; | ||
import org.eclipse.wildwebdeveloper.InitializeLaunchConfigurations; | ||
|
||
public class AbstractDebugDelegate extends DSPLaunchDelegate{ | ||
public static final String PROGRAM = "program"; //$NON-NLS-1$ | ||
public static final String ARGUMENTS = "runtimeArgs"; //$NON-NLS-1$ | ||
public static final String CWD = DebugPlugin.ATTR_WORKING_DIRECTORY; //$NON-NLS-1$ | ||
public static final String ENV = ILaunchManager.ATTR_ENVIRONMENT_VARIABLES; | ||
public static final String SOURCE_MAPS = "sourceMaps"; | ||
public static final String PORT = "port"; //$NON-NLS-1$ | ||
public static final String REQUEST = "request"; //$NON-NLS-1$ | ||
|
||
public void launchWithParameters(ILaunchConfiguration configuration, String mode, ILaunch launch, | ||
IProgressMonitor monitor, Map<String, Object> param, File debugAdapter) throws CoreException { | ||
try { | ||
List<String> debugCmdArgs = Collections.singletonList(debugAdapter.getAbsolutePath()); | ||
|
||
DSPLaunchDelegateLaunchBuilder builder = new DSPLaunchDelegateLaunchBuilder(configuration, mode, launch, | ||
monitor); | ||
builder.setLaunchDebugAdapter(InitializeLaunchConfigurations.getNodeJsLocation(), debugCmdArgs); | ||
builder.setMonitorDebugAdapter(configuration.getAttribute(DSPPlugin.ATTR_DSP_MONITOR_DEBUG_ADAPTER, false)); | ||
builder.setDspParameters(param); | ||
|
||
super.launch(builder); | ||
} catch (Exception e) { | ||
IStatus errorStatus = new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e); | ||
Activator.getDefault().getLog().log(errorStatus); | ||
Display.getDefault().asyncExec(new Runnable() { | ||
@Override | ||
public void run() { | ||
ErrorDialog.openError(Display.getDefault().getActiveShell(), "Debug error", e.getMessage(), errorStatus); //$NON-NLS-1$ | ||
} | ||
}); | ||
|
||
} | ||
} | ||
|
||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't have to do that if we can have the module treated as regular npm in node_modules.