elijah-potter / harper

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

fixed language server only running for filetypes with tree-sitter Language #75

Open parkerbedlan opened 3 months ago

parkerbedlan commented 3 months ago

I found that even when I setup lspconfig with something like this:

lspconfig.harper_ls.setup {
    filetypes = { "markdown", "text", "lua" },
}

that the harper linter would only run for lua files, not markdown or text files. I realized that this is because if new_from_language_id returns None, the linter simply wouldn't run. So I instead had the wildcard pattern return an arbitrary tree-sitter Language, and it fixed the problem.

elijah-potter commented 3 months ago

Thanks for bringing your issue to my attention, unfortunately, I cannot merge this request in its current state.

The lack of support for the text filetype is not a bug--there simply isn't any support for it. Its somewhat difficult to pin down how to treat those files since they are often not actually English. Your solution to this seems to be to treat text files as .toml files, which isn't a robust enough solution for the main repository.

I replaced my harper-ls config with your snippet and was unable to replicate your issue. Would it be possible for me to get a copy of your whole Neovim config? I'd love to find the root problem.