Skip to content

Troubleshooting

Self-help instructions#

To get more visibility into the inner-workings of the LSP client and the server and be able to diagnose problems, open Preferences: LSP Settings from the Command Palette and set the following options:

Option Description
log_debug: true Show verbose debug messages in the Sublime Text console.
log_server: ["panel"] Log communication from and to language servers in the output panel.

Once enabled (no restart necessary), the communication log can be seen by running LSP: Toggle Log Panel from the Command Palette. It might be a good idea to restart Sublime Text and reproduce the issue again, so that the logs are clean.

If you believe the issue is with this package, please include the output from the Sublime console in your issue report!

If the server is crashing on startup, try running LSP: Troubleshoot server from the Command Palette and check the "Server output" for potential errors. Consider sharing the output of this command in the report.

Updating the PATH used by LSP servers#

You can confirm that your issue is due to PATH being different by starting Sublime Text from the command line so that it inherits your shell's environment.

The solution is to make ST read the same PATH that is read by your shell (or OS in general, in case of Windows).

Note: You can see what ST thinks your PATH is by opening the ST console by clicking on View > Show Console, and running import os; os.environ["PATH"] in that console.

Adjusting PATH can differ based on the operating system and the default shell used. Refer to the following table on where this can be adjusted:

Windows Open Start Menu, type "environment" and select "Edit environment variables for your account". Modify the "Path" variable so that it includes the directory path to the program of your choice.
macOS Depending on your default shell, edit: ~/.profile (bash), ~/.zprofile (zsh) or ~/.config/fish/config.fish (fish).
Linux Edit ~/.profile.

Note: It might be necessary to re-login your user account after changing the shell initialization script for the changes to be picked up.

Another solution could be (at least on Linux) to update the server PATH using the envparameter in your LSP configuration file. The following template can be used where: - <your_language_server_name> is the server name - <added_path> is the directory needed for the server to behave correctly

"<your_language_server_name>":
{
    // ...

    "env":
    {
        "PATH": "<added_path>:/usr/local/bin"
    }
}

Common problems#

1. LSP doesn't start my language server#

  • Make sure you have a folder added in your Sublime workspace.
  • Make sure the document you are opening lives under that folder.

Your client configuration requires two settings to match the document your are editing:

  • Scope (eg. source.php): Verify this is correct by running "Show Scope Name" from the developer menu.
  • Syntax (eg. Packages\PHP\PHP.sublime-syntax): Verify by running view.settings().get("syntax") in the console.

2. LSP cannot find my language server (No such file or directory: 'xyz')#

Assuming that the server is actually installed, and that you can start it from your shell, this issue is likely due to Sublime Text's internal environment not picking up the same PATH environment variable as you've configured in your shell.

The exact changes to make can differ depending on what program you want to expose to Sublime Text. The simplest way is to extend the path like so (replacing /usr/local/bin with the path of your choice):

export PATH="/usr/local/bin:$PATH"

If, for example, you want to expose a Node binary to ST and you have it installed through a version manager like nvm, you need to insert its initialization script in the location specified in this table

The complete procedure of updating the PATH used by Sublime Text depends on your platform and is explained here.

3. Popup error Language server <your_server_language_name> has crashed#

Assuming that the server is actually installed, and that you can start it from your shell, this issue is likely due to Sublime Text's internal environment not picking up the same PATH environment variable as you've configured in your shell.

Note : Language servers may have dependencies that should also be in your PATH in addition to the server binary itself.

For instance if you have installed the haskell-language-server using ghcup-hs you should expose its specific installation folder ~/.ghcup/bin. If the build process uses stack then it should also be in your PATH.

The complete procedure of updating the PATH used by Sublime Text depends on your platform and is explained here.

Known Issues#

Completions not shown after certain keywords#

Sublime Text's built-in Completion Rules.tmPreferences for some languages surpress completions after certain keywords. Python's import keyword is an example - no completions are shown at import a| (See this LSP issue). The solution is to put an edited version of the Completion Rules.tmPreferences in the Packages folder (you may need to clear the copy in the Cache folder afterwards). More details on workaround and a final fix for Lua