fix efm and lsp-config tsserver formatting conflicts
This commit is contained in:
parent
cafa50734b
commit
ecd05b4454
|
@ -41,7 +41,7 @@ local luaformat = {
|
||||||
local util = require "lspconfig".util
|
local util = require "lspconfig".util
|
||||||
local on_attach_efm = function(client)
|
local on_attach_efm = function(client)
|
||||||
if client.resolved_capabilities.document_formatting then
|
if client.resolved_capabilities.document_formatting then
|
||||||
vim.cmd [[augroup efm_formatting]]
|
vim.cmd [[augroup lsp_formatting]]
|
||||||
vim.cmd [[autocmd!]]
|
vim.cmd [[autocmd!]]
|
||||||
vim.cmd [[autocmd BufWritePre <buffer> :lua vim.lsp.buf.formatting_seq_sync({}, 1000)]]
|
vim.cmd [[autocmd BufWritePre <buffer> :lua vim.lsp.buf.formatting_seq_sync({}, 1000)]]
|
||||||
vim.cmd [[augroup END]]
|
vim.cmd [[augroup END]]
|
||||||
|
|
|
@ -54,6 +54,11 @@ local on_attach = function(client, bufnr)
|
||||||
-- buf_set_keymap('n', '<space>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts)
|
-- buf_set_keymap('n', '<space>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts)
|
||||||
-- buf_set_keymap('n', '<space>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts)
|
-- buf_set_keymap('n', '<space>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts)
|
||||||
|
|
||||||
|
if client.name == 'tsserver' then
|
||||||
|
print('tsserver - disabling formatting')
|
||||||
|
client.resolved_capabilities.document_formatting = false;
|
||||||
|
end
|
||||||
|
|
||||||
if client.resolved_capabilities.document_formatting then
|
if client.resolved_capabilities.document_formatting then
|
||||||
vim.cmd [[augroup lsp_formatting]]
|
vim.cmd [[augroup lsp_formatting]]
|
||||||
vim.cmd [[autocmd!]]
|
vim.cmd [[autocmd!]]
|
||||||
|
|
|
@ -176,3 +176,5 @@ movie
|
||||||
multivariable
|
multivariable
|
||||||
Unsetting
|
Unsetting
|
||||||
ajax
|
ajax
|
||||||
|
mimetype
|
||||||
|
thumbnailers
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue