Skip to content

Commit e0bc5fd

Browse files
committed
opening extension in right place
registered logging [ci skip] format works making progress making progress sharing node modules creating the docs progress getting react server to show making progress with the server temp get calling api now need to add lineage tab making progress on vscode lineage temp progress: showing the lineage graph [ci skip] cleaning up lineage [ci skip] added ability to open files temp [ci skip] trying to implement lsp [ci skip] temp [ci skip] test [ci skip] temp [ci skip] temp [ci skip]
1 parent 633fe09 commit e0bc5fd

132 files changed

Lines changed: 26804 additions & 76 deletions

File tree

Some content is hidden

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

.vscode/extensions.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
// See http://go.microsoft.com/fwlink/?LinkId=827846
3+
// for the documentation about the extensions.json format
4+
"recommendations": ["dbaeumer.vscode-eslint", "amodio.tsl-problem-matcher", "ms-vscode.extension-test-runner"]
5+
}

.vscode/launch.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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": [
13+
"${workspaceFolder}/examples/sushi",
14+
"--extensionDevelopmentPath=${workspaceFolder}/vscode/extension",
15+
],
16+
"outFiles": [
17+
"${workspaceFolder}/vscode/extension/dist/**/*.js"
18+
],
19+
"preLaunchTask": "${defaultBuildTask}"
20+
}
21+
]
22+
}

.vscode/settings.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Place your settings in this file to overwrite default and user settings.
2+
{
3+
"files.exclude": {
4+
"vscode/extension/out": false, // set this to true to hide the "out" folder with the compiled JS files
5+
"vscode/extension/dist": false, // set this to true to hide the "dist" folder with the compiled JS files
6+
"vscode/react/node_modules": false,
7+
"vscode/react/dist": false
8+
},
9+
"search.exclude": {
10+
"vscode/extension/out": true, // set this to false to include "out" folder in search results
11+
"vscode/extension/dist": true, // set this to false to include "dist" folder in search results
12+
"vscode/react/node_modules": true,
13+
"vscode/react/dist": true
14+
},
15+
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
16+
"typescript.tsc.autoDetect": "off"
17+
}

.vscode/tasks.json

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
// See https://go.microsoft.com/fwlink/?LinkId=733558
2+
// for the documentation about the tasks.json format
3+
{
4+
"version": "2.0.0",
5+
"tasks": [
6+
{
7+
"label": "extension-watch",
8+
"type": "npm",
9+
"script": "watch",
10+
"problemMatcher": "$ts-webpack-watch",
11+
"isBackground": true,
12+
"presentation": {
13+
"reveal": "never",
14+
"group": "watchers"
15+
},
16+
"group": {
17+
"kind": "build",
18+
},
19+
"options": {
20+
"cwd": "${workspaceFolder}/vscode/extension"
21+
},
22+
"dependsOn": [
23+
"react-dev"
24+
],
25+
"dependsOrder": "parallel"
26+
},
27+
{
28+
"label": "react-dev",
29+
"script": "dev",
30+
"type": "npm",
31+
"options": {
32+
"cwd": "${workspaceFolder}/vscode/react"
33+
},
34+
"group": {
35+
"kind": "build",
36+
},
37+
"isBackground": true,
38+
"problemMatcher": {
39+
"owner": "npm",
40+
"pattern": {
41+
"regexp": "."
42+
},
43+
"background": {
44+
"activeOnStart": true,
45+
"beginsPattern": ".",
46+
"endsPattern": "."
47+
}
48+
},
49+
"presentation": {
50+
"reveal": "never",
51+
"group": "watchers"
52+
}
53+
},
54+
{
55+
"label": "extension-watch-develop",
56+
"group": {
57+
"kind": "build",
58+
"isDefault": true
59+
},
60+
"dependsOn": ["react-dev", "extension-watch"],
61+
"dependsOrder": "parallel",
62+
},
63+
{
64+
"type": "npm",
65+
"script": "watch-tests",
66+
"problemMatcher": "$tsc-watch",
67+
"isBackground": true,
68+
"presentation": {
69+
"reveal": "never",
70+
"group": "watchers"
71+
},
72+
"group": "build",
73+
"options": {
74+
"cwd": "${workspaceFolder}/vscode"
75+
}
76+
},
77+
{
78+
"label": "tasks: watch-tests",
79+
"dependsOn": [
80+
"npm: watch",
81+
"npm: watch-tests"
82+
],
83+
"problemMatcher": []
84+
}
85+
]
86+
}

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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 vscode/server/openapi.py
184+
cd vscode/react && npm run generate:api

