Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support of other Text editors #56

Open
2 of 5 tasks
edmundmiller opened this issue Nov 6, 2024 · 7 comments
Open
2 of 5 tasks

Support of other Text editors #56

edmundmiller opened this issue Nov 6, 2024 · 7 comments

Comments

@edmundmiller
Copy link

edmundmiller commented Nov 6, 2024

Emacs

  1. client documentation

Neovim

@mehalter
Copy link

mehalter commented Nov 6, 2024

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): mehalter/nvim-lspconfig@873ef31

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
}

@edmundmiller
Copy link
Author

@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.

@mehalter
Copy link

mehalter commented Nov 6, 2024

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:

  1. Add the Nextflow pack to your list of community extensions (the users's community.lua file):
{ import = "astrocommunity.pack.nextflow" }
  1. Add installation details for where you installed the Nextflow language server .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)

@mehalter
Copy link

mehalter commented Nov 6, 2024

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!

@mehalter
Copy link

mehalter commented Nov 6, 2024

@edmundmiller opened a PR here: neovim/nvim-lspconfig#3423

Fingers crossed! Glad to see this modernization happening!

@edmundmiller
Copy link
Author

Awesome, thank you so much for making that all happen! I'll have to try out the AstroNvim language pack now!

@mehalter
Copy link

mehalter commented Nov 7, 2024

@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 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants