From 1eebad83541d73470779e890d008c01d4bd7c3bb Mon Sep 17 00:00:00 2001 From: Norio Suzuki Date: Sat, 31 Aug 2024 15:47:05 +0900 Subject: [PATCH] docs: fix `lsp-sqls-workspace-config-path` behavior --- docs/manual-language-docs/lsp-sqls.md | 32 +++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/docs/manual-language-docs/lsp-sqls.md b/docs/manual-language-docs/lsp-sqls.md index b8b2b6c410d..54f7f5474a1 100644 --- a/docs/manual-language-docs/lsp-sqls.md +++ b/docs/manual-language-docs/lsp-sqls.md @@ -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 `/.sqls/config.json` containing +## Storing Configuration in `/.sqls/config.json` + +Alternatively, you can store your configuration in the project root at `/.sqls/config.json`: + ``` { "sqls": { @@ -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`).