Skip to content

Templates: placeholders in commands aren't recognized #1959

Done

Description

@muescha

Found while going through all templates for #1954; collected in #1943.

Summary

Some templates have placeholders in their command that the user has to replace. LSP4IJ doesn't know they're placeholders: the server definition can be saved with them, and starting it fails with an error that doesn't point to the placeholder.

Template Placeholder Filled in by the installer?
camel-lsp-server java -jar camel-lsp-server-XXX.jar yes
sdl-lsp java -jar XXX-jar-with-dependencies.jar yes
luau-lsp path/to/your/luau-lsp lsp --definitions=path/to/your/globalTypes.d.luau --docs=path/to/your/rb-docs.json only the program: the installer's command still has --definitions=path/to/your/… and --docs=path/to/your/… done in #1981
codelldb (debug adapter) <<insert base directory>>/extension/adapter/codelldb yes
perl-dap (debug adapter) <<insert base directory>>/perl-dap yes
vscode-js-debug (debug adapter) node <<insert base directory>>/js-debug/src/dapDebugServer.js ${port} 127.0.0.1 yes

So it's not only the version that has to be guessed: before the installer has run, or without it, the command can't work, and for luau-lsp it doesn't work after installing either (done in #1981). Three kinds of placeholder (XXX, path/to/your/…, <<insert base directory>>) are in use.

Placeholders also show up in settings sent to the server: the Dart template's settings.json has "dart.customDevTools" with /path/to/devtools and /path/to/dart-sdk, and (done in #1981) the perl-dap launch configuration launch.env.json has "API_KEY": "your-api-key-here" as an example.

Finding out the version

For the templates with an installer, nobody has to guess the version:

  • camel-lsp-server downloads with "maven": {"groupId": …, "artifactId": …}; MavenArtifactFetcher asks Maven Central for the latestVersion and builds the URL from it (with a fixed url to 1.31.0 next to it);
  • luau-lsp, codelldb and perl-dap download the latest GitHub release, sdl-lsp the releases/latest URL;
  • the installer then writes the command with the real file name, java -jar ${output.dir}/${output.file.name}.

So the version is known after installing. It's only the template's command, before or without the installer, that has the placeholder.

