diff --git a/cspell-allow-list.txt b/cspell-allow-list.txt index 295f4911e..70671d4dc 100644 --- a/cspell-allow-list.txt +++ b/cspell-allow-list.txt @@ -129,6 +129,7 @@ codellama codemod codemonitors codesearch +COLLADA collatable colordiff colours @@ -150,6 +151,7 @@ ctstate CUDA customcert customising +Cython d'Ivoire daemonset dagre @@ -184,7 +186,10 @@ drwxr dshm dumpall eastus +Easybuild EBADF +Ecere +Eclass eksctl ELEC elif @@ -226,6 +231,7 @@ gitea githost Gitolite gitserver +GLSL gnachman gobwas gofmt @@ -235,13 +241,17 @@ googlecloud gopkg goreleaser goroutines +gosyntect graphbook graphd graphqlbackend +Graphviz gsuite +Haml healthcheck healthz HELO +HLSL horsegraph horsten hostmatcher @@ -285,6 +295,7 @@ jobutil journalctl Jsonnet jsonschemadoc +Kaitai Kaspersky katex keegancsmith @@ -315,6 +326,7 @@ losetup lsif Luhansk maedahbatool +Magik Marino maxage maxmemory @@ -435,6 +447,8 @@ pvcs pykafka quicklinks Qwen +Raku +RAML rbacs readwrite reclone @@ -461,6 +475,8 @@ rescope resourcemanager Rica Rockskip +Rocq +Roff rootfs rstrip runllm @@ -497,6 +513,7 @@ sigalg Slackbot SLES slurpfile +Snakemake Snek snekpm somerandom @@ -506,6 +523,7 @@ sourcegraphcom spacebar specialised spectaql +SQLPL SQLSTATE srcgraph ssbc @@ -612,6 +630,7 @@ vscodesourcegraph waitlist WCAG Weaveworks +Wikitext winsize workspacesin workspacesonlyfetchworkspace diff --git a/docs/code-navigation/auto-indexing.mdx b/docs/code-navigation/auto-indexing.mdx index bf8a30eeb..b7ebd435d 100644 --- a/docs/code-navigation/auto-indexing.mdx +++ b/docs/code-navigation/auto-indexing.mdx @@ -9,8 +9,6 @@ With Sourcegraph deployments supporting [executors](/admin/executors/), your repository contents can be automatically analyzed to produce a code graph index file. Once [auto-indexing is enabled](/code-navigation/auto-indexing#enable-auto-indexing) and [auto-indexing policies are configured](/code-navigation/auto-indexing#configure-auto-indexing), repositories will be periodically cloned into an executor sandbox, analyzed, and the resulting index file will be uploaded back to the Sourcegraph instance. -Auto-indexing is currently available for Go, TypeScript, JavaScript, Python, Ruby and JVM repositories. See also [dependency navigation](/code-navigation/features#dependency-navigation) for instructions on how to setup cross-dependency navigation depending on what language ecosystem you use. - ## Enable auto-indexing The following docs explains how to turn on [auto-indexing](/code-navigation/auto-indexing) on your Sourcegraph instance to enable [precise code navigation](/code-navigation/precise-code-navigation). @@ -144,7 +142,7 @@ For **NPM**, you can create a [secret named `NPM_TOKEN`](https://docs.npmjs.com/ ## Language support -Auto-indexing is currently available for Go, TypeScript, JavaScript, Python, Ruby and JVM repositories. See also [dependency navigation](/code-navigation/features#dependency-navigation) for instructions on how to setup cross-dependency navigation depending on what language ecosystem you use. +See [language support](/code-navigation/language-support) for the languages auto-indexing supports. See also [dependency navigation](/code-navigation/features#dependency-navigation) for instructions on how to setup cross-dependency navigation depending on what language ecosystem you use. ## Lifecycle of an indexing job diff --git a/docs/code-navigation/index.mdx b/docs/code-navigation/index.mdx index 56963f786..b335c8226 100644 --- a/docs/code-navigation/index.mdx +++ b/docs/code-navigation/index.mdx @@ -92,4 +92,4 @@ Learn about how Code Navigation fits into Sourcegraph in the [architecture overv ## What languages are supported? -Search-based code navigation supports 40 programming languages, including all of the most popular ones: Apex, Clojure, Cobol, C++, C#, CSS, Cuda, Dart, Elixir, Erlang, Go, GraphQL, Groovy, Haskell, Java, JavaScript, Jsonnet, Kotlin, Lisp, Lua, OCaml, Pascal, Perl, PHP, PowerShell, Protobuf, Python, R, Ruby, Rust, Scala, Shell, Starlark, Strato, Swift, Tcl, Thrift, TypeScript, Verilog, VHDL. +See [language support](/code-navigation/language-support) for the languages that each type of Code Navigation supports. diff --git a/docs/code-navigation/language-support.mdx b/docs/code-navigation/language-support.mdx new file mode 100644 index 000000000..7de0ca288 --- /dev/null +++ b/docs/code-navigation/language-support.mdx @@ -0,0 +1,181 @@ +# Language support + +

