aboutsummaryrefslogtreecommitdiff
path: root/book
diff options
context:
space:
mode:
authorfarwyler2022-06-05 10:50:57 +0000
committerGitHub2022-06-05 10:50:57 +0000
commitf92a25a856d572c7bd4b8e597a3f86ce211e81d5 (patch)
treef6f63b8ab2c6af7d47f64b9bd8a90bd9950ed3e3 /book
parentb2bd87df81756d4925bf1f4da6962b9dd83a807c (diff)
Passing extra formatting options to LSPs (#2635)
* allows passing extra formatting options to LSPs - adds optional field 'format' to [[language]] sections in 'languages.toml' - passes specified options the LSPs via FormattingOptions * cleaner conversion of formatting properties * move formatting options inside lsp::Client * cleans up formatting properties merge
Diffstat (limited to 'book')
-rw-r--r--book/src/languages.md12
1 files changed, 12 insertions, 0 deletions
diff --git a/book/src/languages.md b/book/src/languages.md
index 1fa24787..8c27785e 100644
--- a/book/src/languages.md
+++ b/book/src/languages.md
@@ -14,6 +14,18 @@ name = "rust"
auto-format = false
```
+## LSP formatting options
+
+Use `format` field to pass extra formatting options to [Document Formatting Requests](https://github.com/microsoft/language-server-protocol/blob/gh-pages/_specifications/specification-3-16.md#document-formatting-request--leftwards_arrow_with_hook).
+
+```toml
+[[language]]
+name = "typescript"
+auto-format = true
+# pass format options according to https://github.com/typescript-language-server/typescript-language-server#workspacedidchangeconfiguration omitting the "[language].format." prefix.
+config = { format = { "semicolons" = "insert", "insertSpaceBeforeFunctionParenthesis" = true } }
+```
+
## Tree-sitter grammars
Tree-sitter grammars can also be configured in `languages.toml`: