harper icon indicating copy to clipboard operation
harper copied to clipboard

feat: more languages supported

Open elijah-potter opened this issue 2 years ago • 78 comments

I'd like to expand the number of languages supported for comment checking. There are a number of additional considerations for structured comments (like JavaDoc), but some should be pretty straightforward.

Running list:

  • Bash
  • YAML
  • HTML
  • Java
  • Groovy
  • Git commit buffers (filetype gitcommit)
  • PowerShell

In addition to adding language parsers to the tree-sitter code, we would also need to open pull requests for nvim-lspconfig, mason and fix harper-ls to announce support for the capability.

Feel free to add suggestions to this list.

elijah-potter avatar Apr 27 '24 03:04 elijah-potter

Alright. At the time of writing, we've got JavaDoc, HTML, and Bash supported, as well as gitcommit buffers.

elijah-potter avatar Aug 09 '24 01:08 elijah-potter

If you could add php to the list as well, it would be great

mostafaqanbaryan avatar Aug 11 '24 10:08 mostafaqanbaryan

Adding dart would be great as well.

Vinzent03 avatar Sep 03 '24 08:09 Vinzent03

Hey, markdown support seems pretty advanced. :+1: But are there plans to also support other markup languages, such as djot, with the same level of functionality? Or will only markdown be seen as a first-class citizen in the near future?

Either way, I am thrilled about the project and being able to use a solid spell-checker LSP :partying_face: :

PS: Are you planning on adding a sponsoring option?

kai-tub avatar Sep 05 '24 06:09 kai-tub

Coming back to this issue after a solid period of stagnation, to give an update.

#332 has added Haskell support, #354 is adding Vimscript, and #353 is adding cmake support. These will all be considered "rough" until someone has the time to go in and touch them up (which is a good first issue to tackle, if anyone is interested).

I plan on adding PHP and potentially PowerShell later today.

But are there plans to also support other markup languages, such as djot, with the same level of functionality?

We've got an open PR for Typst support: #302. I do not personally have time in the near future to add similar levels of polish to a new language as the Markdown parser. That said, we are entirely open to PRs on the topic, and I can answer any questions you may have. I'm not sure how complex djot is, but it may be as simple as importing the right Treesitter parser.

Either way, I am thrilled about the project and being able to use a solid spell-checker LSP 🥳

That's great to hear! I aim to please.

PS: Are you planning on adding a sponsoring option?

We might be a little past that.

elijah-potter avatar Jan 03 '25 19:01 elijah-potter

Emacs org-mode support would be rad

krupan avatar Feb 05 '25 21:02 krupan

I just had a peep at the supported languages and here are some I note to be missing:

  • Assembly
  • Elixir
  • Kotlin
  • Odin
  • Zig

I've never used Elixir. Kotlin probably requires the least effort, possibly none. Zig and Odin from memory both also just have C-like comments. Assembly uses ; to introduce comments, at least the common ones.

hippietrail avatar Feb 06 '25 05:02 hippietrail

Glad to see PowerShell is on the running list!

jkprcl avatar Feb 06 '25 13:02 jkprcl

mail support isn't great right now. Since it uses the PlainEnglish parser, it also applies rules to the headers and metadata of the file which isn't ideal. I'm working on a tree-sitter parser for the mail format atm, I'm wondering if it would be possible to only apply harper's rules to contents of the (body) node, or something like that?

ficd0 avatar Feb 20 '25 00:02 ficd0

Yeah! Using the masker in harper-tree-sitter you can select by node label.

elijah-potter avatar Feb 20 '25 02:02 elijah-potter

sounds great. I will give that a shot when I'm able.

ficd0 avatar Feb 20 '25 06:02 ficd0

It would be nice to have support for jujutsu commits just like git-commit.

update: implemented in #2082

funnes avatar Feb 22 '25 22:02 funnes

Re: a discussion in the discord, we could look into supporting Quatro and RMarkdown. They're both extensions of markdown. RMarkdown has a very solid tree-sitter parser available. Quatro has one too but I haven't been able to verify if it still works. Using these parser and the Masker we should be able to support them. For the time being, they could be treated the same as regular Markdown files; after a brief test, this generally works fine at the cost of some false positives on certain syntax elements.

ficd0 avatar Feb 22 '25 23:02 ficd0

I use VSCode to edit LaTeX documents, so having support for that would be nice!

derjasper avatar Mar 04 '25 14:03 derjasper

It looks like @grantlemons has started work on a Quatro parser. He previously attempted LaTeX, but it never made it in.

elijah-potter avatar Mar 04 '25 23:03 elijah-potter

Yep, Quatro overall seems pretty easy to mask, but it extends Markdown in a few ways that make it non-trivial. (#749)

grantlemons avatar Mar 04 '25 23:03 grantlemons

It looks like @grantlemons has started work on a Quatro parser. He previously attempted LaTeX, but it never made it in.

Masking Latex would definitely be non-trivial considering Latex's complexity and the turing-complete syntax. This is also why writing a tree-sitter parser that will correctly parse all possible Latex files is basically impossible.

I messed around with Latex parsing a while ago. Using the tree-sitter parser wouldn't be very consistent for masking because a lot of (text) nodes are actually the inputs to functions. It's pretty damn hard to consistently decide whether a given node or section of text should be checked or not.

Ltex-ls is a project that does manage to do it, however. We could look at their implementation for some ideas; although I imagine adding LaTeX support would be no small feat.

ficd0 avatar Mar 05 '25 00:03 ficd0

Support for the asciidoc markup language would be really helpful.

martinohanlon avatar Mar 18 '25 16:03 martinohanlon

I would love to have support for Scala and YAML. Thank you for such a great tool!

tymcauley avatar Mar 20 '25 04:03 tymcauley

Please add MDX support: https://mdxjs.com/docs/what-is-mdx/

anarion80 avatar Apr 09 '25 19:04 anarion80