nvim: plugins/lsp: Add nvim-lsp-ts-utils
This commit is contained in:
parent
25afe0527c
commit
7383245dd3
2 changed files with 37 additions and 1 deletions
|
@ -1,6 +1,7 @@
|
|||
local nvim_lsp = require('lspconfig')
|
||||
local protocol = require('vim.lsp.protocol')
|
||||
local signature = require('lsp_signature')
|
||||
local ts_utils = require("nvim-lsp-ts-utils")
|
||||
|
||||
-- Taken from https://www.reddit.com/r/neovim/comments/gyb077/nvimlsp_peek_defination_javascript_ttserver/
|
||||
function preview_location(location, context, before_context)
|
||||
|
@ -114,6 +115,40 @@ local on_attach = function(client, bufnr)
|
|||
'璉'; -- operator
|
||||
' '; -- type parameter
|
||||
}
|
||||
|
||||
if client.name == 'tsserver' then
|
||||
ts_utils.setup {
|
||||
debug = false,
|
||||
disable_commands = false,
|
||||
enable_import_on_completion = false,
|
||||
import_on_completion_timeout = 5000,
|
||||
|
||||
eslint_enable_code_actions = true,
|
||||
eslint_bin = "eslint",
|
||||
eslint_args = {"-f", "json", "--stdin", "--stdin-filename", "$FILENAME"},
|
||||
eslint_enable_disable_comments = true,
|
||||
eslint_enable_diagnostics = true,
|
||||
eslint_diagnostics_debounce = 250,
|
||||
|
||||
enable_formatting = true,
|
||||
formatter = "prettier",
|
||||
formatter_args = {"--stdin-filepath", "$FILENAME"},
|
||||
format_on_save = false,
|
||||
no_save_after_format = false,
|
||||
|
||||
complete_parens = true,
|
||||
signature_help_in_parens = false,
|
||||
|
||||
update_imports_on_move = false,
|
||||
require_confirmation_on_move = false,
|
||||
}
|
||||
|
||||
ts_utils.setup_client(client)
|
||||
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'go', ':TSLspOrganize<CR>', { silent = true })
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gf', ':TSLspFixCurrent<CR>', { silent = true })
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gI', ':TSLspImportAll<CR>', { silent = true })
|
||||
end
|
||||
end
|
||||
|
||||
function set_snippet_capabilities()
|
||||
|
|
|
@ -113,7 +113,8 @@ local init = function ()
|
|||
-- LSP
|
||||
use {
|
||||
'neovim/nvim-lspconfig',
|
||||
'ray-x/lsp_signature.nvim'
|
||||
'ray-x/lsp_signature.nvim',
|
||||
'jose-elias-alvarez/nvim-lsp-ts-utils'
|
||||
}
|
||||
-- Language support & syntax highlighting
|
||||
-- Coq
|
||||
|
|
Loading…
Reference in a new issue