+ See which code features Sourcegraph supports for each language. +

+ +Code Search finds text in files of any language. These features depend on the language of a file: + +- **Syntax highlighting**: Colors code in the file view and in search results. +- **[Symbol search](/code-search/types/symbol)**: Finds declarations with `type:symbol` searches and lists them in the symbol sidebar. +- **[Search-based navigation](/code-navigation/search-based-code-navigation)**: Go to definition and Find references from search heuristics, with no setup. +- **[Syntactic navigation](/code-navigation/syntactic-code-navigation)**: More accurate navigation from syntax analysis, on instances that enable it. +- **[Precise navigation](/code-navigation/precise-code-navigation)**: Compiler-accurate navigation from a SCIP index that an [indexer](/code-navigation/precise-code-navigation#supported-languages-and-indexers) creates for the repository. +- **[Auto-indexing](/code-navigation/auto-indexing)**: Sourcegraph detects the project and runs the indexer itself. + +## Languages with full support + +These languages have precise navigation, the most accurate Code Navigation: + +| Language | Syntax highlighting | Symbol search | Search-based navigation | Syntactic navigation | Precise navigation | Auto-indexing | +| ----------------- | :-----------------: | :-----------: | :---------------------: | :------------------: | :----------------: | :-----------: | +| C | ✓ | ✓ | ✓ | ✓ | ✓ | | +| C# | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| C++ | ✓ | ✓ | ✓ | ✓ | ✓ | | +| CUDA | ✓ | ✓ | ✓ | | ✓ | | +| Go | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| Java | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| JavaScript | ✓ | ✓ | ✓ | | ✓ | ✓ | +| Kotlin | ✓ | ✓ | ✓ | | ✓ | ✓ | +| Python | ✓ | ✓ | ✓ | | ✓ | ✓ | +| Ruby | ✓ | ✓ | ✓ | | ✓ | ✓ | +| Rust | ✓ | ✓ | ✓ | | ✓ | ✓ | +| Scala | ✓ | ✓ | ✓ | ✓ | ✓ | | +| TSX | ✓ | ✓ | ✓ | | ✓ | ✓ | +| TypeScript | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| Visual Basic .NET | ✓ | | | | ✓ | ✓ | + +Precise navigation for Scala needs a [scip-java release before 0.13](/code-navigation/precise-code-navigation#supported-languages-and-indexers). + +## Languages with partial support + +These languages have no syntactic navigation, precise navigation, or auto-indexing: + +| Language | Syntax highlighting | Symbol search | Search-based navigation | +| ------------------------ | :-----------------: | :-----------: | :---------------------: | +| ActionScript | ✓ | | | +| Apex | ✓ | ✓ | ✓ | +| AppleScript | ✓ | | | +| ASP.NET | ✓ | | | +| BASIC | | ✓ | | +| Batchfile | ✓ | | | +| BibTeX | ✓ | | | +| Cap'n Proto | ✓ | | | +| Classic ASP | ✓ | | | +| Clojure | ✓ | ✓ | ✓ | +| CMake | ✓ | | | +| COBOL | ✓ | ✓ | ✓ | +| Common Lisp | ✓ | ✓ | ✓ | +| Crontab | ✓ | | | +| CSS | ✓ | ✓ | | +| D | ✓ | ✓ | | +| Dart | ✓ | | ✓ | +| Diff | ✓ | | | +| DM | ✓ | | | +| Dockerfile | ✓ | | | +| Elixir | ✓ | ✓ | ✓ | +| Elm | ✓ | ✓ | | +| Emacs Lisp | ✓ | | ✓ | +| Erlang | ✓ | ✓ | ✓ | +| F# | ✓ | | | +| Fish | ✓ | | | +| Forth | ✓ | | | +| Gherkin | ✓ | | | +| Git Attributes | ✓ | | | +| Git Commit | ✓ | | | +| Git Config | ✓ | | | +| GLSL | ✓ | | | +| Go Checksums | ✓ | | | +| Go Module | ✓ | | | +| GraphQL | ✓ | ✓ | ✓ | +| Graphviz (DOT) | ✓ | | | +| Groovy | ✓ | ✓ | ✓ | +| Hack | ✓ | ✓ | | +| Haml | ✓ | | | +| Haskell | ✓ | ✓ | ✓ | +| HCL, Terraform | ✓ | | | +| HLSL | ✓ | | | +| HTML | ✓ | | | +| HTML+EEX | ✓ | | | +| HTML+ERB | ✓ | | | +| Ignore List | ✓ | | | +| INI | ✓ | | | +| Java Properties | ✓ | | | +| Java Server Pages | ✓ | | | +| JavaScript+ERB | ✓ | | | +| JCL | ✓ | | | +| JSON | ✓ | | | +| Jsonnet | ✓ | ✓ | ✓ | +| Julia | ✓ | | | +| Less | ✓ | ✓ | | +| Literate Haskell | ✓ | | | +| Lua | ✓ | ✓ | ✓ | +| Magik | ✓ | ✓ | | +| Makefile | ✓ | | | +| Markdown | ✓ | ✓ | | +| MATLAB | ✓ | ✓ | | +| Maven POM | ✓ | | | +| Move | ✓ | | | +| Nickel | ✓ | | | +| Ninja | ✓ | | | +| Nix | ✓ | | | +| Objective-C | ✓ | ✓ | ✓ | +| Objective-C++ | ✓ | ✓ | | +| OCaml | ✓ | ✓ | ✓ | +| Pascal | ✓ | ✓ | ✓ | +| Perl | ✓ | ✓ | ✓ | +| PHP | ✓ | ✓ | ✓ | +| Pkl | ✓ | | ✓ | +| PostScript | ✓ | | | +| PowerShell | ✓ | ✓ | ✓ | +| Protocol Buffers | ✓ | ✓ | ✓ | +| Puppet | ✓ | | | +| R | ✓ | ✓ | ✓ | +| Raku | | ✓ | | +| Regular Expression | ✓ | | | +| reStructuredText | ✓ | | | +| Rocq Prover (Coq) | ✓ | | | +| Roff | ✓ | | | +| RPM Spec | ✓ | | | +| Sass | ✓ | ✓ | | +| Scheme | ✓ | ✓ | | +| SCSS | ✓ | ✓ | | +| Shell | ✓ | ✓ | ✓ | +| Smalltalk | ✓ | | | +| Smarty | ✓ | | | +| Solidity | ✓ | | | +| SQL | ✓ | | | +| Starlark | ✓ | | ✓ | +| Strato | | | ✓ | +| Stylus | ✓ | | | +| Svelte | ✓ | | ✓ | +| Swift | ✓ | ✓ | ✓ | +| SystemVerilog | ✓ | ✓ | ✓ | +| Tcl | ✓ | ✓ | ✓ | +| TeX, LaTeX | ✓ | | | +| Textile | ✓ | | | +| Thrift | ✓ | ✓ | ✓ | +| TOML | ✓ | | | +| Verilog | ✓ | ✓ | ✓ | +| VHDL | ✓ | ✓ | ✓ | +| Vim Script | ✓ | ✓ | | +| Vue | ✓ | | | +| Vyper | ✓ | | | +| Wikitext | ✓ | | | +| Windows Registry Entries | ✓ | | | +| XML | ✓ | | | +| XML Property List | ✓ | | | +| YAML | ✓ | | | +| Zig | ✓ | ✓ | ✓ | + +Files in a language without a checkmark for syntax highlighting are shown as plain text. Administrators can assign file extensions and path patterns to a language with `syntaxHighlighting.languages` in the [site configuration](/admin/config/site-config). + +## Formats highlighted as another language + +These formats have syntax highlighting only, using the grammar of the language they are based on: + +| Highlighted as | Formats | +| -------------- | ------------------------------------------------------------ | +| Clojure | edn | +| Groovy | Gradle | +| INI | EditorConfig, NPM Config | +| JSON | Ecere Projects, JSON with Comments, JSONLD, Jupyter Notebook | +| Kotlin | Gradle Kotlin DSL | +| Perl | Pod | +| PHP | HTML+PHP | +| Python | Cython, Easybuild, Snakemake | +| Roff | Roff Manpage | +| SQL | PLSQL, PLpgSQL, SQLPL, TSQL | +| Shell | Gentoo Ebuild, Gentoo Eclass | +| XML | Ant Build System, COLLADA, SVG, XPages, XProc, XSLT | +| YAML | BuildStream, Kaitai Struct, RAML, Unity3D Asset | diff --git a/docs/code-navigation/precise-code-navigation.mdx b/docs/code-navigation/precise-code-navigation.mdx index 5400a4308..0aa651a91 100644 --- a/docs/code-navigation/precise-code-navigation.mdx +++ b/docs/code-navigation/precise-code-navigation.mdx @@ -33,9 +33,9 @@ Precise code navigation relies on the open source [SCIP Code Intelligence Protoc - [Index a Go repository](/code-navigation/how-to/index-a-go-repository#manual-indexing) - [Index a TypeScript or JavaScript repository](/code-navigation/how-to/index-a-typescript-and-javascript-repository#manual-indexing) - - [Index a Java, Scala, or Kotlin repository](https://sourcegraph.github.io/scip-java/docs/getting-started.html) - - [Index a Python repository](https://sourcegraph.com/github.com/sourcegraph/scip-python) - - [Index a Ruby repository](https://sourcegraph.com/github.com/sourcegraph/scip-ruby) + - [Index a Java, Scala, or Kotlin repository](https://scip-code.github.io/scip-java/docs/getting-started.html) + - [Index a Python repository](https://github.com/sourcegraph/scip-python) + - [Index a Ruby repository](https://github.com/sourcegraph/scip-ruby) 2. [**Automate indexing via CI**](/code-navigation/how-to/adding-scip-to-workflows): Add indexing and uploading to your CI setup. 3. [**Auto-indexing**](/code-navigation/auto-indexing#enable-auto-indexing): Sourcegraph will automatically index your repositories and enable precise code navigation for them. @@ -46,15 +46,18 @@ Precise Code Navigation requires language-specific indexes to be generated and u | Language | Indexer | Status | | ---------------------- | --------------------------------------------------------------------------------- | ---------------------- | -| Go | [scip-go](https://sourcegraph.com/github.com/sourcegraph/scip-go) | 🟢 Generally available | -| TypeScript, JavaScript | [scip-typescript](https://sourcegraph.com/github.com/sourcegraph/scip-typescript) | 🟢 Generally available | -| C, C++, CUDA | [scip-clang](https://sourcegraph.com/github.com/sourcegraph/scip-clang) | 🟢 Generally available | -| Java, Kotlin, Scala | [scip-java](https://sourcegraph.com/github.com/sourcegraph/scip-java) | 🟢 Generally available | +| Go | [scip-go](https://github.com/scip-code/scip-go) | 🟢 Generally available | +| TypeScript, JavaScript | [scip-typescript](https://github.com/sourcegraph/scip-typescript) | 🟢 Generally available | +| C, C++, CUDA | [scip-clang](https://github.com/sourcegraph/scip-clang) | 🟢 Generally available | +| Java, Kotlin | [scip-java](https://github.com/scip-code/scip-java) | 🟢 Generally available | +| Scala | [scip-java before 0.13](https://github.com/scip-code/scip-java/releases) | 🟢 Generally available | | Rust | [rust-analyzer](https://sourcegraph.com/github.com/rust-lang/rust-analyzer) | 🟢 Generally available | -| Python | [scip-python](https://sourcegraph.com/github.com/sourcegraph/scip-python) | 🟢 Generally available | -| Ruby | [scip-ruby](https://sourcegraph.com/github.com/sourcegraph/scip-ruby) | 🟢 Generally available | +| Python | [scip-python](https://github.com/sourcegraph/scip-python) | 🟢 Generally available | +| Ruby | [scip-ruby](https://github.com/sourcegraph/scip-ruby) | 🟢 Generally available | | C#, Visual Basic | [scip-dotnet](https://github.com/sourcegraph/scip-dotnet) | 🟢 Generally available | +scip-java 0.13 removed Scala support. To index Scala code, use an earlier scip-java release. + The easiest way to configure precise code navigation is with [auto-indexing](/code-navigation/auto-indexing). This feature uses [Sourcegraph executors](/admin/executors/) to automatically create indexes for the code, keeping precise code navigation available and up-to-date. ## Precise navigation examples diff --git a/docs/code-navigation/syntactic-code-navigation.mdx b/docs/code-navigation/syntactic-code-navigation.mdx index b2fd650a1..45bab4bca 100644 --- a/docs/code-navigation/syntactic-code-navigation.mdx +++ b/docs/code-navigation/syntactic-code-navigation.mdx @@ -42,16 +42,7 @@ Syntactic indexing can only be enabled if the policy type is set to HEAD – onl ## Supported languages -Syntactic code navigation requires language-specific implementations, and we currently support the following languages: - -- [Java](https://www.java.com/en/) -- [Go](https://go.dev/) -- [Scala](https://scala-lang.org) -- [C#](https://learn.microsoft.com/en-us/dotnet/csharp/) -- [C++](https://isocpp.org/) - -We are constantly looking to expand the list of supported languages, with Python, Typescript/Javascript, and C planned. -If you are interested in syntactic indexing for these or any other languages, please contact your Sourcegraph account representative. +Syntactic code navigation requires language-specific implementations. See [language support](/code-navigation/language-support) for the languages it supports. ## Comparison with Precise and Search-based diff --git a/docs/getting-started/github-vs-sourcegraph.mdx b/docs/getting-started/github-vs-sourcegraph.mdx index a1694bc84..cbeb44a71 100644 --- a/docs/getting-started/github-vs-sourcegraph.mdx +++ b/docs/getting-started/github-vs-sourcegraph.mdx @@ -236,12 +236,12 @@ With Sourcegraph, a [search context](/code-search/working/search-contexts) repre Both GitHub and Sourcegraph offer out-of-the-box, search-based code navigation. This version of code navigation uses search-based heuristics to find references and definitions across a codebase without any setup required. It is powerful and convenient, but it can sometimes present inaccurate results. For example, it can return false positive references for symbols with common names. It is limited to returning definitions and references within a single repository (it won’t track references across multiple repositories). -GitHub’s [search-based code navigation](https://docs.github.com/en/repositories/working-with-files/using-files/navigating-code-on-github) officially supports 10 languages according to the documentation, but more languages are supported in the latest beta preview. Sourcegraph’s [search-based code navigation](/code-navigation/search-based-code-navigation) supports 40 languages. +GitHub’s [search-based code navigation](https://docs.github.com/en/repositories/working-with-files/using-files/navigating-code-on-github) officially supports 10 languages according to the documentation, but more languages are supported in the latest beta preview. Sourcegraph’s [search-based code navigation](/code-navigation/search-based-code-navigation) supports more than 40 languages. | **Features** | **GitHub** | **Sourcegraph** | | ------------------------ | ------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | | Technical implementation | Heuristic-based | Heuristic-based | -| Language support | 10 languages (C#, CodeQL, Elixir, Go, Java, JavaScript,TypeScript, PHP, Python, Ruby) | 40 languages (The full list of supported languages can be found [here](/code-navigation/search-based-code-navigation)) | +| Language support | 10 languages (C#, CodeQL, Elixir, Go, Java, JavaScript,TypeScript, PHP, Python, Ruby) | More than 40 languages (see [language support](/code-navigation/language-support)) | | Setup | No setup required | No setup required | | Accuracy | Moderate (some false positives) | Moderate (some false positives) | | Cross-repository | ✗ | ✗ | diff --git a/src/data/navigation.ts b/src/data/navigation.ts index a4c5efff0..4b29a4181 100644 --- a/src/data/navigation.ts +++ b/src/data/navigation.ts @@ -154,6 +154,10 @@ export const navigation: NavigationItem[] = [ title: 'Code Navigation features', href: '/code-navigation/features' }, + { + title: 'Language support', + href: '/code-navigation/language-support' + }, { title: 'Search-based Code Navigation', href: '/code-navigation/search-based-code-navigation'