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

What file extensions are supported ? #320

Open
motorto opened this issue Dec 19, 2024 · 9 comments
Open

What file extensions are supported ? #320

motorto opened this issue Dec 19, 2024 · 9 comments
Assignees
Labels
harper-ls question Further information is requested

Comments

@motorto
Copy link

motorto commented Dec 19, 2024

Summary

The harper_ls language server, as documented in the [nvim-lspconfig documentation](https://github.com/neovim/nvim-lspconfig/blob/master/doc/configs.md#harper_ls), is supposed to support the following file types:

{ "c", "cpp", "cs", "gitcommit", "go", "html", "java", "javascript", "lua", "markdown", "nix", "python", "ruby", "rust", "swift", "toml", "typescript", "typescriptreact" }

However, while it works correctly for markdown and lua files, no errors are being reported for other file types, even when no other LSP is active for the file.

Steps to Reproduce

  1. Open a supported file type (e.g., python, c, etc.) in Neovim.
  2. Ensure that no other LSP server is active for the file.
  3. Introduce a syntax error or invalid code.
  4. Observe the absence of error reporting by harper_ls.

Observed Behavior

  • harper_ls works correctly for markdown files (errors are reported as expected).
  • No errors or diagnostics are reported for other supported file types.

Expected Behavior

  • harper_ls should provide diagnostics and error reporting for all supported file types listed in the documentation.

Environment

  • Neovim Version: NVIM v0.10.2
  • OS: fedora 41

Additional Notes

  • The issue does not appear to be configuration-specific, as the server initializes without errors.
  • This behavior persists across multiple supported file types (python, c, etc.).
@grantlemons
Copy link
Contributor

Harper doesn't aim to correct syntax errors or invalid code, that is the role of a language specific lsp. Those languages are "supported" because it will spellcheck comments on files of those types.

@elijah-potter elijah-potter self-assigned this Dec 20, 2024
@elijah-potter elijah-potter added question Further information is requested harper-ls labels Dec 20, 2024
@elijah-potter
Copy link
Collaborator

Hey @motorto,

It sounds like you're concerned because you are not getting language diagnostics when you provide invalid code to harper-ls. Does that sound right?

That's actually entirely expected. Harper doesn't aim to fix you're code, but rather your comments. Harper is actually a grammar checker, designed to make your non-code text easier to read and be understood by other people on your team.

If you want confirmation that it's working, try adding a comment containing "This is an test". You should be getting diagnostics to fix it.

Hope your day goes well :). Let me know if that answered your question so I can go ahead and close this ticket.

@motorto
Copy link
Author

motorto commented Dec 20, 2024 via email

@andremarianiello
Copy link

andremarianiello commented Dec 26, 2024

I am running into a similar problem. I am expecting spell-checkable regions of my code (e.g. comments) to be analyzed by harper, but when I try in this example python file test.py

# Ths is is main

def main():
    print("hello world")

neovim's spell checker catches Ths, but harper doesn't catch the duplicated words even though it is running on this file. If I rename the file to test.md, then harper catches the misspelling and duplicated word on the first line. At this point I assumed that my expectations about how harper decides what to analyze are simply unfounded assumptions, so I came to the repo looking for an explanation in the issues, and that is how I found this one detailing the same problem. Since this is relevant here I might as well simply ask: how does harper decide what portions of the active buffer to analyze diagnostics for?

EDIT: If I port this to Go

// Ths is is main

func main() {
  fmt.Println("hello world")
}

I do get harper diagnostics for the comment on the first line, so this might be a python specific issue?

@grantlemons
Copy link
Contributor

grantlemons commented Dec 26, 2024

Hmm, this could be an issue with the comment parser (harper-comments/src/comment_parser.rs). Go is a weird case as it has a custom handler, and markdown isn't comment parsing, so any issues here wouldn't apply.

Weirdly, this seems to only apply to is for me.
Image

Raw Parsing Output:

