Created
October 8, 2022 02:48
-
-
Save amiralies/958278cc181c84acb22fa064222717f5 to your computer and use it in GitHub Desktop.
Ensime TNG nvim lspconfig
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 {} |
since ensime-tng is project agnostic, I think it's safe to set the project root to /
or any other wildcard that neovim supports.
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?
@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
If anyone is looking to use this and has a workspace that isn't a git workspace, you can replace
root_dir
with something like I use innvim-metals
which will look for given patterns. Although it requires plenary.