Skip to content

Commit

Permalink
docs: fix lsp-sqls-workspace-config-path behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
suzuki committed Aug 31, 2024
1 parent c36b95b commit 1eebad8
Showing 1 changed file with 30 additions and 2 deletions.
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`).

0 comments on commit 1eebad8

Please sign in to comment.