Skip to content
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

docs: fix lsp-sqls-workspace-config-path behavior #4535

Merged
merged 1 commit into from
Sep 14, 2024
Merged
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
32 changes: 30 additions & 2 deletions docs/manual-language-docs/lsp-sqls.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ root_file: docs/manual-language-docs/lsp-sqls.md

```

Alternatively, you can leave `lsp-sqls-workspace-config-path` to the default "workspace" value, and put a json file in `<project>/.sqls/config.json` containing
## Storing Configuration in `<project>/.sqls/config.json`

Alternatively, you can store your configuration in the project root at `<project>/.sqls/config.json`:

```
{
"sqls": {
Expand All @@ -29,4 +32,29 @@ Alternatively, you can leave `lsp-sqls-workspace-config-path` to the default "wo
}
```

Now lsp should start in sql-mode buffers, and you can pick a server connection with `M-x lsp-execute-code-action` and "Switch Connections" (or directly with `M-x lsp-sql-switch-connection`). You can change database with `M-x lsp-execute-code-action` and "Switch Database" (or `M-x lsp-sql-switch-database`).
In this case, you need to set `lsp-sqls-workspace-config-path` to "root":

```emacs-lisp
(setq lsp-sqls-workspace-config-path "root")
```

## Storing Configuration in the Current Directory

If you want to configure it for the current directory, you can create a `.sqls/config.json` file:

```
.sqls/config.json
target.sql
```

For this setup, ensure that `lsp-sqls-workspace-config-path` is set to "workspace":

```emacs-lisp
(setq lsp-sqls-workspace-config-path "workspace")
```

# Switching Connections and Databases

Now, lsp should start in sql-mode buffers. You can choose a server connection using `M-x lsp-execute-code-action` and then selecting "Switch Connections", or directly with `M-x lsp-sql-switch-connection`.

To change the database, use `M-x lsp-execute-code-action` and select "Switch Database" (or `M-x lsp-sql-switch-database`).
Loading