aboutsummaryrefslogtreecommitdiff
path: root/init.lua
diff options
context:
space:
mode:
authorMichiel van den Heuvel <michielvdnheuvel@gmail.com>2023-06-24 19:46:03 +0200
committerMichiel van den Heuvel <michielvdnheuvel@gmail.com>2023-06-29 15:13:31 +0200
commit336cf3083232e824c8990834b56c6a1068b5a631 (patch)
tree1fb4ae7b34bbc1c31306488f87103b72d40bb8e8 /init.lua
parente83950a7149f364b653395cdd4d9446875a7f469 (diff)
downloadvis-lspc-336cf3083232e824c8990834b56c6a1068b5a631.tar.gz
vis-lspc-336cf3083232e824c8990834b56c6a1068b5a631.zip
Make formatting options sort of configurable
This should be wired up to code that's in a pull request in the vis repository for the default options. This PR does not yet expose `expandtab`. Referenced PR: https://github.com/martanne/vis/pull/717
Diffstat (limited to 'init.lua')
-rw-r--r--init.lua7
1 files changed, 6 insertions, 1 deletions
diff --git a/init.lua b/init.lua
index 48f7b97..843bfdc 100644
--- a/init.lua
+++ b/init.lua
@@ -1109,6 +1109,7 @@ local function ls_start_server(syntax)
local ls = {
name = ls_conf.name,
settings = ls_conf.settings,
+ formatting_options = ls_conf.formatting_options,
initialized = false,
id = 0,
inflight = {},
@@ -1345,8 +1346,12 @@ vis:command_register('lspc-format', function(_, _, win)
local params = {
textDocument = {uri = path_to_uri(win.file.path)},
- options = {tabSize = 2, insertSpaces = true},
+ options = ls.formatting_options,
}
+ if params.options == nil then
+ -- probably a safe default, but this should be hooked up to the vis options
+ params.options = {tabSize = 4, insertSpaces = true}
+ end
ls_call_text_document_method(ls, 'formatting', params, win)
end)