basic-code-intel provides fuzzy code intelligence using a combination of ctags and search. All of the programming language Sourcegraph extensions use the basic-code-intel npm package that lives in this repository.
First install goreman:
$ go get github.com/mattn/goreman
Then run:
$ ./dev
Open up your Sourcegraph settings https://sourcegraph.com/users/you/settings and disable the language extensions you're developing:
"extensions": {
"sourcegraph/cpp": false,
...
}
Then sideload the extension (http://localhost:1234) on your Sourcegraph instance and refresh the page. Make sure you don't see two of the same language extension.
Open the browser Network tab and you should start seeing graphql?Search
calls when you hover over tokens.
- package/ The basic-code-intel npm package https://www.yarnpkg.com/en/package/@sourcegraph/basic-code-intel (exposes basic-code-intel functionality to Go and TypeScript, which live in other repositories)
- template/ A template language extension that uses that package (for development purposes)
- generator/ A script that generates all of the various basic language extensions (all but Go and TypeScript, which live in separate repositories)
After you make a change to the basic-code-intel package and bump the version number in package/package.json
, build and publish it to npm:
cd package
yarn run build
npm publish
Then, update the version in the downstream language extensions by bumping the version in package.json
.
Finally, publish the extensions with bash generator/generate.sh --publish
.
- Create a new extension https://docs.sourcegraph.com/extensions/authoring/creating
- Take a look at the Go extension to see how to use the
@sourcegraph/basic-code-intel
package - Change the file extensions, test, and publish
- Add an entry to
languages
ingenerator/src/main.ts
- (optional, to enable jump to definition) Ensure the language is present in the command line arguments to universal-ctags https://github.com/sourcegraph/sourcegraph/blob/21efc6844838e773b9a8f4a7ba1d5628e8076984/cmd/symbols/internal/pkg/ctags/parser.go#L71
- Run
bash generate.sh --languages <language name> --publish