diff --git a/lua/plugins/autocomplete.lua b/lua/plugins/autocomplete.lua index e5dca30..3783fd1 100644 --- a/lua/plugins/autocomplete.lua +++ b/lua/plugins/autocomplete.lua @@ -1,28 +1,27 @@ return { -- NOTE: cmp-path, - { - "hrsh7th/cmp-nvim-lsp" + "hrsh7th/cmp-nvim-lsp", }, { "L3MON4D3/LuaSnip", dependencies = { - 'saadparwaiz1/cmp_luasnip', - 'rafamadriz/friendly-snippets' - } + "saadparwaiz1/cmp_luasnip", + "rafamadriz/friendly-snippets", + }, }, { "hrsh7th/nvim-cmp", config = function() -- Set up nvim-cmp. - local cmp = require 'cmp' + local cmp = require("cmp") require("luasnip.loaders.from_vscode").lazy_load() cmp.setup({ snippet = { -- REQUIRED - you must specify a snippet engine expand = function(args) - require('luasnip').lsp_expand(args.body) -- For `luasnip` users. + require("luasnip").lsp_expand(args.body) -- For `luasnip` users. end, }, window = { @@ -30,19 +29,32 @@ return { documentation = cmp.config.window.bordered(), }, mapping = cmp.mapping.preset.insert({ - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), - [''] = cmp.mapping.complete(), - [''] = cmp.mapping.abort(), - [''] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.complete(), + [""] = cmp.mapping.abort(), + [""] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. }), sources = cmp.config.sources({ - { name = 'nvim_lsp' }, - { name = 'luasnip' }, -- For luasnip users. + { name = "nvim_lsp" }, + { name = "luasnip" }, -- For luasnip users. }, { - { name = 'buffer' }, - }) + { name = "buffer" }, + }), }) - end - } + end, + }, + { + "windwp/nvim-ts-autotag", + ft = { + "vue", + "javascript", + "typescript", + "jsx", + "tsx", + }, + config = function() + require("nvim-ts-autotag").setup() + end, + }, } diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index 77e172b..897b331 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -22,7 +22,6 @@ return { "spell", "codespell", "prettierd", - "gospel", --"gofumpt", --"biome", "pylint", @@ -83,54 +82,34 @@ return { -- JS & TS - local secret = os.getenv("VUE_LSP_PATH") - -- WARN: Version 2 stop working with nvim lsp - -- https://github.com/vuejs/language-tools/issues/3925 - -- https://github.com/williamboman/mason-lspconfig.nvim/issues/371#issuecomment-1988153959 - -- https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#volar - -- npm install -g @vue/language-server # vue lsp를 전역으로 설치 - -- npm list -g # 이 명령으로 설치된 경로를 알아낼 수 있음 - -- .zshrc, bash, posh rc 파일에 설치한 @vue/language-server의 경로를 VUE_LSP_PATH에 설정할 것. - -- VUE_LSP_PATH="명령으로_알아낸_설치_경로/node_modules/@vue/language-server" - -- 모든 해결책이 소용없다면 다음 명령 활용 - -- :MasonInstall vue-language-server@1.8.27 - -- TODO: 모노레포에서 VUE_LSP_PATH 활용가능하게 설정하기 - if secret == nil then - print("VUE LSP PATH not set") - lspconfig.tsserver.setup({ - capabilities = capabilities, - }) - else - lspconfig.tsserver.setup({ - init_options = { - plugins = { - { - name = "@vue/typescript-plugin", - location = secret, - languages = { - "typescript", - "javascript", - "vue", - }, - }, + -- NOTE: 공식 문서 내용 + -- https://github.com/vuejs/language-tools?tab=readme-ov-file#community-integration + -- If you are using mason.nvim, you can get the ts_plugin_path like this + local mason_registry = require("mason-registry") + local vue_language_server_path = mason_registry.get_package("vue-language-server"):get_install_path() + .. "/node_modules/@vue/language-server" + + lspconfig.tsserver.setup({ + init_options = { + plugins = { + { + name = "@vue/typescript-plugin", + location = vue_language_server_path, + languages = { "vue" }, }, }, - filetypes = { - "javascript", - "typescript", - "vue", - }, - capabilities = capabilities, - }) - end - - lspconfig.marksman.setup({ + }, + filetypes = { "typescript", "javascript", "javascriptreact", "typescriptreact", "vue" }, capabilities = capabilities, }) lspconfig.volar.setup({ capabilities = capabilities, }) + lspconfig.marksman.setup({ + capabilities = capabilities, + }) + -- Go lspconfig.gopls.setup({ capabilities = capabilities,