-
Notifications
You must be signed in to change notification settings - Fork 116
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
fileBasename without extension #71
Comments
where is the |
I don't know where exactly it is coming from but it is implemented for launch.json as well as tasks.json. For all other variables that are built in you can have a look here: The thing though with ${fileBasename} is that it is implemented through the node.js function path.basename which in turn follows the (irritational) behaviour of the shell and returns the whole filename including the extension. So if my file I want to debug is located in "/my/path/to/my/source.c", ${fileBasename} will return "source.c" instead of "source". It used to return the whole path on Linux (and maybe OS X as well) which seems to be standard nodejs behaviour but that was not intended and though was considered a bug in vs-code and fixed (microsoft/vscode#6623). A nodejs function that strips away the extension is already there: I just stumbled about an implementation of it in another vs-code addon: If I only would know a little more about Typescript I would probably just have implemented it myself and send you a pull request but unfortunately this is a little bit too cryptic for me right now, sorry ;) |
ah so its the current file, ok that is easily done then |
ok you can now use it using I can't omit the |
Im also gonna bump the version and publish it once the travis test is done |
First of all thank you very much for this plugin. This is not a bug but a feature request (closely related to microsoft/vscode#1104).
I've managed to debug embedded applications with the following launch.json config (on Linux). Maybe you can add it to the readme, so if others wanted to do similar stuff, they would get it working faster.
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug",
"type": "gdb",
"gdbpath": "arm-none-eabi-gdb",
"request": "attach",
"cwd": "${workspaceRoot}",
"executable": "${cwd}/blink.elf",
"target": "localhost:3333",
"remote": true
}
]
}
The one thing that bothers me though, is that you can not use ${fileBasename} as a variable for the executable (blink.elf in my case) because it includes the extension (.c) as well.
I think it should be something like
"executable": "${cwd}/${FileBasenameNoExt}.elf"
There is already a supposal for this (including code) here:
https://visualstudio.uservoice.com/forums/293070-visual-studio-code/suggestions/8945725-add-filebasenamenoext-to-tasks-json-variables
Would be awesome if you could implement that as a custom variable for code-debug, since the upstream issue does not seem to be as important to be resolved but for debugging I think it would be great.
The text was updated successfully, but these errors were encountered: