Skip to content

Instantly share code, notes, and snippets.

@amiralies
Created October 8, 2022 02:48
Show Gist options
  • Save amiralies/958278cc181c84acb22fa064222717f5 to your computer and use it in GitHub Desktop.
Save amiralies/958278cc181c84acb22fa064222717f5 to your computer and use it in GitHub Desktop.
Ensime TNG nvim lspconfig
local configs = require 'lspconfig.configs'
local lspconfig = require 'lspconfig'
-- Check if the config is already defined (useful when reloading this file)
if not configs.ensime then
configs.ensime = {
default_config = {
cmd = {
'java', '-jar', os.getenv("HOME") .. '/.cache/ensime/lib/ensime-lsp.jar'
},
filetypes = {'scala'},
root_dir = function(fname)
return lspconfig.util.find_git_ancestor(fname)
end,
settings = {}
}
}
end
-- call `setup()` to enable the FileType autocmd
require'lspconfig'.ensime.setup {}
@fommil
Copy link

fommil commented Oct 18, 2022

since ensime-tng is project agnostic, I think it's safe to set the project root to / or any other wildcard that neovim supports.

@ckipp01
Copy link

ckipp01 commented Oct 18, 2022

since ensime-tng is project agnostic

Could you explain a bit more about what you mean by this? If it's project agnostic how does it know what sources for example "belong" to a project?

@fommil
Copy link

fommil commented Oct 18, 2022

@ckipp01 check out the README for details. The compiler plugin extracts the build information, and it can reconcile all the open files that belong to the same compilation module. The build tool's definition of the project is irrelevant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment