This repository has been archived by the owner on Sep 26, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
aabe7f4
commit 14386e8
Showing
1 changed file
with
13 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,32 @@ | ||
# Language Server Indexing Format Implementation for Go | ||
# Go LSIF indexer | ||
|
||
🚨 This implementation is still in very early stage and follows the latest LSIF specification closely. | ||
Visit https://lsif.dev/ to learn about LSIF. | ||
|
||
## Language Server Index Format | ||
## Prerequisites | ||
|
||
The purpose of the Language Server Index Format (LSIF) is 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](https://microsoft.github.io/language-server-protocol/) 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. | ||
- [Go](https://golang.org/) | ||
|
||
A first draft specification can be found [here](https://github.com/Microsoft/language-server-protocol/blob/master/indexFormat/specification.md). | ||
## Installation | ||
|
||
## Quickstart | ||
``` | ||
go get github.com/sourcegraph/lsif-go/cmd/lsif-go | ||
``` | ||
|
||
1. Download and build this program via `go get github.com/sourcegraph/lsif-go/cmd/lsif-go`. | ||
2. The binary `lsif-go` should be installed into your `$GOPATH/bin` directory. | ||
3. Make sure you have added `$GOPATH/bin` to your `$PATH` envrionment variable. | ||
4. Go to a root directory of a Go project, then execute `lsif-go`: | ||
## Indexing your repository | ||
|
||
``` | ||
➜ lsif-go --out data.lsif | ||
$ lsif-go --projectRoot . --out dump.lsif | ||
4 package(s), 10 file(s), 597 def(s), 11521 element(s) | ||
Processed in 770.817859ms | ||
``` | ||
|
||
By default, the indexer will read the current directory as the root of the project. | ||
|
||
Use `lsif-go --help` for more information | ||
|
||
## Try it out! | ||
Use `lsif-go --help` for more information. | ||
|
||
Go to https://sourcegraph.com/github.com/gorilla/mux@d83b6ff/-/blob/mux.go and try to hover and jump around! | ||
## Development | ||
|
||
## Testing Commands | ||
Testing commands: | ||
|
||
- Validate: `lsif-util validate data.lsif` | ||
- Visualize: `lsif-util visualize data.lsif --distance 2 | dot -Tpng -o image.png` |