Changes returning to solo.io (#1)
1. Add ghostty config 2. Revise the nvim-lsp config to remedy deprecation warnings 3. Add back solo.zsh with enhancements Reviewed-on: #1 Co-authored-by: Jacob Bohanon <jacobbohanon@gmail.com> Co-committed-by: Jacob Bohanon <jacobbohanon@gmail.com>
This commit was merged in pull request #1.
This commit is contained in:
103
nvim/lua/lsp.lua
103
nvim/lua/lsp.lua
@@ -1,5 +1,3 @@
|
||||
-- Mappings.
|
||||
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
|
||||
local opts = { noremap = true, silent = true }
|
||||
vim.keymap.set('n', '<space>d', vim.diagnostic.open_float, opts)
|
||||
vim.keymap.set('n', '<space>dd', require 'telescope.builtin'.diagnostics, opts)
|
||||
@@ -7,14 +5,9 @@ vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts)
|
||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
|
||||
vim.keymap.set('n', '<space>dl', vim.diagnostic.setloclist, opts)
|
||||
|
||||
-- Use an on_attach function to only map the following keys
|
||||
-- after the language server attaches to the current buffer
|
||||
local on_attach = function(client, bufnr)
|
||||
-- Enable completion triggered by <c-x><c-o>
|
||||
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||
vim.bo[bufnr].omnifunc = 'v:lua.vim.lsp.omnifunc'
|
||||
|
||||
-- Mappings.
|
||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||
local bufopts = { noremap = true, silent = true, buffer = bufnr }
|
||||
vim.keymap.set('n', 'gD', require 'telescope.builtin'.lsp_type_definitions, bufopts)
|
||||
vim.keymap.set('n', 'gd', require 'telescope.builtin'.lsp_definitions, bufopts)
|
||||
@@ -27,51 +20,30 @@ local on_attach = function(client, bufnr)
|
||||
vim.keymap.set('n', 'gr', require 'telescope.builtin'.lsp_references, bufopts)
|
||||
vim.keymap.set('n', '<space>f', vim.lsp.buf.format, bufopts)
|
||||
end
|
||||
|
||||
local capabilities = require('cmp_nvim_lsp').default_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||
require('lspconfig')['gopls'].setup {
|
||||
|
||||
vim.lsp.config('*', {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
})
|
||||
|
||||
vim.lsp.config('gopls', {
|
||||
settings = {
|
||||
gopls = {
|
||||
templateExtensions = { 'gotmpl', 'gohtml' },
|
||||
}
|
||||
},
|
||||
filetypes = { "go", "gomod", "gowork", "gotmpl", "gohtml", "gohtmltmpl" },
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
require('lspconfig')['pyright'].setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
require('lspconfig')['tsserver'].setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
require('lspconfig')['clangd'].setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
-- This is the default list of filetypes excluding proto
|
||||
})
|
||||
|
||||
vim.lsp.config('clangd', {
|
||||
-- default filetypes excluding proto
|
||||
-- https://github.com/neovim/nvim-lspconfig/blob/0ef64599b8aa0187ee5f6d92cb39c951f348f041/lua/lspconfig/server_configurations/clangd.lua#L70C5-L70C66
|
||||
filetypes = { 'c', 'cpp', 'objc', 'objcpp', 'cuda' }
|
||||
}
|
||||
require('lspconfig')['rust_analyzer'].setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
require('lspconfig')['bashls'].setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
require('lspconfig')['bzl'].setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
require('lspconfig')['cmake'].setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
require('lspconfig')['lua_ls'].setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
})
|
||||
|
||||
vim.lsp.config('lua_ls', {
|
||||
on_init = function(client)
|
||||
local path = client.workspace_folders[1].name
|
||||
if (vim.uv or vim.loop).fs_stat(path .. '/.luarc.json') or (vim.uv or vim.loop).fs_stat(path .. '/.luarc.jsonc') then
|
||||
@@ -80,39 +52,40 @@ require('lspconfig')['lua_ls'].setup {
|
||||
|
||||
client.config.settings.Lua = vim.tbl_deep_extend('force', client.config.settings.Lua, {
|
||||
runtime = {
|
||||
-- Tell the language server which version of Lua you're using
|
||||
-- (most likely LuaJIT in the case of Neovim)
|
||||
version = 'LuaJIT'
|
||||
},
|
||||
-- Make the server aware of Neovim runtime files
|
||||
workspace = {
|
||||
checkThirdParty = false,
|
||||
library = {
|
||||
vim.env.VIMRUNTIME
|
||||
-- Depending on the usage, you might want to add additional paths here.
|
||||
-- "${3rd}/luv/library"
|
||||
-- "${3rd}/busted/library",
|
||||
}
|
||||
-- or pull in all of 'runtimepath'. NOTE: this is a lot slower
|
||||
-- library = vim.api.nvim_get_runtime_file("", true)
|
||||
}
|
||||
})
|
||||
end,
|
||||
settings = {
|
||||
Lua = {}
|
||||
}
|
||||
}
|
||||
require('lspconfig')['zls'].setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
})
|
||||
|
||||
vim.lsp.config('zls', {
|
||||
cmd = { '/home/jacob/src/github.com/zigtools/zls/zig-out/bin/zls' },
|
||||
settings = {
|
||||
zls = {
|
||||
zig_exe_path = '/home/jacob/.zig/zig/zig',
|
||||
settings = {
|
||||
zls = {
|
||||
zig_exe_path = '/home/jacob/.zig/zig/zig',
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
require('lspconfig')['protols'].setup{
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
})
|
||||
|
||||
vim.lsp.enable({
|
||||
'gopls',
|
||||
'pyright',
|
||||
'ts_ls',
|
||||
'clangd',
|
||||
'rust_analyzer',
|
||||
'bashls',
|
||||
'bzl',
|
||||
'cmake',
|
||||
'lua_ls',
|
||||
'zls',
|
||||
'protols',
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user