Hey all,
i’m using neovim with Julia (julials). I have set up my LSP with “Mason” regarding to the documentation from the github. I include the relevant configs here, but if you want a look at my full neovim config, go to my GitHub: (GitHub - MichaelBrueggemann/nvim).
My Issue is, that the LSP is working correctly (i can get Hover documentation etc.) but when i’m in a file that uses Tokens from a local module, neovim doesnt recognize the References. But when i’m in a file deeper nested in my project, this issue is gone.
The module “GEMS” is fully defined in “~/Repositories/gems” and i started my neovim session in this directory via “nvim .”.
Does anyone has had similar experiences? If there are Information missing, please tell me.
As i’m a new user i can’t create multiple embedded files, so i placed all relevant screenshots in a PNGs at the bottom.
[LSP-Config]
local mason = require('mason')
local mason_lsp = require('mason-lspconfig')
-- setup mason itself
mason.setup({
ui = {
icons = {
package_installed = "✓",
package_pending = "➜",
package_uninstalled = "✗"
}
}
})
-- Customized on_attach function
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
-- 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')
-- See `:help vim.lsp.*` for documentation on any of the below functions
local opts = { buffer = bufnr }
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts)
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, 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', '<leader>ca', vim.lsp.buf.code_action, opts)
vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, opts)
vim.keymap.set('n', '<leader>rf', vim.lsp.buf.references, opts)
vim.keymap.set('n', '<leader>f', function()
print("formatting...")
vim.lsp.buf.format { async = true }
print("Formatting done!")
end, opts)
print("Language server started: " .. client.name)
end
local lspconfig = require('lspconfig')
local lsp_capabilities = vim.lsp.protocol.make_client_capabilities()
-- define autocompletion capabilitites
local cmp_capabilities = require("cmp_nvim_lsp").default_capabilities(lsp_capabilities)
-- list all lsp servers, that should be installed
local lsp_servers = {
'lua_ls',
'julials',
'jdtls',
}
-- install lsps
mason_lsp.setup({
ensure_installed = lsp_servers,
automatic_installation = true,
})
lspconfig.julials.setup({
on_attach = on_attach,
capabilities = cmp_capabilities,
})
[Screenshots]