Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
25fdf73
Remove settings, other than debug logs from the extension
doriable Nov 18, 2025
889d980
Fix test releases URL
doriable Nov 19, 2025
258edb5
Address comments
doriable Nov 19, 2025
d898ddf
Adjust test conditions
doriable Nov 19, 2025
b37623e
Fix linux tests
doriable Nov 19, 2025
56a3efe
Fix test condition
doriable Nov 19, 2025
c61f4b9
Change artifact name for playwright results
doriable Nov 19, 2025
15535a8
Update README
doriable Nov 19, 2025
fb0f498
Update feature list to match docs
doriable Nov 19, 2025
a2a26d9
Address comments.
doriable Nov 19, 2025
c0c0409
Use single quotes in yaml
doriable Nov 19, 2025
6ce4ac0
Temporarily disable playwright tests when buf is not on the system $PATH
doriable Nov 20, 2025
8bf9e73
Add shared module in tests for mock server and use in playwright
doriable Nov 21, 2025
3ae28aa
Fix formatting
doriable Nov 21, 2025
e84f0e8
Address README changes
doriable Nov 21, 2025
291e3f4
Remove configurations from package.json
doriable Nov 21, 2025
2e70074
Merge remote-tracking branch 'origin/main' into BSR-6071-remove-configs
doriable Nov 24, 2025
7eba0bd
Merge remote-tracking branch 'origin/main' into BSR-6071-remove-configs
doriable Nov 24, 2025
6cb8942
Lengthen playwright test timeout
doriable Nov 24, 2025
7aa2ffd
Apply suggestions from code review
doriable Nov 25, 2025
4563ca8
Use playwright global setup/teardown
doriable Nov 25, 2025
55d9291
Update README.md
doriable Dec 2, 2025
e416567
Merge remote-tracking branch 'origin/main' into BSR-6071-remove-configs
doriable Dec 5, 2025
f8547ac
Disable playwright tests when buf is not installed on system $PATH
doriable Dec 5, 2025
1d67398
Fix
doriable Dec 5, 2025
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
16 changes: 14 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ jobs:
- macos-latest
- ubuntu-latest
- windows-latest
buf-bin-setup:
- buf-on-path
- buf-not-on-path
runs-on: ${{ matrix.os }}
steps:
- name: checkout
Expand All @@ -19,6 +22,7 @@ jobs:
node-version-file: ".nvmrc"
cache: npm
- uses: bufbuild/buf-action@v1
if: matrix.buf-bin-setup == 'buf-on-path'
with:
setup_only: true
- name: install-deps
Expand All @@ -32,24 +36,32 @@ jobs:
- name: format
run: npm run format
- name: integration-tests-with-xvfb
env:
BUF_INSTALLED: ${{ matrix.buf-bin-setup }}
run: xvfb-run -a npm run test:integration
if: runner.os == 'Linux'
- name: integration-tests
shell: bash
env:
BUF_INSTALLED: ${{ matrix.buf-bin-setup }}
run: npm run test:integration
if: runner.os != 'Linux'
- name: playwright-tests
run: npm run test:playwright
# Limiting playwright tests to macOS for now due to issues with xvfb on Linux and
# timeouts on windows
if: runner.os == 'macOS'
#
# NOTE: We disable playwright tests when buf is not installed on the system $PATH
# for now so we don't have the extension attempting to resolve the installation.
# We'll need to find a way to intercept the call from playwright's VS Code extension.
if: runner.os == 'macOS' && matrix.buf-bin-setup == 'buf-on-path'
- name: check diff
run: node scripts/gh-diffcheck.mjs
- name: upload-playwright-test-results
uses: actions/upload-artifact@v4
if: always()
with:
name: test-results
name: test-results-${{ matrix.buf-bin-setup }}
path: test-results/
retention-days: 5
if-no-files-found: ignore
72 changes: 14 additions & 58 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,86 +1,42 @@
# Buf for Visual Studio Code

The [VS Code Buf extension][vs-code-marketplace] helps you work with [Protocol Buffers][protobuf]
files in a much more intuitive way, adding smart syntax highlighting, navigation, formatting,
files in a much more intuitive way, adding semantic syntax highlighting, navigation, formatting,
documentation and diagnostic hovers, and integrations with [Buf][buf] commands.

## Features

- **Code navigation** - Go-to definition and documentation insets for `.proto` symbols.
- **Syntax highlighting** - Protobuf specific color and styling of code.
- **Code editing** - Formatting via `buf format` and annotations and hovers based on `buf lint`.
- **Documentation hovers** - Documentation for definitions when hovering a reference.
- **Buf command support** - Execution of `buf` CLI commands via the [Command Palette][command-palette].
- Go to definition
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you simplify these? The README does not read very cleanly.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These have been changed to match the documentation changes that have been made, so they match the LSP page in our docs.

- Go to references
- Auto-complete
- Contextual information on mouse hover
- Protobuf file formatting
- Syntax highlighting
- Workspace / Document symbols

![Preview features](./preview.gif)

## Getting Started

[Install the latest version via the VS Code marketplace][vs-code-marketplace].

By default, the extension will use your locally-installed version of `buf` on your system
`$PATH`. However, you don't have to install `buf` - the extension can manage and install it
for you based on the [buf.commandLine.path](#buf.commandline.path) and [buf.commandLine.version](#buf.commandline.version)
configurations:

| | <pre>buf.commandLine.path</pre> | <pre>buf.commandLine.version</pre> |
| --- | --- | --- |
| Default: Use `buf` from the system `$PATH`. | {empty} | {empty} |
| Use the latest released version of `buf` and check for updates on extension activation. | {empty} | `latest` |
| Use `buf` at specified path. | User specified path | {empty} |
| Install and use the specified version of `buf`. | {empty} | User specified semver version |
| Use `buf` at specified path and display an error message. | User specified path | User specified semver version |
You do not need to install the Buf CLI to use this extension. By default, the extension uses
the Buf CLI from your system `$PATH`. If `buf` isn't found on your `$PATH`, the extension
automatically downloads and installs the latest version to its own storage directory.

## Extension Settings

This extension contributes the following configuration settings.

### buf.commandLine.path

Default: `null`
The path to a specific install of Buf to use. Relative paths are supported and are relative to the VS Code workspace root.

### buf.commandLine.version

Default: `null`
Specific version (e.g. 'v1.53.0') of Buf release to download and install.

### buf.restartAfterCrash

Default: `true`
Automatically restart the Buf Language Server (up to 4 times) if it crashes.

### buf.enableHover
This extension contributes the following configuration setting.

Default: `true`
Enable hover features provided by the language server.

### buf.enable

Default: `true`
Enable Buf Language Server features.

### buf.debug
### buf.debugLogs

Default: `false`
Enable debug logs in output channels.

### buf.log-format

Default: `text`
Buf Language Server log format.
Enable debug logs in the Buf Language Server output channels.

## Commands

This extension contributes the following commands to the [Command Palette][command-palette].

### Setup

- Install CLI: installs the `buf` CLI based on `buf.commandLine.path` and `buf.commandLine.version`
configurations and then attempts to start the language server.
- Update CLI: updates the `buf` CLI based on `buf.commandLine.path` and `buf.commandLine.version`
configurations and then attempts to start the language server.

### Language Server

- Start Buf Language Server: starts the Buf Language Server. If the Buf Language Server is
Expand Down
70 changes: 2 additions & 68 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,6 @@
"title": "Module stats",
"description": "Get stats for Buf modules across VS Code workspace(s)."
},
{
"command": "buf.install",
"category": "Buf",
"icon": "$(cloud-download)",
"title": "Install CLI",
"description": "Install the Buf CLI from GitHub releases."
},
{
"command": "buf.showOutput",
"category": "Buf",
Expand All @@ -147,74 +140,15 @@
"category": "Buf",
"icon": "$(debug-stop)",
"title": "Stop Buf Language Server"
},
{
"command": "buf.update",
"category": "Buf",
"icon": "$(sync)",
"title": "Update CLI",
"description": "Check for updates and install the latest version of the Buf CLI."
}
],
"configuration": {
"title": "Buf",
"properties": {
"buf.commandLine.path": {
"type": "string",
"description": "The path to a specific install of Buf to use. Relative paths are supported and are relative to the workspace root."
},
"buf.commandLine.version": {
"type": "string",
"description": "Specific version (git tag e.g. 'v1.53.0') of Buf release to download and install."
},
"buf.restartAfterCrash": {
"type": "boolean",
"default": true,
"description": "Automatically restart Buf (up to 4 times) if it crashes."
},
"buf.enableHover": {
"type": "boolean",
"default": true,
"description": "Enable hover features provided by the language server."
},
"buf.enable": {
"type": "boolean",
"default": true,
"description": "Enable Buf language server features."
},
"buf.debug": {
"buf.debugLogs": {
"type": "boolean",
"default": false,
"description": "Enable debug mode."
},
"buf.log-format": {
"type": [
"string",
"null"
],
"enum": [
"text",
"color",
"json"
],
"default": "text",
"description": "Buf language server log format."
},
"buf.checks.breaking.againstStrategy": {
"type": "string",
"enum": [
"disk",
"git"
],
"default": "git",
"description": "The strategy to use when checking breaking changes against a specific reference.",
"deprecationMessage": "Deprecated: breaking change detection is no longer supported in the LSP."
},
"buf.checks.breaking.againstGitRef": {
"type": "string",
"default": "refs/remotes/origin/HEAD",
"description": "The Git reference to check breaking changes against.",
"deprecationMessage": "Deprecated: breaking change detection is no longer supported in the LSP."
"description": "Enable debug logs for the Buf language server."
}
}
},
Expand Down
3 changes: 2 additions & 1 deletion playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ export default defineConfig<TestOptions>({
reporter: process.env.CI ? "html" : "list",
timeout: 120_000_000,
expect: {
timeout: 40_000,
timeout: 60_000,
},
globalSetup: "./test/playwright/global-setup",
projects: [
{
name: "VS Code insiders",
Expand Down
14 changes: 0 additions & 14 deletions src/commands/install-buf.ts

This file was deleted.

4 changes: 0 additions & 4 deletions src/commands/register-all-commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,10 @@ import { bufGenerate } from "./buf-generate";
import { bufLsFiles } from "./buf-ls-files";
import { bufPrice } from "./buf-price";
import { bufStats } from "./buf-stats";
import { installBuf } from "./install-buf";
import { showCommands } from "./show-commands";
import { showOutput } from "./show-output";
import { startLanguageServer } from "./start-lsp";
import { stopLanguageServer } from "./stop-lsp";
import { updateBuf } from "./update-buf";

/**
* @file Provides a convenience function for registering all commands in the extension.
Expand All @@ -35,12 +33,10 @@ const commands = [
bufLsFiles,
bufPrice,
bufStats,
installBuf,
showCommands,
showOutput,
startLanguageServer,
stopLanguageServer,
updateBuf,
];

/**
Expand Down
14 changes: 0 additions & 14 deletions src/commands/update-buf.ts

This file was deleted.

14 changes: 5 additions & 9 deletions src/extension.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import * as vscode from "vscode";
import { installBuf } from "./commands/install-buf";
import { registerAllCommands } from "./commands/register-all-commands";
import { startLanguageServer } from "./commands/start-lsp";
import { stopLanguageServer } from "./commands/stop-lsp";
import { log } from "./log";
import { bufState } from "./state";
import { activateStatusBar, deactivateStatusBar } from "./status-bar";

/**
Expand All @@ -15,7 +15,7 @@ export async function activate(ctx: vscode.ExtensionContext) {
ctx.subscriptions.push(
vscode.workspace.onDidChangeConfiguration(handleOnDidConfigChange)
);
await installBuf.execute();
await bufState.init(ctx);
}

/**
Expand All @@ -35,13 +35,9 @@ const handleOnDidConfigChange = async (e: vscode.ConfigurationChangeEvent) => {
if (!e.affectsConfiguration("buf")) {
return;
}
if (
e.affectsConfiguration("buf.commandLine.path") ||
e.affectsConfiguration("buf.commandLine.version")
) {
await installBuf.execute();
}
if (e.affectsConfiguration("buf.enable")) {
if (e.affectsConfiguration("buf.debugLogs")) {
// When debug logs configuration changes, restart the language server.
await stopLanguageServer.execute();
await startLanguageServer.execute();
}
};
5 changes: 1 addition & 4 deletions src/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,8 @@ import { progress } from "./progress";

/**
* The GitHub release URL for the Buf CLI.
*
* Exported for tests.
*/
export const githubReleaseURL =
"https://api.github.com/repos/bufbuild/buf/releases/";
const githubReleaseURL = "https://api.github.com/repos/bufbuild/buf/releases/";

/**
* Release is a GitHub release for the Buf CLI.
Expand Down
Loading