This commit is contained in:
2025-08-01 14:11:46 +02:00
parent 4d30d7f9fa
commit bbea041283
2 changed files with 25 additions and 30 deletions

View File

@@ -1,14 +1,6 @@
-- TODO: Read until 817 -- Paths for working with vue
-- external requirements
-- - use nvm and install @vue/typescript-plugin globally
-- then ts_ls will use it for vue parsing. It is already in the arch install script.
--local nvm_bin = os.getenv('nvm_home'):gsub('\n[^\n]*$', '') -- remove line endings
--local node_version = vim.fn.system('nvm current'):gsub('\n[^\n]*$', '') -- remove line endings
--local vue_typescript_plugin_path = vim.fs.normalize(nvm_bin .. '\\' .. node_version .. '\\node_modules\\@vue\\typescript-plugin')
local vue_typescript_plugin_path = vim.fs.normalize '~/node_modules/@vue/typescript-plugin' local vue_typescript_plugin_path = vim.fs.normalize '~/node_modules/@vue/typescript-plugin'
local vue_language_server_path = vim.fn.stdpath 'data' .. '/mason/packages/vue-language-server/node_modules/@vue/language-server' local vue_language_server_path = vim.fs.normalize(vim.fn.stdpath 'data' .. '/mason/packages/vue-language-server/node_modules/@vue/language-server')
print(vue_language_server_path)
-- "<leader>sh" to [s]earch the [h]elp documentation. -- "<leader>sh" to [s]earch the [h]elp documentation.
@@ -570,6 +562,11 @@ require('lazy').setup({
vtsls = { vtsls = {
filetypes = { 'typescript', 'javascript', 'javascriptreact', 'typescriptreact', 'vue' }, filetypes = { 'typescript', 'javascript', 'javascriptreact', 'typescriptreact', 'vue' },
settings = { settings = {
typescript = {
format = {
enable = false,
},
},
vtsls = { vtsls = {
tsserver = { tsserver = {
globalPlugins = { globalPlugins = {
@@ -586,6 +583,11 @@ require('lazy').setup({
}, },
eslint = { eslint = {
flags = { debounce_text_changes = 500 }, flags = { debounce_text_changes = 500 },
settings = {
codeActionOnSave = {
enable = true,
},
},
-- on_attach = function(client, bufnr) -- on_attach = function(client, bufnr)
-- client.server_capabilities.documentFormattingProvider = true -- client.server_capabilities.documentFormattingProvider = true
-- if client.server_capabilities.documentFormattingProvider then -- if client.server_capabilities.documentFormattingProvider then
@@ -649,7 +651,6 @@ require('lazy').setup({
'xmlformatter', 'xmlformatter',
'isort', 'isort',
'black', 'black',
'debugpy',
'prettierd', 'prettierd',
'json-lsp', 'json-lsp',
}) })
@@ -689,7 +690,7 @@ require('lazy').setup({
-- Disable "format_on_save lsp_fallback" for languages that don't -- Disable "format_on_save lsp_fallback" for languages that don't
-- have a well standardized coding style. You can add additional -- have a well standardized coding style. You can add additional
-- languages here or re-enable it for the disabled ones. -- languages here or re-enable it for the disabled ones.
local disable_filetypes = { c = true, cpp = true } local disable_filetypes = { c = true, cpp = true, vue = true }
if disable_filetypes[vim.bo[bufnr].filetype] then if disable_filetypes[vim.bo[bufnr].filetype] then
return nil return nil
else else
@@ -705,12 +706,6 @@ require('lazy').setup({
-- python = { "isort", "black" }, -- python = { "isort", "black" },
-- --
-- You can use 'stop_after_first' to run the first available formatter from the list -- You can use 'stop_after_first' to run the first available formatter from the list
javascript = { 'eslint-lsp' },
typescript = { 'eslint-lsp' },
esmodule = { 'eslint-lsp' },
vue = { 'eslint-lsp' },
typescriptreact = { 'eslint-lsp' },
javascriptreact = { 'eslint-lsp' },
xml = { 'xmlformatter' }, xml = { 'xmlformatter' },
python = { 'black', 'isort' }, python = { 'black', 'isort' },
json = { 'prettierd' }, json = { 'prettierd' },

View File

@@ -46,18 +46,18 @@ return {
-- Create autocommand which carries out the actual linting -- Create autocommand which carries out the actual linting
-- on the specified events. -- on the specified events.
local lint_augroup = vim.api.nvim_create_augroup('lint', { clear = true }) -- local lint_augroup = vim.api.nvim_create_augroup('lint', { clear = true })
vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave' }, { -- vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave' }, {
group = lint_augroup, -- group = lint_augroup,
callback = function() -- callback = function()
-- Only run the linter in buffers that you can modify in order to -- -- Only run the linter in buffers that you can modify in order to
-- avoid superfluous noise, notably within the handy LSP pop-ups that -- -- avoid superfluous noise, notably within the handy LSP pop-ups that
-- describe the hovered symbol using Markdown. -- -- describe the hovered symbol using Markdown.
if vim.opt_local.modifiable:get() then -- if vim.opt_local.modifiable:get() then
lint.try_lint() -- lint.try_lint()
end -- end
end, -- end,
}) -- })
end, end,
}, },
} }