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

Grammar-/spellcheck in all inline comments, not only in latex #350

Closed
hpvd opened this issue Jul 7, 2021 · 8 comments
Closed

Grammar-/spellcheck in all inline comments, not only in latex #350

hpvd opened this issue Jul 7, 2021 · 8 comments
Assignees
Labels
1-feature-request ✨ Issue type: Request for a desirable, nice-to-have feature 3-fixed Issue resolution: Issue has been fixed on the develop branch
Milestone

Comments

@hpvd
Copy link

hpvd commented Jul 7, 2021

Is your feature request related to a problem? Please describe.
Good spelling and grammar in documents written in latex and co is gorgeous.
But there is an other place where broken spelling and grammar is also somehow frustrating:
in comments within code.
This is not only true for inline-comments in latex (where comments are indicated with % ), but in any coding language.
Beside correct spelling and grammar in comments

  • can be seen as some kind of quality indicator,
  • it ensures comprehensibility of comments, and
  • there is also another not that obvious practical problem:
    Having broken spelling in comments make it hard to find the place in code which one has in mind to work on, because there are no results when searching for word or phrases one think one has used in comments...

Describe the solution you'd like
Use the developed matured technology of this extension
also for spelling and grammar check in all comments of (m)any code language(s),
possibly in the same languages the very liked vs-code extension "better comments" supports (it makes it possible to categorize and highlight/colorize comments in an easy way) , see https://marketplace.visualstudio.com/items?itemName=aaron-bond.better-comments
=> the result would be "even better comments" :-)

Describe alternatives you've considered
keep on writing comments with spelling and grammar errors....
...and keep being faced with the 3 problems mentioned above.

Additional context
none

@hpvd hpvd added the 1-feature-request ✨ Issue type: Request for a desirable, nice-to-have feature label Jul 7, 2021
@hpvd hpvd changed the title Grammar/Spellcheck in all comments not only in latex Grammar-/spellcheck in all comments, not only in latex Jul 7, 2021
@hpvd hpvd changed the title Grammar-/spellcheck in all comments, not only in latex Grammar-/spellcheck in all inline comments, not only in latex Jul 7, 2021
@valentjn
Copy link
Owner

valentjn commented Jul 8, 2021

I'm not sure about this:

  • Why only inline comments and not also block comments in other languages?
  • What about the huge number of false positives this will yield for code that has been commented out? (Plus, there will a lot of false positives due to variable names/inline code snippets even in natural-language comments.)
  • What about (detection of) different markup styles in documentation, like Doxygen, reStructuredText, etc.? (Without detection, this will again result in a lot of false positives.)
  • How can we detect comments without writing/relying on full parsers of the languages?

@hpvd
Copy link
Author

hpvd commented Jul 8, 2021

thanks for these thoughts!
Yes this are all valid points. Maybe I was a little to enthusiastic regarding further possibilities when using your great extension the first time :-)

just a quick shot:
Maybe one possibility would be to work close together with/rely on the mentioned "better comments"- extension, and let this one do some part of the work: only check comments which have been identified and highlighted/colored by this extension...

@hpvd
Copy link
Author

hpvd commented Jul 8, 2021

with 1,893,354 installs the community / demand for this extension seems pretty big, which should keep it getting better in identifying the right "comments"...

@valentjn valentjn self-assigned this Jul 17, 2021
@valentjn valentjn added the 3-fixed Issue resolution: Issue has been fixed on the develop branch label Jul 17, 2021
@valentjn valentjn added this to the 10.6.0 milestone Jul 17, 2021
@valentjn
Copy link
Owner

valentjn commented Jul 17, 2021

This is now implemented upstream, but it will be opt-in (add the language to ltex.enabled). During tests, I saw a lot of false positives in a small sample of large GitHub repositories.

Note: Only comments in programming languages (C++, Java, etc.) will be checked, not in the markup languages LTEX already supports (there should be no need to check those, either).

@hpvd
Copy link
Author

hpvd commented Jul 20, 2021

Awesome many thanks!

Just a question: why not checking comments in markup languages like LaTeX?

e.g. when doing collaboration on writing documents/papers with colleagues, several people would see and use the comments.
Please see example:

2021-07-20_16h07_39

@valentjn
Copy link
Owner

The main reason is that it would be pretty complex to implement it in the current framework.

However, as I said, it isn't really useful for markup languages. When you read a program, in order to understand it, you read the code and its comments, which are therefore part of the code/program, in a way. When you read a LATEX document, you usually read the PDF and not the code. This is probably the reason vanilla Markdown doesn't support comments.

Another reason is that it wouldn't be possible to make it opt-in without an additional setting, in contrast to programs.

Finally, for todo notes, you should really be using \todo, because it's easy to forget to solve a todo issue if it's not clearly marked in the output with red text or similar. LTEX already has special support for \todo, see #42 and #63.

@valentjn
Copy link
Owner

Feature released in 11.0.0.

@GitMensch
Copy link

For anyone coming here searching about the "inline comment after code" feature: it works with the command ltex.checkSelection.

GitMensch added a commit to GitMensch/ltex that referenced this issue Mar 11, 2022
me-johnomar added a commit to me-johnomar/ltex-ls that referenced this issue Jan 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1-feature-request ✨ Issue type: Request for a desirable, nice-to-have feature 3-fixed Issue resolution: Issue has been fixed on the develop branch
Projects
None yet
Development

No branches or pull requests

3 participants