Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 30 additions & 18 deletions lua/plugins/autocomplete.lua
Original file line number Diff line number Diff line change
@@ -1,48 +1,60 @@
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 = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
},
mapping = cmp.mapping.preset.insert({
['<C-b>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.abort(),
['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping.abort(),
["<CR>"] = 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,
},
}
61 changes: 20 additions & 41 deletions lua/plugins/lsp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ return {
"spell",
"codespell",
"prettierd",
"gospel",
--"gofumpt",
--"biome",
"pylint",
Expand Down Expand Up @@ -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 [email protected]
-- 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,
Expand Down