|
@@ -16,6 +16,19 @@ end
|
|
|
if vim.fn.executable("deno") == 1 then
|
|
|
vim.lsp.enable("deno");
|
|
|
else
|
|
|
+ local function make_settings()
|
|
|
+ -- we disable formatting but these are still used when performing some code
|
|
|
+ -- actions
|
|
|
+ local format = {
|
|
|
+ indentSize = vim.bo.shiftwidth,
|
|
|
+ convertTabsToSpaces = vim.o.expandtab,
|
|
|
+ }
|
|
|
+ return {
|
|
|
+ javascript = { format = format },
|
|
|
+ typescript = { format = format },
|
|
|
+ }
|
|
|
+ end
|
|
|
+
|
|
|
vim.lsp.config("ts_ls", {
|
|
|
init_options = {
|
|
|
completionDisableFilterText = true,
|
|
@@ -25,6 +38,7 @@ else
|
|
|
providePrefixAndSuffixTextForRename = false,
|
|
|
},
|
|
|
},
|
|
|
+ settings = make_settings(),
|
|
|
handlers = {
|
|
|
['$/typescriptVersion'] = function(err, result, ctx, config)
|
|
|
vim.notify(string.format('Typescript %s', result.version))
|
|
@@ -38,6 +52,12 @@ else
|
|
|
-- eslint and dprint for that
|
|
|
client.server_capabilities.documentFormattingProvider = false
|
|
|
client.server_capabilities.documentRangeFormattingProvider = false
|
|
|
+
|
|
|
+ -- we only really know our settings once we've opened a file so report
|
|
|
+ -- the new formatting settings
|
|
|
+ client:notify(vim.lsp.protocol.Methods.workspace_didChangeConfiguration, {
|
|
|
+ settings = make_settings(),
|
|
|
+ })
|
|
|
end,
|
|
|
on_attach = function(client)
|
|
|
-- add custom commands, we follow upstream's Lsp* prefix convention
|