Skip to content

lsp-extension-missing-dot ​

LSP extension mappings must start with a dot

Error

Rule Details ​

This rule validates keys in the extensionToLanguage mapping of each LSP server entry in lsp.json. File extensions must begin with a dot (e.g., .ts, .py) to be recognized by the LSP system. Extensions without a leading dot will fail to match files correctly, causing language server features like code completion and diagnostics to not activate.

Incorrect ​

Extension keys missing the leading dot

json
{
  "typescript-server": {
    "command": "/usr/bin/tsserver",
    "extensionToLanguage": {
      "ts": "typescript",
      "tsx": "typescriptreact"
    }
  }
}

Correct ​

Extension keys with leading dot

json
{
  "typescript-server": {
    "command": "/usr/bin/tsserver",
    "extensionToLanguage": {
      ".ts": "typescript",
      ".tsx": "typescriptreact"
    }
  }
}

How To Fix ​

Add a leading dot to each extension key in the extensionToLanguage mapping. For example, change "ts" to ".ts" and "py" to ".py".

Options ​

This rule does not have any configuration options.

Resources ​

Version ​

Available since: v0.2.0