Skip to content

${vscode:lineNumber} is not substituted #2

@unennhexium

Description

@unennhexium

First of all, thank you for developing this extension. I found it very useful.
Also thanks for using TypeScript and set up extensionHost launch configuration.
There are many extensions whose developers even not tried to launch them before publishing.


What Version
Extension 0.0.2
VSCode 1.109.5
OS Ubuntu 25.10

What I do

I have a script which uses rust-analyzer to scan the file, finds all doc-tests in it and builds <file>:<line-number> to <test-command-line-string> map. It requires:

  • workspace folder
  • file path
  • line number

to select and launch a particular command line from this map.

I am using the following configuration:

.gutteraid/patterns.json
{
  "version": "0.0.2",
  "matchers": [
    {
      "filePattern": "**/*.rs",
      "taskPattern": "\\/\\/\\/ ```rust",
      "scripts": [
        [
          "echo", // Will be replaced with my script.
          "${vscode:workspaceFolder}",
          "${vscode:file}",
          "${vscode:lineNumber}"
        ]
      ]
    }
  ]
}

What I expect

Required parameters substituted using ${vscode:...} syntax.

Terminal output:

% 'echo' '/home/<user>/src/<repo>' '/home/<user>/src/<repo>/<pkg>/src/library/<file>.rs' '143'
/home/user/src/<repo> /home/<user>/src/<rep>/<pkg>/src/library/<file>.rs 143

What I actually see

${vscode:lineNumber} is not recognized and substituted as ${lineNumber} literal string. This is the same thing which hapens to random identifiers used, e.g ${vscode:unexistingVariable} is substitued as ${unexistingVariable} literal string.

Terminal output:

% 'echo' '/home/<user>/src/<repo>' '/home/<user>/src/<repo>/<pkg>/src/library/<file>.rs' '${lineNumber}'
/home/user/src/<repo> /home/<user>/src/<rep>/<pkg>/src/library/<file>.rs ${lineNumber}

P.S. Use VSCode settings to configure matchers

Please, do not try to reinvent the wheel and use user settings to configure the patterns (not .gutteraid/patterns.json).

Reasons:

  • Cross machine/project settings sync for free.
  • Settings overwriting already implemented: .vscode/settings.json overwrites ~/.config/Code/User/settings.json (Linux path but other OSes have a similar).
  • Support for comments, so one can quickly experiment with different patterns or even switch between the different ones commenting and uncommenting them. The extension currently emits an errors if there are comments in configuration: "[error] Failed to load task patterns: ...".

If you want to maintain the JSON-schema and use separate file for schema to work, you can continue to do it. Adding settings "Config preference" with variants: "File system first", "Editor settings first" - will resolve the problem of conflicting configurations. You can try to merge one into another or use selected one alone. The default value can be "File system first", meaning .gutteraid/patterns.json will continue be used by default, providing compatibility with current setups your users have.

If you think the configuration is or will become too complex to place it into VSCode settings, the VSCode settings still can be used for simple setups.

P.P.S.

Can you allow me to select the gutter icon for each matcher? 🥺

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions