Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Sourcegraph Docs

<!-- Working branch for April 2025 Release -->
<!-- Working branch for SG 6.3 Release -->

Welcome to the Sourcegraph documentation! We're excited to have you contribute to our docs. We've recently rearchitectured our docs tech stack — powered by Next.js, TailwindCSS and deployed on Vercel. This guide will walk you through the process of contributing to our documentation using the new tech stack.

Expand Down
2 changes: 1 addition & 1 deletion docs.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const config = {
DOCS_LATEST_VERSION: '6.2'
DOCS_LATEST_VERSION: '6.3'
};

module.exports = config;
118 changes: 118 additions & 0 deletions docs/code-search/compare-file-filtering.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
# File Filtering in the Repository Comparison Page

The repository comparison page provides powerful file filtering capabilities that allow you to focus on specific files in a comparison. The system supports multiple ways to specify which files you want to view when comparing branches, tags, or commits.

## Query parameter-based file filtering

The comparison page supports three different query parameters to specify which files to include in the comparison:

### 1. Individual file paths

You can specify individual files using either of these parameters:

- `filePath=path/to/file.js` - Primary parameter for specifying files
- `f=path/to/file.js` - Shorthand alternative

Multiple files can be included by repeating the parameter:

```shell
?filePath=src/index.ts&filePath=src/components/Button.tsx
```

### 2. Compressed file lists

For comparisons with a large number of files, the system supports compressed file lists (newline-separated):

- `compressedFileList=base64EncodedCompressedData` - Efficiently packs many file paths

This parameter efficiently transmits large file paths using base64-encoded, gzip-compressed data. The compression allows hundreds or thousands of files to be included in a URL without exceeding length limits, which vary depending on the browser, HTTP server, and other services involved, like Cloudflare.

```typescript
// Behind the scenes, the code decompresses file lists using:
const decodedData = atoburl(compressedFileList)
const compressedData = Uint8Array.from([...decodedData].map(char => char.charCodeAt(0)))
const decompressedData = pako.inflate(compressedData, { to: 'string' })
```

One way to create a list of files for the `compressedFileList` parameter is to use Python's built-in libraries to compress and encode using url-safe base64 encoding (smaller than base64-encoding, then url-encoding).

```shell
python3 -c "import sys, zlib, base64; sys.stdout.write(base64.urlsafe_b64encode(zlib.compress(sys.stdin.buffer.read())).decode().rstrip('='))" < list.of.files > list.of.files.deflated.b64url
```

### 3. Special focus mode

You can focus on a single file using:

- `focus=true&filePath=path/to/specific/file.js` - Show only this file in detail view

## File filtering UI components

The comparison view provides several UI components to help you filter and navigate files:

### FileDiffPicker

The FileDiffPicker component allows you to:

- Search for files by name or path
- Filter files by type/extension
- Toggle between showing all files or only modified files
- Sort files by different criteria (path, size of change, etc.)

This component uses a dedicated file metadata query optimized for quick filtering. Results are displayed as you type. Through client-side filtering, the component can efficiently handle repositories with thousands of files.

### File navigation

When viewing diffs, you can:

- Click on any file in the sidebar to switch to that file
- Use keyboard shortcuts to navigate between files
- Toggle between expanded and collapsed views of files
- Show or hide specific changes (additions, deletions, etc.)

### URL-based filtering

Any filters you apply through the UI will update the URL with the appropriate query parameters. This means you can:

1. Share specific filtered views with others
2. Bookmark comparisons with specific file filters
3. Navigate back and forth between different filter states using browser history

## Implementation details

The system makes strategic performance trade-offs to provide a smooth user experience:

```typescript
/*
* For customers with extremely large PRs with thousands of files,
* we fetch all file paths in a single API call to enable client-side filtering.
*
* This eliminates numerous smaller API calls for server-side filtering
* when users search in the FileDiffPicker. While requiring one large
* initial API call, it significantly improves subsequent search performance.
*/
```

The file filtering system uses a specialized file metadata query that is faster and lighter than the comprehensive file diffs query used to display actual code changes.

## Usage examples

1. View only JavaScript files:

```bash
?filePath=src/utils.js&filePath=src/components/App.js
```

2. Focus on a single file:

```bash
?focus=true&filePath=src/components/Button.tsx
```

3. Use a compressed file list for many files:

```bash
?compressedFileList=H4sIAAAAAAAAA2NgYGBg...
```

This flexible filtering system allows you to create customized views of repository comparisons, making reviewing changes in large projects easier.
9 changes: 9 additions & 0 deletions docs/code-search/features.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,15 @@ Here is an example of search results with personalized search ranking enabled:

As you can see, the results are now ranked based on their relevance to the query, and the results from repositories you've recently contributed to are boosted.

## Compare changes across revisions

When you run a search, you can compare the results from two different revisions of the codebase. From your search query results page, click the three-dot **...** icon next to the **Contributors** tab. Then select the **Compare** option.

From here, you can execute file and directory filtering and compare large diffs, making it easier to navigate and manage.

This file picker is useful when comparing branches with thousands of changed files and allows you to select specific files or directories to focus on. You can [filter files directly](/code-search/compare-file-filtering) by constructing a URL with multiple file paths or use a compressed file list for even larger selections.

![file-and-directory-filtering](https://storage.googleapis.com/sourcegraph-assets/Docs/filter-by-file-dir-on-compare.png)

## Other search tips

Expand Down
23 changes: 22 additions & 1 deletion docs/code-search/working/search_contexts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,35 @@ You can also search across multiple contexts at once using the `OR` [boolean ope

To organize your search contexts better, you can use a specific context as your default and star any number of contexts. This affects what context is selected when loading Sourcegraph and how the list of contexts is sorted.

### Default context
### Default search context

#### For users

Any authenticated user can use a search context as their default. To set a default, go to the search context management page, open the "..." menu for a context, and click on "Use as default". If the user doesn't have a default, `global` will be used.

If a user ever loses access to their default search context (eg. the search context is made private), they will see a warning at the top of the search contexts dropdown menu list and `global` will be used. If a user's default search context is deleted, `global` will immediately be set as their default.

The default search context is always selected when loading the Sourcegraph webapp. The one exception is when opening a link to a search query that does not contain a `context:` filter, in which case the `global` context will be used.

#### For site admins

Site admins can set a default search context for all users on the Sourcegraph instance. This helps teams improve onboarding and search quality by focusing searches on the most relevant parts of the codebase rather than the entire indexed set of repositories.

An admin can set a default search context via:

- Click the **More** button from the top menu of the Sourcegraph web app
- Next, go to **Search Contexts**
- For the existing context list, click on the **...** menu and select **[Site admin only] Set as default for all users**
- Alternatively, you can create a new context and then set it for all users via the same option

![admin-level-default-context](https://storage.googleapis.com/sourcegraph-assets/Docs/admin-default-context.png)

Here are a few considerations:

- If a user already has a personal default search context set, it will not be overridden
- The admin-set default will apply automatically if a user only uses the global context
- Individual users can see the instance-wide default and override it with their own default if they choose

### Starred contexts

Any authenticated user can star a search context. To star a context, click on the star icon in the search context management page. This will cause the context to appear near the top of their search contexts list. The `global` context cannot be starred.
Expand Down
6 changes: 6 additions & 0 deletions docs/cody/capabilities/chat.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@ Smart Apply also supports the executing of commands in the terminal. When you as

![smart-apply](https://storage.googleapis.com/sourcegraph-assets/Docs/smart-apply-2025.png)

### Model used for Smart Apply

To ensure low latency, Cody uses a more targeted Qwen 2.5 Coder model for Smart Apply. This model improves the responsiveness of the Smart Apply feature in both VS Code and JetBrains while preserving edit quality. Users on Cody Free, Pro, Enterprise Starter, and Enterprise plans get this default Qwen 2.5 Coder model for Smart Apply suggestions.

Enterprise users not using Cody Gateway get a Claude Sonnet-based model for Smart Apply.

## Chat history

Cody keeps a history of your chat sessions. You can view it by clicking the **History** button in the chat panel. You can **Export** it to a JSON file for later use or click the **Delete all** button to clear the chat history.
Expand Down
47 changes: 27 additions & 20 deletions docs/cody/capabilities/supported-models.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@ Cody supports a variety of cutting-edge large language models for use in chat an

<Callout type="note">Newer versions of Sourcegraph Enterprise, starting from v5.6, it will be even easier to add support for new models and providers, see [Model Configuration](/cody/enterprise/model-configuration) for more information.</Callout>

| **Provider** | **Model** | **Free** | **Pro** | **Enterprise** | | | | |
| :------------ | :-------------------------------------------------------------------------------------------------------------------------------------------- | :----------- | :----------- | :------------- | --- | --- | --- | --- |
| OpenAI | [GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-and-gpt-4-turbo#:~:text=TRAINING%20DATA-,gpt%2D4%2D0125%2Dpreview,-New%20GPT%2D4) | - | ✅ | ✅ | | | | |
| OpenAI | [GPT-4o](https://platform.openai.com/docs/models#gpt-4o) | - | ✅ | ✅ | | | | |
| OpenAI | [GPT-4o-mini](https://platform.openai.com/docs/models#gpt-4o-mini) | ✅ | ✅ | ✅ | | | | |
| OpenAI | [o3-mini-medium](https://openai.com/index/openai-o3-mini/) (experimental) | ✅ | ✅ | ✅ | | | | |
| OpenAI | [o3-mini-high](https://openai.com/index/openai-o3-mini/) (experimental) | - | - | ✅ | | | | |
| OpenAI | [o1](https://platform.openai.com/docs/models#o1) | - | ✅ | ✅ | | | | |
| Anthropic | [Claude 3.5 Haiku](https://docs.anthropic.com/claude/docs/models-overview#model-comparison) | ✅ | ✅ | ✅ | | | | |
| Anthropic | [Claude 3.5 Sonnet](https://docs.anthropic.com/claude/docs/models-overview#model-comparison) | ✅ | ✅ | ✅ | | | | |
| Anthropic | [Claude 3.7 Sonnet](https://docs.anthropic.com/claude/docs/models-overview#model-comparison) | - | ✅ | ✅ | | | | |
| Google | [Gemini 1.5 Pro](https://deepmind.google/technologies/gemini/pro/) | ✅ | ✅ | ✅ (beta) | | | | |
| Google | [Gemini 2.0 Flash](https://deepmind.google/technologies/gemini/flash/) | ✅ | ✅ | ✅ | | | | |
| Google | [Gemini 2.0 Flash-Lite Preview](https://deepmind.google/technologies/gemini/flash/) (experimental) | ✅ | ✅ | ✅ | | | | |
| **Provider** | **Model** | **Free** | **Pro** | **Enterprise** | | | | |
| :----------- | :-------------------------------------------------------------------------------------------------------------------------------------------- | :------- | :------ | :------------- | --- | --- | --- | --- |
| OpenAI | [GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-and-gpt-4-turbo#:~:text=TRAINING%20DATA-,gpt%2D4%2D0125%2Dpreview,-New%20GPT%2D4) | - | ✅ | ✅ | | | | |
| OpenAI | [GPT-4o](https://platform.openai.com/docs/models#gpt-4o) | - | ✅ | ✅ | | | | |
| OpenAI | [GPT-4o-mini](https://platform.openai.com/docs/models#gpt-4o-mini) | ✅ | ✅ | ✅ | | | | |
| OpenAI | [o3-mini-medium](https://openai.com/index/openai-o3-mini/) (experimental) | ✅ | ✅ | ✅ | | | | |
| OpenAI | [o3-mini-high](https://openai.com/index/openai-o3-mini/) (experimental) | - | - | ✅ | | | | |
| OpenAI | [o1](https://platform.openai.com/docs/models#o1) | - | ✅ | ✅ | | | | |
| Anthropic | [Claude 3.5 Haiku](https://docs.anthropic.com/claude/docs/models-overview#model-comparison) | ✅ | ✅ | ✅ | | | | |
| Anthropic | [Claude 3.5 Sonnet](https://docs.anthropic.com/claude/docs/models-overview#model-comparison) | ✅ | ✅ | ✅ | | | | |
| Anthropic | [Claude 3.7 Sonnet](https://docs.anthropic.com/claude/docs/models-overview#model-comparison) | - | ✅ | ✅ | | | | |
| Google | [Gemini 1.5 Pro](https://deepmind.google/technologies/gemini/pro/) | ✅ | ✅ | ✅ (beta) | | | | |
| Google | [Gemini 2.0 Flash](https://deepmind.google/technologies/gemini/flash/) | ✅ | ✅ | ✅ | | | | |
| Google | [Gemini 2.0 Flash-Lite Preview](https://deepmind.google/technologies/gemini/flash/) (experimental) | ✅ | ✅ | ✅ | | | | |

<Callout type="note">To use Claude 3 Sonnet models with Cody Enterprise, make sure you've upgraded your Sourcegraph instance to the latest version. </Callout>

Expand All @@ -39,13 +39,20 @@ In addition, Sourcegraph Enterprise customers using GCP Vertex (Google Cloud Pla

Cody uses a set of models for autocomplete which are suited for the low latency use case.

| **Provider** | **Model** | **Free** | **Pro** | **Enterprise** | | | | |
| :-------------------- | :---------------------------------------------------------------------------------------- | :------- | :------ | :------------- | --- | --- | --- | --- |
| Fireworks.ai | [DeepSeek-Coder-V2](https://huggingface.co/deepseek-ai/DeepSeek-Coder-V2-Lite-Instruct) | ✅ | ✅ | ✅ | | | | |
| Fireworks.ai | [StarCoder](https://arxiv.org/abs/2305.06161) | - | - | ✅ | | | | |
| Anthropic | [claude Instant](https://docs.anthropic.com/claude/docs/models-overview#model-comparison) | - | - | ✅ | | | | |
| | | | | | | | | |
| **Provider** | **Model** | **Free** | **Pro** | **Enterprise** | | | | |
| :----------- | :---------------------------------------------------------------------------------------- | :------- | :------ | :------------- | --- | --- | --- | --- |
| Fireworks.ai | [DeepSeek-Coder-V2](https://huggingface.co/deepseek-ai/DeepSeek-Coder-V2-Lite-Instruct) | ✅ | ✅ | ✅ | | | | |
| Anthropic | [claude Instant](https://docs.anthropic.com/claude/docs/models-overview#model-comparison) | - | - | ✅ | | | | |
| | | | | | | | | |

<Callout type="note">The default autocomplete model for Cody Free, Pro and Enterprise users is DeepSeek-Coder-V2.</Callout>

<Callout type="note">The DeepSeek model used by Sourcegraph is hosted by Fireworks.ai, and is hosted as a single-tenant service in a US-based data center. For more information see our [Cody FAQ](https://sourcegraph.com/docs/cody/faq#is-any-of-my-data-sent-to-deepseek).</Callout>

## Smart Apply

| **Provider** | **Model** | **Free** | **Pro** | **Enterprise** | | | | | | |
| :----------- | :------------- | :------- | :------ | :------------- | --- | --- | --- | --- | --- | --- |
| Fireworks.ai | Qwen 2.5 Coder | ✅ | ✅ | ✅ | | | | | | |

<Callout type="note">Enterprise users not using Cody Gateway get a Claude Sonnet-based model for Smart Apply.</Callout>
1 change: 1 addition & 0 deletions docs/legacy.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

<Accordion title="Sourcegraph 6.X">

- [6.2](https://6.2.sourcegraph.com)
- [6.1](https://6.1.sourcegraph.com)
- [6.0](https://6.0.sourcegraph.com)

Expand Down
4 changes: 2 additions & 2 deletions src/data/versions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ export const versions: VersionI[] = [
url: '/docs',
},
{
name: 'v6.1',
url: 'https://6.1.sourcegraph.com/'
name: 'v6.2',
url: 'https://6.2.sourcegraph.com/'
},
];

Expand Down