mirror of
https://github.com/LunarVim/LunarVim.git
synced 2025-07-14 11:24:43 +02:00
lsp in ftplugin austonautomoy
This commit is contained in:
parent
9bb4f8a085
commit
20ed47e21e
45 changed files with 404 additions and 142 deletions
|
@ -6,3 +6,4 @@ require'lspconfig'.cssls.setup {
|
|||
},
|
||||
on_attach = require'lsp'.common_on_attach
|
||||
}
|
||||
vim.cmd("setl ts=2 sw=2")
|
|
@ -1 +0,0 @@
|
|||
setl ts=2 sw=2
|
|
@ -7,3 +7,4 @@ require'lspconfig'.html.setup {
|
|||
on_attach = require'lsp'.common_on_attach,
|
||||
capabilities = capabilities
|
||||
}
|
||||
vim.cmd("setl ts=2 sw=2")
|
|
@ -1 +0,0 @@
|
|||
setl ts=2 sw=2
|
|
@ -65,3 +65,4 @@ if O.lang.tsserver.autoformat then
|
|||
}
|
||||
})
|
||||
end
|
||||
vim.cmd("setl ts=2 sw=2")
|
|
@ -1 +0,0 @@
|
|||
setl ts=2 sw=2
|
68
ftplugin/javascriptreact.lua
Normal file
68
ftplugin/javascriptreact.lua
Normal file
|
@ -0,0 +1,68 @@
|
|||
-- npm install -g typescript typescript-language-server
|
||||
-- require'snippets'.use_suggested_mappings()
|
||||
-- local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
-- capabilities.textDocument.completion.completionItem.snippetSupport = true;
|
||||
-- local on_attach_common = function(client)
|
||||
-- print("LSP Initialized")
|
||||
-- require'completion'.on_attach(client)
|
||||
-- require'illuminate'.on_attach(client)
|
||||
-- end
|
||||
require'lspconfig'.tsserver.setup {
|
||||
cmd = {
|
||||
DATA_PATH ..
|
||||
"/lspinstall/typescript/node_modules/.bin/typescript-language-server",
|
||||
"--stdio"
|
||||
},
|
||||
filetypes = {
|
||||
"javascript", "javascriptreact", "javascript.jsx", "typescript",
|
||||
"typescriptreact", "typescript.tsx"
|
||||
},
|
||||
on_attach = require'lsp'.tsserver_on_attach,
|
||||
-- This makes sure tsserver is not used for formatting (I prefer prettier)
|
||||
-- on_attach = require'lsp'.common_on_attach,
|
||||
root_dir = require('lspconfig/util').root_pattern("package.json",
|
||||
"tsconfig.json",
|
||||
"jsconfig.json", ".git"),
|
||||
settings = {documentFormatting = false},
|
||||
handlers = {
|
||||
["textDocument/publishDiagnostics"] = vim.lsp.with(
|
||||
vim.lsp.diagnostic.on_publish_diagnostics, {
|
||||
virtual_text = O.lang.tsserver.diagnostics.virtual_text,
|
||||
signs = O.lang.tsserver.diagnostics.signs,
|
||||
underline = O.lang.tsserver.diagnostics.underline,
|
||||
update_in_insert = true
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
if O.lang.tsserver.autoformat then
|
||||
require('lv-utils').define_augroups({
|
||||
_javascript_autoformat = {
|
||||
{
|
||||
|
||||
'BufWritePre', '*.js',
|
||||
'lua vim.lsp.buf.formatting_sync(nil, 1000)'
|
||||
}
|
||||
},
|
||||
_javascriptreact_autoformat = {
|
||||
{
|
||||
'BufWritePre', '*.jsx',
|
||||
'lua vim.lsp.buf.formatting_sync(nil, 1000)'
|
||||
}
|
||||
},
|
||||
_typescript_autoformat = {
|
||||
{
|
||||
'BufWritePre', '*.ts',
|
||||
'lua vim.lsp.buf.formatting_sync(nil, 1000)'
|
||||
}
|
||||
},
|
||||
_typescriptreact_autoformat = {
|
||||
{
|
||||
'BufWritePre', '*.tsx',
|
||||
'lua vim.lsp.buf.formatting_sync(nil, 1000)'
|
||||
}
|
||||
}
|
||||
})
|
||||
end
|
||||
vim.cmd("setl ts=2 sw=2")
|
|
@ -1 +0,0 @@
|
|||
setl commentstring={/*%s*/} ts=2 sw=2
|
|
@ -39,3 +39,33 @@ if O.lang.lua.autoformat then
|
|||
})
|
||||
end
|
||||
|
||||
local lua_arguments = {}
|
||||
|
||||
local luaFormat = {
|
||||
formatCommand = "lua-format -i --no-keep-simple-function-one-line --column-limit=80",
|
||||
formatStdin = true
|
||||
}
|
||||
|
||||
local lua_fmt = {
|
||||
formatCommand = "luafmt --indent-count 2 --line-width 120 --stdin",
|
||||
formatStdin = true
|
||||
}
|
||||
|
||||
if O.lang.lua.formatter == 'lua-format' then
|
||||
table.insert(lua_arguments, luaFormat)
|
||||
elseif O.lang.lua.formatter == 'lua-fmt' then
|
||||
table.insert(lua_arguments, lua_fmt)
|
||||
end
|
||||
|
||||
require"lspconfig".efm.setup {
|
||||
-- init_options = {initializationOptions},
|
||||
cmd = {DATA_PATH .. "/lspinstall/efm/efm-langserver"},
|
||||
init_options = {documentFormatting = true, codeAction = false},
|
||||
filetypes = {"lua"},
|
||||
settings = {
|
||||
rootMarkers = {".git/"},
|
||||
languages = {
|
||||
lua = lua_arguments,
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,3 +1,52 @@
|
|||
local python_arguments = {}
|
||||
|
||||
-- TODO replace with path argument
|
||||
local flake8 = {
|
||||
LintCommand = "flake8 --ignore=E501 --stdin-display-name ${INPUT} -",
|
||||
lintStdin = true,
|
||||
lintFormats = {"%f:%l:%c: %m"}
|
||||
}
|
||||
|
||||
local isort = {formatCommand = "isort --quiet -", formatStdin = true}
|
||||
|
||||
local yapf = {formatCommand = "yapf --quiet", formatStdin = true}
|
||||
local black = {formatCommand = "black --quiet -", formatStdin = true}
|
||||
|
||||
if O.lang.python.linter == 'flake8' then table.insert(python_arguments, flake8) end
|
||||
|
||||
if O.lang.python.isort then table.insert(python_arguments, isort) end
|
||||
|
||||
if O.lang.python.formatter == 'yapf' then
|
||||
table.insert(python_arguments, yapf)
|
||||
elseif O.lang.python.formatter == 'black' then
|
||||
table.insert(python_arguments, black)
|
||||
end
|
||||
|
||||
require"lspconfig".efm.setup {
|
||||
-- init_options = {initializationOptions},
|
||||
cmd = {DATA_PATH .. "/lspinstall/efm/efm-langserver"},
|
||||
init_options = {documentFormatting = true, codeAction = false},
|
||||
filetypes = {"lua", "python", "javascriptreact", "javascript", "typescript","typescriptreact","sh", "html", "css", "yaml", "markdown", "vue"},
|
||||
settings = {
|
||||
rootMarkers = {".git/", "requirements.txt"},
|
||||
languages = {
|
||||
python = python_arguments,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-- npm i -g pyright
|
||||
require'lspconfig'.pyright.setup {
|
||||
cmd = {
|
33
ftplugin/sh.lua
Normal file
33
ftplugin/sh.lua
Normal file
|
@ -0,0 +1,33 @@
|
|||
-- npm i -g bash-language-server
|
||||
require'lspconfig'.bashls.setup {
|
||||
cmd = {DATA_PATH .. "/lspinstall/bash/node_modules/.bin/bash-language-server", "start"},
|
||||
on_attach = require'lsp'.common_on_attach,
|
||||
filetypes = { "sh", "zsh" }
|
||||
}
|
||||
|
||||
-- sh
|
||||
local sh_arguments = {}
|
||||
|
||||
local shfmt = {formatCommand = 'shfmt -ci -s -bn', formatStdin = true}
|
||||
|
||||
local shellcheck = {
|
||||
LintCommand = 'shellcheck -f gcc -x',
|
||||
lintFormats = {'%f:%l:%c: %trror: %m', '%f:%l:%c: %tarning: %m', '%f:%l:%c: %tote: %m'}
|
||||
}
|
||||
|
||||
if O.lang.sh.formatter == 'shfmt' then table.insert(sh_arguments, shfmt) end
|
||||
|
||||
if O.lang.sh.linter == 'shellcheck' then table.insert(sh_arguments, shellcheck) end
|
||||
|
||||
require"lspconfig".efm.setup {
|
||||
-- init_options = {initializationOptions},
|
||||
cmd = {DATA_PATH .. "/lspinstall/efm/efm-langserver"},
|
||||
init_options = {documentFormatting = true, codeAction = false},
|
||||
filetypes = {"sh"},
|
||||
settings = {
|
||||
rootMarkers = {".git/"},
|
||||
languages = {
|
||||
sh = sh_arguments,
|
||||
}
|
||||
}
|
||||
}
|
68
ftplugin/typescript.lua
Normal file
68
ftplugin/typescript.lua
Normal file
|
@ -0,0 +1,68 @@
|
|||
-- npm install -g typescript typescript-language-server
|
||||
-- require'snippets'.use_suggested_mappings()
|
||||
-- local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
-- capabilities.textDocument.completion.completionItem.snippetSupport = true;
|
||||
-- local on_attach_common = function(client)
|
||||
-- print("LSP Initialized")
|
||||
-- require'completion'.on_attach(client)
|
||||
-- require'illuminate'.on_attach(client)
|
||||
-- end
|
||||
require'lspconfig'.tsserver.setup {
|
||||
cmd = {
|
||||
DATA_PATH ..
|
||||
"/lspinstall/typescript/node_modules/.bin/typescript-language-server",
|
||||
"--stdio"
|
||||
},
|
||||
filetypes = {
|
||||
"javascript", "javascriptreact", "javascript.jsx", "typescript",
|
||||
"typescriptreact", "typescript.tsx"
|
||||
},
|
||||
on_attach = require'lsp'.tsserver_on_attach,
|
||||
-- This makes sure tsserver is not used for formatting (I prefer prettier)
|
||||
-- on_attach = require'lsp'.common_on_attach,
|
||||
root_dir = require('lspconfig/util').root_pattern("package.json",
|
||||
"tsconfig.json",
|
||||
"jsconfig.json", ".git"),
|
||||
settings = {documentFormatting = false},
|
||||
handlers = {
|
||||
["textDocument/publishDiagnostics"] = vim.lsp.with(
|
||||
vim.lsp.diagnostic.on_publish_diagnostics, {
|
||||
virtual_text = O.lang.tsserver.diagnostics.virtual_text,
|
||||
signs = O.lang.tsserver.diagnostics.signs,
|
||||
underline = O.lang.tsserver.diagnostics.underline,
|
||||
update_in_insert = true
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
if O.lang.tsserver.autoformat then
|
||||
require('lv-utils').define_augroups({
|
||||
_javascript_autoformat = {
|
||||
{
|
||||
|
||||
'BufWritePre', '*.js',
|
||||
'lua vim.lsp.buf.formatting_sync(nil, 1000)'
|
||||
}
|
||||
},
|
||||
_javascriptreact_autoformat = {
|
||||
{
|
||||
'BufWritePre', '*.jsx',
|
||||
'lua vim.lsp.buf.formatting_sync(nil, 1000)'
|
||||
}
|
||||
},
|
||||
_typescript_autoformat = {
|
||||
{
|
||||
'BufWritePre', '*.ts',
|
||||
'lua vim.lsp.buf.formatting_sync(nil, 1000)'
|
||||
}
|
||||
},
|
||||
_typescriptreact_autoformat = {
|
||||
{
|
||||
'BufWritePre', '*.tsx',
|
||||
'lua vim.lsp.buf.formatting_sync(nil, 1000)'
|
||||
}
|
||||
}
|
||||
})
|
||||
end
|
||||
vim.cmd("setl ts=2 sw=2")
|
88
ftplugin/typescriptreact.lua
Normal file
88
ftplugin/typescriptreact.lua
Normal file
|
@ -0,0 +1,88 @@
|
|||
-- npm install -g typescript typescript-language-server
|
||||
-- require'snippets'.use_suggested_mappings()
|
||||
-- local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
-- capabilities.textDocument.completion.completionItem.snippetSupport = true;
|
||||
-- local on_attach_common = function(client)
|
||||
-- print("LSP Initialized")
|
||||
-- require'completion'.on_attach(client)
|
||||
-- require'illuminate'.on_attach(client)
|
||||
-- end
|
||||
require'lspconfig'.tsserver.setup {
|
||||
cmd = {
|
||||
DATA_PATH ..
|
||||
"/lspinstall/typescript/node_modules/.bin/typescript-language-server",
|
||||
"--stdio"
|
||||
},
|
||||
filetypes = {
|
||||
"javascript", "javascriptreact", "javascript.jsx", "typescript",
|
||||
"typescriptreact", "typescript.tsx"
|
||||
},
|
||||
on_attach = require'lsp'.tsserver_on_attach,
|
||||
-- This makes sure tsserver is not used for formatting (I prefer prettier)
|
||||
-- on_attach = require'lsp'.common_on_attach,
|
||||
root_dir = require('lspconfig/util').root_pattern("package.json",
|
||||
"tsconfig.json",
|
||||
"jsconfig.json", ".git"),
|
||||
settings = {documentFormatting = false},
|
||||
handlers = {
|
||||
["textDocument/publishDiagnostics"] = vim.lsp.with(
|
||||
vim.lsp.diagnostic.on_publish_diagnostics, {
|
||||
virtual_text = O.lang.tsserver.diagnostics.virtual_text,
|
||||
signs = O.lang.tsserver.diagnostics.signs,
|
||||
underline = O.lang.tsserver.diagnostics.underline,
|
||||
update_in_insert = true
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
if O.lang.tsserver.autoformat then
|
||||
require('lv-utils').define_augroups({
|
||||
_javascript_autoformat = {
|
||||
{
|
||||
|
||||
'BufWritePre', '*.js',
|
||||
'lua vim.lsp.buf.formatting_sync(nil, 1000)'
|
||||
}
|
||||
},
|
||||
_javascriptreact_autoformat = {
|
||||
{
|
||||
'BufWritePre', '*.jsx',
|
||||
'lua vim.lsp.buf.formatting_sync(nil, 1000)'
|
||||
}
|
||||
},
|
||||
_typescript_autoformat = {
|
||||
{
|
||||
'BufWritePre', '*.ts',
|
||||
'lua vim.lsp.buf.formatting_sync(nil, 1000)'
|
||||
}
|
||||
},
|
||||
_typescriptreact_autoformat = {
|
||||
{
|
||||
'BufWritePre', '*.tsx',
|
||||
'lua vim.lsp.buf.formatting_sync(nil, 1000)'
|
||||
}
|
||||
}
|
||||
})
|
||||
end
|
||||
vim.cmd("setl ts=2 sw=2")
|
||||
|
||||
local nvim_lsp = require'lspconfig'
|
||||
local configs = require'lspconfig/configs'
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||
|
||||
configs.emmet_ls = {
|
||||
default_config = {
|
||||
cmd = {'emmet-ls', '--stdio'};
|
||||
filetypes = {'html', 'css', 'javascript', 'javascriptreact', 'typescript', 'typescriptreact'};
|
||||
root_dir = function()
|
||||
return vim.loop.cwd()
|
||||
end;
|
||||
settings = {};
|
||||
};
|
||||
}
|
||||
|
||||
nvim_lsp.emmet_ls.setup{
|
||||
-- on_attach = on_attach;
|
||||
}
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
require('lspconfig').vuels.setup {
|
||||
cmd = {DATA_PATH .. "/lspinstall/vue/node_modules/.bin/vls", "--stdio"},
|
||||
on_attach = require'lsp'.common_on_attach,
|
|
@ -3,3 +3,4 @@ require'lspconfig'.yamlls.setup{
|
|||
cmd = {DATA_PATH .. "/lspinstall/yaml/node_modules/.bin/yaml-language-server", "--stdio"},
|
||||
on_attach = require'lsp'.common_on_attach,
|
||||
}
|
||||
vim.cmd("setl ts=2 sw=2 ts=2 ai et")
|
|
@ -1 +0,0 @@
|
|||
setl ts=2 sw=2 ts=2 ai et
|
40
ftplugin/zsh.lua
Normal file
40
ftplugin/zsh.lua
Normal file
|
@ -0,0 +1,40 @@
|
|||
-- npm i -g bash-language-server
|
||||
require'lspconfig'.bashls.setup {
|
||||
cmd = {DATA_PATH .. "/lspinstall/bash/node_modules/.bin/bash-language-server", "start"},
|
||||
on_attach = require'lsp'.common_on_attach,
|
||||
filetypes = { "sh", "zsh" }
|
||||
}
|
||||
|
||||
-- npm i -g bash-language-server
|
||||
require'lspconfig'.bashls.setup {
|
||||
cmd = {DATA_PATH .. "/lspinstall/bash/node_modules/.bin/bash-language-server", "start"},
|
||||
on_attach = require'lsp'.common_on_attach,
|
||||
filetypes = { "sh", "zsh" }
|
||||
}
|
||||
|
||||
-- sh
|
||||
local sh_arguments = {}
|
||||
|
||||
local shfmt = {formatCommand = 'shfmt -ci -s -bn', formatStdin = true}
|
||||
|
||||
local shellcheck = {
|
||||
LintCommand = 'shellcheck -f gcc -x',
|
||||
lintFormats = {'%f:%l:%c: %trror: %m', '%f:%l:%c: %tarning: %m', '%f:%l:%c: %tote: %m'}
|
||||
}
|
||||
|
||||
if O.lang.sh.formatter == 'shfmt' then table.insert(sh_arguments, shfmt) end
|
||||
|
||||
if O.lang.sh.linter == 'shellcheck' then table.insert(sh_arguments, shellcheck) end
|
||||
|
||||
require"lspconfig".efm.setup {
|
||||
-- init_options = {initializationOptions},
|
||||
cmd = {DATA_PATH .. "/lspinstall/efm/efm-langserver"},
|
||||
init_options = {documentFormatting = true, codeAction = false},
|
||||
filetypes = {"zsh"},
|
||||
settings = {
|
||||
rootMarkers = {".git/"},
|
||||
languages = {
|
||||
sh = sh_arguments,
|
||||
}
|
||||
}
|
||||
}
|
34
init.lua
34
init.lua
|
@ -8,39 +8,5 @@ require('keymappings')
|
|||
require('lv-galaxyline')
|
||||
require('lv-treesitter')
|
||||
require('lv-which-key')
|
||||
|
||||
-- LSP
|
||||
require('lsp')
|
||||
-- TODO should I put this in the filetype files?
|
||||
if O.lang.java.active then require('lsp.java-ls') end
|
||||
if O.lang.clang.active then require('lsp.clangd') end
|
||||
if O.lang.sh.active then require('lsp.bash-ls') end
|
||||
if O.lang.cmake.active then require('lsp.cmake-ls') end
|
||||
if O.lang.css.active then require('lsp.css-ls') end
|
||||
if O.lang.dart.active then require('lsp.dart-ls') end
|
||||
if O.lang.docker.active then require('lsp.docker-ls') end
|
||||
if O.lang.efm.active then require('lsp.efm-general-ls') end
|
||||
if O.lang.elm.active then require('lsp.elm-ls') end
|
||||
if O.lang.emmet.active then require('lsp.emmet-ls') end
|
||||
if O.lang.graphql.active then require('lsp.graphql-ls') end
|
||||
if O.lang.go.active then require('lsp.go-ls') end
|
||||
if O.lang.html.active then require('lsp.html-ls') end
|
||||
if O.lang.json.active then require('lsp.json-ls') end
|
||||
if O.lang.kotlin.active then require('lsp.kotlin-ls') end
|
||||
if O.lang.latex.active then require('lsp.latex-ls') end
|
||||
if O.lang.lua.active then require('lsp.lua-ls') end
|
||||
if O.lang.php.active then require('lsp.php-ls') end
|
||||
if O.lang.python.active then require('lsp.python-ls') end
|
||||
if O.lang.ruby.active then require('lsp.ruby-ls') end
|
||||
if O.lang.rust.active then require('lsp.rust-ls') end
|
||||
if O.lang.svelte.active then require('lsp.svelte-ls') end
|
||||
if O.lang.terraform.active then require('lsp.terraform-ls') end
|
||||
if O.lang.tailwindcss.active then require('lsp.tailwindcss-ls') end
|
||||
if O.lang.vim.active then require('lsp.vim-ls') end
|
||||
if O.lang.yaml.active then require('lsp.yaml-ls') end
|
||||
if O.lang.elixir.active then require('lsp.elixir-ls') end
|
||||
if O.lang.tsserver.active then
|
||||
require('lsp.js-ts-ls')
|
||||
require('lsp.angular-ls')
|
||||
require('lsp.vue-ls')
|
||||
end
|
||||
|
|
|
@ -67,7 +67,6 @@ O = {
|
|||
|
||||
lang = {
|
||||
python = {
|
||||
active = false,
|
||||
linter = '',
|
||||
-- @usage can be 'yapf', 'black'
|
||||
formatter = '',
|
||||
|
@ -85,11 +84,9 @@ O = {
|
|||
}
|
||||
},
|
||||
dart = {
|
||||
active = false,
|
||||
sdk_path = '/usr/lib/dart/bin/snapshots/analysis_server.dart.snapshot'
|
||||
},
|
||||
lua = {
|
||||
active = false,
|
||||
-- @usage can be 'lua-format'
|
||||
formatter = '',
|
||||
autoformat = false,
|
||||
|
@ -100,7 +97,6 @@ O = {
|
|||
}
|
||||
},
|
||||
sh = {
|
||||
active = false,
|
||||
-- @usage can be 'shellcheck'
|
||||
linter = '',
|
||||
-- @usage can be 'shfmt'
|
||||
|
@ -113,7 +109,6 @@ O = {
|
|||
}
|
||||
},
|
||||
tsserver = {
|
||||
active = false,
|
||||
-- @usage can be 'eslint'
|
||||
linter = '',
|
||||
-- @usage can be 'prettier'
|
||||
|
@ -126,7 +121,6 @@ O = {
|
|||
}
|
||||
},
|
||||
json = {
|
||||
active = false,
|
||||
-- @usage can be 'prettier'
|
||||
formatter = '',
|
||||
autoformat = false,
|
||||
|
@ -137,14 +131,12 @@ O = {
|
|||
}
|
||||
},
|
||||
tailwindcss = {
|
||||
active = false,
|
||||
filetypes = {
|
||||
'html', 'css', 'scss', 'javascript', 'javascriptreact',
|
||||
'typescript', 'typescriptreact'
|
||||
}
|
||||
},
|
||||
clang = {
|
||||
active = false,
|
||||
diagnostics = {
|
||||
virtual_text = {spacing = 0, prefix = ""},
|
||||
signs = true,
|
||||
|
@ -152,7 +144,6 @@ O = {
|
|||
}
|
||||
},
|
||||
ruby = {
|
||||
active = false,
|
||||
diagnostics = {
|
||||
virtualtext = {spacing = 0, prefix = ""},
|
||||
signs = true,
|
||||
|
@ -160,13 +151,12 @@ O = {
|
|||
},
|
||||
filetypes = {'rb', 'erb', 'rakefile'}
|
||||
},
|
||||
go = {active = false},
|
||||
elixir = {active = false},
|
||||
vim = {active = false},
|
||||
yaml = {active = false},
|
||||
terraform = {active = false},
|
||||
go = {},
|
||||
elixir = {},
|
||||
vim = {},
|
||||
yaml = {},
|
||||
terraform = {},
|
||||
rust = {
|
||||
active = false,
|
||||
linter = '',
|
||||
formatter = '',
|
||||
autoformat = false,
|
||||
|
@ -176,21 +166,19 @@ O = {
|
|||
underline = true
|
||||
}
|
||||
},
|
||||
svelte = {active = false},
|
||||
php = {active = false},
|
||||
latex = {active = false},
|
||||
kotlin = {active = false},
|
||||
html = {active = false},
|
||||
elm = {active = false},
|
||||
emmet = {active = false},
|
||||
graphql = {active = false},
|
||||
efm = {active = true},
|
||||
docker = {active = false},
|
||||
cmake = {active = false},
|
||||
java = {active = false},
|
||||
svelte = {},
|
||||
php = {},
|
||||
latex = {},
|
||||
kotlin = {},
|
||||
html = {},
|
||||
elm = {},
|
||||
emmet = {active = true},
|
||||
graphql = {},
|
||||
efm = {},
|
||||
docker = {},
|
||||
cmake = {},
|
||||
java = {},
|
||||
css = {
|
||||
active = false,
|
||||
|
||||
formatter = '',
|
||||
autoformat = false,
|
||||
virtual_text = true
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
-- TODO find correct root filetype
|
||||
-- :LspInstall angular
|
||||
require'lspconfig'.angularls.setup {
|
||||
cmd = {DATA_PATH .. "/lspinstall/angular/node_modules/@angular/language-server/bin/ngserver", "--stdio"},
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
-- npm i -g bash-language-server
|
||||
require'lspconfig'.bashls.setup {
|
||||
cmd = {DATA_PATH .. "/lspinstall/bash/node_modules/.bin/bash-language-server", "start"},
|
||||
on_attach = require'lsp'.common_on_attach,
|
||||
filetypes = { "sh", "zsh" }
|
||||
}
|
|
@ -1,62 +1,4 @@
|
|||
-- Example configuations here: https://github.com/mattn/efm-langserver
|
||||
-- TODO this file needs to be refactored eache lang should be it's own file
|
||||
-- python
|
||||
local python_arguments = {}
|
||||
|
||||
-- TODO replace with path argument
|
||||
local flake8 = {
|
||||
LintCommand = "flake8 --ignore=E501 --stdin-display-name ${INPUT} -",
|
||||
lintStdin = true,
|
||||
lintFormats = {"%f:%l:%c: %m"}
|
||||
}
|
||||
|
||||
local isort = {formatCommand = "isort --quiet -", formatStdin = true}
|
||||
|
||||
local yapf = {formatCommand = "yapf --quiet", formatStdin = true}
|
||||
local black = {formatCommand = "black --quiet -", formatStdin = true}
|
||||
|
||||
if O.lang.python.linter == 'flake8' then table.insert(python_arguments, flake8) end
|
||||
|
||||
if O.lang.python.isort then table.insert(python_arguments, isort) end
|
||||
|
||||
if O.lang.python.formatter == 'yapf' then
|
||||
table.insert(python_arguments, yapf)
|
||||
elseif O.lang.python.formatter == 'black' then
|
||||
table.insert(python_arguments, black)
|
||||
end
|
||||
|
||||
-- lua
|
||||
local lua_arguments = {}
|
||||
|
||||
local luaFormat = {
|
||||
formatCommand = "lua-format -i --no-keep-simple-function-one-line --column-limit=80",
|
||||
formatStdin = true
|
||||
}
|
||||
|
||||
local lua_fmt = {
|
||||
formatCommand = "luafmt --indent-count 2 --line-width 120 --stdin",
|
||||
formatStdin = true
|
||||
}
|
||||
|
||||
if O.lang.lua.formatter == 'lua-format' then
|
||||
table.insert(lua_arguments, luaFormat)
|
||||
elseif O.lang.lua.formatter == 'lua-fmt' then
|
||||
table.insert(lua_arguments, lua_fmt)
|
||||
end
|
||||
|
||||
-- sh
|
||||
local sh_arguments = {}
|
||||
|
||||
local shfmt = {formatCommand = 'shfmt -ci -s -bn', formatStdin = true}
|
||||
|
||||
local shellcheck = {
|
||||
LintCommand = 'shellcheck -f gcc -x',
|
||||
lintFormats = {'%f:%l:%c: %trror: %m', '%f:%l:%c: %tarning: %m', '%f:%l:%c: %tote: %m'}
|
||||
}
|
||||
|
||||
if O.lang.sh.formatter == 'shfmt' then table.insert(sh_arguments, shfmt) end
|
||||
|
||||
if O.lang.sh.linter == 'shellcheck' then table.insert(sh_arguments, shellcheck) end
|
||||
|
||||
-- tsserver/web javascript react, vue, json, html, css, yaml
|
||||
local prettier = {formatCommand = "prettier --stdin-filepath ${INPUT}", formatStdin = true}
|
||||
|
@ -96,9 +38,6 @@ require"lspconfig".efm.setup {
|
|||
settings = {
|
||||
rootMarkers = {".git/"},
|
||||
languages = {
|
||||
python = python_arguments,
|
||||
lua = lua_arguments,
|
||||
sh = sh_arguments,
|
||||
javascript = tsserver_args,
|
||||
javascriptreact = tsserver_args,
|
||||
typescript = tsserver_args,
|
||||
|
|
|
@ -6,7 +6,7 @@ capabilities.textDocument.completion.completionItem.snippetSupport = true
|
|||
configs.emmet_ls = {
|
||||
default_config = {
|
||||
cmd = {'emmet-ls', '--stdio'};
|
||||
filetypes = {'html', 'css'};
|
||||
filetypes = {'html', 'css', 'javascript', 'javascriptreact', 'typescript', 'typescriptreact'};
|
||||
root_dir = function()
|
||||
return vim.loop.cwd()
|
||||
end;
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
-- TODO what is a svelte filetype
|
||||
require'lspconfig'.svelte.setup {
|
||||
cmd = {DATA_PATH .. "/lspinstall/svelte/node_modules/.bin/svelteserver", "--stdio"},
|
||||
on_attach = require'lsp'.common_on_attach
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
-- TODO what is a tailwindcss filetype
|
||||
local lspconfig = require 'lspconfig'
|
||||
|
||||
lspconfig.tailwindcss.setup {
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
local remap = vim.api.nvim_set_keymap
|
||||
local npairs = require('nvim-autopairs')
|
||||
local Rule = require('nvim-autopairs.rule')
|
||||
|
||||
|
|
|
@ -35,10 +35,11 @@ return require("packer").startup(function(use)
|
|||
-- TODO refactor all of this (for now it works, but yes I know it could be wrapped in a simpler function)
|
||||
use {"neovim/nvim-lspconfig"}
|
||||
use {"glepnir/lspsaga.nvim", event = "BufRead"}
|
||||
use {"kabouzeid/nvim-lspinstall", event = "BufRead"}
|
||||
use {"kabouzeid/nvim-lspinstall"}
|
||||
-- Telescope
|
||||
use {"nvim-lua/popup.nvim"}
|
||||
use {"nvim-lua/plenary.nvim"}
|
||||
use {"tjdevries/astronauta.nvim"}
|
||||
use {
|
||||
"nvim-telescope/telescope.nvim",
|
||||
config = [[require('lv-telescope')]],
|
||||
|
|
|
@ -49,7 +49,6 @@ O.lang.clang.diagnostics.underline = false
|
|||
-- add things like O.python.formatter.isort.exec_path
|
||||
O.lang.python.formatter = 'yapf'
|
||||
-- O.python.linter = 'flake8'
|
||||
O.lang.python.active = true
|
||||
O.lang.python.isort = true
|
||||
O.lang.python.autoformat = true
|
||||
O.lang.python.diagnostics.virtual_text = true
|
||||
|
@ -59,9 +58,9 @@ O.lang.python.analysis.type_checking = "off"
|
|||
O.lang.python.analysis.auto_search_paths = true
|
||||
O.lang.python.analysis.use_library_code_types = true
|
||||
|
||||
|
||||
-- lua
|
||||
-- TODO look into stylua
|
||||
O.lang.lua.active = true
|
||||
O.lang.lua.formatter = 'lua-format'
|
||||
-- O.lua.formatter = 'lua-format'
|
||||
O.lang.lua.autoformat = false
|
||||
|
@ -72,7 +71,6 @@ O.lang.tsserver.linter = nil
|
|||
O.lang.tsserver.autoformat = true
|
||||
|
||||
-- json
|
||||
O.lang.json.active = false
|
||||
O.lang.json.autoformat = true
|
||||
|
||||
-- ruby
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue