diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c6831e45..39518dd4 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -39,6 +39,11 @@ jobs: run: | cd Example bazelisk test //HelloWorld:HelloWorldTests + - name: Build VSCode extension + run: | + cd vscode-extension + npm install + npm run compile - name: Build release source archive run: make release_source_archive - uses: actions/upload-artifact@v4 diff --git a/vscode-extension/.gitignore b/vscode-extension/.gitignore new file mode 100644 index 00000000..db75a72c --- /dev/null +++ b/vscode-extension/.gitignore @@ -0,0 +1,4 @@ +node_modules/ +out/ +*.vsix + diff --git a/vscode-extension/.vscode/launch.json b/vscode-extension/.vscode/launch.json new file mode 100644 index 00000000..97e7a593 --- /dev/null +++ b/vscode-extension/.vscode/launch.json @@ -0,0 +1,13 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Run Extension", + "type": "extensionHost", + "request": "launch", + "args": ["--extensionDevelopmentPath=${workspaceFolder}"], + "outFiles": ["${workspaceFolder}/out/**/*.js"], + "preLaunchTask": "npm: compile" + } + ] +} diff --git a/vscode-extension/.vscode/tasks.json b/vscode-extension/.vscode/tasks.json new file mode 100644 index 00000000..e249bf79 --- /dev/null +++ b/vscode-extension/.vscode/tasks.json @@ -0,0 +1,22 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "type": "npm", + "script": "compile", + "problemMatcher": "$tsc", + "label": "npm: compile", + "group": { + "kind": "build", + "isDefault": true + } + }, + { + "type": "npm", + "script": "watch", + "problemMatcher": "$tsc-watch", + "label": "npm: watch", + "isBackground": true + } + ] +} diff --git a/vscode-extension/.vscodeignore b/vscode-extension/.vscodeignore new file mode 100644 index 00000000..812cacb1 --- /dev/null +++ b/vscode-extension/.vscodeignore @@ -0,0 +1,7 @@ +.vscode/** +src/** +tsconfig.json +**/*.ts +**/*.map +node_modules/** + diff --git a/vscode-extension/README.md b/vscode-extension/README.md new file mode 100644 index 00000000..d183b9c1 --- /dev/null +++ b/vscode-extension/README.md @@ -0,0 +1,11 @@ +# VSCode Extension + +This is an early WIP VSCode extension. It has the goal of enabling support for functionality such as: + +- [ ] (Cursor / VSCode): Automatic generation of build, launch, and debug tasks + +- [ ] (Cursor / VSCode): Test explorer & ability to run tests from within the IDE by clicking the tests individually, similarly to Xcode + +- [ ] 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) + +The extension is in active development and is not yet ready for use. diff --git a/vscode-extension/package-lock.json b/vscode-extension/package-lock.json new file mode 100644 index 00000000..14a2e9eb --- /dev/null +++ b/vscode-extension/package-lock.json @@ -0,0 +1,58 @@ +{ + "name": "sourcekit-bazel-bsp", + "version": "0.0.1", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "sourcekit-bazel-bsp", + "version": "0.0.1", + "devDependencies": { + "@types/node": "^20.0.0", + "@types/vscode": "^1.85.0", + "typescript": "^5.3.0" + }, + "engines": { + "vscode": "^1.85.0" + } + }, + "node_modules/@types/node": { + "version": "20.19.27", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.19.27.tgz", + "integrity": "sha512-N2clP5pJhB2YnZJ3PIHFk5RkygRX5WO/5f0WC08tp0wd+sv0rsJk3MqWn3CbNmT2J505a5336jaQj4ph1AdMug==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~6.21.0" + } + }, + "node_modules/@types/vscode": { + "version": "1.107.0", + "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.107.0.tgz", + "integrity": "sha512-XS8YE1jlyTIowP64+HoN30OlC1H9xqSlq1eoLZUgFEC8oUTO6euYZxti1xRiLSfZocs4qytTzR6xCBYtioQTCg==", + "dev": true, + "license": "MIT" + }, + "node_modules/typescript": { + "version": "5.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", + "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/undici-types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", + "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", + "dev": true, + "license": "MIT" + } + } +} diff --git a/vscode-extension/package.json b/vscode-extension/package.json new file mode 100644 index 00000000..314791f8 --- /dev/null +++ b/vscode-extension/package.json @@ -0,0 +1,32 @@ +{ + "name": "sourcekit-bazel-bsp", + "displayName": "SourceKit Bazel BSP", + "description": "Companion extension for sourcekit-bazel-bsp", + "version": "0.0.1", + "publisher": "spotify", + "repository": { + "type": "git", + "url": "https://github.com/spotify/sourcekit-bazel-bsp" + }, + "engines": { + "vscode": "^1.85.0" + }, + "categories": [ + "Programming Languages" + ], + "activationEvents": [ + "onStartupFinished" + ], + "main": "./out/extension.js", + "contributes": {}, + "scripts": { + "vscode:prepublish": "npm run compile", + "compile": "tsc -p ./", + "watch": "tsc -watch -p ./" + }, + "devDependencies": { + "@types/vscode": "^1.85.0", + "@types/node": "^20.0.0", + "typescript": "^5.3.0" + } +} diff --git a/vscode-extension/src/extension.ts b/vscode-extension/src/extension.ts new file mode 100644 index 00000000..e59c8f2f --- /dev/null +++ b/vscode-extension/src/extension.ts @@ -0,0 +1,28 @@ +// Copyright (c) 2025 Spotify AB. +// +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +import { log } from "./logger"; + +export function activate() { + log("Extension activated ✅"); +} + +export function deactivate() { + log("Extension deactivated ❌"); +} diff --git a/vscode-extension/src/logger.ts b/vscode-extension/src/logger.ts new file mode 100644 index 00000000..b800f7c2 --- /dev/null +++ b/vscode-extension/src/logger.ts @@ -0,0 +1,26 @@ +// Copyright (c) 2025 Spotify AB. +// +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +import * as vscode from "vscode"; + +const outputChannel = vscode.window.createOutputChannel("SourceKit Bazel BSP"); + +export function log(message: string) { + outputChannel.appendLine(message); +} diff --git a/vscode-extension/tsconfig.json b/vscode-extension/tsconfig.json new file mode 100644 index 00000000..fd084c46 --- /dev/null +++ b/vscode-extension/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "ES2020", + "lib": ["ES2020"], + "outDir": "out", + "rootDir": "src", + "sourceMap": true, + "strict": true, + "esModuleInterop": true, + "skipLibCheck": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true + }, + "include": ["src/**/*"], + "exclude": ["node_modules"] +}