You've already forked dotfiles
feat: Removing nvim-lspconfig and starting the removal of Mason, adding
in LSP definitions for servers that are used, adding in a script to check for LSPs, removing some extraneous items in the tmux conf, moving autopairs to its own file
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
-- Pulled from the nvim-lspconfig plugin: https://github.com/neovim/nvim-lspconfig/blob/master/lsp/clangd.lua
|
||||
-- TODO: Review for cleaning up any extraneous items and reduce maint surface
|
||||
|
||||
-- https://clangd.llvm.org/extensions.html#switch-between-sourceheader
|
||||
local function switch_source_header(bufnr, client)
|
||||
local method_name = 'textDocument/switchSourceHeader'
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
-- Handles setting up the connection to a locally running Godot instance for LSP responses
|
||||
|
||||
return {
|
||||
cmd = vim.lsp.rpc.connect('127.0.0.1', 6005),
|
||||
filetypes = {
|
||||
|
||||
@@ -1,15 +1,9 @@
|
||||
vim.filetype.add {
|
||||
extension = {
|
||||
-- tera = 'jinja',
|
||||
jinja = 'jinja',
|
||||
jinja2 = 'jinja',
|
||||
j2 = 'jinja',
|
||||
}
|
||||
}
|
||||
-- Jinja LSP setup tuned to include Tera templates
|
||||
-- TODO: Not currently working correctly for Tera templates
|
||||
|
||||
return {
|
||||
name = 'jinja_lsp',
|
||||
cmd = { 'jinja-lsp' },
|
||||
filetypes = { 'jinja', 'tera', 'html' },
|
||||
-- template_extension = { 'html', 'jinja', 'j2', 'tera' },
|
||||
filetypes = { 'jinja', 'tera' },
|
||||
root_markers = { '.git' },
|
||||
}
|
||||
|
||||
@@ -1,9 +1,47 @@
|
||||
-- Lua LSP config handles the initialization of workspace folders to pull in library references for completion
|
||||
return {
|
||||
cmd = { 'lua-language-server' },
|
||||
filetypes = { 'lua' },
|
||||
on_init = function (client)
|
||||
if client.workspace_folders then
|
||||
local path = client.workspace_folders[1].name
|
||||
if
|
||||
path ~= vim.fn.stdpath('config')
|
||||
and (vim.uv.fs_stat(path .. '/.luarc.json') or vim.uv.fs_stat(path .. '/.luarc.jsonc'))
|
||||
then
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
client.config.settings.Lua = vim.tbl_deep_extend('force', client.config.settings.Lua, {
|
||||
runtime = {
|
||||
version = 'LuaJIT',
|
||||
path = {
|
||||
'lua/?.lua',
|
||||
'lua/?/init.lua',
|
||||
},
|
||||
},
|
||||
workspace = {
|
||||
checkThirdParty = false,
|
||||
library = {
|
||||
vim.env.VIMRUNTIME,
|
||||
vim.api.nvim_get_runtime_file('lua/lspconfig', false)[1],
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
root_markers = {
|
||||
'.emmyrc.json',
|
||||
'.git',
|
||||
'.luachecrc',
|
||||
'.luarc.json',
|
||||
'.luarc.jsonc',
|
||||
'.stylua.toml',
|
||||
},
|
||||
settings = {
|
||||
Lua = {
|
||||
diagnostics = {
|
||||
globals = { 'vim' }
|
||||
}
|
||||
}
|
||||
}
|
||||
codeLens = { enable = true },
|
||||
hint = { enable = true, semicolon = 'Disable' },
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
return {
|
||||
filetypes = { 'md', 'markdown', 'telekasten' }
|
||||
cmd = { 'marksman' },
|
||||
filetypes = { 'md', 'markdown', 'telekasten' },
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
-- Python LSP disabling some linting that is not required to enforce
|
||||
|
||||
return {
|
||||
cmd = { 'pylsp' },
|
||||
filetypes = { 'python' },
|
||||
|
||||
1
nvim/after/lsp/r_language_server.lua
Normal file
1
nvim/after/lsp/r_language_server.lua
Normal file
@@ -0,0 +1 @@
|
||||
return {}
|
||||
@@ -1,4 +1,179 @@
|
||||
-- Rust LSP adding in some additions for extensive diagnostics
|
||||
|
||||
-- Section from nvim-lspconfig
|
||||
-- local function reload_workspace()
|
||||
-- local clients = vim.lsp.get_clients { bufnr = bufnr, name = 'rust_analyzer' }
|
||||
-- for _, client in ipairs(clients) do
|
||||
-- vim.notify 'Reloading Cargo Workspace'
|
||||
-- client:request('rust-analyzer/reloadWorkspace', nil, function(err)
|
||||
-- if err then
|
||||
-- error(tostring(err))
|
||||
-- end
|
||||
-- vim.notify 'Cargo workspace reloaded'
|
||||
-- end, 0)
|
||||
-- end
|
||||
-- end
|
||||
--
|
||||
-- local function user_sysroot_src()
|
||||
-- return vim.tbl_get(vim.lsp.config['rust_analyzer'], 'settings', 'rust-analyzer', 'cargo', 'sysrootSrc')
|
||||
-- end
|
||||
--
|
||||
-- local function default_sysroot_src()
|
||||
-- local sysroot = vim.tbl_get(vim.lsp.config['rust_analyzer'], 'settings', 'rust-analyzer', 'cargo', 'sysroot')
|
||||
-- if not sysroot then
|
||||
-- local rustc = os.getenv 'RUSTC' or 'rustc'
|
||||
-- local result = vim.system({ rustc, '--print', 'sysroot' }, { text = true }):wait()
|
||||
--
|
||||
-- local stdout = result.stdout
|
||||
--
|
||||
-- if result.code == 0 and stdout then
|
||||
-- if string.sub(stdout, #stdout) == '\n' then
|
||||
-- if #stdout > 1 then
|
||||
-- sysroot = string.sub(stdout, 1, #stdout - 1)
|
||||
-- else
|
||||
-- sysroot = ''
|
||||
-- end
|
||||
-- else
|
||||
-- sysroot = stdout
|
||||
-- end
|
||||
-- end
|
||||
-- end
|
||||
--
|
||||
-- return sysroot and vim.fs.joinpath(sysroot, 'lib/rustlib/src/rust/library') or nil
|
||||
-- end
|
||||
--
|
||||
-- local function is_library(fname)
|
||||
-- local user_home = vim.fs.normalize(vim.env.HOME)
|
||||
-- local cargo_home = os.getenv 'CARGO_HOME' or user_home .. '/.cargo'
|
||||
-- local registry = cargo_home .. '/registry/src'
|
||||
-- local git_registry = cargo_home .. '/git/checkouts'
|
||||
--
|
||||
-- local rustup_home = os.getenv 'RUSTUP_HOME' or user_home .. '/.rustup'
|
||||
-- local toolchains = rustup_home .. '/toolchains'
|
||||
--
|
||||
-- local sysroot_src = user_sysroot_src() or default_sysroot_src()
|
||||
--
|
||||
-- for _, item in ipairs { toolchains, registry, git_registry, sysroot_src } do
|
||||
-- if item and vim.fs.relpath(item, fname) then
|
||||
-- local clients = vim.lsp.get_clients { name = 'rust_analyzer' }
|
||||
-- return #clients > 0 and clients[#clients].config.root_dir or nil
|
||||
-- end
|
||||
-- end
|
||||
-- end
|
||||
--
|
||||
-- return {
|
||||
-- cmd = { 'rust-analyzer' },
|
||||
-- filetypes = { 'rust' },
|
||||
-- root_dir = function(bufnr, on_dir)
|
||||
-- local fname = vim.api.nvim_buf_get_name(bufnr)
|
||||
-- local reused_dir = is_library(fname)
|
||||
-- if reused_dir then
|
||||
-- on_dir(reused_dir)
|
||||
-- return
|
||||
-- end
|
||||
--
|
||||
-- local cargo_crate_dir = vim.fs.root(fname, { 'Cargo.toml' })
|
||||
-- local cargo_workspace_root
|
||||
--
|
||||
-- if cargo_crate_dir == nil then
|
||||
-- on_dir(
|
||||
-- vim.fs.root(fname, { 'rust-project.json' })
|
||||
-- or vim.fs.dirname(vim.fs.find('.git', { path = fname, upward = true })[1])
|
||||
-- )
|
||||
-- return
|
||||
-- end
|
||||
--
|
||||
-- local cmd = {
|
||||
-- 'cargo',
|
||||
-- 'metadata',
|
||||
-- '--no-deps',
|
||||
-- '--format-version',
|
||||
-- '1',
|
||||
-- '--manifest-path',
|
||||
-- cargo_crate_dir .. '/Cargo.toml',
|
||||
-- }
|
||||
--
|
||||
-- vim.system(cmd, { text = true }, function(output)
|
||||
-- if output.code == 0 then
|
||||
-- if output.stdout then
|
||||
-- local result = vim.json.decode(output.stdout)
|
||||
-- if result['workspace_root'] then
|
||||
-- cargo_workspace_root = vim.fs.normalize(result['workspace_root'])
|
||||
-- end
|
||||
-- end
|
||||
--
|
||||
-- on_dir(cargo_workspace_root or cargo_crate_dir)
|
||||
-- else
|
||||
-- vim.schedule(function()
|
||||
-- vim.notify(('[rust_analyzer] cmd failed with code %d: %s\n%s'):format(output.code, cmd, output.stderr))
|
||||
-- end)
|
||||
-- end
|
||||
-- end)
|
||||
-- end,
|
||||
-- capabilities = {
|
||||
-- experimental = {
|
||||
-- serverStatusNotification = true,
|
||||
-- commands = {
|
||||
-- commands = {
|
||||
-- 'rust-analyzer.showReferences',
|
||||
-- 'rust-analyzer.runSingle',
|
||||
-- 'rust-analyzer.debugSingle',
|
||||
-- },
|
||||
-- },
|
||||
-- },
|
||||
-- },
|
||||
-- ---@type lspconfig.settings.rust_analyzer
|
||||
-- settings = {
|
||||
-- ['rust-analyzer'] = {
|
||||
-- lens = {
|
||||
-- debug = { enable = true },
|
||||
-- enable = true,
|
||||
-- implementations = { enable = true },
|
||||
-- references = {
|
||||
-- adt = { enable = true },
|
||||
-- enumVariant = { enable = true },
|
||||
-- method = { enable = true },
|
||||
-- trait = { enable = true },
|
||||
-- },
|
||||
-- run = { enable = true },
|
||||
-- updateTest = { enable = true },
|
||||
-- },
|
||||
-- },
|
||||
-- },
|
||||
-- before_init = function(init_params, config)
|
||||
-- -- See https://github.com/rust-lang/rust-analyzer/blob/eb5da56d839ae0a9e9f50774fa3eb78eb0964550/docs/dev/lsp-extensions.md?plain=1#L26
|
||||
-- if config.settings and config.settings['rust-analyzer'] then
|
||||
-- init_params.initializationOptions = config.settings['rust-analyzer']
|
||||
-- end
|
||||
-- ---@param command table{ title: string, command: string, arguments: any[] }
|
||||
-- vim.lsp.commands['rust-analyzer.runSingle'] = function(command)
|
||||
-- local r = command.arguments[1]
|
||||
-- local cmd = { 'cargo', unpack(r.args.cargoArgs) }
|
||||
-- if r.args.executableArgs and #r.args.executableArgs > 0 then
|
||||
-- vim.list_extend(cmd, { '--', unpack(r.args.executableArgs) })
|
||||
-- end
|
||||
--
|
||||
-- local proc = vim.system(cmd, { cwd = r.args.cwd, env = r.args.environment })
|
||||
--
|
||||
-- local result = proc:wait()
|
||||
--
|
||||
-- if result.code == 0 then
|
||||
-- vim.notify(result.stdout, vim.log.levels.INFO)
|
||||
-- else
|
||||
-- vim.notify(result.stderr, vim.log.levels.ERROR)
|
||||
-- end
|
||||
-- end
|
||||
-- end,
|
||||
-- on_attach = function(_, bufnr)
|
||||
-- vim.api.nvim_buf_create_user_command(bufnr, 'LspCargoReload', function()
|
||||
-- reload_workspace(bufnr)
|
||||
-- end, { desc = 'Reload current cargo workspace' })
|
||||
-- end,
|
||||
-- }
|
||||
|
||||
return {
|
||||
cmd = { 'rust-analyzer' },
|
||||
filetypes = { 'rust' },
|
||||
settings = {
|
||||
['rust_analyzer'] = {
|
||||
check = {
|
||||
|
||||
4
nvim/after/lsp/shellcheck.lua
Normal file
4
nvim/after/lsp/shellcheck.lua
Normal file
@@ -0,0 +1,4 @@
|
||||
return {
|
||||
cmd = { 'shellcheck' },
|
||||
filetypes = { 'zsh', 'bash', 'sh' },
|
||||
}
|
||||
@@ -1,3 +1,5 @@
|
||||
-- YAML LSP specific settings with a number of custom tags specifically for use with AWS CloudFormation templates
|
||||
|
||||
return {
|
||||
settings = {
|
||||
redhat = { telemetry = { enabled = false } },
|
||||
|
||||
Reference in New Issue
Block a user