Skip to content

Commit d03db2b

Browse files
authored
vscode: setup hello world extension (#567)
1 parent 9acfecb commit d03db2b

25 files changed

+5874
-2
lines changed

.github/workflows/rust.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,33 +32,39 @@ jobs:
3232
os: ubuntu-22.04
3333
target: x86_64-unknown-linux-gnu
3434
artifact_name: squawk-linux-x64
35+
vscode_artifact_name: linux-x64
3536

3637
- name: Linux arm64
3738
os: ubuntu-22.04
3839
target: aarch64-unknown-linux-gnu
3940
artifact_name: squawk-linux-arm64
41+
vscode_artifact_name: linux-arm64
4042
rustflags: "-C linker=aarch64-linux-gnu-gcc"
4143

4244
- name: Linux Alpine x86_64
4345
os: ubuntu-22.04
4446
target: x86_64-unknown-linux-musl
4547
artifact_name: squawk-linux-musl-x64
48+
vscode_artifact_name: alpine-x64
4649
rustflags: "-C linker=rust-lld"
4750

4851
- name: Windows x86_64
4952
os: windows-latest
5053
target: x86_64-pc-windows-msvc
5154
artifact_name: squawk-windows-x64.exe
55+
vscode_artifact_name: win32-x64
5256

5357
- name: macOS x86_64
5458
os: macos-latest
5559
target: x86_64-apple-darwin
5660
artifact_name: squawk-darwin-x64
61+
vscode_artifact_name: darwin-x64
5762

5863
- name: macOS arm64
5964
os: macos-latest
6065
target: aarch64-apple-darwin
6166
artifact_name: squawk-darwin-arm64
67+
vscode_artifact_name: darwin-arm64
6268

6369
name: ${{ matrix.name }}
6470
runs-on: ${{ matrix.os }}
@@ -106,12 +112,53 @@ jobs:
106112
name: release-${{ matrix.artifact_name }}
107113
path: target/release/${{ matrix.artifact_name }}
108114

115+
- name: VSCode - Make server dir
116+
shell: bash
117+
run: mkdir squawk-vscode/server
118+
119+
- name: VSCode - Copy binary into extension (windows)
120+
if: matrix.target == 'x86_64-pc-windows-msvc'
121+
shell: bash
122+
run: cp target/release/${{ matrix.artifact_name }} squawk-vscode/server/squawk.exe
123+
124+
- name: VSCode - Copy binary into extension (linux, mac)
125+
if: matrix.target != 'x86_64-pc-windows-msvc'
126+
shell: bash
127+
run: cp target/release/${{ matrix.artifact_name }} squawk-vscode/server/squawk
128+
129+
- name: VSCode - Setup pnpm
130+
uses: pnpm/action-setup@v2
131+
with:
132+
version: 8
133+
134+
- name: VSCode - Setup node
135+
uses: actions/setup-node@v3
136+
with:
137+
node-version-file: "squawk-vscode/package.json"
138+
cache-dependency-path: "squawk-vscode/pnpm-lock.yaml"
139+
cache: "pnpm"
140+
141+
- name: VSCode - Install JS dependencies
142+
working-directory: "squawk-vscode"
143+
run: pnpm install
144+
145+
- name: VSCode - Build
146+
working-directory: "squawk-vscode"
147+
run: pnpm exec vsce pack --no-dependencies --target ${{ matrix.vscode_artifact_name }}
148+
149+
- name: VSCode - Artifact
150+
uses: actions/upload-artifact@v4
151+
with:
152+
name: squawk-vscode-${{ matrix.vscode_artifact_name }}
153+
path: squawk-vscode/*.vsix
154+
109155
- name: Release
110156
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # pin@v1
111157
if: startsWith(github.ref, 'refs/tags/')
112158
with:
113159
files: |
114160
target/release/${{ matrix.artifact_name }}
161+
squawk-vscode/*.vsix
115162
env:
116163
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
117164

s/lint

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/sh
22
set -e
33

4-
if [[ "$CI" ]]; then
4+
if [ -z "$CI" ]; then
55
cargo fmt -- --check
66
cargo clippy --all-targets --all-features -- -D warnings
77
else

s/prettier

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
set -ex
44

55
main() {
6-
if [ "$CI" ]; then
6+
if [ -z "$CI" ]; then
77
./node_modules/.bin/prettier --check '**/*.{js,md,yml,json}'
88
else
99
./node_modules/.bin/prettier '**/*.{js,md,yml,json}' --write

squawk-vscode/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.vscode-test
2+
out
3+
*.vsix
4+
server/

squawk-vscode/.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
enable-pre-post-scripts = true

squawk-vscode/.prettierignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
build/
2+
node_modules/
3+
playground/
4+
coverage/
5+
extension/
6+
dist/
7+
out/
8+
.venv/
9+
.mypy_cache/
10+
.terraform/
11+
.pytest_cache/
12+
target/
13+
docs

squawk-vscode/.vscode-test.mjs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { defineConfig } from "@vscode/test-cli"
2+
3+
export default defineConfig({
4+
files: "out/test/**/*.test.js",
5+
})
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
// See http://go.microsoft.com/fwlink/?LinkId=827846
3+
// for the documentation about the extensions.json format
4+
"recommendations": [
5+
"dbaeumer.vscode-eslint",
6+
"connor4312.esbuild-problem-matchers",
7+
"ms-vscode.extension-test-runner"
8+
]
9+
}

squawk-vscode/.vscode/launch.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// A launch configuration that compiles the extension and then opens it inside a new window
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
{
6+
"version": "0.2.0",
7+
"configurations": [
8+
{
9+
"name": "Run Extension",
10+
"type": "extensionHost",
11+
"request": "launch",
12+
"args": ["--extensionDevelopmentPath=${workspaceFolder}"],
13+
"outFiles": ["${workspaceFolder}/dist/**/*.js"],
14+
"preLaunchTask": "${defaultBuildTask}"
15+
}
16+
]
17+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Place your settings in this file to overwrite default and user settings.
2+
{
3+
"files.exclude": {
4+
"out": false, // set this to true to hide the "out" folder with the compiled JS files
5+
"dist": false // set this to true to hide the "dist" folder with the compiled JS files
6+
},
7+
"search.exclude": {
8+
"out": true, // set this to false to include "out" folder in search results
9+
"dist": true // set this to false to include "dist" folder in search results
10+
},
11+
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
12+
"typescript.tsc.autoDetect": "off"
13+
}

0 commit comments

Comments
 (0)