Off-sprint project that intends to index symbols from a language server (LSP), for code search.
Try the resulting Code Seach UI: https://codesandbox.io/s/ais-ecommerce-demo-app-580me.
Do better than GitHub to discover and explore a codebase.
Use cases:
JavaScript/TypeScript
$ git clone https://github.com/sourcegraph/javascript-typescript-langserver.git
$ cd javascript-typescript-langserver
$ npm install
$ npm run build
$ node lib/language-server --trace
Go
# Install https://github.com/golang/tools/tree/master/gopls
$ gopls -v serve -rpc.trace --port 2089 --debug=localhost:6060 -logfile /tmp/log.log -listen 127.0.0.1:2089
$ git clone https://github.com/adrienjoly/algocodesearch.git
$ cd algocodesearch
$ npm install
$ npm run test:js # with js lsp running
$ npm run test:go # with go lsp running
This should send a LSP request to the server and print the response to stdout.
# git clone https://github.com/adrienjoly/algocodesearch.git
# cd algocodesearch
# npm install
$ node indexing.js ../my-js-project/ "output-file-prefix"
# => will generate output-file-prefix-index-symbols.json and output-file-prefix-index-refs.json
text
property to be clickable (i.e. horizontal nagivation)For one file of source code
{
"objectID": (hash of JSON)
"name": "WorkspaceSymbolParams",
"kind": 13,
"location": {
"uri": "file:///path/to/javascript-typescript-langserver/src/typescript-service.ts",
"range": {
"start": {
"line": 62,
"character": 4
},
"end": {
"line": 62,
"character": 25
}
}
}
}
{
"uri": "file:///path/to/javascript-typescript-langserver/node_modules/%40types/lodash/common/lang.d.ts",
"range": {
"start": {
"line": 11,
"character": 8
},
"end": {
"line": 11,
"character": 17
}
}
}