The contributed settings are still named `languageServerExample.*`, so neither reaches the server

Open Beginner friendly
#200 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
85/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
typescript, vscode
Domain
devtools

Research direction

Start with the configuration block in package.json:10-30, then compare it with the settings lookup in eo-lsp-server/src/server.ts:141-144 and src/defaultSettings.ts. Check extension.ts:66 for the LanguageClient id. Done means the contributed settings use the server's eo.limit names and matching trace prefix, with the documented default aligned to 1000.

Written by the indexing model from the issue text.

Description

The two settings this extension contributes are named after the VS Code sample it was started from, and neither reaches the server: the section is wrong and, for the one that would matter, so is the key.

package.json:10-30:

"configuration": {
  "properties": {
    "languageServerExample.maxNumberOfProblems": {
      "default": 100,
      "description": "Controls the maximum number of problems produced by the server.",
      "scope": "resource",
      "type": "number"
    },
    "languageServerExample.trace.server": { … }
  },
  "title": "Configuration",
  "type": "object"
}

The server asks for a different section entirely. eo-lsp-server/src/server.ts:141-144:

result = connection.workspace.getConfiguration({
    scopeUri: resource,
    section: "eo"
}).then(config => settings(config));

and reads a differently named field out of it — src/defaultSettings.ts declares interface DefaultSettings { limit: number }, and diagnostics(errors, effective.limit, …) is what caps the report.

So a user who opens Settings, finds "Controls the maximum number of problems produced by the server", and sets it to 5 gets no change at all: the server never reads languageServerExample.*, and even under the right section the key it looks for is limit, not maxNumberOfProblems. The default stays 1000, the number defaultSettings carries.

languageServerExample.trace.server has the same problem in a different direction: vscode-languageclient derives the trace setting from the client's id, which extension.ts:66 sets when constructing LanguageClient, so the setting VS Code honours is named after that id and not after languageServerExample.

grep -rn "languageServerExample\|maxNumberOfProblems" src/ test/ finds nothing outside package.json — no code in this repository reads either one.

Root cause

The extension began as the lsp-sample from vscode-extension-samples, whose contribution block uses exactly these two names, and the block was kept while the server it talks to grew its own configuration.

Suggested fix

Name the section the server reads, and the field it reads inside it:

"configuration": {
  "properties": {
    "eo.limit": {
      "default": 1000,
      "description": "Maximum number of diagnostics reported per file.",
      "scope": "resource",
      "type": "number"
    },
    "eo.trace.server": {
      "default": "off",
      "description": "Traces the communication between VS Code and the EO language server.",
      "enum": ["off", "messages", "verbose"],
      "scope": "window",
      "type": "string"
    }
  },
  "title": "EO",
  "type": "object"
}

with the client id in extension.ts matching the trace prefix, so eo.trace.server is the name VS Code actually looks up. The 1000 above is the server's own default; leaving 100 here would advertise a cap the server does not apply.

Dominant language
TypeScript
Stars
9
Forks
5
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from objectionary/eo-vscode

All issues in objectionary/eo-vscode

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.