• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

sourcegraph/javascript-typescript-langserver: JavaScript and TypeScript code int ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

sourcegraph/javascript-typescript-langserver

开源软件地址:

https://github.com/sourcegraph/javascript-typescript-langserver

开源编程语言:

TypeScript 99.2%

开源软件介绍:

⚠️ This project is no longer maintained

This language server is an implementation of LSP using TypeScript's APIs. This approach made it difficult to keep up with new features of TypeScript and implied that the server always uses a bundled TypeScript version, instead of the local TypeScript in node_modules like using the official (non-LSP) tsserver allows.

On top of that, over time we simplified our architecture for running language servers in the cloud at Sourcegraph which removed the necessity for this level of tight integration and control. Theia's TypeScript language server is a thinner wrapper around tsserver, which avoids these problems to some extent. Our latest approach of running a TypeScript language server in the cloud uses Theia's language server (and transitively tsserver) under the hood.

However, since then our code intelligence evolved even further and is nowadays powered primarily by LSIF, the Language Server Index Format. LSIF is developed together with LSP and uses the same structures, but in a pre-computed serialization instead of an RPC protocol. This allows us to provide near-instant code intelligence for our tricky on-demand cloud code intelligence scenarios and hence we are focusing all of our efforts on LSIF indexers. All of this work is also open source of course and if you're curious you can read more about how we use LSIF on our blog.

LSP is still the obvious choice for editor scenarios and everyone is welcome to fork this repository and pick up maintenance, although from what we learned we would recommend to build on Theia's approach (wrapping tsserver). We would also love to see and are looking forward to native LSP support for the official tsserver, which would eliminate the need for any wrappers.


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.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap