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

fix(nix): Fix wrong lsp in nix pack. #882

Merged
merged 1 commit into from
Apr 14, 2024
Merged

fix(nix): Fix wrong lsp in nix pack. #882

merged 1 commit into from
Apr 14, 2024

Conversation

Uzaaft
Copy link
Member

@Uzaaft Uzaaft commented Apr 14, 2024

No description provided.

Copy link

github-actions bot commented Apr 14, 2024

Review Checklist

Does this PR follow the [Contribution Guidelines](development guidelines)? Following is a partial checklist:

Proper conventional commit scoping:

  • If you are adding a new plugin, the scope would be the name of the category it is being added into. ex. feat(utility): added noice.nvim plugin

  • If you are modifying a pre-existing plugin or pack, the scope would be the name of the plugin folder. ex. fix(noice-nvim): fix LSP handler error

  • Pull request title has the appropriate conventional commit type and scope where the scope is the name of the pre-existing directory in the project as described above

  • README is properly formatted and uses fenced in links with <url> unless they are inside a [title](url)

  • Proper usage of opts table rather than setting things up with the config function.

@Uzaaft
Copy link
Member Author

Uzaaft commented Apr 14, 2024

R? @AstroNvim/astrocommunity-maintainers

@luxus
Copy link
Member

luxus commented Apr 14, 2024

i changed it locally to https://github.com/nix-community/nixd (via https://github.com/nix-community/nixd/blob/main/nixd/docs/editor-setup.md)
and alejandra to nixfmt with conform (waiting for NixOS/nixfmt#153)
but just days ago.. but both are bleeding edge right now. i wanted to wait until nixOS 2405 is released and some more testing

return {
  {
    "nvim-treesitter/nvim-treesitter",
    optional = true,
    opts = function(_, opts)
      if opts.ensure_installed ~= "all" then
        opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { "nix" })
      end
    end,
  },
  {
    "AstroNvim/astrolsp",
    -- we must use the function override because table merging
    -- does not play nicely with list-like tables
    ---@param opts AstroLSPOpts
    opts = function(plugin, opts)
      -- safely extend the servers list
      opts.servers = opts.servers or {}
      vim.list_extend(opts.servers, {
        "nixd",
        -- add more servers as needed...
      })
    end,
  },
  {
    "nvimtools/none-ls.nvim",
    optional = true,
    opts = function(_, opts)
      local nls = require "null-ls"
      if type(opts.sources) == "table" then
        vim.list_extend(opts.sources, {
          nls.builtins.code_actions.statix,
          nls.builtins.formatting.alejandra,
          nls.builtins.diagnostics.deadnix,
        })
      end
    end,
  },
  {
    "stevearc/conform.nvim",
    optional = true,
    opts = {
      formatters_by_ft = {
        nix = { "nixfmt" },
      },
    },
  },
  -- {
  --   "mfussenegger/nvim-lint",
  --   optional = true,
  --   opts = {
  --     linters_by_ft = {
  --       nix = { "statix", "nix" },
  --     },
  --   },
  -- },
}

and i guess it makes sense to add deadnix
https://github.com/bondzula/nvim/blob/7a58fd58857a9a121df9703d4ad132b9bb583e56/lua/plugins/nvim-lint.lua#L9-L41

@Uzaaft
Copy link
Member Author

Uzaaft commented Apr 14, 2024

i changed it locally to https://github.com/nix-community/nixd (via https://github.com/nix-community/nixd/blob/main/nixd/docs/editor-setup.md) and alejandra to nixfmt with conform (waiting for NixOS/nixfmt#153) but just days ago.. but both are bleeding edge right now. i wanted to wait until nixOS 2405 is released and some more testing

return {
  {
    "nvim-treesitter/nvim-treesitter",
    optional = true,
    opts = function(_, opts)
      if opts.ensure_installed ~= "all" then
        opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { "nix" })
      end
    end,
  },
  {
    "AstroNvim/astrolsp",
    -- we must use the function override because table merging
    -- does not play nicely with list-like tables
    ---@param opts AstroLSPOpts
    opts = function(plugin, opts)
      -- safely extend the servers list
      opts.servers = opts.servers or {}
      vim.list_extend(opts.servers, {
        "nixd",
        -- add more servers as needed...
      })
    end,
  },
  {
    "nvimtools/none-ls.nvim",
    optional = true,
    opts = function(_, opts)
      local nls = require "null-ls"
      if type(opts.sources) == "table" then
        vim.list_extend(opts.sources, {
          nls.builtins.code_actions.statix,
          nls.builtins.formatting.alejandra,
          nls.builtins.diagnostics.deadnix,
        })
      end
    end,
  },
  {
    "stevearc/conform.nvim",
    optional = true,
    opts = {
      formatters_by_ft = {
        nix = { "nixfmt" },
      },
    },
  },
  -- {
  --   "mfussenegger/nvim-lint",
  --   optional = true,
  --   opts = {
  --     linters_by_ft = {
  --       nix = { "statix", "nix" },
  --     },
  --   },
  -- },
}

and i guess it makes sense to add deadnix https://github.com/bondzula/nvim/blob/7a58fd58857a9a121df9703d4ad132b9bb583e56/lua/plugins/nvim-lint.lua#L9-L41

That’s outside of the scope of this PR.

@luxus
Copy link
Member

luxus commented Apr 14, 2024

still not sure if it makes sense to merge this and then switch to the official lsp when it is in stable next month
but yes the nil_ls change was in my pr that got lost :D

@Uzaaft
Copy link
Member Author

Uzaaft commented Apr 14, 2024

still not sure if it makes sense to merge this and then switch to the official lsp when it is in stable next month but yes the nil_ls change was in my pr that got lost :D

It’s still a month away.

Copy link
Member

@luxus luxus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@luxus luxus merged commit c009f66 into main Apr 14, 2024
13 checks passed
@luxus luxus deleted the feat/nix branch April 14, 2024 20:57
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

Successfully merging this pull request may close these issues.

2 participants