code-intel-extensions
code-intel-extensions copied to clipboard
Provides precise code intelligence via LSIF and Language Servers, and fuzzy code intelligence using ctags and text search
Sourcegraph code intelligence extensions
This repository contains the code for the Sourcegraph extensions that provide code intelligence. These extensions provide precise code intelligence via LSIF and provides fuzzy code intelligence using a combination of ctags and search.
Repository structure
templateTemplate used to create extensions for specific languagestemplate/src/language-specsLanguage definitions, which are fed into the template to instantiate many language extensions
Development
-
Run
yarn -
Run
yarn run generate --languages=cpp && yarn --cwd generated-cpp run serve(replacecppwith your language) -
Open up your Sourcegraph settings https://sourcegraph.com/users/you/settings and disable the language extensions you're developing:
{ ... "extensions": { "sourcegraph/cpp": false, ... } } -
Sideload the extension (hit OK on the alert to accept the default URL http://localhost:1234) on your Sourcegraph instance and refresh the page. Make sure you don't see two of the same language extension in the Ext menu.
Adding a language extension
- Add an entry to the
template/src/language-specsdirectory. For languages with a trivial configuration add a new entry (in alphabetical order) tolanguages.ts. Otherwise, add additional files following the existing examples. - (optional, to enable jump to definition) Ensure the language is present in the command line arguments to universal-ctags https://github.com/sourcegraph/go-ctags/blob/main/ctags.go#L69
- Make sure there is a mapping entry for the
languageIDin https://sourcegraph.com/github.com/sourcegraph/sourcegraph/-/blob/client/template/src/languages.ts#L40 - Generate and publish the extension as described below.
Generating & publishing extensions
Typically you do not need to explicitly generate and publish extensions. By default, extensions are generated and published in BuildKite from the master branch.
If you need to manually generate/publish extensions, do so as follows:
Generate:
- Specific language extensions:
yarn run generate --languages=foo,bar - All known language extensions:
yarn run generate
Publish:
- Ensure the
srccommand-line tool is installed on your PATH, and environment variables are set:SRC_ENDPOINTshould be the URL of your instance.SRC_ACCESS_TOKENshould contain an access token for your instance.
- Publish:
- Specific generated language extensions:
yarn run publish --languages=foo,bar - All known generated language extensions:
yarn run publish
- Specific generated language extensions: