-
Notifications
You must be signed in to change notification settings - Fork 47
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
Harper doesn't work on text files? #149
Comments
I've never used Helix, so I really can't speak to how to set it up with Harper. I know there are others who use Harpet with Helix that can perhaps help. However Harper supports a number of programming languages and works correctly in both Visual Studio Code and Neovim. If you haven't already, try opening up a JavaScript buffer. |
So, it works very well with Helix for markdown. The specific Helix configuration isn't an issue; I know how to get the language servers to run in Helix. But even if we configure Helix to use harper-ls for .txt files, the language server doesn't detect misspellings or otherwise respond (I can confirm it launched, though). Is this intentional / a restriction that's built into the language server? Should harper-ls work on text files? |
I am having similar issues making the LS work in emacs, see #150 In my case, it actually fails with an error, but from a primitive, user perspective, it doesn't find any errors either. :) |
Just an idea: why limit harper based on filetype at all? It probably should be up to the user to determine what kind of files to use - that is, if I have a typst, or LaTeX, or This would allow users to use harper for things like git commits, emails written in AERC or himalaya, scratch notes with weird extensions, etc. Alternately, if you MUST check file type (to do per-language comment checking, I guess?), allow a default / catchall. Bottom line: this is a brilliant piece of code and I want to use it everywhere I can. |
@elijah-potter it does normally run with helix on multiple programming languages, rust at least. Is this an intentional behavior? |
On 2024-09-09 10:59:23, Seth Bromberger wrote:
Just an idea: why limit harper based on filetype at all? It probably should be up to the user to determine what kind of files to use - that is, if I have a typst, or LaTeX, or `.myfunkymarkdown` file, harper shouldn't really care, right?
This would allow users to use harper for things like emails written in AERC or himalaya, scratch notes with weird extensions, etc.
I was also stomped by this as well, btw...
|
Internally, Harper has a number of parsers whose principle job is to convert an arbitrary character sequence into a There are Input to the What we could do in Does that sound correct? Side Note:
You should already be able to use Harper in these situations, as per #92 |
@elijah-potter - Thank you for the great explanation of how harper works behind the scenes.
Yes - or, more precisely, allow this to be an option so that folks who don't want harper to do anything for unknown files can continue to have the same behavior they have now, but those of us who want plain text to be the default can do so. For helix, this is a really good proposal, since we can choose to start specific language servers for specific languages detected by helix - so I can add harper-ls to my "plain text" language detection section in my Helix config, and it will only launch when Helix detects plain text. Hopefully that's not too confusing. Thank you for your consideration of this idea. EDIT:
It doesn't work with himalaya: for example, |
Another option I just thought of - allow users to override the "detected file" via command-line option: that way I can start up something like |
I will say I've been using aerc-mail with neovim + harper and I haven't encountered any issues so far. Granted my implementation in harper for email files is a bit naive but it "works" enough. What I really need to do is sit down and read how the email spec works to find a way to ignore quoted replies |
So I see #93 makes files with a I tried to figure out where the 'mail' string comes from, but didn't see in the LSP spec, or tower-lsp, or in the Harper codebase, though I'm sure it's around here somewhere 🤷
Another option, which perhaps requires less reading, is to make a parser based on |
Ah, that was the piece I was missing: it's the editor that sets this LSP metadata! From there, I found that Helix supports a [[language]]
name = "eml"
language-id = "mail" # this is what I needed to add
scope = "source.eml"
roots = []
file-types = ["eml"]
injection-regex = "eml"
text-width = 80
soft-wrap = { enable = true, wrap-at-text-width = true }
language-servers = [ "harper-ls" ] This doesn't answer the larger "arbitrary text file" discussion of course, but solved the email case for me, thanks! |
I'm trying to figure out how to run harper on typst files, a markup-based typsetting language, similar to latex. Is there any way to get it working? I'm using neovim and the configured language server works for other (code) files, but not in typst. |
I've got harper configured with helix, and it works really well for markdown files. However, it doesn't seem to want to work on text files (or any other non-markdown file I've tried). Is this an inherent limitation?
Helix allows specifying per-file-type language servers, so it would be really useful to be able to remove this limitation from the lsp server (if it indeed exists).
The text was updated successfully, but these errors were encountered: