Skip to content

Commit e9a305e

Browse files
authored
feat: vscode extension (#4104)
1 parent bfe60de commit e9a305e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+28946
-47
lines changed

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ node_modules/
1717
vscode/extension/node_modules/
1818
vscode/extension/dist
1919
vscode/extension/out
20+
vscode/extension/src_react
2021
vscode/extension/tsconfig.tsbuildinfo
2122
vscode/extension/.vscode-test/
2223

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ py-style:
1616
SKIP=prettier,eslint pre-commit run --all-files
1717

1818
ui-style:
19-
npm run lint
19+
pnpm run lint
2020

2121
doc-test:
2222
python -m pytest --doctest-modules sqlmesh/core sqlmesh/utils
@@ -178,3 +178,7 @@ athena-test: guard-AWS_ACCESS_KEY_ID guard-AWS_SECRET_ACCESS_KEY guard-ATHENA_S3
178178
vscode_settings:
179179
mkdir -p .vscode
180180
cp -r ./tooling/vscode/*.json .vscode/
181+
182+
vscode-generate-openapi:
183+
python3 web/server/openapi.py --output vscode/extension/openapi.json
184+
cd vscode/react && pnpm run generate:api

pnpm-lock.yaml

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

pnpm-workspace.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
packages:
22
- vscode/bus
33
- vscode/extension
4+
- vscode/react
45
- web/client

tooling/vscode/tasks.json

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
"tasks": [
66
{
77
"label": "extension-watch",
8-
"type": "npm",
9-
"script": "watch",
8+
"type": "shell",
9+
"command": "pnpm run watch",
1010
"problemMatcher": "$ts-webpack-watch",
1111
"isBackground": true,
1212
"presentation": {
@@ -18,6 +18,35 @@
1818
},
1919
"options": {
2020
"cwd": "${workspaceFolder}/vscode/extension"
21+
},
22+
"dependsOn": ["react-dev"],
23+
"dependsOrder": "parallel"
24+
},
25+
{
26+
"label": "react-dev",
27+
"type": "shell",
28+
"command": "pnpm run build:watch",
29+
"options": {
30+
"cwd": "${workspaceFolder}/vscode/react"
31+
},
32+
"group": {
33+
"kind": "build"
34+
},
35+
"isBackground": true,
36+
"problemMatcher": {
37+
"owner": "npm",
38+
"pattern": {
39+
"regexp": "."
40+
},
41+
"background": {
42+
"activeOnStart": true,
43+
"beginsPattern": ".",
44+
"endsPattern": "."
45+
}
46+
},
47+
"presentation": {
48+
"reveal": "never",
49+
"group": "watchers"
2150
}
2251
},
2352
{
@@ -26,12 +55,12 @@
2655
"kind": "build",
2756
"isDefault": true
2857
},
29-
"dependsOn": ["extension-watch"],
58+
"dependsOn": ["react-dev", "extension-watch"],
3059
"dependsOrder": "parallel"
3160
},
3261
{
33-
"type": "npm",
34-
"script": "watch-tests",
62+
"type": "shell",
63+
"command": "pnpm run watch-tests",
3564
"problemMatcher": "$tsc-watch",
3665
"isBackground": true,
3766
"presentation": {
@@ -40,12 +69,12 @@
4069
},
4170
"group": "build",
4271
"options": {
43-
"cwd": "${workspaceFolder}/vscode/extension"
72+
"cwd": "${workspaceFolder}/vscode"
4473
}
4574
},
4675
{
4776
"label": "tasks: watch-tests",
48-
"dependsOn": ["npm: watch", "npm: watch-tests"],
77+
"dependsOn": ["watch-tests"],
4978
"problemMatcher": []
5079
}
5180
]

vscode/bus/src/callbacks.ts

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
export type Callback = {
2+
openFile: {
3+
uri: string
4+
}
5+
queryRequest: {
6+
requestId: string
7+
url: string
8+
method?: string
9+
params?: Record<string, string>
10+
body?: Record<string, any>
11+
}
12+
}
13+
14+
/**
15+
* A tuple type representing a callback event with its associated payload.
16+
* The first element is the callback key (e.g., 'openFile', 'formatProject').
17+
* The second element is the payload type associated with that key.
18+
*
19+
* Example:
20+
* const openFileEvent: CallbackEvent<'openFile'> = ['openFile', { path: '/path/to/file' }];
21+
*/
22+
export type CallbackEvent = {
23+
[K in keyof Callback]: { key: K; payload: Callback[K] }
24+
}[keyof Callback]
25+
26+
/**
27+
* A tuple type representing a VSCode event with its associated payload.
28+
*/
29+
export type VSCodeCallback = {
30+
changeFocusOnFile: {
31+
path: string
32+
}
33+
queryResponse: {
34+
requestId: string
35+
response: any
36+
}
37+
}
38+
39+
export type VSCodeEvent = {
40+
[K in keyof VSCodeCallback]: { key: K; payload: VSCodeCallback[K] }
41+
}[keyof VSCodeCallback]

vscode/bus/tsconfig.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
"noUnusedParameters": true,
1212
"noEmit": true,
1313
"moduleResolution": "node",
14-
"baseUrl": "./"
14+
"baseUrl": "./",
15+
"skipLibCheck": true
1516
},
16-
"include": ["src/**/*"]
17+
"include": ["src/**/*"],
18+
"exclude": ["node_modules", "dist", "../../node_modules"]
1719
}

vscode/extension/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ out
44
.vscode-test
55
*.vsix
66
LICENSE
7+
src_react
8+
!src_react/.gitkeep

vscode/extension/.vscodeignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,8 @@ vsc-extension-quickstart.md
1212
**/*.map
1313
**/*.ts
1414
**/.vscode-test.*
15+
<<<<<<< HEAD
1516
assets/logo.svg
1617
esbuild.js
18+
=======
19+
>>>>>>> c5ee2535 (progress)

vscode/extension/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,3 @@ The extension allows you to:
2525
### Linting
2626

2727
The extension allows you to see linting errors and warnings inline.
28-

0 commit comments

Comments
 (0)