-
-
Notifications
You must be signed in to change notification settings - Fork 39
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
Remote debugging without extra launch settings locally #142
base: master
Are you sure you want to change the base?
Remote debugging without extra launch settings locally #142
Conversation
Having difficulty to debug files on Remote Server. VSCODE doesn't work untill I provide local files. Can someone help on this.? |
As far as I know, the node debugger allows connecting to a remote process, and pathMapping to "local" files using the |
@@ -112,6 +112,89 @@ export class Manager implements vscode.TreeDataProvider<string | FileSystemConfi | |||
} | |||
root = root.replace(/^~/, home.replace(/\/$/, '')); | |||
} | |||
|
|||
vscode.debug.registerDebugConfigurationProvider("*", { |
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.
I'm not sure we're supposed to use these register methods dynamically, especially without ever unsubscribing them
}); | ||
|
||
|
||
vscode.debug.registerDebugAdapterTrackerFactory('*', { |
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.
Same remark as on line 116
if (vscode.window.activeTextEditor) | ||
file = root + vscode.window.activeTextEditor.document.uri.path; // '${file}' can not be resolved per default | ||
if (debugConfig['program']) | ||
debugConfig['program'] = eval('`' + debugConfig['program'] + '`'); // resolve ${file}, ${workspaceFolder} |
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.
This seems a bit unsafe and a bad practice. A regular (dynamic) string replacement would work here.
I'm also not sure about if vscode will replace things like ${workspaceFolder}
before/after this step.
onWillStartSession: () => { | ||
if (config && config.debugPreLaunch) { | ||
const file = session.configuration['program']; | ||
const command = eval('`' + config.debugPreLaunch + '`'); // resolve ${file} and config. |
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.
Same remark as on line 142
}} | ||
}); | ||
|
||
vscode.debug.registerDebugAdapterTrackerFactory('*', { |
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.
Same remark as on line 116.
This should also use the Logging
facility instead of directly logging to the console.
This whole registerDebugAdapterTrackerFactory
could be merged with the one on line 151.
|
||
export function debugPreLaunch(config: FileSystemConfig, onChange: FSCChanged<'debugPreLaunch'>): React.ReactElement { | ||
const callback = (value?: string) => onChange('debugPreLaunch', value); | ||
const description = 'Task to run before debug session starts. SSH command: e.g. `/opt/vistec/python/bin/python -m ptvsd --host ${config.host} --port ${config.debugPort} --wait ${file}`'; |
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.
A bit of a long description which doesn't specify that the command will be run locally
2b9e766
to
284e02f
Compare
fa8c015
to
9be6aa0
Compare
Unfortunately you are not right, if you write in #77 that existing debug features can be used. A lot of variables #https://code.visualstudio.com/docs/editor/variables-reference not resolved, e.g. '${file}'. The 'pathMappings' in launch.json to set breakpoints has to be defined specifically for the extension!
From a practical point of view, with your great extenstion remote working is like local working. But to launch means to distinguish. So i have to manage a launch, for every SSH-FS configuration, that define host and root, where actually only a debugport as new information is added. The worst thing is that I have to manage a little extra locally!
I add two config properties, patch SSH-launch's to attach and define pathmapping from SSH-FS root setting. You can work with a local launch, too. But there is no need.