Open edmundmiller opened 2 weeks ago
I have a branch of nvim-lspconfig
that adds Nextflow support that works and makes sure there is the one necessary setting set (nextflow.files.exclude
): https://github.com/mehalter/nvim-lspconfig/commit/873ef31beee09f10554676dcd1dea4c9ed9e7c1e
The contribution guidelines indicate that a language server repo needs to have 100+ stars to be added to avoid bloat of short lived/not very used language servers being added into the codebase. I will keep an eye out and open the PR there when it's appropriate. Here is a minimal code block that can be added to a Neovim configuration to manually add the language server until then:
-- Hot patch nvim-lspconfig to add Nextflow language server
require("lspconfig.configs").nextflow_ls = {
default_config = {
cmd = { "java", "-jar", "nextflow-language-server-all.jar" },
filetypes = { "nextflow" },
root_dir = function(fname)
local util = require("lspconfig.util")
return util.root_pattern('nextflow.config')(fname) or util.find_git_ancestor(fname)
end,
settings = {
nextflow = {
files = {
exclude = { ".git", ".nf-test", "work" },
},
},
},
},
}
-- Set up the Nextflow language server like any other language server
-- (once the language server is added upstream, this will be the only code necessary)
require("lspconfig").nextflow_ls.setup {
capabilities = vim.lsp.protocol.make_client_capabilities(),
-- on_attach = function(client, bufnr) end, -- set up on attach function
}
@mehalter Could we use the stars from https://github.com/nextflow-io/vscode-language-nextflow in that case? 😆
It's a pretty small community, the VS Code extension only has 27K Downloads. So completly understand if that's never going to get merged in because it's too small and might not get maintained.
Also worth noting for users that use AstroNvim there is a community language pack for Nextflow that does most of this boiler plate as well as adds syntax highlighting, filetype detection, and icons for the filetype. This can be added easily for those users as well.
The link to the language pack has the instructions for setting it up, but the gist comes down to in your AstroNvim configuration you need to:
community.lua
file):{ import = "astrocommunity.pack.nextflow" }
.jar
file (goes into the user's plugins/
folder such as plugins/nextflow_ls.lua
):return {
"AstroNvim/astrolsp",
opts = {
-- This line enables the setup of the Nextfow language server
servers = { "nextflow_ls" },
configs = {
-- Must set the command with the path to your JAR file
nextflow_ls = {
cmd = { "java", "-jar", "<path to language-server-all.jar>" },
},
},
},
}
(Once this gets added to Mason and lspconfig
then all the user would have to do is step 1 and it will handle installing and setting up the language server, I'll update this comment once that happens)
That's a good question, plus this is an official language server of the language's organization so that probably helps rather than it being a personal project. I'll open the PR and see what they say and mention it's the officially supported language stuff. If they bounce it back then I'll just keep an eye out and keep on pressing!
@edmundmiller opened a PR here: https://github.com/neovim/nvim-lspconfig/pull/3423
Fingers crossed! Glad to see this modernization happening!
Awesome, thank you so much for making that all happen! I'll have to try out the AstroNvim language pack now!
@edmundmiller the neovim lspconfig PR I opened for merged in! Thanks for linking me the vs code download count! That was a valid metric for vetting the language server :)