docs/development.md

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ SQLMesh is licensed under [Apache 2.0](https://github.com/TobikoData/sqlmesh/blo
44

55
## Prerequisites
66

7+
<<<<<<< HEAD
78
Before you begin, ensure you have the following installed on your machine. Exactly how to install these is dependent on your operating system.
9+
=======
10+
Before you begin, ensure you have the following installed on your machine. Exacltly how to install these is dependent on your operating system.
11+
>>>>>>> afd4b2c1 (opening extension in right place)
812
913
* Docker
1014
* Docker Compose V2
@@ -25,9 +29,47 @@ Once you have activated your virtual environment, you can install the dependenci
2529
```bash
2630
make install-dev
2731
```
32+
<<<<<<< HEAD
2833

2934
Optionally, you can use pre-commit to automatically run linters/formatters:
3035

36+
=======
37+
<<<<<<< HEAD
38+
Run linters and formatters:
39+
```bash
40+
make style
41+
```
42+
Run faster tests for quicker local feedback:
43+
```bash
44+
make fast-test
45+
```
46+
Run more comprehensive tests that run on each commit:
47+
```bash
48+
make slow-test
49+
```
50+
Install docs dependencies:
51+
```bash
52+
make install-doc
53+
```
54+
Run docs server:
55+
```bash
56+
make docs-serve
57+
```
58+
Run docs tests:
59+
```bash
60+
make doc-test
61+
```
62+
Run ide:
63+
```bash
64+
make ui-up
65+
```
66+
(Optional) Use pre-commit to automatically run linters/formatters:
67+
=======
68+
69+
Optionally, you can use pre-commit to automatically run linters/formatters:
70+
71+
>>>>>>> 61520e5a (creating the docs)
72+
>>>>>>> afd4b2c1 (opening extension in right place)
3173
```bash
3274
make install-pre-commit
3375
```
@@ -52,6 +94,15 @@ Run more comprehensive tests that run on each commit:
5294
make slow-test
5395
```
5496

97+
<<<<<<< HEAD
98+
=======
99+
Run Airflow tests that will run when PR is merged to main:
100+
101+
```bash
102+
make airflow-docker-test-with-env
103+
```
104+
105+
>>>>>>> afd4b2c1 (opening extension in right place)
55106
## Documentation
56107

57108
In order to run the documentation server, you will need to install the dependencies by running the following command.
@@ -90,6 +141,7 @@ make ui-up
90141

91142
## Developing the VSCode extension
92143

144+
<<<<<<< HEAD
93145
Similar to UI development, you can also develop the VSCode extension. To do so, make sure you have the dependencies installed by running the following command inside the `vscode/extension` directory.
94146

95147
```bash
@@ -101,3 +153,37 @@ Once that is done, developing the VSCode extension is most easily done by launch
101153
```bash
102154
make vscode_settings
103155
```
156+
=======
157+
Developing the VSCode extension is most easily done by launching the debug process from a visual studio code workspace.
158+
159+
By default, the VSCode extension will run the SQLMesh server locally and open a new visual studio code window that allows you to try out the SQLMesh IDE. It by default opens the `examples/sushi` project.
160+
161+
Please see the below diagram for a high level overview of the UI.
162+
163+
```mermaid
164+
graph TD
165+
A[VSCode Extension] --> |start server| B[SQLMesh Server]
166+
A --> |creates webviews| C[Webviews]
167+
C --> |reads react webpages from| B
168+
A --> |calls lsp| B
169+
React[React App] --> |embedded in| B
170+
```
171+
172+
For development purposes, the React app is not embedded into the python server. Instead a separate instance of the React app is run. This allows you to make changes to the UI and see them immediately.
173+
174+
This makes the architecture diagram at development time look like the following.
175+
176+
```mermaid
177+
graph TD
178+
A[VSCode Extension] --> |start server| B[SQLMesh Server]
179+
A --> |creates webviews| C[Webviews]
180+
React [React Server] --> |passes on api requests| B
181+
C --> |reads react webpages from| React
182+
```
183+
184+
In development mode, the React app is not embedded into the python server. Instead a separate instance of the React app is run. This allows you to make changes to the UI and see them immediately.
185+
186+
The React App runs on the port 5173. The VSCode extension will automatically open the React app in a new tab.
187+
The python server will run on the port 5174.
188+
189+
>>>>>>> afd4b2c1 (opening extension in right place)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"editor.formatOnSave": true
3+
}

examples/sushi/audits/assert_item_price_above_zero.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ AUDIT (
66

77
SELECT *
88
FROM sushi.items
9-
WHERE price <= 0
9+
WHERE price <= 0

examples/sushi/audits/items.sql

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
AUDIT (
22
name assert_items_price_exceeds_threshold
33
);
4-
SELECT *
5-
FROM @this_model
6-
WHERE price <= @price;
74

5+
SELECT
6+
*
7+
FROM @this_model
8+
WHERE
9+
price <= @price

examples/sushi/audits/order_items.sql

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ AUDIT (
22
name assert_order_items_quantity_exceeds_threshold
33
);
44

5-
SELECT *
5+
SELECT
6+
*
67
FROM @this_model
7-
WHERE quantity <= @quantity
8+
WHERE
9+
quantity <= @quantity

0 commit comments

Comments
 (0)