VS Code LSP Config

November 2, 2025 ยท View on GitHub

A VS Code extension for configuring external language servers for different file types, similar to Neovim's lspconfig plugin.

Features

  • Configure language servers for different file types using a JavaScript configuration file
  • Enable/disable language servers on-demand
  • View the status of running language servers
  • Easily restart language servers
  • Inspired by Neovim's lspconfig plugin

Usage

  1. Install the extension from the VS Code marketplace
  2. Create a configuration file by running the command: LSP Config: Create Configuration File
  3. Edit the lspconfig.js file to configure your desired language servers
  4. Enable language servers with the command: LSP Config: Enable/Disable Language Servers

Configuration

All extension configuration is stored in the <UserHome>/.config/vscode-lspconfig folder.

Configuration File Path:

  • macOS/Linux: ~/.config/vscode-lspconfig/
  • Windows: %USERPROFILE%\.config\vscode-lspconfig\

In addition to this, the extension looks for syntax and VS Code language configuration files inside a folder within the above configuration directory with a name that matches the languageId.

The main configuration file is lspconfig.js, which contains the primary configuration defining the language servers that will be loaded by this extension.

This file should export an object where each key is a language server identifier (languageId) and the value is the configuration for that server.

Example configuration:

module.exports = {
  bashls: {
    name: "Bash Language Server",
    command: "bash-language-server",
    args: ["start"],
    documentSelector: [
      { scheme: "file", language: "bashls" }
    ],
    settings: {
      bashIde: {
        globPattern: "**/*@(.sh|.inc|.bash|.command)"
      }
    },
    language: {
      extensions: [".sh", ".bash"],
      aliases: ["sh", "bash"]
    }
  }
};

Configuration Options

Each language server configuration can include the following options:

OptionTypeDescriptionRequired
namestringDisplay name of the language serverYes
commandstring or string[]Command or path to the language server executableYes
argsstring[]Command line arguments to pass to the language serverNo
documentSelector[].languagestringLanguage identifier that the server handles (e.g., "javascript"). The value should be the same as the key used for the configuration entry (languageId)Yes
documentSelector[].schemestringURI scheme the server supports (e.g., "file")Yes
initializationOptionsanyOptions to pass to the language server during initializationNo
settingsanyConfiguration settings to send to the language serverNo
revealOutputChannelOn"info" | "warn" | "error" | "never"When to reveal the output channelNo
env{ [key: string]: string }Environment variables to set when running the language serverNo
installMessagestringMessage to display when the language server is not installedNo
language.extensionsstring[]File extensions associated with the language (e.g., [".js", ".jsx"])No
language.aliasesstring[]Language aliases that can be used in VS Code, when the language is already contributed by another extensionNo
language.enableConfigbooleanWhether to enable language configuration for this server (language specific features like brackets, autoClosingPairs, etc.)No
language.enableSyntaxbooleanWhether to enable language syntax highlighting for this serverNo

Language Configuration

When language.enableConfig is set to true, the extension will look for a file named language-configuration.json inside the dedicated language folder as described in the configuration section. The file structure should be as described in the VS Code documentation.

Syntax Configuration

When language.enableSyntax is set to true, the extension will look for a file named tmLanguage.json inside the dedicated language folder as described in the configuration section. The file structure should be as described in the VS Code documentation.


## Commands

The extension provides the following commands:

  • LSP Config: Create Configuration File: Create a new configuration file in your workspace
  • LSP Config: Enable/Disable Language Servers: Enable or disable language servers
  • LSP Config: Restart Language Server: Restart a running language server
  • LSP Config: Reload Configuration: Reload the configuration file after making changes
  • LSP Config: Stop All Language Servers: Stop all running language servers
  • LSP Config: Show Language Server Status: Show which language servers are currently active

Requirements

  • VS Code 1.60.0 or higher
  • Language servers must be installed separately

Inspiration

This extension is inspired by Neovim's lspconfig project.

License

Apache License 2.0. See LICENSE file for details.