node package manager

javascript-typescript-langserver

JavaScript/TypeScript language server

npm npm Build Status Windows Build Status codecov Dependencies OpenTracing Badge Gitter

This is a language server for JavaScript and TypeScript that adheres to the Language Server Protocol (LSP). It uses TypeScript's LanguageService to perform source code analysis.

Try it out

Features

  • Hovers
  • Goto definition
  • Find all references
  • Document symbols
  • Workspace symbol search
  • Rename
  • Completion
  • Signature help
  • Diagnostics
  • Quick fixes

Run it from source

# install dependencies
npm install
 
# compile
npm run build
# or compile on file changes
npm run watch
 
# run over STDIO
node lib/language-server-stdio
# or run over TCP
node lib/language-server
 
# run tests
npm test

Options

  Usage: language-server [options]

  Options:

    -h, --help            output usage information
    -V, --version         output the version number
    -s, --strict          enabled strict mode
    -p, --port [port]     specifies LSP port to use (2089)
    -c, --cluster [num]   number of concurrent cluster workers (defaults to number of CPUs, 8)
    -t, --trace           print all requests and responses
    -l, --logfile [file]  log to this file

Extensions

This language server implements some LSP extensions, prefixed with an x.

  • Files extension
    Allows the server to request file contents without accessing the file system
  • SymbolDescriptor extension
    Get a SymbolDescriptor for a symbol, search the workspace for symbols or references to it
  • Streaming
    Supports streaming partial results for all endpoints through JSON Patches
  • Packages extension
    Methods to get information about dependencies
  • TCP / multiple client support
    When running over TCP, the exit notification will not kill the process, but close the TCP socket

Versioning

This project follows semver for command line arguments and standard LSP methods. Any change to command line arguments, Node version or protocol breaking changes will result in a major version increase.