question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add support for variable ${workspaceFolderBasename} and config namespace

See original GitHub issue

Visual studio has several predefined variables: https://code.visualstudio.com/docs/editor/variables-reference, which they unfortunately don’t support in settings.json for some reason. Extensions can support them. This Extension does support some of them. But one is I need is missing (it has a different name). It also uses a different namespace: command: instead of config:

I would like support for ${workspaceFolderBasename}. The alternative is workspaceName, but I like to be consistent in my settings.json file. I use ${workspaceFolderBasename} in multiple json files.

Example

{
    "cmake.buildDirectory": "${workspaceFolder}/../build-${workspaceFolderBasename}",
    "testMate.cpp.test.workingDirectory": "${command:cmake.buildDirectory}",
    "testMate.cpp.test.executables": "${command:cmake.buildDirectory}/${workspaceName}_test.exe",
}

I would prefer it like this:

{
    "cmake.buildDirectory": "${workspaceFolder}/../build-${workspaceFolderBasename}",
    "testMate.cpp.test.workingDirectory": "${config:cmake.buildDirectory}",
    "testMate.cpp.test.executables": "${config:cmake.buildDirectory}/${workspaceFolderBasename}_test.exe",
}

Thus I want workspaceFolderBasename supported and I want config: to work too. I use config: notation also in tasks.json and launch.json. For example:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Debug Nucleo openocd",
            "cwd": "${workspaceFolder}",
            "executable": "${config:cmake.buildDirectory}/${workspaceFolderBasename}.elf",

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
matepekcommented, Jul 22, 2022

${workspaceFolderBasename} can be achieved with ${workspaceFolder[-1]}. Config is cool. I’m adding it

0reactions
matepekcommented, Jul 29, 2022

I think the command is basically resolved on the cmake extension’s code. VSCode does not provide an api for variable resolution, I can just query the configs. Every extension provide their own resolution. Now I added some recursion but I’m not a fan of it. I wouldn’t suggest you to depend on a lot but you can try out.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Variables reference - Visual Studio Code
Variables Reference. Visual Studio Code supports variable substitution in Debugging and Task configuration files as well as some select settings.
Read more >
Add support for variables in plugins | Grafana documentation
Add support for variables in plugins Variables are placeholders for values, and can be used to create things like templated queries and dashboard...
Read more >
VSCode environment variables besides ${workspaceRoot}
The following predefined variables are supported: ${workspaceFolder} - the path of the folder opened in VS Code; ${workspaceFolderBasename} - the name of the ......
Read more >
Cannot create environment variable for logging category with ...
The logging configuration often uses namespaces (or namespace like strings, separated by periods) as category keys.
Read more >
Unable to fetch metrics for the Geneva account. Failing with ...
I am trying to setup Grafana dashboards for Geneva and I am successful in ... But I could able to create only Account...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found