Ideas

  1. No version in the command at all. Let the installer save the download under a fixed name, with "output": {"file": {"name": "camel-lsp-server.jar"}}, as luau-lsp and codelldb already do. Then the template can have the real command, e.g. java -jar $USER_HOME$/.lsp4ij/lsp/camel-lsp-server/camel-lsp-server.jar, with no placeholder, and the installer only has to download. The same works for sdl-lsp (it already saves sdl-lsp.jar) and for the <<insert base directory>> of the debug adapters, which could be their serverDist, e.g. $USER_HOME$/.lsp4ij/dap/codelldb/extension/adapter/codelldb.

  2. One placeholder syntax that LSP4IJ knows, for what really has to come from the user, such as luau-lsp's type definitions, e.g. ${input:Path to globalTypes.d.luau} or, more telling, ${change-placeholder:Path to globalTypes.d.luau}:

  3. Input values in a table of their own, filled by the user or by the installer. The command keeps markers such as ${input:installpath:Path to the camel-lsp-server JAR}: input marks a value to fill in, installpath is its key, and the rest is the description shown to the user. Below the command, the settings show a table of these values, with the description as a tooltip or in a dialog. A key the installer knows, such as installpath, is filled in by the installer after installing; the others by the user.

    • The installer no longer has to replace the whole command. Today configureServer with "update": true overwrites it, so a change the user made, e.g. an extra argument, is gone after Reinstall. With the table, the command stays as it is, and the installer only sets its value.
    • Validation gets simple: an empty value is flagged in its row, with its description, and a server with an empty required value isn't started, but says which value is missing.
    • The user sees which values the installer sets, so nobody has to guess a version.
    • VS Code does much the same in tasks.json and launch.json: ${input:id} in the command, and an "inputs" list with id, type and description (docs).
    • The table is optional: server definitions without inputs keep working as they do today.

    Two ways to shape it:

    • Declare the inputs once, as VS Code does, and only use the key in the command, ${input:installpath}, so a value used twice doesn't repeat its description:

      "inputs": [
        { "id": "installpath", "description": "Path to the camel-lsp-server JAR", "filledBy": "installer" },
        { "id": "definitions", "description": "Path to globalTypes.d.luau", "optional": true }
      ]

      The short form ${input:installpath:description} could still be allowed when there's no inputs list.

    • Let the installer set a value instead of a command, e.g. "setInput": {"installpath": "${output.dir}/${output.file.name}"} in place of configureServer. Values the user fills in have no filledBy; optional ones that stay empty are left out, together with their argument, e.g. luau-lsp's --definitions=${input:definitions}.

    This adds another kind of variable next to ${BASE_DIR}, $USER_HOME$, ${port} and ${output.dir}, but the only one that says "something has to go here".

  4. Optional arguments out of the command. For luau-lsp lsp, --definitions and --docs default to an empty list, so it starts without them; the types can also be set with the settings luau-lsp.types.definitionFiles and luau-lsp.types.documentationFiles (see its README). The template's command could leave them out, and the settings could hold them, instead of a command that fails until they're replaced. Done in fix: small template and installer bugs from #1959, #1960, #1961 and #1947 #1981.

  5. Examples as examples. The Dart dart.customDevTools with /path/to/… could be left out of settings.json (it's an override only some need), and (done in fix: small template and installer bugs from #1959, #1960, #1961 and #1947 #1981) "your-api-key-here" marked as an example in the launch configuration's name.

1 removes most placeholders without any new mechanism; 2 or 3 is for the few that remain, and 3 also keeps the user's own changes to the command when the installer runs again. It goes well with #1958, since a template whose command works without the installer can also start without asking first.

How this was checked

Claude Code found this by reading all template files and MavenArtifactFetcher at 42b4e25; nothing of it was run. That luau-lsp starts without --definitions and --docs comes from its source (src/main.cpp) and README, not from running it.

Activity

  1. lagergren commented on Nov 13, 2026

    @lagergren
    Collaborator

    0.30.0 fixes two of these, in #1981:

    • luau-lsp starts the server where its installer puts it, with the path in quotes. Neither the template nor the installer passes --definitions or --docs with path/to/your/… files any more: both are optional.
    • Dart's settings.json no longer sends dart.customDevTools with /path/to/… folders.

    The other placeholders stay: XXX in camel-lsp-server and sdl-lsp, and <<insert base directory>> in the codelldb, perl-dap and vscode-js-debug debug adapters. Their installers fill them in, so they only matter before installing, or without the installer. The ideas above, a placeholder syntax that LSP4IJ knows or a table of inputs, are still open.

  2. added
    bug
    on Nov 21, 2026
  3. added this to the 0.30.3 milestone on Nov 30, 2026
  4. lagergren commented on Nov 30, 2026

    @lagergren
    Collaborator

    This is on 0.30.3 now. A first part is in #2367: the sdl-lsp installer saves the download as sdl-lsp.jar in ~/.lsp4ij/lsp/sdl-lsp, so the sdl-lsp template has the real command, java -jar "$USER_HOME$/.lsp4ij/lsp/sdl-lsp/sdl-lsp.jar", instead of XXX (idea 1 above). The others follow: XXX in camel-lsp-server, and <<insert base directory>> in the CodeLLDB, Perl and VSCode JS Debug debug adapters, and the inputs of idea 3 for what only the user knows.

  5. lagergren commented on Nov 30, 2026

    @lagergren
    Collaborator

    All the placeholders in the commands of the bundled templates are gone once #2367 and #2336 are merged. The templates get the commands that their installers give, from installers that save their servers under fixed names (idea 1 above):

    Ideas 2 and 3, for values that only the user knows, are in #2368. This issue can be closed once both PRs are merged.

  6. lagergren commented on Nov 30, 2026

    @lagergren
    Collaborator

    Closing as done for 0.30.3: no template on main has a placeholder in its command any more.

    Template Its command now By
    camel-lsp-server the installed camel-lsp-server.jar, a fixed name #2367
    sdl-lsp the installed sdl-lsp.jar in ~/.lsp4ij/lsp/sdl-lsp #2367
    codelldb the installed adapter in ~/.lsp4ij/dap #2367
    perl-dap the installed perl-dap in ~/.lsp4ij/dap/perl-dap #2367
    vscode-js-debug the installed dapDebugServer.js in ~/.lsp4ij/dap #2336
    luau-lsp #1981, earlier

    Each command is where the template's installer puts the server, so it works once the installer has run. Without the installer, the user edits it as any command. The idea of telling LSP4IJ what a user has to fill in, so that it can ask for it, is #2368.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugtemplate-ls

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions