Skip to content

feat: vscode extension #4104

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ node_modules/
vscode/extension/node_modules/
vscode/extension/dist
vscode/extension/out
vscode/extension/src_react
vscode/extension/tsconfig.tsbuildinfo
vscode/extension/.vscode-test/

Expand Down
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ py-style:
SKIP=prettier,eslint pre-commit run --all-files

ui-style:
npm run lint
pnpm run lint

doc-test:
python -m pytest --doctest-modules sqlmesh/core sqlmesh/utils
Expand Down Expand Up @@ -178,3 +178,7 @@ athena-test: guard-AWS_ACCESS_KEY_ID guard-AWS_SECRET_ACCESS_KEY guard-ATHENA_S3
vscode_settings:
mkdir -p .vscode
cp -r ./tooling/vscode/*.json .vscode/

vscode-generate-openapi:
python3 web/server/openapi.py --output vscode/extension/openapi.json
cd vscode/react && pnpm run generate:api
938 changes: 929 additions & 9 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
packages:
- vscode/bus
- vscode/extension
- vscode/react
- web/client
43 changes: 36 additions & 7 deletions tooling/vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"tasks": [
{
"label": "extension-watch",
"type": "npm",
"script": "watch",
"type": "shell",
"command": "pnpm run watch",
"problemMatcher": "$ts-webpack-watch",
"isBackground": true,
"presentation": {
Expand All @@ -18,6 +18,35 @@
},
"options": {
"cwd": "${workspaceFolder}/vscode/extension"
},
"dependsOn": ["react-dev"],
"dependsOrder": "parallel"
},
{
"label": "react-dev",
"type": "shell",
"command": "pnpm run build:watch",
"options": {
"cwd": "${workspaceFolder}/vscode/react"
},
"group": {
"kind": "build"
},
"isBackground": true,
"problemMatcher": {
"owner": "npm",
"pattern": {
"regexp": "."
},
"background": {
"activeOnStart": true,
"beginsPattern": ".",
"endsPattern": "."
}
},
"presentation": {
"reveal": "never",
"group": "watchers"
}
},
{
Expand All @@ -26,12 +55,12 @@
"kind": "build",
"isDefault": true
},
"dependsOn": ["extension-watch"],
"dependsOn": ["react-dev", "extension-watch"],
"dependsOrder": "parallel"
},
{
"type": "npm",
"script": "watch-tests",
"type": "shell",
"command": "pnpm run watch-tests",
"problemMatcher": "$tsc-watch",
"isBackground": true,
"presentation": {
Expand All @@ -40,12 +69,12 @@
},
"group": "build",
"options": {
"cwd": "${workspaceFolder}/vscode/extension"
"cwd": "${workspaceFolder}/vscode"
}
},
{
"label": "tasks: watch-tests",
"dependsOn": ["npm: watch", "npm: watch-tests"],
"dependsOn": ["watch-tests"],
"problemMatcher": []
}
]
Expand Down
41 changes: 41 additions & 0 deletions vscode/bus/src/callbacks.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
export type Callback = {
openFile: {
uri: string
}
queryRequest: {
requestId: string
url: string
method?: string
params?: Record<string, string>
body?: Record<string, any>
}
}

/**
* A tuple type representing a callback event with its associated payload.
* The first element is the callback key (e.g., 'openFile', 'formatProject').
* The second element is the payload type associated with that key.
*
* Example:
* const openFileEvent: CallbackEvent<'openFile'> = ['openFile', { path: '/path/to/file' }];
*/
export type CallbackEvent = {
[K in keyof Callback]: { key: K; payload: Callback[K] }
}[keyof Callback]

/**
* A tuple type representing a VSCode event with its associated payload.
*/
export type VSCodeCallback = {
changeFocusOnFile: {
path: string
}
queryResponse: {
requestId: string
response: any
}
}

export type VSCodeEvent = {
[K in keyof VSCodeCallback]: { key: K; payload: VSCodeCallback[K] }
}[keyof VSCodeCallback]
6 changes: 4 additions & 2 deletions vscode/bus/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
"noUnusedParameters": true,
"noEmit": true,
"moduleResolution": "node",
"baseUrl": "./"
"baseUrl": "./",
"skipLibCheck": true
},
"include": ["src/**/*"]
"include": ["src/**/*"],
"exclude": ["node_modules", "dist", "../../node_modules"]
}
2 changes: 2 additions & 0 deletions vscode/extension/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ out
.vscode-test
*.vsix
LICENSE
src_react
!src_react/.gitkeep
3 changes: 3 additions & 0 deletions vscode/extension/.vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,8 @@ vsc-extension-quickstart.md
**/*.map
**/*.ts
**/.vscode-test.*
<<<<<<< HEAD
assets/logo.svg
esbuild.js
=======
>>>>>>> c5ee2535 (progress)
1 change: 0 additions & 1 deletion vscode/extension/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,3 @@ The extension allows you to:
### Linting

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

Loading