Define an index format for Language Servers
Перейти к файлу
Dirk Bäumer 148fa60b98
Install correct sqlite version (#189)
2024-07-04 11:48:11 +02:00
.vscode Add a JSON based language service (#175) 2024-06-26 14:26:43 +02:00
build Separate working directory and package name (#178) 2024-06-26 07:51:36 -07:00
configs/github.com Turn test off for TypeScript (#168) 2024-04-29 08:34:31 -07:00
images Fixes some code blocks and the readme 2018-12-04 11:18:12 +01:00
language-service Normalize URI in JSON store. Update sqlite to 10.7.0 (#188) 2024-07-04 10:38:28 +02:00
lsif Update dependencies (#174) 2024-06-24 17:33:07 +02:00
npm Update dependencies (#174) 2024-06-24 17:33:07 +02:00
protocol Update third party notice (#181) 2024-06-27 11:26:15 +02:00
samples Update dependencies plus code cleanup (#165) 2023-12-07 15:28:13 +00:00
sqlite Install correct sqlite version (#189) 2024-07-04 11:48:11 +02:00
tooling Update dependencies (#174) 2024-06-24 17:33:07 +02:00
tsc Move from protocol to types (#179) 2024-06-26 08:38:33 -07:00
tsc-tests Update dependencies (#174) 2024-06-24 17:33:07 +02:00
.eslintignore Add range emit validation 2021-04-13 22:28:40 +02:00
.eslintrc.base.json Update dependencies plus code cleanup (#165) 2023-12-07 15:28:13 +00:00
.gitignore Add a JSON based language service (#175) 2024-06-26 14:26:43 +02:00
.lsifrc.json Adapt TS 4.4 Beta version 2021-07-13 15:40:33 +02:00
LICENSE Make code license primary 2018-12-05 14:31:16 +01:00
README.md Fix typo in VS Code LSIF extension usage guide (#151) 2022-11-17 09:27:06 +01:00
SECURITY.md Add SECURITY.md 2021-03-11 11:28:28 +01:00
ThirdPartyNotices.txt Add LSIF specification and tsc and npm tool implementation 2018-12-04 11:12:33 +01:00
azure-pipelines.yml Remove indexing job (#172) 2024-05-21 17:18:53 +02:00
package-lock.json Update dependencies (#174) 2024-06-24 17:33:07 +02:00
package.json Update dependencies (#174) 2024-06-24 17:33:07 +02:00
tsconfig.base.json Provide API for language service (#180) 2024-06-27 11:17:16 +02:00
tsconfig.json Add a JSON based language service (#175) 2024-06-26 14:26:43 +02:00
tsconfig.watch.json Add a JSON based language service (#175) 2024-06-26 14:26:43 +02:00

README.md

Language Server Index Format

The purpose of the Language Server Index Format (LSIF) is it to define a standard format for language servers or other programming tools to dump their knowledge about a workspace. This dump can later be used to answer language server LSP requests for the same workspace without running the language server itself. Since much of the information would be invalidated by a change to the workspace, the dumped information typically excludes requests used when mutating a document. So, for example, the result of a code complete request is typically not part of such a dump.

A first draft specification can be found here.

How to Run the tools

  • > npm install -g lsif to install the LSIF tool chain.
  • > lsif tsc -p .\tsconfig.json --stdout creates a LSIF dump for the given typescript project. Output format is new line separated JSON.

If the project provides and npm package or is depending on other npm modules the TypeScript monikers can be converted into stable npm monikers. To do so you can either ask the tsc tool to already do that using

  • > lsif tsc -p .\tsconfig.json --package .\package.json --stdout

or you can run the tool separate in case you want to inspect the newly generated NPM monikers using

  • lsif tsc -p .\tsconfig.json --stdout || lsif npm --stdin --package .\package.json --stdout

Please note that the tools are work in progress and that we have not done any extensive testing so far. Known issues are:

  1. Go to Declaration for function overloads doesn't honor the signature
  2. Go to Type Declaration is not fully implement
  3. Document link support and go to implementation is completely missing

Both tools support --help to get information about their command line arguments.

LSIF utility tools

You can validate LSIF output using the LSIF utility tools.

LSIF extension

There is also an extension for VS Code that can serve the content of a LSIF JSON file. Consider you have dumped the content of a workspace into an LSIF JSON file then you can use the extension to serve the supported LSP requests. This works as follows:

  • follow the steps in 'How to Run the tools` above and create a dump.
  • > git clone https://github.com/Microsoft/vscode-lsif-extension.git
  • > cd vscode-lsif-extension
  • > npm install
  • > npm run compile
  • open the workspace on vscode-lsif-extension using code.
  • switch to the debug viewlet and launch Launch Client
  • in the launch version of VS Code open the command palette and execute the command: Open LSIF Database
  • in the open file picker dialog navigate to a created dump and select it.

The extension

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Legal Notices

Copyright (c) Microsoft Corporation. All rights reserved.

Licensed under the MIT License.

Microsoft, Windows, Microsoft Azure and/or other Microsoft products and services referenced in the documentation may be either trademarks or registered trademarks of Microsoft in the United States and/or other countries. The licenses for this project do not grant you rights to use any Microsoft names, logos, or trademarks. Microsoft's general trademark guidelines can be found at http://go.microsoft.com/fwlink/?LinkID=254653.

Privacy information can be found at https://privacy.microsoft.com/en-us/

Microsoft and any contributors reserve all others rights, whether under their respective copyrights, patents, or trademarks, whether by implication, estoppel or otherwise.