mirror of
https://github.com/halfdan/dotfiles.git
synced 2025-04-25 20:05:40 +00:00
use lexical
This commit is contained in:
parent
43c2d9f3cd
commit
814000d6e8
@ -88,6 +88,45 @@ local lsp_status = require('lsp-status')
|
||||
lsp_status.register_progress()
|
||||
|
||||
local lspconfig = require 'lspconfig'
|
||||
local configs = require 'lspconfig.configs'
|
||||
|
||||
-- Global mappings.
|
||||
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
|
||||
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float)
|
||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev)
|
||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next)
|
||||
vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist)
|
||||
|
||||
-- Use LspAttach autocommand to only map the following keys
|
||||
-- after the language server attaches to the current buffer
|
||||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
group = vim.api.nvim_create_augroup('UserLspConfig', {}),
|
||||
callback = function(ev)
|
||||
-- Enable completion triggered by <c-x><c-o>
|
||||
vim.bo[ev.buf].omnifunc = 'v:lua.vim.lsp.omnifunc'
|
||||
|
||||
-- Buffer local mappings.
|
||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||
local opts = { buffer = ev.buf }
|
||||
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts)
|
||||
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts)
|
||||
vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts)
|
||||
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, opts)
|
||||
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, opts)
|
||||
vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, opts)
|
||||
vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, opts)
|
||||
vim.keymap.set('n', '<space>wl', function()
|
||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
end, opts)
|
||||
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, opts)
|
||||
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, opts)
|
||||
vim.keymap.set({ 'n', 'v' }, '<space>ca', vim.lsp.buf.code_action, opts)
|
||||
vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts)
|
||||
vim.keymap.set('n', '<space>f', function()
|
||||
vim.lsp.buf.format { async = true }
|
||||
end, opts)
|
||||
end,
|
||||
})
|
||||
|
||||
local on_attach = function(client, bufnr)
|
||||
nnoremap("gd", "<cmd>Lspsaga peek_definition<CR>")
|
||||
@ -125,10 +164,10 @@ local function config(_config)
|
||||
end
|
||||
|
||||
-- Enable the following language servers
|
||||
local servers = { 'gopls', 'julials', 'rust_analyzer', 'pyright' }
|
||||
for _, lsp in ipairs(servers) do
|
||||
lspconfig[lsp].setup(config())
|
||||
end
|
||||
-- local servers = { 'gopls', 'julials', 'rust_analyzer', 'pyright' }
|
||||
-- for _, lsp in ipairs(servers) do
|
||||
-- lspconfig[lsp].setup(config())
|
||||
-- end
|
||||
|
||||
require'lspconfig'.lua_ls.setup {
|
||||
settings = {
|
||||
@ -176,3 +215,26 @@ require('rust-tools').setup({
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
local lexical_config = {
|
||||
filetypes = { "elixir", "eelixir", "heex" },
|
||||
cmd = { "/Users/halfdan/code/lexical/_build/dev/package/lexical/bin/start_lexical.sh" },
|
||||
settings = {},
|
||||
}
|
||||
|
||||
if not configs.lexical then
|
||||
configs.lexical = {
|
||||
default_config = {
|
||||
filetypes = lexical_config.filetypes,
|
||||
cmd = lexical_config.cmd,
|
||||
root_dir = function(fname)
|
||||
return lspconfig.util.root_pattern("mix.exs", ".git")(fname) or vim.loop.os_homedir()
|
||||
end,
|
||||
-- optional settings
|
||||
settings = lexical_config.settings,
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
lspconfig.lexical.setup({})
|
||||
|
||||
|
@ -144,27 +144,27 @@ require("lazy").setup({
|
||||
"elixir-tools/elixir-tools.nvim",
|
||||
version = "*",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
config = function()
|
||||
local elixir = require("elixir")
|
||||
local elixirls = require("elixir.elixirls")
|
||||
-- config = function()
|
||||
-- local elixir = require("elixir")
|
||||
-- local elixirls = require("elixir.elixirls")
|
||||
|
||||
elixir.setup {
|
||||
nextls = {enable = true},
|
||||
credo = {},
|
||||
elixirls = {
|
||||
enable = false,
|
||||
settings = elixirls.settings {
|
||||
dialyzerEnabled = false,
|
||||
enableTestLenses = false,
|
||||
},
|
||||
on_attach = function(client, bufnr)
|
||||
vim.keymap.set("n", "<space>fp", ":ElixirFromPipe<cr>", { buffer = true, noremap = true })
|
||||
vim.keymap.set("n", "<space>tp", ":ElixirToPipe<cr>", { buffer = true, noremap = true })
|
||||
vim.keymap.set("v", "<space>em", ":ElixirExpandMacro<cr>", { buffer = true, noremap = true })
|
||||
end,
|
||||
}
|
||||
}
|
||||
end,
|
||||
-- elixir.setup {
|
||||
-- nextls = {enable = true},
|
||||
-- credo = {},
|
||||
-- elixirls = {
|
||||
-- enable = false,
|
||||
-- settings = elixirls.settings {
|
||||
-- dialyzerEnabled = false,
|
||||
-- enableTestLenses = false,
|
||||
-- },
|
||||
-- on_attach = function(client, bufnr)
|
||||
-- vim.keymap.set("n", "<space>fp", ":ElixirFromPipe<cr>", { buffer = true, noremap = true })
|
||||
-- vim.keymap.set("n", "<space>tp", ":ElixirToPipe<cr>", { buffer = true, noremap = true })
|
||||
-- vim.keymap.set("v", "<space>em", ":ElixirExpandMacro<cr>", { buffer = true, noremap = true })
|
||||
-- end,
|
||||
-- }
|
||||
-- }
|
||||
-- end,
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user