mirror of
https://github.com/LunarVim/LunarVim.git
synced 2025-08-03 09:35:26 +02:00
reformat most langs
This commit is contained in:
parent
81adc270dd
commit
2a7b3d4892
54 changed files with 1660 additions and 843 deletions
|
@ -1,40 +1,4 @@
|
||||||
O.formatters.filetype["c"] = {
|
require("lang.c").format()
|
||||||
function()
|
require("lang.c").lint()
|
||||||
return {
|
require("lang.c").lsp()
|
||||||
exe = O.lang.clang.formatter.exe,
|
require("lang.c").dap()
|
||||||
args = O.lang.clang.formatter.args,
|
|
||||||
stdin = not (O.lang.clang.formatter.stdin ~= nil),
|
|
||||||
}
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
O.formatters.filetype["cpp"] = O.formatters.filetype["c"]
|
|
||||||
|
|
||||||
require("formatter.config").set_defaults {
|
|
||||||
logging = false,
|
|
||||||
filetype = O.formatters.filetype,
|
|
||||||
}
|
|
||||||
|
|
||||||
if require("lv-utils").check_lsp_client_active "clangd" then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local clangd_flags = { "--background-index" }
|
|
||||||
|
|
||||||
if O.lang.clang.cross_file_rename then
|
|
||||||
table.insert(clangd_flags, "--cross-file-rename")
|
|
||||||
end
|
|
||||||
|
|
||||||
table.insert(clangd_flags, "--header-insertion=" .. O.lang.clang.header_insertion)
|
|
||||||
|
|
||||||
require("lspconfig").clangd.setup {
|
|
||||||
cmd = { DATA_PATH .. "/lspinstall/cpp/clangd/bin/clangd", unpack(clangd_flags) },
|
|
||||||
on_attach = require("lsp").common_on_attach,
|
|
||||||
handlers = {
|
|
||||||
["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
|
|
||||||
virtual_text = O.lang.clang.diagnostics.virtual_text,
|
|
||||||
signs = O.lang.clang.diagnostics.signs,
|
|
||||||
underline = O.lang.clang.diagnostics.underline,
|
|
||||||
update_in_insert = true,
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,9 +1,4 @@
|
||||||
if require("lv-utils").check_lsp_client_active "cmake" then
|
require("lang.cmake").format()
|
||||||
return
|
require("lang.cmake").lint()
|
||||||
end
|
require("lang.cmake").lsp()
|
||||||
|
require("lang.cmake").dap()
|
||||||
require("lspconfig").cmake.setup {
|
|
||||||
cmd = { DATA_PATH .. "/lspinstall/cmake/venv/bin/cmake-language-server" },
|
|
||||||
on_attach = require("lsp").common_on_attach,
|
|
||||||
filetypes = { "cmake" },
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,10 +1,4 @@
|
||||||
if require("lv-utils").check_lsp_client_active "omnisharp" then
|
require("lang.cs").format()
|
||||||
return
|
require("lang.cs").lint()
|
||||||
end
|
require("lang.cs").lsp()
|
||||||
|
require("lang.cs").dap()
|
||||||
-- C# language server (csharp/OmniSharp) setup
|
|
||||||
require("lspconfig").omnisharp.setup {
|
|
||||||
on_attach = require("lsp").common_on_attach,
|
|
||||||
root_dir = require("lspconfig").util.root_pattern(".sln", ".git"),
|
|
||||||
cmd = { DATA_PATH .. "/lspinstall/csharp/omnisharp/run", "--languageserver", "--hostPID", tostring(vim.fn.getpid()) },
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,49 +1,4 @@
|
||||||
vim.cmd "let proj = FindRootDirectory()"
|
require("lang.css").format()
|
||||||
local root_dir = vim.api.nvim_get_var "proj"
|
require("lang.css").lint()
|
||||||
|
require("lang.css").lsp()
|
||||||
-- use the global prettier if you didn't find the local one
|
require("lang.css").dap()
|
||||||
local prettier_instance = root_dir .. "/node_modules/.bin/prettier"
|
|
||||||
if vim.fn.executable(prettier_instance) ~= 1 then
|
|
||||||
prettier_instance = O.lang.tsserver.formatter.exe
|
|
||||||
end
|
|
||||||
|
|
||||||
local ft = vim.bo.filetype
|
|
||||||
O.formatters.filetype[ft]= {
|
|
||||||
function()
|
|
||||||
local args = { "--stdin-filepath", vim.fn.fnameescape(vim.api.nvim_buf_get_name(0)) }
|
|
||||||
-- TODO: O.lang.[ft].formatter.args
|
|
||||||
local extend_args = O.lang.css.formatter.args
|
|
||||||
|
|
||||||
for i = 1, #extend_args do
|
|
||||||
table.insert(args, extend_args[i])
|
|
||||||
end
|
|
||||||
|
|
||||||
return {
|
|
||||||
exe = prettier_instance,
|
|
||||||
args = args,
|
|
||||||
stdin = true
|
|
||||||
}
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
|
|
||||||
require("formatter.config").set_defaults {
|
|
||||||
logging = false,
|
|
||||||
filetype = O.formatters.filetype,
|
|
||||||
}
|
|
||||||
|
|
||||||
if not require("lv-utils").check_lsp_client_active "cssls" then
|
|
||||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
|
||||||
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
|
||||||
-- npm install -g vscode-css-languageserver-bin
|
|
||||||
require("lspconfig").cssls.setup {
|
|
||||||
cmd = {
|
|
||||||
"node",
|
|
||||||
DATA_PATH .. "/lspinstall/css/vscode-css/css-language-features/server/dist/node/cssServerMain.js",
|
|
||||||
"--stdio",
|
|
||||||
},
|
|
||||||
on_attach = require("lsp").common_on_attach,
|
|
||||||
capabilities = capabilities,
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
vim.cmd "setl ts=2 sw=2"
|
|
||||||
|
|
|
@ -1,29 +1,4 @@
|
||||||
O.formatters.filetype["dart"] = {
|
require("lang.dart").format()
|
||||||
function()
|
require("lang.dart").lint()
|
||||||
return {
|
require("lang.dart").lsp()
|
||||||
exe = O.lang.dart.formatter.exe,
|
require("lang.dart").dap()
|
||||||
args = O.lang.dart.formatter.args,
|
|
||||||
stdin = not (O.lang.dart.formatter.stdin ~= nil),
|
|
||||||
}
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
|
|
||||||
require("formatter.config").set_defaults {
|
|
||||||
logging = false,
|
|
||||||
filetype = O.formatters.filetype,
|
|
||||||
}
|
|
||||||
if require("lv-utils").check_lsp_client_active "dartls" then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
require("lspconfig").dartls.setup {
|
|
||||||
cmd = { "dart", O.lang.dart.sdk_path, "--lsp" },
|
|
||||||
on_attach = require("lsp").common_on_attach,
|
|
||||||
init_options = {
|
|
||||||
closingLabels = false,
|
|
||||||
flutterOutline = false,
|
|
||||||
onlyAnalyzeProjectsWithOpenFiles = false,
|
|
||||||
outline = false,
|
|
||||||
suggestFromUnimportedLibraries = true,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,10 +1,4 @@
|
||||||
if require("lv-utils").check_lsp_client_active "dockerls" then
|
require("lang.dockerfile").format()
|
||||||
return
|
require("lang.dockerfile").lint()
|
||||||
end
|
require("lang.dockerfile").lsp()
|
||||||
|
require("lang.dockerfile").dap()
|
||||||
-- npm install -g dockerfile-language-server-nodejs
|
|
||||||
require("lspconfig").dockerls.setup {
|
|
||||||
cmd = { DATA_PATH .. "/lspinstall/dockerfile/node_modules/.bin/docker-langserver", "--stdio" },
|
|
||||||
on_attach = require("lsp").common_on_attach,
|
|
||||||
root_dir = vim.loop.cwd,
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,29 +1,4 @@
|
||||||
if require("lv-utils").check_lsp_client_active "elixirls" then
|
require("lang.elixir").format()
|
||||||
return
|
require("lang.elixir").lint()
|
||||||
end
|
require("lang.elixir").lsp()
|
||||||
|
require("lang.elixir").dap()
|
||||||
O.formatters.filetype["elixir"] = {
|
|
||||||
function()
|
|
||||||
return {
|
|
||||||
exe = O.lang.elixir.formatter.exe,
|
|
||||||
args = O.lang.elixir.formatter.args,
|
|
||||||
stdin = not (O.lang.elixir.formatter.stdin ~= nil),
|
|
||||||
}
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
|
|
||||||
require("formatter.config").set_defaults {
|
|
||||||
logging = false,
|
|
||||||
filetype = O.formatters.filetype,
|
|
||||||
}
|
|
||||||
|
|
||||||
require("lspconfig").elixirls.setup {
|
|
||||||
cmd = { DATA_PATH .. "/lspinstall/elixir/elixir-ls/language_server.sh" },
|
|
||||||
}
|
|
||||||
|
|
||||||
-- needed for the LSP to recognize elixir files (alternativly just use elixir-editors/vim-elixir)
|
|
||||||
-- vim.cmd([[
|
|
||||||
-- au BufRead,BufNewFile *.ex,*.exs set filetype=elixir
|
|
||||||
-- au BufRead,BufNewFile *.eex,*.leex,*.sface set filetype=eelixir
|
|
||||||
-- au BufRead,BufNewFile mix.lock set filetype=elixir
|
|
||||||
-- ]])
|
|
||||||
|
|
|
@ -1,13 +1,4 @@
|
||||||
if require("lv-utils").check_lsp_client_active "elmls" then
|
require("lang.elm").format()
|
||||||
return
|
require("lang.elm").lint()
|
||||||
end
|
require("lang.elm").lsp()
|
||||||
|
require("lang.elm").dap()
|
||||||
require("lspconfig").elmls.setup {
|
|
||||||
cmd = { DATA_PATH .. "/lspinstall/elm/node_modules/.bin/elm-language-server" },
|
|
||||||
init_options = {
|
|
||||||
elmAnalyseTrigger = "change",
|
|
||||||
elmFormatPath = DATA_PATH .. "/lspinstall/elm/node_modules/.bin/elm-format",
|
|
||||||
elmPath = DATA_PATH .. "/lspinstall/elm/node_modules/.bin/elm",
|
|
||||||
elmTestPath = DATA_PATH .. "/lspinstall/elm/node_modules/.bin/elm-test",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,15 +1,4 @@
|
||||||
if require("lv-utils").check_lsp_client_active "elixirls" then
|
require("lang.euphoria3").format()
|
||||||
return
|
require("lang.euphoria3").lint()
|
||||||
end
|
require("lang.euphoria3").lsp()
|
||||||
|
require("lang.euphoria3").dap()
|
||||||
-- TODO: Remove this at some point
|
|
||||||
require("lspconfig").elixirls.setup {
|
|
||||||
cmd = { DATA_PATH .. "/lspinstall/elixir/elixir-ls/language_server.sh" },
|
|
||||||
}
|
|
||||||
|
|
||||||
-- needed for the LSP to recognize elixir files (alternativly just use elixir-editors/vim-elixir)
|
|
||||||
-- vim.cmd([[
|
|
||||||
-- au BufRead,BufNewFile *.ex,*.exs set filetype=elixir
|
|
||||||
-- au BufRead,BufNewFile *.eex,*.leex,*.sface set filetype=eelixir
|
|
||||||
-- au BufRead,BufNewFile mix.lock set filetype=elixir
|
|
||||||
-- ]])
|
|
||||||
|
|
|
@ -1,29 +1,4 @@
|
||||||
O.formatters.filetype["go"] = {
|
require("lang.go").format()
|
||||||
function()
|
require("lang.go").lint()
|
||||||
return {
|
require("lang.go").lsp()
|
||||||
exe = O.lang.go.formatter.exe,
|
require("lang.go").dap()
|
||||||
args = O.lang.go.formatter.args,
|
|
||||||
stdin = not (O.lang.go.formatter.stdin ~= nil),
|
|
||||||
}
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
|
|
||||||
require("formatter.config").set_defaults {
|
|
||||||
logging = false,
|
|
||||||
filetype = O.formatters.filetype,
|
|
||||||
}
|
|
||||||
|
|
||||||
if not require("lv-utils").check_lsp_client_active "gopls" then
|
|
||||||
require("lspconfig").gopls.setup {
|
|
||||||
cmd = { DATA_PATH .. "/lspinstall/go/gopls" },
|
|
||||||
settings = { gopls = { analyses = { unusedparams = true }, staticcheck = true } },
|
|
||||||
root_dir = require("lspconfig").util.root_pattern(".git", "go.mod"),
|
|
||||||
init_options = { usePlaceholders = true, completeUnimported = true },
|
|
||||||
on_attach = require("lsp").common_on_attach,
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
vim.opt_local.tabstop = 4
|
|
||||||
vim.opt_local.shiftwidth = 4
|
|
||||||
vim.opt_local.softtabstop = 4
|
|
||||||
vim.opt_local.expandtab = false
|
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
if require("lv-utils").check_lsp_client_active "graphql" then
|
require("lang.graphql").format()
|
||||||
return
|
require("lang.graphql").lint()
|
||||||
end
|
require("lang.graphql").lsp()
|
||||||
|
require("lang.graphql").dap()
|
||||||
-- npm install -g graphql-language-service-cli
|
|
||||||
require("lspconfig").graphql.setup { on_attach = require("lsp").common_on_attach }
|
|
||||||
|
|
|
@ -1,17 +1,4 @@
|
||||||
if not require("lv-utils").check_lsp_client_active "html" then
|
require("lang.html").format()
|
||||||
-- npm install -g vscode-html-languageserver-bin
|
require("lang.html").lint()
|
||||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
require("lang.html").lsp()
|
||||||
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
require("lang.html").dap()
|
||||||
|
|
||||||
require("lspconfig").html.setup {
|
|
||||||
cmd = {
|
|
||||||
"node",
|
|
||||||
DATA_PATH .. "/lspinstall/html/vscode-html/html-language-features/server/dist/node/htmlServerMain.js",
|
|
||||||
"--stdio",
|
|
||||||
},
|
|
||||||
on_attach = require("lsp").common_on_attach,
|
|
||||||
capabilities = capabilities,
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
vim.cmd "setl ts=2 sw=2"
|
|
||||||
|
|
|
@ -1,96 +1,4 @@
|
||||||
vim.cmd "let proj = FindRootDirectory()"
|
require("lang.java").format()
|
||||||
local root_dir = vim.api.nvim_get_var "proj"
|
require("lang.java").lint()
|
||||||
|
require("lang.java").lsp()
|
||||||
-- use the global prettier if you didn't find the local one
|
require("lang.java").dap()
|
||||||
local prettier_instance = root_dir .. "/node_modules/.bin/prettier"
|
|
||||||
if vim.fn.executable(prettier_instance) ~= 1 then
|
|
||||||
prettier_instance = O.lang.tsserver.formatter.exe
|
|
||||||
end
|
|
||||||
|
|
||||||
O.formatters.filetype["java"] = {
|
|
||||||
function()
|
|
||||||
return {
|
|
||||||
exe = prettier_instance,
|
|
||||||
-- TODO: allow user to override this
|
|
||||||
args = { "--stdin-filepath", vim.api.nvim_buf_get_name(0) },
|
|
||||||
stdin = true,
|
|
||||||
}
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
|
|
||||||
require("formatter.config").set_defaults {
|
|
||||||
logging = false,
|
|
||||||
filetype = O.formatters.filetype,
|
|
||||||
}
|
|
||||||
|
|
||||||
if require("lv-utils").check_lsp_client_active "jdtls" then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
if O.lang.java.java_tools.active then
|
|
||||||
-- find_root looks for parent directories relative to the current buffer containing one of the given arguments.
|
|
||||||
if vim.fn.has "mac" == 1 then
|
|
||||||
WORKSPACE_PATH = "/Users/" .. USER .. "/workspace/"
|
|
||||||
elseif vim.fn.has "unix" == 1 then
|
|
||||||
WORKSPACE_PATH = "/home/" .. USER .. "/workspace/"
|
|
||||||
else
|
|
||||||
print "Unsupported system"
|
|
||||||
end
|
|
||||||
JAVA_LS_EXECUTABLE = CONFIG_PATH .. "/utils/bin/jdtls"
|
|
||||||
|
|
||||||
require("jdtls").start_or_attach {
|
|
||||||
on_attach = require("lsp").common_on_attach,
|
|
||||||
cmd = { JAVA_LS_EXECUTABLE, WORKSPACE_PATH .. vim.fn.fnamemodify(vim.fn.getcwd(), ":p:h:t") },
|
|
||||||
}
|
|
||||||
|
|
||||||
vim.api.nvim_set_keymap(
|
|
||||||
"n",
|
|
||||||
"<leader>la",
|
|
||||||
":lua require('jdtls').code_action()<CR>",
|
|
||||||
{ noremap = true, silent = true }
|
|
||||||
)
|
|
||||||
vim.api.nvim_set_keymap(
|
|
||||||
"n",
|
|
||||||
"<leader>lR",
|
|
||||||
":lua require('jdtls').code_action(false, 'refactor')<CR>",
|
|
||||||
{ noremap = true, silent = true }
|
|
||||||
)
|
|
||||||
|
|
||||||
vim.cmd "command! -buffer JdtCompile lua require('jdtls').compile()"
|
|
||||||
vim.cmd "command! -buffer JdtUpdateConfig lua require('jdtls').update_project_config()"
|
|
||||||
-- vim.cmd "command! -buffer JdtJol lua require('jdtls').jol()"
|
|
||||||
vim.cmd "command! -buffer JdtBytecode lua require('jdtls').javap()"
|
|
||||||
-- vim.cmd "command! -buffer JdtJshell lua require('jdtls').jshell()"
|
|
||||||
else
|
|
||||||
local util = require "lspconfig/util"
|
|
||||||
|
|
||||||
require("lspconfig").jdtls.setup {
|
|
||||||
on_attach = require("lsp").common_on_attach,
|
|
||||||
cmd = { DATA_PATH .. "/lspinstall/java/jdtls.sh" },
|
|
||||||
filetypes = { "java" },
|
|
||||||
root_dir = util.root_pattern { ".git", "build.gradle", "pom.xml" },
|
|
||||||
-- init_options = {bundles = bundles}
|
|
||||||
-- on_attach = require'lsp'.common_on_attach
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
-- local bundles = {
|
|
||||||
-- vim.fn.glob(
|
|
||||||
-- CONFIG_PATH.."/.debuggers/java-debug/com.microsoft.java.debug.plugin/target/com.microsoft.java.debug.plugin-*.jar")
|
|
||||||
-- };
|
|
||||||
|
|
||||||
-- require('jdtls').start_or_attach({
|
|
||||||
-- on_attach = on_attach,
|
|
||||||
-- cmd = {DATA_PATH .. "/lspinstall/java/jdtls.sh"},
|
|
||||||
-- root_dir = require('jdtls.setup').find_root({'build.gradle', 'pom.xml', '.git'}),
|
|
||||||
-- init_options = {bundles = bundles}
|
|
||||||
-- })
|
|
||||||
|
|
||||||
-- TODO: setup autoformat stuff later
|
|
||||||
-- _java = {
|
|
||||||
-- -- {'FileType', 'java', 'luafile '..CONFIG_PATH..'/lua/lsp/java-ls.lua'},
|
|
||||||
-- {
|
|
||||||
-- 'FileType', 'java',
|
|
||||||
-- 'nnoremap ca <Cmd>lua require(\'jdtls\').code_action()<CR>'
|
|
||||||
-- }
|
|
||||||
-- }
|
|
||||||
|
|
|
@ -1,35 +1,4 @@
|
||||||
O.formatters.filetype["json"] = {
|
require("lang.json").format()
|
||||||
function()
|
require("lang.json").lint()
|
||||||
return {
|
require("lang.json").lsp()
|
||||||
exe = O.lang.json.formatter.exe,
|
require("lang.json").dap()
|
||||||
args = O.lang.json.formatter.args,
|
|
||||||
stdin = not (O.lang.json.formatter.stdin ~= nil),
|
|
||||||
}
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
|
|
||||||
require("formatter.config").set_defaults {
|
|
||||||
logging = false,
|
|
||||||
filetype = O.formatters.filetype,
|
|
||||||
}
|
|
||||||
if require("lv-utils").check_lsp_client_active "jsonls" then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
-- npm install -g vscode-json-languageserver
|
|
||||||
require("lspconfig").jsonls.setup {
|
|
||||||
cmd = {
|
|
||||||
"node",
|
|
||||||
DATA_PATH .. "/lspinstall/json/vscode-json/json-language-features/server/dist/node/jsonServerMain.js",
|
|
||||||
"--stdio",
|
|
||||||
},
|
|
||||||
on_attach = require("lsp").common_on_attach,
|
|
||||||
|
|
||||||
commands = {
|
|
||||||
Format = {
|
|
||||||
function()
|
|
||||||
vim.lsp.buf.range_formatting({}, { 0, 0 }, { vim.fn.line "$", 0 })
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,38 +1,4 @@
|
||||||
if require("lv-utils").check_lsp_client_active "kotlin_language_server" then
|
require("lang.kotlin").format()
|
||||||
return
|
require("lang.kotlin").lint()
|
||||||
end
|
require("lang.kotlin").lsp()
|
||||||
|
require("lang.kotlin").dap()
|
||||||
--- default config for gradle-projects of the
|
|
||||||
--- kotlin-language-server: https://github.com/fwcd/kotlin-language-server
|
|
||||||
---
|
|
||||||
--- This server requires vim to be aware of the kotlin-filetype.
|
|
||||||
--- You could refer for this capability to:
|
|
||||||
--- https://github.com/udalov/kotlin-vim (recommended)
|
|
||||||
--- Note that there is no LICENSE specified yet.
|
|
||||||
|
|
||||||
local util = require "lspconfig/util"
|
|
||||||
|
|
||||||
local bin_name = DATA_PATH .. "/lspinstall/kotlin/server/bin/kotlin-language-server"
|
|
||||||
if vim.fn.has "win32" == 1 then
|
|
||||||
bin_name = bin_name .. ".bat"
|
|
||||||
end
|
|
||||||
|
|
||||||
local root_files = {
|
|
||||||
"settings.gradle", -- Gradle (multi-project)
|
|
||||||
"settings.gradle.kts", -- Gradle (multi-project)
|
|
||||||
"build.xml", -- Ant
|
|
||||||
"pom.xml", -- Maven
|
|
||||||
}
|
|
||||||
|
|
||||||
local fallback_root_files = {
|
|
||||||
"build.gradle", -- Gradle
|
|
||||||
"build.gradle.kts", -- Gradle
|
|
||||||
}
|
|
||||||
|
|
||||||
require("lspconfig").kotlin_language_server.setup {
|
|
||||||
cmd = { bin_name },
|
|
||||||
on_attach = require("lsp").common_on_attach,
|
|
||||||
root_dir = function(fname)
|
|
||||||
return util.root_pattern(unpack(root_files))(fname) or util.root_pattern(unpack(fallback_root_files))(fname)
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,47 +1,4 @@
|
||||||
O.formatters.filetype["lua"] = {
|
require("lang.lua").format()
|
||||||
function()
|
require("lang.lua").lint()
|
||||||
return {
|
require("lang.lua").lsp()
|
||||||
exe = O.lang.lua.formatter.exe,
|
require("lang.lua").dap()
|
||||||
args = O.lang.lua.formatter.args,
|
|
||||||
stdin = not (O.lang.lua.formatter.stdin ~= nil),
|
|
||||||
}
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
|
|
||||||
require("formatter.config").set_defaults {
|
|
||||||
logging = false,
|
|
||||||
filetype = O.formatters.filetype,
|
|
||||||
}
|
|
||||||
if not require("lv-utils").check_lsp_client_active "sumneko_lua" then
|
|
||||||
-- https://github.com/sumneko/lua-language-server/wiki/Build-and-Run-(Standalone)
|
|
||||||
local sumneko_root_path = DATA_PATH .. "/lspinstall/lua"
|
|
||||||
local sumneko_binary = sumneko_root_path .. "/sumneko-lua-language-server"
|
|
||||||
|
|
||||||
require("lspconfig").sumneko_lua.setup {
|
|
||||||
cmd = { sumneko_binary, "-E", sumneko_root_path .. "/main.lua" },
|
|
||||||
on_attach = require("lsp").common_on_attach,
|
|
||||||
settings = {
|
|
||||||
Lua = {
|
|
||||||
runtime = {
|
|
||||||
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
|
|
||||||
version = "LuaJIT",
|
|
||||||
-- Setup your lua path
|
|
||||||
path = vim.split(package.path, ";"),
|
|
||||||
},
|
|
||||||
diagnostics = {
|
|
||||||
-- Get the language server to recognize the `vim` global
|
|
||||||
globals = { "vim" },
|
|
||||||
},
|
|
||||||
workspace = {
|
|
||||||
-- Make the server aware of Neovim runtime files
|
|
||||||
library = {
|
|
||||||
[vim.fn.expand "$VIMRUNTIME/lua"] = true,
|
|
||||||
[vim.fn.expand "$VIMRUNTIME/lua/vim/lsp"] = true,
|
|
||||||
},
|
|
||||||
maxPreload = 100000,
|
|
||||||
preloadFileSize = 1000,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
|
@ -1,41 +1,4 @@
|
||||||
O.formatters.filetype["php"] = {
|
require("lang.php").format()
|
||||||
function()
|
require("lang.php").lint()
|
||||||
return {
|
require("lang.php").lsp()
|
||||||
exe = O.lang.php.formatter.exe,
|
require("lang.php").dap()
|
||||||
args = O.lang.php.formatter.args,
|
|
||||||
stdin = not (O.lang.php.formatter.stdin ~= nil),
|
|
||||||
}
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
|
|
||||||
require("formatter.config").set_defaults {
|
|
||||||
logging = false,
|
|
||||||
filetype = O.formatters.filetype,
|
|
||||||
}
|
|
||||||
if require("lv-utils").check_lsp_client_active "intelephense" then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
require("lspconfig").intelephense.setup {
|
|
||||||
cmd = { DATA_PATH .. "/lspinstall/php/node_modules/.bin/intelephense", "--stdio" },
|
|
||||||
on_attach = require("lsp").common_on_attach,
|
|
||||||
handlers = {
|
|
||||||
["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
|
|
||||||
virtual_text = O.lang.php.diagnostics.virtual_text,
|
|
||||||
signs = O.lang.php.diagnostics.signs,
|
|
||||||
underline = O.lang.php.diagnostics.underline,
|
|
||||||
update_in_insert = true,
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
filetypes = O.lang.php.filetypes,
|
|
||||||
settings = {
|
|
||||||
intelephense = {
|
|
||||||
format = {
|
|
||||||
braces = O.lang.php.format.braces,
|
|
||||||
},
|
|
||||||
environment = {
|
|
||||||
phpVersion = O.lang.php.environment.php_version,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,32 +1,4 @@
|
||||||
O.formatters.filetype["ruby"] = {
|
require("lang.ruby").format()
|
||||||
function()
|
require("lang.ruby").lint()
|
||||||
return {
|
require("lang.ruby").lsp()
|
||||||
exe = O.lang.ruby.formatter.exe,
|
require("lang.ruby").dap()
|
||||||
args = O.lang.ruby.formatter.args,
|
|
||||||
stdin = not (O.lang.ruby.formatter.stdin ~= nil),
|
|
||||||
}
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
|
|
||||||
require("formatter.config").set_defaults {
|
|
||||||
logging = false,
|
|
||||||
filetype = O.formatters.filetype,
|
|
||||||
}
|
|
||||||
if require("lv-utils").check_lsp_client_active "solargraph" then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
-- If you are using rvm, make sure to change below configuration
|
|
||||||
require("lspconfig").solargraph.setup {
|
|
||||||
cmd = { DATA_PATH .. "/lspinstall/ruby/solargraph/solargraph", "stdio" },
|
|
||||||
on_attach = require("lsp").common_on_attach,
|
|
||||||
handlers = {
|
|
||||||
["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
|
|
||||||
virtual_text = O.lang.ruby.diagnostics.virtual_text,
|
|
||||||
signs = O.lang.ruby.diagnostics.signs,
|
|
||||||
underline = O.lang.ruby.diagnostics.underline,
|
|
||||||
update_in_insert = true,
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
filetypes = O.lang.ruby.filetypes,
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,111 +1,4 @@
|
||||||
O.formatters.filetype["rust"] = {
|
require("lang.rust").format()
|
||||||
function()
|
require("lang.rust").lint()
|
||||||
return {
|
require("lang.rust").lsp()
|
||||||
exe = O.lang.rust.formatter.exe,
|
require("lang.rust").dap()
|
||||||
args = O.lang.rust.formatter.args,
|
|
||||||
stdin = not (O.lang.rust.formatter.stdin ~= nil),
|
|
||||||
}
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
|
|
||||||
require("formatter.config").set_defaults {
|
|
||||||
logging = false,
|
|
||||||
filetype = O.formatters.filetype,
|
|
||||||
}
|
|
||||||
if require("lv-utils").check_lsp_client_active "rust_analyzer" then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
if O.lang.rust.rust_tools.active then
|
|
||||||
local opts = {
|
|
||||||
tools = { -- rust-tools options
|
|
||||||
-- automatically set inlay hints (type hints)
|
|
||||||
-- There is an issue due to which the hints are not applied on the first
|
|
||||||
-- opened file. For now, write to the file to trigger a reapplication of
|
|
||||||
-- the hints or just run :RustSetInlayHints.
|
|
||||||
-- default: true
|
|
||||||
autoSetHints = true,
|
|
||||||
|
|
||||||
-- whether to show hover actions inside the hover window
|
|
||||||
-- this overrides the default hover handler
|
|
||||||
-- default: true
|
|
||||||
hover_with_actions = true,
|
|
||||||
|
|
||||||
runnables = {
|
|
||||||
-- whether to use telescope for selection menu or not
|
|
||||||
-- default: true
|
|
||||||
use_telescope = true,
|
|
||||||
|
|
||||||
-- rest of the opts are forwarded to telescope
|
|
||||||
},
|
|
||||||
|
|
||||||
inlay_hints = {
|
|
||||||
-- wheter to show parameter hints with the inlay hints or not
|
|
||||||
-- default: true
|
|
||||||
show_parameter_hints = true,
|
|
||||||
|
|
||||||
-- prefix for parameter hints
|
|
||||||
-- default: "<-"
|
|
||||||
parameter_hints_prefix = O.lang.rust.rust_tools.parameter_hints_prefix,
|
|
||||||
|
|
||||||
-- prefix for all the other hints (type, chaining)
|
|
||||||
-- default: "=>"
|
|
||||||
other_hints_prefix = O.lang.rust.rust_tools.other_hints_prefix,
|
|
||||||
|
|
||||||
-- whether to align to the lenght of the longest line in the file
|
|
||||||
max_len_align = false,
|
|
||||||
|
|
||||||
-- padding from the left if max_len_align is true
|
|
||||||
max_len_align_padding = 1,
|
|
||||||
|
|
||||||
-- whether to align to the extreme right or not
|
|
||||||
right_align = false,
|
|
||||||
|
|
||||||
-- padding from the right if right_align is true
|
|
||||||
right_align_padding = 7,
|
|
||||||
},
|
|
||||||
|
|
||||||
hover_actions = {
|
|
||||||
-- the border that is used for the hover window
|
|
||||||
-- see vim.api.nvim_open_win()
|
|
||||||
border = {
|
|
||||||
{ "╭", "FloatBorder" },
|
|
||||||
{ "─", "FloatBorder" },
|
|
||||||
{ "╮", "FloatBorder" },
|
|
||||||
{ "│", "FloatBorder" },
|
|
||||||
{ "╯", "FloatBorder" },
|
|
||||||
{ "─", "FloatBorder" },
|
|
||||||
{ "╰", "FloatBorder" },
|
|
||||||
{ "│", "FloatBorder" },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
-- all the opts to send to nvim-lspconfig
|
|
||||||
-- these override the defaults set by rust-tools.nvim
|
|
||||||
-- see https://github.com/neovim/nvim-lspconfig/blob/master/CONFIG.md#rust_analyzer
|
|
||||||
server = {
|
|
||||||
cmd = { DATA_PATH .. "/lspinstall/rust/rust-analyzer" },
|
|
||||||
on_attach = require("lsp").common_on_attach,
|
|
||||||
}, -- rust-analyser options
|
|
||||||
}
|
|
||||||
require("rust-tools").setup(opts)
|
|
||||||
else
|
|
||||||
require("lspconfig").rust_analyzer.setup {
|
|
||||||
cmd = { DATA_PATH .. "/lspinstall/rust/rust-analyzer" },
|
|
||||||
on_attach = require("lsp").common_on_attach,
|
|
||||||
filetypes = { "rust" },
|
|
||||||
root_dir = require("lspconfig.util").root_pattern("Cargo.toml", "rust-project.json"),
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
-- TODO: fix these mappings
|
|
||||||
vim.api.nvim_exec(
|
|
||||||
[[
|
|
||||||
autocmd Filetype rust nnoremap <leader>lm <Cmd>RustExpandMacro<CR>
|
|
||||||
autocmd Filetype rust nnoremap <leader>lH <Cmd>RustToggleInlayHints<CR>
|
|
||||||
autocmd Filetype rust nnoremap <leader>le <Cmd>RustRunnables<CR>
|
|
||||||
autocmd Filetype rust nnoremap <leader>lh <Cmd>RustHoverActions<CR>
|
|
||||||
]],
|
|
||||||
true
|
|
||||||
)
|
|
||||||
|
|
|
@ -1,52 +1,4 @@
|
||||||
O.formatters.filetype["sh"] = {
|
require("lang.sh").format()
|
||||||
function()
|
require("lang.sh").lint()
|
||||||
return {
|
require("lang.sh").lsp()
|
||||||
exe = O.lang.sh.formatter.exe,
|
require("lang.sh").dap()
|
||||||
args = O.lang.sh.formatter.args,
|
|
||||||
stdin = not (O.lang.sh.formatter.stdin ~= nil),
|
|
||||||
}
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
|
|
||||||
require("formatter.config").set_defaults {
|
|
||||||
logging = false,
|
|
||||||
filetype = O.formatters.filetype,
|
|
||||||
}
|
|
||||||
if not require("lv-utils").check_lsp_client_active "bashls" then
|
|
||||||
-- 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" },
|
|
||||||
}
|
|
||||||
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.linter == "shellcheck" then
|
|
||||||
table.insert(sh_arguments, shellcheck)
|
|
||||||
end
|
|
||||||
|
|
||||||
if not require("lv-utils").check_lsp_client_active "efm" then
|
|
||||||
require("lspconfig").efm.setup {
|
|
||||||
-- init_options = {initializationOptions},
|
|
||||||
cmd = { DATA_PATH .. "/lspinstall/efm/efm-langserver" },
|
|
||||||
init_options = { documentFormatting = true, codeAction = false },
|
|
||||||
root_dir = require("lspconfig").util.root_pattern ".git/",
|
|
||||||
filetypes = { "sh" },
|
|
||||||
settings = {
|
|
||||||
rootMarkers = { ".git/" },
|
|
||||||
languages = {
|
|
||||||
sh = sh_arguments,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
101
ftplugin/tex.lua
101
ftplugin/tex.lua
|
@ -1,97 +1,4 @@
|
||||||
if require("lv-utils").check_lsp_client_active "texlab" then
|
require("lang.tex").format()
|
||||||
return
|
require("lang.tex").lint()
|
||||||
end
|
require("lang.tex").lsp()
|
||||||
|
require("lang.tex").dap()
|
||||||
local preview_settings = {}
|
|
||||||
|
|
||||||
local sumatrapdf_args = { "-reuse-instance", "%p", "-forward-search", "%f", "%l" }
|
|
||||||
local evince_args = { "-f", "%l", "%p", "\"code -g %f:%l\"" }
|
|
||||||
local okular_args = { "--unique", "file:%p#src:%l%f" }
|
|
||||||
local zathura_args = { "--synctex-forward", "%l:1:%f", "%p" }
|
|
||||||
local qpdfview_args = { "--unique", "%p#src:%f:%l:1" }
|
|
||||||
local skim_args = { "%l", "%p", "%f" }
|
|
||||||
|
|
||||||
if O.lang.latex.forward_search.executable == "C:/Users/{User}/AppData/Local/SumatraPDF/SumatraPDF.exe" then
|
|
||||||
preview_settings = sumatrapdf_args
|
|
||||||
elseif O.lang.latex.forward_search.executable == "evince-synctex" then
|
|
||||||
preview_settings = evince_args
|
|
||||||
elseif O.lang.latex.forward_search.executable == "okular" then
|
|
||||||
preview_settings = okular_args
|
|
||||||
elseif O.lang.latex.forward_search.executable == "zathura" then
|
|
||||||
preview_settings = zathura_args
|
|
||||||
elseif O.lang.latex.forward_search.executable == "qpdfview" then
|
|
||||||
preview_settings = qpdfview_args
|
|
||||||
elseif O.lang.latex.forward_search.executable == "/Applications/Skim.app/Contents/SharedSupport/displayline" then
|
|
||||||
preview_settings = skim_args
|
|
||||||
end
|
|
||||||
|
|
||||||
require("lspconfig").texlab.setup {
|
|
||||||
cmd = { DATA_PATH .. "/lspinstall/latex/texlab" },
|
|
||||||
on_attach = require("lsp").common_on_attach,
|
|
||||||
handlers = {
|
|
||||||
["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
|
|
||||||
virtual_text = O.lang.latex.diagnostics.virtual_text,
|
|
||||||
signs = O.lang.latex.diagnostics.signs,
|
|
||||||
underline = O.lang.latex.diagnostics.underline,
|
|
||||||
update_in_insert = true,
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
filetypes = { "tex", "bib" },
|
|
||||||
settings = {
|
|
||||||
texlab = {
|
|
||||||
auxDirectory = O.lang.latex.aux_directory,
|
|
||||||
bibtexFormatter = O.lang.latex.bibtex_formatter,
|
|
||||||
build = {
|
|
||||||
args = O.lang.latex.build.args,
|
|
||||||
executable = O.lang.latex.build.executable,
|
|
||||||
forwardSearchAfter = O.lang.latex.build.forward_search_after,
|
|
||||||
onSave = O.lang.latex.build.on_save,
|
|
||||||
},
|
|
||||||
chktex = {
|
|
||||||
onEdit = O.lang.latex.chktex.on_edit,
|
|
||||||
onOpenAndSave = O.lang.latex.chktex.on_open_and_save,
|
|
||||||
},
|
|
||||||
diagnosticsDelay = O.lang.latex.diagnostics_delay,
|
|
||||||
formatterLineLength = O.lang.latex.formatter_line_length,
|
|
||||||
forwardSearch = {
|
|
||||||
args = preview_settings,
|
|
||||||
executable = O.lang.latex.forward_search.executable,
|
|
||||||
},
|
|
||||||
latexFormatter = O.lang.latex.latex_formatter,
|
|
||||||
latexindent = {
|
|
||||||
modifyLineBreaks = O.lang.latex.latexindent.modify_line_breaks,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
vim.g.vimtex_compiler_method = "latexmk"
|
|
||||||
vim.g.vimtex_view_method = "zathura"
|
|
||||||
vim.g.vimtex_fold_enabled = 0
|
|
||||||
vim.g.vimtex_quickfix_ignore_filters = O.lang.latex.ignore_errors
|
|
||||||
|
|
||||||
O.plugin.which_key.mappings["t"] = {
|
|
||||||
name = "+Latex",
|
|
||||||
c = { "<cmd>VimtexCompile<cr>", "Toggle Compilation Mode" },
|
|
||||||
f = { "<cmd>call vimtex#fzf#run()<cr>", "Fzf Find" },
|
|
||||||
i = { "<cmd>VimtexInfo<cr>", "Project Information" },
|
|
||||||
s = { "<cmd>VimtexStop<cr>", "Stop Project Compilation" },
|
|
||||||
t = { "<cmd>VimtexTocToggle<cr>", "Toggle Table Of Content" },
|
|
||||||
v = { "<cmd>VimtexView<cr>", "View PDF" },
|
|
||||||
b = { "<cmd>TexlabBuild<cr>", "Build with Texlab" },
|
|
||||||
p = { "<cmd>TexlabForward<cr>", "Preview with Texlab" },
|
|
||||||
}
|
|
||||||
|
|
||||||
-- Compile on initialization, cleanup on quit
|
|
||||||
vim.api.nvim_exec(
|
|
||||||
[[
|
|
||||||
augroup vimtex_event_1
|
|
||||||
au!
|
|
||||||
au User VimtexEventQuit call vimtex#compiler#clean(0)
|
|
||||||
au User VimtexEventInitPost call vimtex#compiler#compile()
|
|
||||||
augroup END
|
|
||||||
]],
|
|
||||||
false
|
|
||||||
)
|
|
||||||
if O.lang.latex.auto_save then
|
|
||||||
vim.api.nvim_exec([[au FocusLost * :wa]], false)
|
|
||||||
end
|
|
||||||
|
|
|
@ -1,25 +1,4 @@
|
||||||
O.formatters.filetype["hcl"] = {
|
require("lang.terraform").format()
|
||||||
function()
|
require("lang.terraform").lint()
|
||||||
return {
|
require("lang.terraform").lsp()
|
||||||
exe = O.lang.terraform.formatter.exe,
|
require("lang.terraform").dap()
|
||||||
args = O.lang.terraform.formatter.args,
|
|
||||||
stdin = not (O.lang.terraform.formatter.stdin ~= nil),
|
|
||||||
}
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
O.formatters.filetype["tf"] = O.formatters.filetype["hcl"]
|
|
||||||
|
|
||||||
require("formatter.config").set_defaults {
|
|
||||||
logging = false,
|
|
||||||
filetype = O.formatters.filetype,
|
|
||||||
}
|
|
||||||
|
|
||||||
if require("lv-utils").check_lsp_client_active "terraformls" then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
require("lspconfig").terraformls.setup {
|
|
||||||
cmd = { DATA_PATH .. "/lspinstall/terraform/terraform-ls", "serve" },
|
|
||||||
on_attach = require("lsp").common_on_attach,
|
|
||||||
filetypes = { "tf", "terraform", "hcl" },
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,9 +1,4 @@
|
||||||
if require("lv-utils").check_lsp_client_active "vimls" then
|
require("lang.vim").format()
|
||||||
return
|
require("lang.vim").lint()
|
||||||
end
|
require("lang.vim").lsp()
|
||||||
|
require("lang.vim").dap()
|
||||||
-- npm install -g vim-language-server
|
|
||||||
require("lspconfig").vimls.setup {
|
|
||||||
cmd = { DATA_PATH .. "/lspinstall/vim/node_modules/.bin/vim-language-server", "--stdio" },
|
|
||||||
on_attach = require("lsp").common_on_attach,
|
|
||||||
}
|
|
||||||
|
|
|
@ -6,8 +6,21 @@ M.config = function()
|
||||||
end
|
end
|
||||||
|
|
||||||
M.format = function()
|
M.format = function()
|
||||||
-- TODO: implement formatter (if applicable)
|
O.formatters.filetype["c"] = {
|
||||||
return "No formatters configured!"
|
function()
|
||||||
|
return {
|
||||||
|
exe = O.lang.clang.formatter.exe,
|
||||||
|
args = O.lang.clang.formatter.args,
|
||||||
|
stdin = not (O.lang.clang.formatter.stdin ~= nil),
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
O.formatters.filetype["cpp"] = O.formatters.filetype["c"]
|
||||||
|
|
||||||
|
require("formatter.config").set_defaults {
|
||||||
|
logging = false,
|
||||||
|
filetype = O.formatters.filetype,
|
||||||
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
M.lint = function()
|
M.lint = function()
|
||||||
|
@ -16,8 +29,30 @@ M.lint = function()
|
||||||
end
|
end
|
||||||
|
|
||||||
M.lsp = function()
|
M.lsp = function()
|
||||||
-- TODO: implement lsp
|
if require("lv-utils").check_lsp_client_active "clangd" then
|
||||||
return "No LSP configured!"
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local clangd_flags = { "--background-index" }
|
||||||
|
|
||||||
|
if O.lang.clang.cross_file_rename then
|
||||||
|
table.insert(clangd_flags, "--cross-file-rename")
|
||||||
|
end
|
||||||
|
|
||||||
|
table.insert(clangd_flags, "--header-insertion=" .. O.lang.clang.header_insertion)
|
||||||
|
|
||||||
|
require("lspconfig").clangd.setup {
|
||||||
|
cmd = { DATA_PATH .. "/lspinstall/cpp/clangd/bin/clangd", unpack(clangd_flags) },
|
||||||
|
on_attach = require("lsp").common_on_attach,
|
||||||
|
handlers = {
|
||||||
|
["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
|
||||||
|
virtual_text = O.lang.clang.diagnostics.virtual_text,
|
||||||
|
signs = O.lang.clang.diagnostics.signs,
|
||||||
|
underline = O.lang.clang.diagnostics.underline,
|
||||||
|
update_in_insert = true,
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
M.dap = function()
|
M.dap = function()
|
||||||
|
|
35
lua/lang/cmake.lua
Normal file
35
lua/lang/cmake.lua
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
M.config = function()
|
||||||
|
-- TODO: implement config for language
|
||||||
|
return "No config available!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.format = function()
|
||||||
|
-- TODO: implement formatters (if applicable)
|
||||||
|
return "No formatters configured!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.lint = function()
|
||||||
|
-- TODO: implement linters (if applicable)
|
||||||
|
return "No linters configured!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.lsp = function()
|
||||||
|
if require("lv-utils").check_lsp_client_active "cmake" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
require("lspconfig").cmake.setup {
|
||||||
|
cmd = { DATA_PATH .. "/lspinstall/cmake/venv/bin/cmake-language-server" },
|
||||||
|
on_attach = require("lsp").common_on_attach,
|
||||||
|
filetypes = { "cmake" },
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
M.dap = function()
|
||||||
|
-- TODO: implement dap
|
||||||
|
return "No DAP configured!"
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
36
lua/lang/cs.lua
Normal file
36
lua/lang/cs.lua
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
M.config = function()
|
||||||
|
-- TODO: implement config for language
|
||||||
|
return "No config available!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.format = function()
|
||||||
|
-- TODO: implement formatter for language
|
||||||
|
return "No formatter available!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.lint = function()
|
||||||
|
-- TODO: implement linters (if applicable)
|
||||||
|
return "No linters configured!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.lsp = function()
|
||||||
|
if require("lv-utils").check_lsp_client_active "omnisharp" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- C# language server (csharp/OmniSharp) setup
|
||||||
|
require("lspconfig").omnisharp.setup {
|
||||||
|
on_attach = require("lsp").common_on_attach,
|
||||||
|
root_dir = require("lspconfig").util.root_pattern(".sln", ".git"),
|
||||||
|
cmd = { DATA_PATH .. "/lspinstall/csharp/omnisharp/run", "--languageserver", "--hostPID", tostring(vim.fn.getpid()) },
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
M.dap = function()
|
||||||
|
-- TODO: implement dap
|
||||||
|
return "No DAP configured!"
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
69
lua/lang/css.lua
Normal file
69
lua/lang/css.lua
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
M.config = function()
|
||||||
|
-- TODO: implement config for language
|
||||||
|
return "No config available!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.format = function()
|
||||||
|
vim.cmd "let proj = FindRootDirectory()"
|
||||||
|
local root_dir = vim.api.nvim_get_var "proj"
|
||||||
|
|
||||||
|
-- use the global prettier if you didn't find the local one
|
||||||
|
local prettier_instance = root_dir .. "/node_modules/.bin/prettier"
|
||||||
|
if vim.fn.executable(prettier_instance) ~= 1 then
|
||||||
|
prettier_instance = O.lang.tsserver.formatter.exe
|
||||||
|
end
|
||||||
|
|
||||||
|
local ft = vim.bo.filetype
|
||||||
|
O.formatters.filetype[ft] = {
|
||||||
|
function()
|
||||||
|
local args = { "--stdin-filepath", vim.fn.fnameescape(vim.api.nvim_buf_get_name(0)) }
|
||||||
|
-- TODO: O.lang.[ft].formatter.args
|
||||||
|
local extend_args = O.lang.css.formatter.args
|
||||||
|
|
||||||
|
for i = 1, #extend_args do
|
||||||
|
table.insert(args, extend_args[i])
|
||||||
|
end
|
||||||
|
|
||||||
|
return {
|
||||||
|
exe = prettier_instance,
|
||||||
|
args = args,
|
||||||
|
stdin = true,
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
require("formatter.config").set_defaults {
|
||||||
|
logging = false,
|
||||||
|
filetype = O.formatters.filetype,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
M.lint = function()
|
||||||
|
-- TODO: implement linters (if applicable)
|
||||||
|
return "No linters configured!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.lsp = function()
|
||||||
|
if not require("lv-utils").check_lsp_client_active "cssls" then
|
||||||
|
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||||
|
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||||
|
-- npm install -g vscode-css-languageserver-bin
|
||||||
|
require("lspconfig").cssls.setup {
|
||||||
|
cmd = {
|
||||||
|
"node",
|
||||||
|
DATA_PATH .. "/lspinstall/css/vscode-css/css-language-features/server/dist/node/cssServerMain.js",
|
||||||
|
"--stdio",
|
||||||
|
},
|
||||||
|
on_attach = require("lsp").common_on_attach,
|
||||||
|
capabilities = capabilities,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
M.dap = function()
|
||||||
|
-- TODO: implement dap
|
||||||
|
return "No DAP configured!"
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
53
lua/lang/dart.lua
Normal file
53
lua/lang/dart.lua
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
M.config = function()
|
||||||
|
-- TODO: implement config for language
|
||||||
|
return "No config available!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.format = function()
|
||||||
|
O.formatters.filetype["dart"] = {
|
||||||
|
function()
|
||||||
|
return {
|
||||||
|
exe = O.lang.dart.formatter.exe,
|
||||||
|
args = O.lang.dart.formatter.args,
|
||||||
|
stdin = not (O.lang.dart.formatter.stdin ~= nil),
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
|
require("formatter.config").set_defaults {
|
||||||
|
logging = false,
|
||||||
|
filetype = O.formatters.filetype,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
M.lint = function()
|
||||||
|
-- TODO: implement linters (if applicable)
|
||||||
|
return "No linters configured!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.lsp = function()
|
||||||
|
if require("lv-utils").check_lsp_client_active "dartls" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
require("lspconfig").dartls.setup {
|
||||||
|
cmd = { "dart", O.lang.dart.sdk_path, "--lsp" },
|
||||||
|
on_attach = require("lsp").common_on_attach,
|
||||||
|
init_options = {
|
||||||
|
closingLabels = false,
|
||||||
|
flutterOutline = false,
|
||||||
|
onlyAnalyzeProjectsWithOpenFiles = false,
|
||||||
|
outline = false,
|
||||||
|
suggestFromUnimportedLibraries = true,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
M.dap = function()
|
||||||
|
-- TODO: implement dap
|
||||||
|
return "No DAP configured!"
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
36
lua/lang/dockerfile.lua
Normal file
36
lua/lang/dockerfile.lua
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
M.config = function()
|
||||||
|
-- TODO: implement config for language
|
||||||
|
return "No config available!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.format = function()
|
||||||
|
-- TODO: implement formatter for language
|
||||||
|
return "No formatter available!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.lint = function()
|
||||||
|
-- TODO: implement linters (if applicable)
|
||||||
|
return "No linters configured!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.lsp = function()
|
||||||
|
if require("lv-utils").check_lsp_client_active "dockerls" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- npm install -g dockerfile-language-server-nodejs
|
||||||
|
require("lspconfig").dockerls.setup {
|
||||||
|
cmd = { DATA_PATH .. "/lspinstall/dockerfile/node_modules/.bin/docker-langserver", "--stdio" },
|
||||||
|
on_attach = require("lsp").common_on_attach,
|
||||||
|
root_dir = vim.loop.cwd,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
M.dap = function()
|
||||||
|
-- TODO: implement dap
|
||||||
|
return "No DAP configured!"
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
52
lua/lang/elixir.lua
Normal file
52
lua/lang/elixir.lua
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
M.config = function()
|
||||||
|
-- TODO: implement config for language
|
||||||
|
return "No config available!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.format = function()
|
||||||
|
O.formatters.filetype["elixir"] = {
|
||||||
|
function()
|
||||||
|
return {
|
||||||
|
exe = O.lang.elixir.formatter.exe,
|
||||||
|
args = O.lang.elixir.formatter.args,
|
||||||
|
stdin = not (O.lang.elixir.formatter.stdin ~= nil),
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
|
require("formatter.config").set_defaults {
|
||||||
|
logging = false,
|
||||||
|
filetype = O.formatters.filetype,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
M.lint = function()
|
||||||
|
-- TODO: implement linters (if applicable)
|
||||||
|
return "No linters configured!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.lsp = function()
|
||||||
|
if require("lv-utils").check_lsp_client_active "elixirls" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
require("lspconfig").elixirls.setup {
|
||||||
|
cmd = { DATA_PATH .. "/lspinstall/elixir/elixir-ls/language_server.sh" },
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
M.dap = function()
|
||||||
|
-- TODO: implement dap
|
||||||
|
return "No DAP configured!"
|
||||||
|
end
|
||||||
|
|
||||||
|
-- needed for the LSP to recognize elixir files (alternativly just use elixir-editors/vim-elixir)
|
||||||
|
-- vim.cmd [[
|
||||||
|
-- au BufRead,BufNewFile *.ex,*.exs set filetype=elixir
|
||||||
|
-- au BufRead,BufNewFile *.eex,*.leex,*.sface set filetype=eelixir
|
||||||
|
-- au BufRead,BufNewFile mix.lock set filetype=elixir
|
||||||
|
-- ]]
|
||||||
|
|
||||||
|
return M
|
39
lua/lang/elm.lua
Normal file
39
lua/lang/elm.lua
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
M.config = function()
|
||||||
|
-- TODO: implement config for language
|
||||||
|
return "No config available!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.format = function()
|
||||||
|
-- TODO: implement formatter for language
|
||||||
|
return "No formatter available!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.lint = function()
|
||||||
|
-- TODO: implement linters (if applicable)
|
||||||
|
return "No linters configured!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.lsp = function()
|
||||||
|
if require("lv-utils").check_lsp_client_active "elmls" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
require("lspconfig").elmls.setup {
|
||||||
|
cmd = { DATA_PATH .. "/lspinstall/elm/node_modules/.bin/elm-language-server" },
|
||||||
|
init_options = {
|
||||||
|
elmAnalyseTrigger = "change",
|
||||||
|
elmFormatPath = DATA_PATH .. "/lspinstall/elm/node_modules/.bin/elm-format",
|
||||||
|
elmPath = DATA_PATH .. "/lspinstall/elm/node_modules/.bin/elm",
|
||||||
|
elmTestPath = DATA_PATH .. "/lspinstall/elm/node_modules/.bin/elm-test",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
M.dap = function()
|
||||||
|
-- TODO: implement dap
|
||||||
|
return "No DAP configured!"
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
41
lua/lang/euphoria3.lua
Normal file
41
lua/lang/euphoria3.lua
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
M.config = function()
|
||||||
|
-- TODO: implement config for language
|
||||||
|
return "No config available!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.format = function()
|
||||||
|
-- TODO: implement formatter for language
|
||||||
|
return "No formatter available!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.lint = function()
|
||||||
|
-- TODO: implement linters (if applicable)
|
||||||
|
return "No linters configured!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.lsp = function()
|
||||||
|
if require("lv-utils").check_lsp_client_active "elixirls" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- TODO: Remove this at some point
|
||||||
|
require("lspconfig").elixirls.setup {
|
||||||
|
cmd = { DATA_PATH .. "/lspinstall/elixir/elixir-ls/language_server.sh" },
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
-- needed for the LSP to recognize elixir files (alternativly just use elixir-editors/vim-elixir)
|
||||||
|
-- vim.cmd([[
|
||||||
|
-- au BufRead,BufNewFile *.ex,*.exs set filetype=elixir
|
||||||
|
-- au BufRead,BufNewFile *.eex,*.leex,*.sface set filetype=eelixir
|
||||||
|
-- au BufRead,BufNewFile mix.lock set filetype=elixir
|
||||||
|
-- ]])
|
||||||
|
|
||||||
|
M.dap = function()
|
||||||
|
-- TODO: implement dap
|
||||||
|
return "No DAP configured!"
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
47
lua/lang/go.lua
Normal file
47
lua/lang/go.lua
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
M.config = function()
|
||||||
|
O.formatters.filetype["go"] = {
|
||||||
|
function()
|
||||||
|
return {
|
||||||
|
exe = O.lang.go.formatter.exe,
|
||||||
|
args = O.lang.go.formatter.args,
|
||||||
|
stdin = not (O.lang.go.formatter.stdin ~= nil),
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
|
require("formatter.config").set_defaults {
|
||||||
|
logging = false,
|
||||||
|
filetype = O.formatters.filetype,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
M.format = function()
|
||||||
|
-- TODO: implement formatter for language
|
||||||
|
return "No formatter available!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.lint = function()
|
||||||
|
-- TODO: implement linters (if applicable)
|
||||||
|
return "No linters configured!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.lsp = function()
|
||||||
|
if not require("lv-utils").check_lsp_client_active "gopls" then
|
||||||
|
require("lspconfig").gopls.setup {
|
||||||
|
cmd = { DATA_PATH .. "/lspinstall/go/gopls" },
|
||||||
|
settings = { gopls = { analyses = { unusedparams = true }, staticcheck = true } },
|
||||||
|
root_dir = require("lspconfig").util.root_pattern(".git", "go.mod"),
|
||||||
|
init_options = { usePlaceholders = true, completeUnimported = true },
|
||||||
|
on_attach = require("lsp").common_on_attach,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
M.dap = function()
|
||||||
|
-- TODO: implement dap
|
||||||
|
return "No DAP configured!"
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
32
lua/lang/graphql.lua
Normal file
32
lua/lang/graphql.lua
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
M.config = function()
|
||||||
|
-- TODO: implement config for language
|
||||||
|
return "No config available!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.format = function()
|
||||||
|
-- TODO: implement formatter for language
|
||||||
|
return "No formatter available!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.lint = function()
|
||||||
|
-- TODO: implement linters (if applicable)
|
||||||
|
return "No linters configured!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.lsp = function()
|
||||||
|
if require("lv-utils").check_lsp_client_active "graphql" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- npm install -g graphql-language-service-cli
|
||||||
|
require("lspconfig").graphql.setup { on_attach = require("lsp").common_on_attach }
|
||||||
|
end
|
||||||
|
|
||||||
|
M.dap = function()
|
||||||
|
-- TODO: implement dap
|
||||||
|
return "No DAP configured!"
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
41
lua/lang/html.lua
Normal file
41
lua/lang/html.lua
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
M.config = function()
|
||||||
|
-- TODO: implement config for language
|
||||||
|
return "No config available!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.format = function()
|
||||||
|
-- TODO: implement formatters (if applicable)
|
||||||
|
return "No formatters configured!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.lint = function()
|
||||||
|
-- TODO: implement linters (if applicable)
|
||||||
|
return "No linters configured!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.lsp = function()
|
||||||
|
if not require("lv-utils").check_lsp_client_active "html" then
|
||||||
|
-- npm install -g vscode-html-languageserver-bin
|
||||||
|
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||||
|
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||||
|
|
||||||
|
require("lspconfig").html.setup {
|
||||||
|
cmd = {
|
||||||
|
"node",
|
||||||
|
DATA_PATH .. "/lspinstall/html/vscode-html/html-language-features/server/dist/node/htmlServerMain.js",
|
||||||
|
"--stdio",
|
||||||
|
},
|
||||||
|
on_attach = require("lsp").common_on_attach,
|
||||||
|
capabilities = capabilities,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
M.dap = function()
|
||||||
|
-- TODO: implement dap
|
||||||
|
return "No DAP configured!"
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
119
lua/lang/java.lua
Normal file
119
lua/lang/java.lua
Normal file
|
@ -0,0 +1,119 @@
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
M.config = function()
|
||||||
|
-- TODO: implement config for language
|
||||||
|
return "No config available!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.format = function()
|
||||||
|
vim.cmd "let proj = FindRootDirectory()"
|
||||||
|
local root_dir = vim.api.nvim_get_var "proj"
|
||||||
|
|
||||||
|
-- use the global prettier if you didn't find the local one
|
||||||
|
local prettier_instance = root_dir .. "/node_modules/.bin/prettier"
|
||||||
|
if vim.fn.executable(prettier_instance) ~= 1 then
|
||||||
|
prettier_instance = O.lang.tsserver.formatter.exe
|
||||||
|
end
|
||||||
|
|
||||||
|
O.formatters.filetype["java"] = {
|
||||||
|
function()
|
||||||
|
return {
|
||||||
|
exe = prettier_instance,
|
||||||
|
-- TODO: allow user to override this
|
||||||
|
args = { "--stdin-filepath", vim.api.nvim_buf_get_name(0) },
|
||||||
|
stdin = true,
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
|
require("formatter.config").set_defaults {
|
||||||
|
logging = false,
|
||||||
|
filetype = O.formatters.filetype,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
M.lint = function()
|
||||||
|
-- TODO: implement linters (if applicable)
|
||||||
|
return "No linters configured!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.lsp = function()
|
||||||
|
if require("lv-utils").check_lsp_client_active "jdtls" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if O.lang.java.java_tools.active then
|
||||||
|
-- find_root looks for parent directories relative to the current buffer containing one of the given arguments.
|
||||||
|
if vim.fn.has "mac" == 1 then
|
||||||
|
WORKSPACE_PATH = "/Users/" .. USER .. "/workspace/"
|
||||||
|
elseif vim.fn.has "unix" == 1 then
|
||||||
|
WORKSPACE_PATH = "/home/" .. USER .. "/workspace/"
|
||||||
|
else
|
||||||
|
print "Unsupported system"
|
||||||
|
end
|
||||||
|
JAVA_LS_EXECUTABLE = CONFIG_PATH .. "/utils/bin/jdtls"
|
||||||
|
|
||||||
|
require("jdtls").start_or_attach {
|
||||||
|
on_attach = require("lsp").common_on_attach,
|
||||||
|
cmd = { JAVA_LS_EXECUTABLE, WORKSPACE_PATH .. vim.fn.fnamemodify(vim.fn.getcwd(), ":p:h:t") },
|
||||||
|
}
|
||||||
|
|
||||||
|
vim.api.nvim_set_keymap(
|
||||||
|
"n",
|
||||||
|
"<leader>la",
|
||||||
|
":lua require('jdtls').code_action()<CR>",
|
||||||
|
{ noremap = true, silent = true }
|
||||||
|
)
|
||||||
|
vim.api.nvim_set_keymap(
|
||||||
|
"n",
|
||||||
|
"<leader>lR",
|
||||||
|
":lua require('jdtls').code_action(false, 'refactor')<CR>",
|
||||||
|
{ noremap = true, silent = true }
|
||||||
|
)
|
||||||
|
|
||||||
|
vim.cmd "command! -buffer JdtCompile lua require('jdtls').compile()"
|
||||||
|
vim.cmd "command! -buffer JdtUpdateConfig lua require('jdtls').update_project_config()"
|
||||||
|
-- vim.cmd "command! -buffer JdtJol lua require('jdtls').jol()"
|
||||||
|
vim.cmd "command! -buffer JdtBytecode lua require('jdtls').javap()"
|
||||||
|
-- vim.cmd "command! -buffer JdtJshell lua require('jdtls').jshell()"
|
||||||
|
else
|
||||||
|
local util = require "lspconfig/util"
|
||||||
|
|
||||||
|
require("lspconfig").jdtls.setup {
|
||||||
|
on_attach = require("lsp").common_on_attach,
|
||||||
|
cmd = { DATA_PATH .. "/lspinstall/java/jdtls.sh" },
|
||||||
|
filetypes = { "java" },
|
||||||
|
root_dir = util.root_pattern { ".git", "build.gradle", "pom.xml" },
|
||||||
|
-- init_options = {bundles = bundles}
|
||||||
|
-- on_attach = require'lsp'.common_on_attach
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
M.dap = function()
|
||||||
|
-- TODO: implement dap
|
||||||
|
return "No DAP configured!"
|
||||||
|
end
|
||||||
|
|
||||||
|
-- local bundles = {
|
||||||
|
-- vim.fn.glob(
|
||||||
|
-- CONFIG_PATH.."/.debuggers/java-debug/com.microsoft.java.debug.plugin/target/com.microsoft.java.debug.plugin-*.jar")
|
||||||
|
-- };
|
||||||
|
|
||||||
|
-- require('jdtls').start_or_attach({
|
||||||
|
-- on_attach = on_attach,
|
||||||
|
-- cmd = {DATA_PATH .. "/lspinstall/java/jdtls.sh"},
|
||||||
|
-- root_dir = require('jdtls.setup').find_root({'build.gradle', 'pom.xml', '.git'}),
|
||||||
|
-- init_options = {bundles = bundles}
|
||||||
|
-- })
|
||||||
|
|
||||||
|
-- TODO: setup autoformat stuff later
|
||||||
|
-- _java = {
|
||||||
|
-- -- {'FileType', 'java', 'luafile '..CONFIG_PATH..'/lua/lsp/java-ls.lua'},
|
||||||
|
-- {
|
||||||
|
-- 'FileType', 'java',
|
||||||
|
-- 'nnoremap ca <Cmd>lua require(\'jdtls\').code_action()<CR>'
|
||||||
|
-- }
|
||||||
|
-- }
|
||||||
|
|
||||||
|
return M
|
25
lua/lang/javascript.lua
Normal file
25
lua/lang/javascript.lua
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
M.config = function()
|
||||||
|
-- TODO: implement config for language
|
||||||
|
return "No config available!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.format = function()
|
||||||
|
-- TODO: implement formatter for language
|
||||||
|
return "No formatter available!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.lint = function()
|
||||||
|
-- TODO: implement linters (if applicable)
|
||||||
|
return "No linters configured!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.lsp = function() end
|
||||||
|
|
||||||
|
M.dap = function()
|
||||||
|
-- TODO: implement dap
|
||||||
|
return "No DAP configured!"
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
25
lua/lang/javascriptreact.lua
Normal file
25
lua/lang/javascriptreact.lua
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
M.config = function()
|
||||||
|
-- TODO: implement config for language
|
||||||
|
return "No config available!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.format = function()
|
||||||
|
-- TODO: implement formatter for language
|
||||||
|
return "No formatter available!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.lint = function()
|
||||||
|
-- TODO: implement linters (if applicable)
|
||||||
|
return "No linters configured!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.lsp = function() end
|
||||||
|
|
||||||
|
M.dap = function()
|
||||||
|
-- TODO: implement dap
|
||||||
|
return "No DAP configured!"
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
59
lua/lang/json.lua
Normal file
59
lua/lang/json.lua
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
M.config = function()
|
||||||
|
-- TODO: implement config for language
|
||||||
|
return "No config available!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.format = function()
|
||||||
|
O.formatters.filetype["json"] = {
|
||||||
|
function()
|
||||||
|
return {
|
||||||
|
exe = O.lang.json.formatter.exe,
|
||||||
|
args = O.lang.json.formatter.args,
|
||||||
|
stdin = not (O.lang.json.formatter.stdin ~= nil),
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
|
require("formatter.config").set_defaults {
|
||||||
|
logging = false,
|
||||||
|
filetype = O.formatters.filetype,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
M.lint = function()
|
||||||
|
-- TODO: implement linters (if applicable)
|
||||||
|
return "No linters configured!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.lsp = function()
|
||||||
|
if require("lv-utils").check_lsp_client_active "jsonls" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- npm install -g vscode-json-languageserver
|
||||||
|
require("lspconfig").jsonls.setup {
|
||||||
|
cmd = {
|
||||||
|
"node",
|
||||||
|
DATA_PATH .. "/lspinstall/json/vscode-json/json-language-features/server/dist/node/jsonServerMain.js",
|
||||||
|
"--stdio",
|
||||||
|
},
|
||||||
|
on_attach = require("lsp").common_on_attach,
|
||||||
|
|
||||||
|
commands = {
|
||||||
|
Format = {
|
||||||
|
function()
|
||||||
|
vim.lsp.buf.range_formatting({}, { 0, 0 }, { vim.fn.line "$", 0 })
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
M.dap = function()
|
||||||
|
-- TODO: implement dap
|
||||||
|
return "No DAP configured!"
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
64
lua/lang/kotlin.lua
Normal file
64
lua/lang/kotlin.lua
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
M.config = function()
|
||||||
|
-- TODO: implement config for language
|
||||||
|
return "No config available!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.format = function()
|
||||||
|
-- TODO: implement formatter for language
|
||||||
|
return "No formatter available!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.lint = function()
|
||||||
|
-- TODO: implement linters (if applicable)
|
||||||
|
return "No linters configured!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.lsp = function()
|
||||||
|
if require("lv-utils").check_lsp_client_active "kotlin_language_server" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
--- default config for gradle-projects of the
|
||||||
|
--- kotlin-language-server: https://github.com/fwcd/kotlin-language-server
|
||||||
|
---
|
||||||
|
--- This server requires vim to be aware of the kotlin-filetype.
|
||||||
|
--- You could refer for this capability to:
|
||||||
|
--- https://github.com/udalov/kotlin-vim (recommended)
|
||||||
|
--- Note that there is no LICENSE specified yet.
|
||||||
|
|
||||||
|
local util = require "lspconfig/util"
|
||||||
|
|
||||||
|
local bin_name = DATA_PATH .. "/lspinstall/kotlin/server/bin/kotlin-language-server"
|
||||||
|
if vim.fn.has "win32" == 1 then
|
||||||
|
bin_name = bin_name .. ".bat"
|
||||||
|
end
|
||||||
|
|
||||||
|
local root_files = {
|
||||||
|
"settings.gradle", -- Gradle (multi-project)
|
||||||
|
"settings.gradle.kts", -- Gradle (multi-project)
|
||||||
|
"build.xml", -- Ant
|
||||||
|
"pom.xml", -- Maven
|
||||||
|
}
|
||||||
|
|
||||||
|
local fallback_root_files = {
|
||||||
|
"build.gradle", -- Gradle
|
||||||
|
"build.gradle.kts", -- Gradle
|
||||||
|
}
|
||||||
|
|
||||||
|
require("lspconfig").kotlin_language_server.setup {
|
||||||
|
cmd = { bin_name },
|
||||||
|
on_attach = require("lsp").common_on_attach,
|
||||||
|
root_dir = function(fname)
|
||||||
|
return util.root_pattern(unpack(root_files))(fname) or util.root_pattern(unpack(fallback_root_files))(fname)
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
M.dap = function()
|
||||||
|
-- TODO: implement dap
|
||||||
|
return "No DAP configured!"
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
25
lua/lang/less.lua
Normal file
25
lua/lang/less.lua
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
M.config = function()
|
||||||
|
-- TODO: implement config for language
|
||||||
|
return "No config available!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.format = function()
|
||||||
|
-- TODO: implement formatter for language
|
||||||
|
return "No formatter available!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.lint = function()
|
||||||
|
-- TODO: implement linters (if applicable)
|
||||||
|
return "No linters configured!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.lsp = function() end
|
||||||
|
|
||||||
|
M.dap = function()
|
||||||
|
-- TODO: implement dap
|
||||||
|
return "No DAP configured!"
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
71
lua/lang/lua.lua
Normal file
71
lua/lang/lua.lua
Normal file
|
@ -0,0 +1,71 @@
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
M.config = function()
|
||||||
|
-- TODO: implement config for language
|
||||||
|
return "No config available!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.format = function()
|
||||||
|
O.formatters.filetype["lua"] = {
|
||||||
|
function()
|
||||||
|
return {
|
||||||
|
exe = O.lang.lua.formatter.exe,
|
||||||
|
args = O.lang.lua.formatter.args,
|
||||||
|
stdin = not (O.lang.lua.formatter.stdin ~= nil),
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
|
require("formatter.config").set_defaults {
|
||||||
|
logging = false,
|
||||||
|
filetype = O.formatters.filetype,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
M.lint = function()
|
||||||
|
-- TODO: implement linters (if applicable)
|
||||||
|
return "No linters configured!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.lsp = function()
|
||||||
|
if not require("lv-utils").check_lsp_client_active "sumneko_lua" then
|
||||||
|
-- https://github.com/sumneko/lua-language-server/wiki/Build-and-Run-(Standalone)
|
||||||
|
local sumneko_root_path = DATA_PATH .. "/lspinstall/lua"
|
||||||
|
local sumneko_binary = sumneko_root_path .. "/sumneko-lua-language-server"
|
||||||
|
|
||||||
|
require("lspconfig").sumneko_lua.setup {
|
||||||
|
cmd = { sumneko_binary, "-E", sumneko_root_path .. "/main.lua" },
|
||||||
|
on_attach = require("lsp").common_on_attach,
|
||||||
|
settings = {
|
||||||
|
Lua = {
|
||||||
|
runtime = {
|
||||||
|
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
|
||||||
|
version = "LuaJIT",
|
||||||
|
-- Setup your lua path
|
||||||
|
path = vim.split(package.path, ";"),
|
||||||
|
},
|
||||||
|
diagnostics = {
|
||||||
|
-- Get the language server to recognize the `vim` global
|
||||||
|
globals = { "vim" },
|
||||||
|
},
|
||||||
|
workspace = {
|
||||||
|
-- Make the server aware of Neovim runtime files
|
||||||
|
library = {
|
||||||
|
[vim.fn.expand "$VIMRUNTIME/lua"] = true,
|
||||||
|
[vim.fn.expand "$VIMRUNTIME/lua/vim/lsp"] = true,
|
||||||
|
},
|
||||||
|
maxPreload = 100000,
|
||||||
|
preloadFileSize = 1000,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
M.dap = function()
|
||||||
|
-- TODO: implement dap
|
||||||
|
return "No DAP configured!"
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
65
lua/lang/php.lua
Normal file
65
lua/lang/php.lua
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
M.config = function()
|
||||||
|
-- TODO: implement config for language
|
||||||
|
return "No config available!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.format = function()
|
||||||
|
O.formatters.filetype["php"] = {
|
||||||
|
function()
|
||||||
|
return {
|
||||||
|
exe = O.lang.php.formatter.exe,
|
||||||
|
args = O.lang.php.formatter.args,
|
||||||
|
stdin = not (O.lang.php.formatter.stdin ~= nil),
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
|
require("formatter.config").set_defaults {
|
||||||
|
logging = false,
|
||||||
|
filetype = O.formatters.filetype,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
M.lint = function()
|
||||||
|
-- TODO: implement linters (if applicable)
|
||||||
|
return "No linters configured!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.lsp = function()
|
||||||
|
if require("lv-utils").check_lsp_client_active "intelephense" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
require("lspconfig").intelephense.setup {
|
||||||
|
cmd = { DATA_PATH .. "/lspinstall/php/node_modules/.bin/intelephense", "--stdio" },
|
||||||
|
on_attach = require("lsp").common_on_attach,
|
||||||
|
handlers = {
|
||||||
|
["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
|
||||||
|
virtual_text = O.lang.php.diagnostics.virtual_text,
|
||||||
|
signs = O.lang.php.diagnostics.signs,
|
||||||
|
underline = O.lang.php.diagnostics.underline,
|
||||||
|
update_in_insert = true,
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
filetypes = O.lang.php.filetypes,
|
||||||
|
settings = {
|
||||||
|
intelephense = {
|
||||||
|
format = {
|
||||||
|
braces = O.lang.php.format.braces,
|
||||||
|
},
|
||||||
|
environment = {
|
||||||
|
phpVersion = O.lang.php.environment.php_version,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
M.dap = function()
|
||||||
|
-- TODO: implement dap
|
||||||
|
return "No DAP configured!"
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
56
lua/lang/ruby.lua
Normal file
56
lua/lang/ruby.lua
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
M.config = function()
|
||||||
|
-- TODO: implement config for language
|
||||||
|
return "No config available!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.format = function()
|
||||||
|
O.formatters.filetype["ruby"] = {
|
||||||
|
function()
|
||||||
|
return {
|
||||||
|
exe = O.lang.ruby.formatter.exe,
|
||||||
|
args = O.lang.ruby.formatter.args,
|
||||||
|
stdin = not (O.lang.ruby.formatter.stdin ~= nil),
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
|
require("formatter.config").set_defaults {
|
||||||
|
logging = false,
|
||||||
|
filetype = O.formatters.filetype,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
M.lint = function()
|
||||||
|
-- TODO: implement linters (if applicable)
|
||||||
|
return "No linters configured!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.lsp = function()
|
||||||
|
if require("lv-utils").check_lsp_client_active "solargraph" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- If you are using rvm, make sure to change below configuration
|
||||||
|
require("lspconfig").solargraph.setup {
|
||||||
|
cmd = { DATA_PATH .. "/lspinstall/ruby/solargraph/solargraph", "stdio" },
|
||||||
|
on_attach = require("lsp").common_on_attach,
|
||||||
|
handlers = {
|
||||||
|
["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
|
||||||
|
virtual_text = O.lang.ruby.diagnostics.virtual_text,
|
||||||
|
signs = O.lang.ruby.diagnostics.signs,
|
||||||
|
underline = O.lang.ruby.diagnostics.underline,
|
||||||
|
update_in_insert = true,
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
filetypes = O.lang.ruby.filetypes,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
M.dap = function()
|
||||||
|
-- TODO: implement dap
|
||||||
|
return "No DAP configured!"
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
135
lua/lang/rust.lua
Normal file
135
lua/lang/rust.lua
Normal file
|
@ -0,0 +1,135 @@
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
M.config = function()
|
||||||
|
-- TODO: implement config for language
|
||||||
|
return "No config available!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.format = function()
|
||||||
|
O.formatters.filetype["rust"] = {
|
||||||
|
function()
|
||||||
|
return {
|
||||||
|
exe = O.lang.rust.formatter.exe,
|
||||||
|
args = O.lang.rust.formatter.args,
|
||||||
|
stdin = not (O.lang.rust.formatter.stdin ~= nil),
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
|
require("formatter.config").set_defaults {
|
||||||
|
logging = false,
|
||||||
|
filetype = O.formatters.filetype,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
M.lint = function()
|
||||||
|
-- TODO: implement linters (if applicable)
|
||||||
|
return "No linters configured!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.lsp = function()
|
||||||
|
if require("lv-utils").check_lsp_client_active "rust_analyzer" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if O.lang.rust.rust_tools.active then
|
||||||
|
local opts = {
|
||||||
|
tools = { -- rust-tools options
|
||||||
|
-- automatically set inlay hints (type hints)
|
||||||
|
-- There is an issue due to which the hints are not applied on the first
|
||||||
|
-- opened file. For now, write to the file to trigger a reapplication of
|
||||||
|
-- the hints or just run :RustSetInlayHints.
|
||||||
|
-- default: true
|
||||||
|
autoSetHints = true,
|
||||||
|
|
||||||
|
-- whether to show hover actions inside the hover window
|
||||||
|
-- this overrides the default hover handler
|
||||||
|
-- default: true
|
||||||
|
hover_with_actions = true,
|
||||||
|
|
||||||
|
runnables = {
|
||||||
|
-- whether to use telescope for selection menu or not
|
||||||
|
-- default: true
|
||||||
|
use_telescope = true,
|
||||||
|
|
||||||
|
-- rest of the opts are forwarded to telescope
|
||||||
|
},
|
||||||
|
|
||||||
|
inlay_hints = {
|
||||||
|
-- wheter to show parameter hints with the inlay hints or not
|
||||||
|
-- default: true
|
||||||
|
show_parameter_hints = true,
|
||||||
|
|
||||||
|
-- prefix for parameter hints
|
||||||
|
-- default: "<-"
|
||||||
|
parameter_hints_prefix = O.lang.rust.rust_tools.parameter_hints_prefix,
|
||||||
|
|
||||||
|
-- prefix for all the other hints (type, chaining)
|
||||||
|
-- default: "=>"
|
||||||
|
other_hints_prefix = O.lang.rust.rust_tools.other_hints_prefix,
|
||||||
|
|
||||||
|
-- whether to align to the lenght of the longest line in the file
|
||||||
|
max_len_align = false,
|
||||||
|
|
||||||
|
-- padding from the left if max_len_align is true
|
||||||
|
max_len_align_padding = 1,
|
||||||
|
|
||||||
|
-- whether to align to the extreme right or not
|
||||||
|
right_align = false,
|
||||||
|
|
||||||
|
-- padding from the right if right_align is true
|
||||||
|
right_align_padding = 7,
|
||||||
|
},
|
||||||
|
|
||||||
|
hover_actions = {
|
||||||
|
-- the border that is used for the hover window
|
||||||
|
-- see vim.api.nvim_open_win()
|
||||||
|
border = {
|
||||||
|
{ "╭", "FloatBorder" },
|
||||||
|
{ "─", "FloatBorder" },
|
||||||
|
{ "╮", "FloatBorder" },
|
||||||
|
{ "│", "FloatBorder" },
|
||||||
|
{ "╯", "FloatBorder" },
|
||||||
|
{ "─", "FloatBorder" },
|
||||||
|
{ "╰", "FloatBorder" },
|
||||||
|
{ "│", "FloatBorder" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- all the opts to send to nvim-lspconfig
|
||||||
|
-- these override the defaults set by rust-tools.nvim
|
||||||
|
-- see https://github.com/neovim/nvim-lspconfig/blob/master/CONFIG.md#rust_analyzer
|
||||||
|
server = {
|
||||||
|
cmd = { DATA_PATH .. "/lspinstall/rust/rust-analyzer" },
|
||||||
|
on_attach = require("lsp").common_on_attach,
|
||||||
|
}, -- rust-analyser options
|
||||||
|
}
|
||||||
|
require("rust-tools").setup(opts)
|
||||||
|
else
|
||||||
|
require("lspconfig").rust_analyzer.setup {
|
||||||
|
cmd = { DATA_PATH .. "/lspinstall/rust/rust-analyzer" },
|
||||||
|
on_attach = require("lsp").common_on_attach,
|
||||||
|
filetypes = { "rust" },
|
||||||
|
root_dir = require("lspconfig.util").root_pattern("Cargo.toml", "rust-project.json"),
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
-- TODO: fix these mappings
|
||||||
|
vim.api.nvim_exec(
|
||||||
|
[[
|
||||||
|
autocmd Filetype rust nnoremap <leader>lm <Cmd>RustExpandMacro<CR>
|
||||||
|
autocmd Filetype rust nnoremap <leader>lH <Cmd>RustToggleInlayHints<CR>
|
||||||
|
autocmd Filetype rust nnoremap <leader>le <Cmd>RustRunnables<CR>
|
||||||
|
autocmd Filetype rust nnoremap <leader>lh <Cmd>RustHoverActions<CR>
|
||||||
|
]],
|
||||||
|
true
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
M.dap = function()
|
||||||
|
-- TODO: implement dap
|
||||||
|
return "No DAP configured!"
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
73
lua/lang/sh.lua
Normal file
73
lua/lang/sh.lua
Normal file
|
@ -0,0 +1,73 @@
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
M.config = function()
|
||||||
|
-- TODO: implement config for language
|
||||||
|
return "No config available!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.format = function()
|
||||||
|
O.formatters.filetype["sh"] = {
|
||||||
|
function()
|
||||||
|
return {
|
||||||
|
exe = O.lang.sh.formatter.exe,
|
||||||
|
args = O.lang.sh.formatter.args,
|
||||||
|
stdin = not (O.lang.sh.formatter.stdin ~= nil),
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
|
require("formatter.config").set_defaults {
|
||||||
|
logging = false,
|
||||||
|
filetype = O.formatters.filetype,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
M.lint = function()
|
||||||
|
-- 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.linter == "shellcheck" then
|
||||||
|
table.insert(sh_arguments, shellcheck)
|
||||||
|
end
|
||||||
|
|
||||||
|
if not require("lv-utils").check_lsp_client_active "efm" then
|
||||||
|
require("lspconfig").efm.setup {
|
||||||
|
-- init_options = {initializationOptions},
|
||||||
|
cmd = { DATA_PATH .. "/lspinstall/efm/efm-langserver" },
|
||||||
|
init_options = { documentFormatting = true, codeAction = false },
|
||||||
|
root_dir = require("lspconfig").util.root_pattern ".git/",
|
||||||
|
filetypes = { "sh" },
|
||||||
|
settings = {
|
||||||
|
rootMarkers = { ".git/" },
|
||||||
|
languages = {
|
||||||
|
sh = sh_arguments,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
M.lsp = function()
|
||||||
|
if not require("lv-utils").check_lsp_client_active "bashls" then
|
||||||
|
-- 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" },
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
M.dap = function()
|
||||||
|
-- TODO: implement dap
|
||||||
|
return "No DAP configured!"
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
48
lua/lang/terraform.lua
Normal file
48
lua/lang/terraform.lua
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
M.config = function()
|
||||||
|
-- TODO: implement config for language
|
||||||
|
return "No config available!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.format = function()
|
||||||
|
O.formatters.filetype["hcl"] = {
|
||||||
|
function()
|
||||||
|
return {
|
||||||
|
exe = O.lang.terraform.formatter.exe,
|
||||||
|
args = O.lang.terraform.formatter.args,
|
||||||
|
stdin = not (O.lang.terraform.formatter.stdin ~= nil),
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
O.formatters.filetype["tf"] = O.formatters.filetype["hcl"]
|
||||||
|
|
||||||
|
require("formatter.config").set_defaults {
|
||||||
|
logging = false,
|
||||||
|
filetype = O.formatters.filetype,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
M.lint = function()
|
||||||
|
-- TODO: implement linters (if applicable)
|
||||||
|
return "No linters configured!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.lsp = function()
|
||||||
|
if require("lv-utils").check_lsp_client_active "terraformls" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
require("lspconfig").terraformls.setup {
|
||||||
|
cmd = { DATA_PATH .. "/lspinstall/terraform/terraform-ls", "serve" },
|
||||||
|
on_attach = require("lsp").common_on_attach,
|
||||||
|
filetypes = { "tf", "terraform", "hcl" },
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
M.dap = function()
|
||||||
|
-- TODO: implement dap
|
||||||
|
return "No DAP configured!"
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
123
lua/lang/tex.lua
Normal file
123
lua/lang/tex.lua
Normal file
|
@ -0,0 +1,123 @@
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
M.config = function()
|
||||||
|
-- TODO: implement config for language
|
||||||
|
return "No config available!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.format = function()
|
||||||
|
-- TODO: implement formatter for language
|
||||||
|
return "No formatter available!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.lint = function()
|
||||||
|
-- TODO: implement linters (if applicable)
|
||||||
|
return "No linters configured!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.lsp = function()
|
||||||
|
if require("lv-utils").check_lsp_client_active "texlab" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local preview_settings = {}
|
||||||
|
|
||||||
|
local sumatrapdf_args = { "-reuse-instance", "%p", "-forward-search", "%f", "%l" }
|
||||||
|
local evince_args = { "-f", "%l", "%p", '"code -g %f:%l"' }
|
||||||
|
local okular_args = { "--unique", "file:%p#src:%l%f" }
|
||||||
|
local zathura_args = { "--synctex-forward", "%l:1:%f", "%p" }
|
||||||
|
local qpdfview_args = { "--unique", "%p#src:%f:%l:1" }
|
||||||
|
local skim_args = { "%l", "%p", "%f" }
|
||||||
|
|
||||||
|
if O.lang.latex.forward_search.executable == "C:/Users/{User}/AppData/Local/SumatraPDF/SumatraPDF.exe" then
|
||||||
|
preview_settings = sumatrapdf_args
|
||||||
|
elseif O.lang.latex.forward_search.executable == "evince-synctex" then
|
||||||
|
preview_settings = evince_args
|
||||||
|
elseif O.lang.latex.forward_search.executable == "okular" then
|
||||||
|
preview_settings = okular_args
|
||||||
|
elseif O.lang.latex.forward_search.executable == "zathura" then
|
||||||
|
preview_settings = zathura_args
|
||||||
|
elseif O.lang.latex.forward_search.executable == "qpdfview" then
|
||||||
|
preview_settings = qpdfview_args
|
||||||
|
elseif O.lang.latex.forward_search.executable == "/Applications/Skim.app/Contents/SharedSupport/displayline" then
|
||||||
|
preview_settings = skim_args
|
||||||
|
end
|
||||||
|
|
||||||
|
require("lspconfig").texlab.setup {
|
||||||
|
cmd = { DATA_PATH .. "/lspinstall/latex/texlab" },
|
||||||
|
on_attach = require("lsp").common_on_attach,
|
||||||
|
handlers = {
|
||||||
|
["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
|
||||||
|
virtual_text = O.lang.latex.diagnostics.virtual_text,
|
||||||
|
signs = O.lang.latex.diagnostics.signs,
|
||||||
|
underline = O.lang.latex.diagnostics.underline,
|
||||||
|
update_in_insert = true,
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
filetypes = { "tex", "bib" },
|
||||||
|
settings = {
|
||||||
|
texlab = {
|
||||||
|
auxDirectory = O.lang.latex.aux_directory,
|
||||||
|
bibtexFormatter = O.lang.latex.bibtex_formatter,
|
||||||
|
build = {
|
||||||
|
args = O.lang.latex.build.args,
|
||||||
|
executable = O.lang.latex.build.executable,
|
||||||
|
forwardSearchAfter = O.lang.latex.build.forward_search_after,
|
||||||
|
onSave = O.lang.latex.build.on_save,
|
||||||
|
},
|
||||||
|
chktex = {
|
||||||
|
onEdit = O.lang.latex.chktex.on_edit,
|
||||||
|
onOpenAndSave = O.lang.latex.chktex.on_open_and_save,
|
||||||
|
},
|
||||||
|
diagnosticsDelay = O.lang.latex.diagnostics_delay,
|
||||||
|
formatterLineLength = O.lang.latex.formatter_line_length,
|
||||||
|
forwardSearch = {
|
||||||
|
args = preview_settings,
|
||||||
|
executable = O.lang.latex.forward_search.executable,
|
||||||
|
},
|
||||||
|
latexFormatter = O.lang.latex.latex_formatter,
|
||||||
|
latexindent = {
|
||||||
|
modifyLineBreaks = O.lang.latex.latexindent.modify_line_breaks,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
vim.g.vimtex_compiler_method = "latexmk"
|
||||||
|
vim.g.vimtex_view_method = "zathura"
|
||||||
|
vim.g.vimtex_fold_enabled = 0
|
||||||
|
vim.g.vimtex_quickfix_ignore_filters = O.lang.latex.ignore_errors
|
||||||
|
|
||||||
|
O.plugin.which_key.mappings["t"] = {
|
||||||
|
name = "+Latex",
|
||||||
|
c = { "<cmd>VimtexCompile<cr>", "Toggle Compilation Mode" },
|
||||||
|
f = { "<cmd>call vimtex#fzf#run()<cr>", "Fzf Find" },
|
||||||
|
i = { "<cmd>VimtexInfo<cr>", "Project Information" },
|
||||||
|
s = { "<cmd>VimtexStop<cr>", "Stop Project Compilation" },
|
||||||
|
t = { "<cmd>VimtexTocToggle<cr>", "Toggle Table Of Content" },
|
||||||
|
v = { "<cmd>VimtexView<cr>", "View PDF" },
|
||||||
|
b = { "<cmd>TexlabBuild<cr>", "Build with Texlab" },
|
||||||
|
p = { "<cmd>TexlabForward<cr>", "Preview with Texlab" },
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Compile on initialization, cleanup on quit
|
||||||
|
vim.api.nvim_exec(
|
||||||
|
[[
|
||||||
|
augroup vimtex_event_1
|
||||||
|
au!
|
||||||
|
au User VimtexEventQuit call vimtex#compiler#clean(0)
|
||||||
|
au User VimtexEventInitPost call vimtex#compiler#compile()
|
||||||
|
augroup END
|
||||||
|
]],
|
||||||
|
false
|
||||||
|
)
|
||||||
|
if O.lang.latex.auto_save then
|
||||||
|
vim.api.nvim_exec([[au FocusLost * :wa]], false)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
M.dap = function()
|
||||||
|
-- TODO: implement dap
|
||||||
|
return "No DAP configured!"
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
25
lua/lang/typescript.lua
Normal file
25
lua/lang/typescript.lua
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
M.config = function()
|
||||||
|
-- TODO: implement config for language
|
||||||
|
return "No config available!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.format = function()
|
||||||
|
-- TODO: implement formatter for language
|
||||||
|
return "No formatter available!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.lint = function()
|
||||||
|
-- TODO: implement linters (if applicable)
|
||||||
|
return "No linters configured!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.lsp = function() end
|
||||||
|
|
||||||
|
M.dap = function()
|
||||||
|
-- TODO: implement dap
|
||||||
|
return "No DAP configured!"
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
25
lua/lang/typescriptreact.lua
Normal file
25
lua/lang/typescriptreact.lua
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
M.config = function()
|
||||||
|
-- TODO: implement config for language
|
||||||
|
return "No config available!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.format = function()
|
||||||
|
-- TODO: implement formatter for language
|
||||||
|
return "No formatter available!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.lint = function()
|
||||||
|
-- TODO: implement linters (if applicable)
|
||||||
|
return "No linters configured!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.lsp = function() end
|
||||||
|
|
||||||
|
M.dap = function()
|
||||||
|
-- TODO: implement dap
|
||||||
|
return "No DAP configured!"
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
35
lua/lang/vim.lua
Normal file
35
lua/lang/vim.lua
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
M.config = function()
|
||||||
|
-- TODO: implement config for language
|
||||||
|
return "No config available!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.format = function()
|
||||||
|
-- TODO: implement formatter for language
|
||||||
|
return "No formatter available!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.lint = function()
|
||||||
|
-- TODO: implement linters (if applicable)
|
||||||
|
return "No linters configured!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.lsp = function()
|
||||||
|
if require("lv-utils").check_lsp_client_active "vimls" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- npm install -g vim-language-server
|
||||||
|
require("lspconfig").vimls.setup {
|
||||||
|
cmd = { DATA_PATH .. "/lspinstall/vim/node_modules/.bin/vim-language-server", "--stdio" },
|
||||||
|
on_attach = require("lsp").common_on_attach,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
M.dap = function()
|
||||||
|
-- TODO: implement dap
|
||||||
|
return "No DAP configured!"
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
25
lua/lang/vue.lua
Normal file
25
lua/lang/vue.lua
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
M.config = function()
|
||||||
|
-- TODO: implement config for language
|
||||||
|
return "No config available!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.format = function()
|
||||||
|
-- TODO: implement formatter for language
|
||||||
|
return "No formatter available!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.lint = function()
|
||||||
|
-- TODO: implement linters (if applicable)
|
||||||
|
return "No linters configured!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.lsp = function() end
|
||||||
|
|
||||||
|
M.dap = function()
|
||||||
|
-- TODO: implement dap
|
||||||
|
return "No DAP configured!"
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
25
lua/lang/yaml.lua
Normal file
25
lua/lang/yaml.lua
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
M.config = function()
|
||||||
|
-- TODO: implement config for language
|
||||||
|
return "No config available!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.format = function()
|
||||||
|
-- TODO: implement formatter for language
|
||||||
|
return "No formatter available!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.lint = function()
|
||||||
|
-- TODO: implement linters (if applicable)
|
||||||
|
return "No linters configured!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.lsp = function() end
|
||||||
|
|
||||||
|
M.dap = function()
|
||||||
|
-- TODO: implement dap
|
||||||
|
return "No DAP configured!"
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
25
lua/lang/zig.lua
Normal file
25
lua/lang/zig.lua
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
M.config = function()
|
||||||
|
-- TODO: implement config for language
|
||||||
|
return "No config available!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.format = function()
|
||||||
|
-- TODO: implement formatter for language
|
||||||
|
return "No formatter available!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.lint = function()
|
||||||
|
-- TODO: implement linters (if applicable)
|
||||||
|
return "No linters configured!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.lsp = function() end
|
||||||
|
|
||||||
|
M.dap = function()
|
||||||
|
-- TODO: implement dap
|
||||||
|
return "No DAP configured!"
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
Loading…
Add table
Add a link
Reference in a new issue