TypeScript LSP Configuration

The details below describe how to install and configure the TypeScript language server found here.
IMPORTANT: This language server assumes Node.js has been installed on the machine. To test for this open the command prompt, run the node -v command and check that the version number output is produced, something similar to this:
v18.4.0
If Node.js is not installed, download and install Node.js from here.

Installing the Language Server

If not already installed then install TypeScript using the following command:
npm install -g typescript
Install the TypeScript Language Server usign the following command:
npm install -g typescript-language-server
With the software installed test the installation by running typescript-language-server.cmd -h at the command line prompt, which should result in the following output:
Usage: typescript-language-server [options]

Options:
  -V, --version                                    output the version number
  --stdio                                          use stdio
  --log-level <logLevel>                           A number indicating the log level (4 = log, 3 = info, 2 = warn, 1 =
                                                   error). Defaults to `2`.
  --tsserver-log-verbosity <tsserverLogVerbosity>  [deprecated] Specify a tsserver log verbosity (terse, normal,
                                                   verbose). Defaults to `normal`. example: --tsserver-log-verbosity
                                                   verbose
  --tsserver-path <path>                           [deprecated] Specify path to tsserver.js or the lib directory.
                                                   example: --tsserver-path=/Users/me/typescript/lib/tsserver.js
  -h, --help                                       display help for command
        
If that output is not produced check the installation and also check to make sure the batch file installation folder has been added to the system PATH environment variable.
NOTE: Some of those options have been [deprecated] and these should not be used.

Configuration

Start Zeus and use the Options, Document Types menu to edit the TypeScript document type and in the Language Server panel apply the following configuration settings:
Program Type: Batch
     Program: typescript-language-server.cmd
   Directory:
   Arguments: --stdio
              --log-level=4
              --tsserver-log-verbosity=verbose
        
NOTE: The directory value is only required if the location of the typescript-language-server.cmd file has not been added to the system PATH.

Using the Language Server

To test the configuration create a simple test.ts file and fire off an auto-complete request:
lsp typescript
This short video shows the autocomplete in action.

The TypeScript language server can also work with a package.json project file but the language server will need to located that file. The easiest way to achieve this is to create a Zeus workspace in that project folder location and then leave the Root Path language server option empty. With that setup in place Zeus will automatically set the Root Path to match the location of the currently open workspace.

Latest Version: Zeus 3.99a
Released: 27 th January 2023