Adding server configurations to nvim-lspconfig
pysan3 opened this issue · comments
Hi,
I recently came across this programming language and really love what the language provides.
I want to add a configuration file for els
to set it up for neovim with the nvim-lspconfig plugin.
Here is the current state of the configuration file.
I was wondering what would be a suitable way to detect the path to the current project.
i.e. we should provide a function to default_config.root_dir
in the configuration file.
Here are some tricks people use for other languages.
util.find_git_ancestor
- Find the nearest
.git/
from ancestors (parent directories).
- Find the nearest
util.root_pattern('<file-name>')
- Find the
'<file-name>'
in parent directories.
- Find the
util.search_ancestors(func)
- Provide a
func
that returnstrue
given the absolute path of each ancestor.
- Provide a
For example, the config file for rust_analyzer
does something like this. (or
is like a fallback)
util.root_pattern('Cargo.toml') \
or [Search 'workspace_root' from `cargo metadata --no-deps`] \
or util.root_pattern('rust-project.json') \
or util.find_git_ancestor()
I read the Package System section in the documentation but was not sure what to look for and whether this was a strict language specification or not.
Could you provide me with some ideas?
Thanks in advance,
@pysan3
The specifications for the package manager can be found here.
https://github.com/erg-lang/erg/blob/main/doc/EN/tools/pack.md
I have not implemented the package manager yet, but I plan to use package.er
as the file equivalent to Cargo.toml
in cargo.
Thank you for providing me the page.
I think I will go with the following setup for now.
util.root_pattern('package.er') \
or util.find_git_ancestor()
I can't wait for this project to take off. Keep up with your hard work!
EDIT: PR to nvim-lspconfig -> neovim/nvim-lspconfig#2165