Skip to content

Commit

Permalink
feat(nextls): init options (#58)
Browse files Browse the repository at this point in the history
Next LS has support for passing configuring the default MIX_ENV and
MIX_TARGET of your project's runtime, and are accepted as init_options
  • Loading branch information
mhanberg committed Oct 2, 2023
1 parent 195dd6e commit 6aa1637
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
10 changes: 10 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,16 @@
"default": 9000,
"markdownDescription": "If adapter is `tcp`, use this port to connect to a running server.\n\nYou can start the server with `path/to/nextls --port <port>`."
},
"elixir-tools.nextLS.MIX_ENV": {
"type": "string",
"default": "dev",
"markdownDescription": "The MIX_ENV to use when starting the runtime for your project."
},
"elixir-tools.nextLS.MIX_TARGET": {
"type": "string",
"default": "host",
"markdownDescription": "The MIX_TARGET to use when starting the runtime for your project."
},
"elixir-tools.nextLS.installationDirectory": {
"type": "string",
"default": "~/.cache/elixir-tools/nextls/bin/",
Expand Down
6 changes: 6 additions & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,12 @@ async function activateNextLS(
throw new Error("boom");
}
const clientOptions: LanguageClientOptions = {
initializationOptions: {
// eslint-disable-next-line @typescript-eslint/naming-convention
mix_env: config.get("MIX_ENV"),
// eslint-disable-next-line @typescript-eslint/naming-convention
mix_target: config.get("MIX_TARGET"),
},
documentSelector: [
{ scheme: "file", language: "elixir" },
{ scheme: "file", language: "surface" },
Expand Down

0 comments on commit 6aa1637

Please sign in to comment.