You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/guides/vscode.md
+25-5Lines changed: 25 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -55,7 +55,7 @@ If you are using Tobiko Cloud, the `tcloud` library will install SQLMesh for you
55
55
First, follow the [Python setup](#python-setup) steps above to create and activate a Python environment. Next, install `tcloud`:
56
56
57
57
```bash
58
-
pip install tcloud
58
+
pip install tcloud# always make sure to install the latest version of tcloud
59
59
```
60
60
61
61
Finally, add the `lsp` extra to your `tcloud.yml` configuration file, as described [here](../cloud/tcloud_getting_started.md#connect-tobiko-cloud-to-data-warehouse).
@@ -155,11 +155,31 @@ The VSCode extension is based on a [language server](https://en.wikipedia.org/wi
155
155
156
156
If you have environment variables that are needed by the context and the language server, you can use one of these approaches to pass variables to the language server:
157
157
158
-
- Open VSCode from a terminal that has the variables set
159
-
- Use environment variables pulled from somewhere else dynamically (e.g. a `.env` file) in your config
160
-
- Set the environment variables in the python environment that the extension uses. You can find detailed instructions [here](https://code.visualstudio.com/docs/python/environments#_environment-variables)
158
+
- Open VSCode from a terminal that has the variables set already.
159
+
- If you have `export ENV_VAR=value` in your shell configuration file (e.g. `.zshrc` or `.bashrc`) when initializing the terminal by default, the variables will be picked up by the language server if opened from that terminal.
160
+
- Use environment variables pulled from somewhere else dynamically in your `config.py` for example by connecting to a secret store
161
+
- By default, a `.env` file in your root project directory will automatically be picked up by the language server through the python environment that the extension uses. For exact details on how to set the environment variables in the Python environment that the extension uses, see [here](https://code.visualstudio.com/docs/python/environments#_environment-variables)
161
162
162
-
### Python environment woes
163
+
You can verify that the environment variables are being passed to the language server by printing them in your terminal.
164
+
165
+
1.`Cmd +Shift + P` (`Ctrl + Shift + P` in case of Windows) to start the VSCode command bar
166
+

167
+
2. Select the option: `SQLMesh: Print Environment Variables`
168
+
3. You should see the environment variables printed in the terminal
If you change your setup during development (e.g., add variables to your shell config), you must restart the language server for the changes to take effect. You can do this by running the following command in the terminal:
172
+
173
+
1.`Cmd +Shift + P` (`Ctrl + Shift + P` in case of Windows) to start the VSCode command bar
174
+
2. Select the option: `SQLMesh: Restart Servers`
175
+

176
+

177
+
178
+
> This loaded message will appear in the lower left corner of the VSCode window.
179
+
180
+
3. Print the environment variables based on the instructions above to verify the changes have taken effect.
181
+
182
+
### Python environment issues
163
183
164
184
The most common problem is the extension not using the correct Python interpreter.
0 commit comments