Comments (11)
@weinand Can you give an example of a task (entry of task.json) which uses a prompt to add command arguments?
from vscode-js-debug.
Applying what is said in https://code.visualstudio.com/docs/editor/variables-reference#_input-variables to the example from above:
{
"version": "2.0.0",
"tasks": [
{
"label": "run tests",
"command": "mocha",
"args": [
"--opts", "tests/mocha.opts",
"-g", "'${input:someArgs}'"
]
}
],
"inputs": [
{
"id": "someArgs",
"type": "promptString",
"description": "enter some arguments"
}
]
}
(I did not verify that this works...)
from vscode-js-debug.
I verified that it works -- https://github.com/Microsoft/vscode-node-debug/issues/108#issuecomment-581815593
You can put an inputs section into launch.json, and reference the defined variables in your launch configurations.
Now I want ONE MORE thing - a way to get the OLD arg behavior allowing a space delimited arg string, because I want one generic configuration to debug any old script, like:
configuration: [
{
// This runs the current file as a script with whatever args are typed
"type": "node",
"request": "launch",
"name": "Launch script",
"cwd": "${fileDirname}",
"program": "${file}",
"args": "${input:argValues}", // <== This doesn't work because this must be a list
"skipFiles": [ "<node_internals>/**" ]
},
With an input section as above with "id": "argValues"
from vscode-js-debug.
from vscode-js-debug.
The mock debugger shows how to ask the user for a string/name from a launch config:
https://github.com/Microsoft/vscode-mock-debug/blob/master/src/extension.ts#L23
The problem is that you cannot (yet) easily use this approach in a launch config without writing that extension code and introducing a 'variable'.
But it is planned to simplify this: microsoft/vscode#12735
from vscode-js-debug.
Since microsoft/vscode#12735 has been implemented it is now possible to provide "Prompt for Arguments" functionality as an extension and use it in launch.json and task.json.
from vscode-js-debug.
@weinand Can you ?
from vscode-js-debug.
@marvingreenberg your ONE MORE thing is covered by this feature request: microsoft/vscode#83678
from vscode-js-debug.
@marvingreenberg I just noticed that this issue lives in the "vscode-node-debug" repository and not "vscode", so it does not ask for a generic VS Code solution (which is not feasible for the reasons explained in length in microsoft/vscode#83678).
What you suggest is actually possible in a specific extension: node-debug could support an alternative argString
property that takes a command-line-like string and parses it into the array args
. This could even take place in the extension outside of the debug adapter.
/cc @connor4312 for js-debug
from vscode-js-debug.
I don't want to comment too much in what is obviously the wrong place (as my earlier comment was) I apologize - and I see that 83678 is not closed permanently. Oh, but I can't comment Over there. I'm definitely +1 on @weinand suggestion to inject (e.g.) _args for string array - it is creative and provides a good appraoch for differnt uses including inputs: {
from vscode-js-debug.
@marvingreenberg I've unlocked microsoft/vscode#83678
from vscode-js-debug.
Related Issues (20)
- Breakpoints unbound, VSCode cannot find source maps HOT 15
- Failed to start inspector port on WSL 2 mirrored network HOT 3
- Fix preview rendering of number '0' when 'description' is not set. HOT 2
- Breakpoints not set properly when running with vitest HOT 3
- When `NODE_OPTIONS` is configured for a dev container, js-debug interferes with it
- debugger not working
- Easier way to jump to function definitions in debug log.
- VS Code built-in extension breakpoints could not be set. HOT 3
- When the Debug for Chrome plugin is running, the browser plugin is gone HOT 7
- Resolve executables in node_modules/.bin directly HOT 1
- Electron render Typescript debugging breakpoints work in vscode natively, but not inside a dev container HOT 4
- Error on vscode js debug terminal HOT 1
- Support external terminal option
- Some of your breakpoints could not be set (greyed out) HOT 5
- added "sourceMap": true, to tsconfig still get issue HOT 1
- Unbound breakpoint HOT 1
- Support new `runtimeExecutable: "mocha"` in launch template
- The split2 module is very slow when handling large amounts of CDP data
- Debugger may hang if a firewall is active HOT 4
- Unable to Build. TypeError: Cannot assign to read only property 'atime' of object '#<Stats>' HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vscode-js-debug.