fix efm and lsp-config tsserver formatting conflicts

This commit is contained in:
Ray Elliott 2021-10-10 18:53:47 +01:00
parent cafa50734b
commit ecd05b4454
4 changed files with 8 additions and 1 deletions

View File

@ -41,7 +41,7 @@ local luaformat = {
local util = require "lspconfig".util
local on_attach_efm = function(client)
if client.resolved_capabilities.document_formatting then
vim.cmd [[augroup efm_formatting]]
vim.cmd [[augroup lsp_formatting]]
vim.cmd [[autocmd!]]
vim.cmd [[autocmd BufWritePre <buffer> :lua vim.lsp.buf.formatting_seq_sync({}, 1000)]]
vim.cmd [[augroup END]]

View File

@ -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>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
vim.cmd [[augroup lsp_formatting]]
vim.cmd [[autocmd!]]

View File

@ -176,3 +176,5 @@ movie
multivariable
Unsetting
ajax
mimetype
thumbnailers

Binary file not shown.