elijah-potter / harper

The Grammar Checker for Developers
https://writewithharper.com
Apache License 2.0
135 stars 3 forks source link

`[lspconfig] Cannot access configuration for harper_ls.` #76

Closed Agent-E11 closed 2 months ago

Agent-E11 commented 2 months ago

I am trying to add harper_ls to Neovim, but I am getting this error whenever I start Neovim:

[lspconfig] Cannot access configuration for harper_ls. Ensure this server is listed in `server_configurations.md` or added as a custom server.

Here is the relevant section of my config (using lazy.nvim) (-- ... means omitted code):


-- lsp-zero.lua
return {
    "VonHeikemen/lsp-zero.nvim",
    -- ...
    config = function()
        -- ...
        local lsp_conf = require("lspconfig")
        -- ...
        lsp_conf.harper_ls.setup({
            settings = {
                ["harper-ls"] = {
                    linters = {
                        spell_check = true,
                        spelled_numbers = false,
                        an_a = true,
                        sentence_capitalization = true,
                        unclosed_quotes = true,
                        wrong_quotes = false,
                        long_sentences = true,
                        repeated_words = true,
                        spaces = true,
                        matcher = true
                    }
                }
            }
        })
        -- ...
    end
}
Agent-E11 commented 2 months ago

I installed it using Mason.nvim

elijah-potter commented 2 months ago

I'd love to get this sorted out for you, but the issue isn't immediately obvious here. Would it be possible to get a copy of your full Neovim configuration so I can try it out on my machine?

Agent-E11 commented 2 months ago

I just created a repo containing all my Neovim config https://github.com/Agent-E11/nvim-config-copy

Agent-E11 commented 2 months ago

The config is dependent on some environment variables, but it should work with the defaults, and the changes are mostly aesthetic

elijah-potter commented 2 months ago

Thanks for sending that over. It seems that we may need to add harper-ls to mason-lspconfig.nvim. I tried your configuration with @grantlemons' fork and it worked. I'll look into opening a pull request in the official repo.

For now, a short-term fix is to swap the version of mason-lspconfig.nvim you are using.

Agent-E11 commented 2 months ago

Thanks! So, should I change the repo of mason.nvim to grantlemons' fork?

Also, should this be a new issue on mason.nvim?

grantlemons commented 2 months ago

This is a mason-lspconfig thing, and just adding support there should get it working for everyone.

I made that fork, which seems to fix everything, but want to make sure I am doing everything in line with whatever contribution policy/process before making the PR, that's the only reason it isn't in the official repo yet.

grantlemons commented 2 months ago

@elijah-potter in the meantime it might be helpful to add this to the harper-ls readme.

elijah-potter commented 2 months ago

I sat down today to fix this issue upstream--only to find out someone already did it.

Huge thanks to @Su3h7aM!

I am going to close the issue as it appears the issue is resolved. Feel free to open it again if it persists.