Skip to content

Commit ecb5fa7

Browse files
committed
env vars docs update
1 parent c11510d commit ecb5fa7

5 files changed

Lines changed: 25 additions & 4 deletions

File tree

docs/guides/vscode.md

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ If you are using Tobiko Cloud, the `tcloud` library will install SQLMesh for you
5555
First, follow the [Python setup](#python-setup) steps above to create and activate a Python environment. Next, install `tcloud`:
5656

5757
```bash
58-
pip install tcloud
58+
pip install tcloud # always make sure to install the latest version of tcloud
5959
```
6060

6161
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,32 @@ The VSCode extension is based on a [language server](https://en.wikipedia.org/wi
155155

156156
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:
157157

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
158+
- Open VSCode from a terminal that has the variables set (e.g. `.zshrc` or `.bashrc`). This will automatically be picked up by the language server only if you have `export ENV_VAR=value` in your shell configuration file when initializing the terminal.
159+
- Use environment variables pulled from somewhere else dynamically (e.g. a `.env` file) in your root project directory. This will automatically be picked up by the language server.
160160
- 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)
161161

162-
### Python environment woes
162+
#### Troubleshooting Environment Variables
163+
164+
You can verify that the environment variables are being passed to the language server by printing them in your terminal.
165+
166+
1. `Cmd +Shift + P` (`Ctrl + Shift + P` in case of Windows) to start the VSCode command bar
167+
![print_env_vars](./vscode/print_env_vars.png)
168+
2. Select the option: `SQLMesh: Print Environment Variables`
169+
3. You should see the environment variables printed in the terminal.
170+
![terminal_env_vars](./vscode/terminal_env_vars.png)
171+
172+
If you change your environment variables in the terminal during development(e.g. `export DATABASE_PASSWORD='XYZ'`), you must restart the language server for the changes to take effect. You can do this by running the following command in the terminal:
173+
174+
1. `Cmd +Shift + P` (`Ctrl + Shift + P` in case of Windows) to start the VSCode command bar
175+
2. Select the option: `SQLMesh: Restart Servers`
176+
![restart_servers](./vscode/restart_servers.png)
177+
![loaded](./vscode/loaded.png)
178+
179+
> This loaded message will appear in the lower left corner of the VSCode window.
180+
181+
3. Print the environment variables based on the instructions above to verify the changes have taken effect.
182+
183+
### Python environment troubleshooting
163184

164185
The most common problem is the extension not using the correct Python interpreter.
165186

docs/guides/vscode/loaded.png

21.1 KB
Loading
16 KB
Loading
11.8 KB
Loading
47.8 KB
Loading

0 commit comments

Comments
 (0)