Skip to content

Commit 486d6f1

Browse files
Add VSCode extension for BSP server log streaming (#113)
* Add VSCode extension for SourceKit Bazel BSP Introduces a TypeScript-based VSCode extension that integrates with the SourceKit Bazel BSP server. Includes basic extension scaffolding, logger utility, and build configuration. * Remove extension logger setup
1 parent ab7cff8 commit 486d6f1

File tree

11 files changed

+225
-0
lines changed

11 files changed

+225
-0
lines changed

.github/workflows/ci.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ jobs:
3939
run: |
4040
cd Example
4141
bazelisk test //HelloWorld:HelloWorldTests
42+
- name: Build VSCode extension
43+
run: |
44+
cd vscode-extension
45+
npm install
46+
npm run compile
4247
- name: Build release source archive
4348
run: make release_source_archive
4449
- uses: actions/upload-artifact@v4

vscode-extension/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules/
2+
out/
3+
*.vsix
4+
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "Run Extension",
6+
"type": "extensionHost",
7+
"request": "launch",
8+
"args": ["--extensionDevelopmentPath=${workspaceFolder}"],
9+
"outFiles": ["${workspaceFolder}/out/**/*.js"],
10+
"preLaunchTask": "npm: compile"
11+
}
12+
]
13+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"type": "npm",
6+
"script": "compile",
7+
"problemMatcher": "$tsc",
8+
"label": "npm: compile",
9+
"group": {
10+
"kind": "build",
11+
"isDefault": true
12+
}
13+
},
14+
{
15+
"type": "npm",
16+
"script": "watch",
17+
"problemMatcher": "$tsc-watch",
18+
"label": "npm: watch",
19+
"isBackground": true
20+
}
21+
]
22+
}

vscode-extension/.vscodeignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.vscode/**
2+
src/**
3+
tsconfig.json
4+
**/*.ts
5+
**/*.map
6+
node_modules/**
7+

vscode-extension/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# VSCode Extension
2+
3+
This is an early WIP VSCode extension. It has the goal of enabling support for functionality such as:
4+
5+
- [ ] (Cursor / VSCode): Automatic generation of build, launch, and debug tasks
6+
7+
- [ ] (Cursor / VSCode): Test explorer & ability to run tests from within the IDE by clicking the tests individually, similarly to Xcode
8+
9+
- [ ] Automatic index and build graph updates when adding / deleting files and targets (in other words, allowing the user to make heavy changes to the project without needing to restart the IDE)
10+
11+
The extension is in active development and is not yet ready for use.

vscode-extension/package-lock.json

Lines changed: 58 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vscode-extension/package.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"name": "sourcekit-bazel-bsp",
3+
"displayName": "SourceKit Bazel BSP",
4+
"description": "Companion extension for sourcekit-bazel-bsp",
5+
"version": "0.0.1",
6+
"publisher": "spotify",
7+
"repository": {
8+
"type": "git",
9+
"url": "https://github.com/spotify/sourcekit-bazel-bsp"
10+
},
11+
"engines": {
12+
"vscode": "^1.85.0"
13+
},
14+
"categories": [
15+
"Programming Languages"
16+
],
17+
"activationEvents": [
18+
"onStartupFinished"
19+
],
20+
"main": "./out/extension.js",
21+
"contributes": {},
22+
"scripts": {
23+
"vscode:prepublish": "npm run compile",
24+
"compile": "tsc -p ./",
25+
"watch": "tsc -watch -p ./"
26+
},
27+
"devDependencies": {
28+
"@types/vscode": "^1.85.0",
29+
"@types/node": "^20.0.0",
30+
"typescript": "^5.3.0"
31+
}
32+
}

vscode-extension/src/extension.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Copyright (c) 2025 Spotify AB.
2+
//
3+
// Licensed to the Apache Software Foundation (ASF) under one
4+
// or more contributor license agreements. See the NOTICE file
5+
// distributed with this work for additional information
6+
// regarding copyright ownership. The ASF licenses this file
7+
// to you under the Apache License, Version 2.0 (the
8+
// "License"); you may not use this file except in compliance
9+
// with the License. You may obtain a copy of the License at
10+
//
11+
// http://www.apache.org/licenses/LICENSE-2.0
12+
//
13+
// Unless required by applicable law or agreed to in writing,
14+
// software distributed under the License is distributed on an
15+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
// KIND, either express or implied. See the License for the
17+
// specific language governing permissions and limitations
18+
// under the License.
19+
20+
import { log } from "./logger";
21+
22+
export function activate() {
23+
log("Extension activated ✅");
24+
}
25+
26+
export function deactivate() {
27+
log("Extension deactivated ❌");
28+
}

vscode-extension/src/logger.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Copyright (c) 2025 Spotify AB.
2+
//
3+
// Licensed to the Apache Software Foundation (ASF) under one
4+
// or more contributor license agreements. See the NOTICE file
5+
// distributed with this work for additional information
6+
// regarding copyright ownership. The ASF licenses this file
7+
// to you under the Apache License, Version 2.0 (the
8+
// "License"); you may not use this file except in compliance
9+
// with the License. You may obtain a copy of the License at
10+
//
11+
// http://www.apache.org/licenses/LICENSE-2.0
12+
//
13+
// Unless required by applicable law or agreed to in writing,
14+
// software distributed under the License is distributed on an
15+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
// KIND, either express or implied. See the License for the
17+
// specific language governing permissions and limitations
18+
// under the License.
19+
20+
import * as vscode from "vscode";
21+
22+
const outputChannel = vscode.window.createOutputChannel("SourceKit Bazel BSP");
23+
24+
export function log(message: string) {
25+
outputChannel.appendLine(message);
26+
}

0 commit comments

Comments
 (0)