Skip to content

Commit a81b62b

Browse files
committed
docs: add documentation for vscode extension
[ci skip]
1 parent 91a92e4 commit a81b62b

3 files changed

Lines changed: 93 additions & 0 deletions

File tree

docs/quickstart/vscode.md

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# Visual Studio Code Extension
2+
3+
> The extension is currently in **preview** and as such is subject to change. You may also encoutnter bugs and api incompatibilities with the SQLMesh version you are running. We encourage you to try it and raise any issues [here](https://github.com/tobikodata/sqlmesh/issues).
4+
5+
In this quickstart guide, you'll set up the SQLMesh extension in Visual Studio Code, we'll show you the capabilities of the extension and how to troubleshoot common issues.
6+
7+
## Installation
8+
9+
Installation is done through the VSCode extension marketplace, search for `SQLMesh` and install the extension from the [marketplace](https://marketplace.visualstudio.com/items?itemName=tobikodata.sqlmesh). For a more in depth guide on how to install extensions, see the [VSCode documentation](https://code.visualstudio.com/docs/configure/extensions/extension-marketplace#_install-an-extension).
10+
11+
### Recommended setup
12+
13+
While installing the extension is simple, setting up a python environmnt correctly is a bit more involved. We do recommend using a dedicated *python virtual environment* to install SQLMesh. For a complete guide visit the [python documentation](https://docs.python.org/3/library/venv.html) but the following steps will create the virtual environment, activate it and install SQLMesh for both a SQLMesh core setup and a Tobiko Cloud setup.
14+
15+
#### SQLMesh Core
16+
17+
but as a summary you can do the following, which will create the virtual environment, activate it and install SQLMesh:
18+
19+
```bash
20+
python -m venv .venv
21+
source .venv/bin/activate
22+
pip install 'sqlmesh[lsp]'
23+
```
24+
25+
Once you have the virtual environment, you can make sure that Visual Studio Code is using the correct python interpreter by going to the [command palette](https://code.visualstudio.com/docs/getstarted/userinterface#_command-palette) and running `Python: Select Interpreter`. Select the python executable in the virtual environment.
26+
27+
![Select interpreter](./vscode/select_interpreter.png)
28+
29+
Once that's done, you can validate that the extension is correctly using the virtual environment by checking the `sqlmesh` output channel in the [output panel](https://code.visualstudio.com/docs/getstarted/userinterface#_output-panel) which details the python path and the details of your SQLMesh installation and looks as follows:
30+
31+
![Output panel](./vscode/interpreter_details.png)
32+
33+
#### Tobiko Cloud
34+
35+
For Tobiko Cloud, the tcloud utility is used to install SQLMesh, so you'll need to set up a python environment, activate it and install SQLMesh using the tcloud utility as follows.
36+
37+
```bash
38+
python -m venv .venv
39+
source .venv/bin/activate
40+
pip install tcloud
41+
```
42+
43+
Once you have the virtual environment, you can make sure that Visual Studio Code is using the correct python interpreter by going to the [command palette](https://code.visualstudio.com/docs/getstarted/userinterface#_command-palette) and running `Python: Select Interpreter`. Select the python executable in the virtual environment.
44+
45+
![Select interpreter](./vscode/select_interpreter.png)
46+
47+
If you are
48+
49+
## Features
50+
51+
### Lineage
52+
53+
### Commands
54+
55+
56+
### Language Server Protocol
57+
58+
The extension uses the [Language Server Protocol](https://langserver.org/) to provide a rich language experience for SQLMesh. These features are currently available:
59+
60+
#### Autocomplete
61+
62+
The SQLMesh LSP adds completion provider for SQLMesh keywords and models. When writing SQL models, keywords or model names, you should see a completion suggestion.
63+
64+
#### Go to definition
65+
66+
The SQLMesh LSP adds a definition provider for SQLMesh models. When you hover over a model name, you should see a tooltip with the model definition.
67+
68+
#### Hover information
69+
70+
The SQLMesh LSP adds a hover provider for SQLMesh models. When you hover over a model name, you should see a tooltip with the model definition.
71+
72+
#### Diagnostics
73+
74+
The SQLMesh LSP adds a diagnostic provider for SQLMesh models. When you write SQL models, you should see diagnostics for any issues in the model.
75+
76+
#### Formatting
77+
78+
The SQLMesh LSP adds a formatting provider for SQLMesh models. When you write SQL models, you should see the model formatted correctly.:w
79+
80+
## Troubleshooting
81+
82+
### LSP extensions
83+
84+
The SQLMesh LSP is not by default incld
85+
86+
### Python environment woes
87+
88+
The most common issue is that the extension is not using the correct python interpreter. We recommend following the [recommended setup](#recommended-setup) to ensure that the extension is using the correct python interpreter. If you have checked the `sqlmesh` output channel and the extension is still not using the correct python interpreter, please raise an issue [here](https://github.com/tobikodata/sqlmesh/issues).
89+
90+
### SQLMesh compatibility
91+
92+
While the extension is in preview and the APIs to the underlying SQLMesh version are not stable, we do not guarantee compatibility between the extension and the SQLMesh version you are using. If you encounter an issue, please raise an issue [here](https://github.com/tobikodata/sqlmesh/issues).
93+
124 KB
Loading
81.8 KB
Loading

0 commit comments

Comments
 (0)