npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

javascript-typescript-langserver

v2.11.3

Published

Implementation of the Language Server Protocol for JavaScript and TypeScript

Downloads

1,908

Readme

JavaScript/TypeScript language server

npm downloads build appveyor build codecov dependencies OpenTracing: enabled semantic-release code style: prettier license chat: on 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
  • Goto type 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
    -j, --enable-jaeger   enable OpenTracing through Jaeger

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.

Debugging Performance with OpenTracing

The language server is fully traced through OpenTracing, which allows to debug what exact operations caused method calls to take long. You can pass a span context through an optional meta field on the JSON RPC message object.

For local development, there is built-in support for the open source OpenTracing implementation Jaeger, which can be set up to run on localhost with just one command (you need Docker installed):

docker run -d -p5775:5775/udp -p6831:6831/udp -p6832:6832/udp \
  -p5778:5778 -p16686:16686 -p14268:14268 jaegertracing/all-in-one:latest

After that, run the language server with the --enable-jaeger command line flag and do some requests from your client. Open http://localhost:16686 in your browser and you will see method calls broken down into spans.