{"span":{"start":2,"end":6},"kind":{"kind":"Word","value":{"noun":{"is_proper":null,"is_plural":null,"is_possessive":null,"is_pronoun":true},"verb":null,"adjective":null,"adverb":null,"conjunction":null,"swear":null,"article":false,"preposition":false,"common":true}}}
{"span":{"start":6,"end":7},"kind":{"kind":"Space","value":1}}
{"span":{"start":7,"end":11},"kind":{"kind":"Word","value":{"noun":{"is_proper":null,"is_plural":null,"is_possessive":null,"is_pronoun":true},"verb":null,"adjective":null,"adverb":null,"conjunction":null,"swear":null,"article":false,"preposition":false,"common":true}}}
{"span":{"start":11,"end":12},"kind":{"kind":"Space","value":1}}
{"span":{"start":12,"end":14},"kind":{"kind":"Word","value":{"noun":{"is_proper":null,"is_plural":true,"is_possessive":null,"is_pronoun":true},"verb":{"is_linking":true,"tense":null},"adjective":null,"adverb":null,"conjunction":null,"swear":null,"article":false,"preposition":false,"common":false}}}
{"span":{"start":14,"end":15},"kind":{"kind":"Space","value":1}}
{"span":{"start":15,"end":17},"kind":{"kind":"Word","value":{"noun":{"is_proper":null,"is_plural":true,"is_possessive":null,"is_pronoun":true},"verb":{"is_linking":true,"tense":null},"adjective":null,"adverb":null,"conjunction":null,"swear":null,"article":false,"preposition":false,"common":false}}}
{"span":{"start":17,"end":18},"kind":{"kind":"Space","value":1}}
{"span":{"start":18,"end":19},"kind":{"kind":"Word","value":{"noun":{"is_proper":null,"is_plural":null,"is_possessive":null,"is_pronoun":true},"verb":{"is_linking":null,"tense":null},"adjective":{},"adverb":null,"conjunction":{},"swear":null,"article":false,"preposition":false,"common":true}}}
{"span":{"start":19,"end":20},"kind":{"kind":"Space","value":1}}
{"span":{"start":20,"end":27},"kind":{"kind":"Word","value":{"noun":null,"verb":null,"adjective":{},"adverb":null,"conjunction":null,"swear":null,"article":false,"preposition":false,"common":false}}}
{"span":{"start":27,"end":28},"kind":{"kind":"Space","value":1}}
{"span":{"start":28,"end":35},"kind":{"kind":"Word","value":{"noun":null,"verb":null,"adjective":{},"adverb":null,"conjunction":null,"swear":null,"article":false,"preposition":false,"common":false}}}
{"span":{"start":35,"end":36},"kind":{"kind":"Space","value":1}}
{"span":{"start":36,"end":41},"kind":{"kind":"Word","value":{"noun":{"is_proper":null,"is_plural":null,"is_possessive":null,"is_pronoun":null},"verb":{"is_linking":null,"tense":null},"adjective":null,"adverb":null,"conjunction":null,"swear":null,"article":false,"preposition":false,"common":false}}}

@grantlemons
Copy link
Contributor

grantlemons commented Dec 26, 2024

Ah, nevermind, the issue I observed is unrelated, and is because is is considered a likely homograph, so the repetition rule doesn't fire. (New issue #333)

Going back to your python vs. go example, I don't observe the same thing.

Advice: 
   ╭─[test.py:1:1]
   │
 1 │ # Ths is is main
   │   ─┬─  
   │    ╰─── Did you mean to spell “Ths” this way?

This might be a difference of version. We haven't been able to do a proper release in a while, so if you are using the Mason version that might be causing this. There should be a new release very soon, so I'll ping y'all to check if you still observe this after the next release.

@andremarianiello
Copy link

I installed from the latest github release.

@grantlemons
Copy link
Contributor

I installed from the latest github release.

Testing on commit 38d76e5 (last release) I observe your issue, but it seems to be fixed already on master. Hopefully we can get this release out ASAP to get this fixed!

@andremarianiello
Copy link

Awesome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
harper-ls question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants