Skip to content

Commit fb039b5

Browse files
committed
feat(nextflow): add configuration for the Nextflow Language Server
1 parent 6166e84 commit fb039b5

File tree

2 files changed

+55
-13
lines changed

2 files changed

+55
-13
lines changed

lua/astrocommunity/pack/nextflow/README.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,33 @@ This plugin pack does the following:
44

55
- Sets up `nextflow` filetype
66
- Adds [`vim-language-nextflow`](https://github.com/nextflow-io/vim-language-nextflow) for syntax highlighting
7-
- Adds snippets to LuaSnip from [`vscode-language-nextflow`](https://github.com/nextflow-io/vscode-language-nextflow)
7+
- Adds configuration for [`nextflow_ls`](https://github.com/nextflow-io/language-server) to `lspconfig`
8+
- See below for instructions on enabling it
89
- Adds `nextflow` icons to `mini.icons`
10+
11+
## Enabling the Nextflow Language Server
12+
13+
While the Nextflow language server is young in development it is yet to be added to Mason or `nvim-lspconfig` so it currently requires manual configuration to get up and running.
14+
15+
### Requirements
16+
17+
- Java 17 or later
18+
- `language-server-all.jar` downloaded from the [Nextflow Language Server Releases](https://github.com/nextflow-io/language-server/releases) or built from the source
19+
20+
### Add to your `plugins/`
21+
22+
```lua
23+
return {
24+
"AstroNvim/astrolsp",
25+
opts = {
26+
-- This line enables the setup of the Nextfow language server
27+
servers = { "nextflow_ls" },
28+
configs = {
29+
-- Must set the command with the path to your JAR file
30+
nextflow_ls = {
31+
cmd = { "java", "-jar", "<path to language-server-all.jar>" },
32+
},
33+
},
34+
},
35+
}
36+
```

lua/astrocommunity/pack/nextflow/init.lua

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,32 @@ return {
1010
},
1111
{ "nextflow-io/vim-language-nextflow", ft = "nextflow" },
1212
{
13-
"L3MON4D3/LuaSnip",
14-
optional = true,
15-
specs = {
16-
"nextflow-io/vscode-language-nextflow",
17-
commit = "efc410e46db3518ec7693668e159fb7b148a0e1a",
18-
ft = "nextflow",
19-
dependencies = { "L3MON4D3/LuaSnip" },
20-
config = function(plugin)
21-
require("luasnip.loaders.from_vscode").lazy_load {
22-
paths = { plugin.dir },
23-
}
24-
end,
13+
"AstroNvim/astrolsp",
14+
---@type AstroLSPOpts
15+
opts = {
16+
---@diagnostic disable-next-line: missing-fields
17+
config = {
18+
nextflow_ls = {
19+
cmd = {
20+
"java",
21+
"-jar",
22+
"nextflow-language-server.jar",
23+
},
24+
filetypes = { "nextflow" },
25+
root_dir = function(fname)
26+
local util = require "lspconfig.util"
27+
return util.root_pattern "nextflow.config"(fname) or util.find_git_ancestor(fname)
28+
end,
29+
settings = {
30+
nextflow = {
31+
suppressFutureWarnings = true,
32+
files = {
33+
exclude = { ".git", ".nf-test", "work" },
34+
},
35+
},
36+
},
37+
},
38+
},
2539
},
2640
},
2741
{

0 commit comments

Comments
 (0)