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

Differentiate between scopes for spell-check compatibility #124

Open
lxwbr opened this issue Mar 23, 2017 · 13 comments
Open

Differentiate between scopes for spell-check compatibility #124

lxwbr opened this issue Mar 23, 2017 · 13 comments
Labels

Comments

@lxwbr
Copy link

lxwbr commented Mar 23, 2017

I have problems using language-tex in combination with spell-check. Spell-check allows to define the scope it should make the suggestions for. Unfortunately language-tex provides only a text.tex.latex scope, which is causing spelling check in LaTeX commands as well as in regular text.

2017-03-23-101817_737x264_scrot

Is there a way to make a differentiation of scope between commands and regular text?

EDIT: possible duplicate of #107. I tried to elaborate a possible solution by scope differentiation here though.

@lxwbr lxwbr changed the title Differentiate between scopes Differentiate between scopes for spell-check compatibility Mar 23, 2017
@PierreMarchand20
Copy link

I am waiting for this to be included in atom to solve the problem you mentioned : atom/spell-check#157

@Aerijo
Copy link
Collaborator

Aerijo commented Jul 17, 2017

Solution: don't use spell-check. Use the linter, linter-ui-default, linter-spell, linter-spell-latex package combination, as the last one is specifically made for compatibility with this package. You do need hunspell or aspell on your system though.

If you must use spell-check, I'm not actually sure what the problem is: your screenshot shows the macro to be scoped as meta.function and support.function. Adding one of these to the exclusion list should work.

@Aerijo Aerijo mentioned this issue Jul 17, 2017
@PierreMarchand20
Copy link

We cannot add this scope to the exclusion list since there is no exclusion list at the moment as far as I know. There will be one when atom/spell-check#157 will be merged.

@Aerijo
Copy link
Collaborator

Aerijo commented Jul 17, 2017

Fair enough. I was thinking of the autocomplete-plus package, where a similar thing already exists for snippets.

I still recommend using the other package combination though, as spell-check doesn't seem aimed at supporting latex. It does mention a latex use case, but using linter etc. also lets you use the chktex package, which is probably useful.

@yudai-nkt
Copy link
Collaborator

I don't think there is appropriate scopes to distinguish those two, but will consider some solutions after atom/spell-check#157 is merged. Please use other lint packages meanwhile.

By the way, I believe order of growth should be denoted in math mode i.e., $O(n)$...

@PierreMarchand20
Copy link

The feature described in atom/spell-check#157 will be in Atom 1.25. I still think it will be great to have a great compatibility with spell-check since it is a default package. (I must admit I tried the solution described with Aerijo with linter without success, and it seemed pretty heavy to handle compare to spell-check, even if, of course, it seems more powerful)

@Aerijo
Copy link
Collaborator

Aerijo commented Jan 18, 2018

@PierreMarchand20 I'm not actually sure what is being asked for here. Every language has a 'root' scope that is applied to all the text. In this case, the root scope is text.tex.latex. A lack of additional scopes indicates the word is normal text, while scopes such as support.function.textit.latex indicate it is a control word.

There is no other way to differentiate text, so a scope blacklist is the only way. Adding a unique scope to all text that is not otherwise scoped would 1) be difficult to achieve 2) probably cause a lot of bugs, and 3) be made redundant when Atom 1.25 is released and spell-check gets a scope blacklist.

@Aerijo
Copy link
Collaborator

Aerijo commented Jan 18, 2018

Also, I can try my best to help with any problems you have setting up linter-spell-latex. Was there a step in particular, or would a general guide be helpful?

@PierreMarchand20
Copy link

PierreMarchand20 commented Jan 18, 2018

Concerning spell-check, I do not know what would be possible. I guess all the scopes (other than text.tex.latex) could be added to the scope blacklist by default in Atom 1.25 ? or at least have a list of all the scopes that we should add. I mean, it would be great to have 'language-latex' directly work nicely with default features in Atom.

Concerning linter-spell-latex, I installed everything you said and at the end I did not succeed to make it work. I do not remember exactly why but I will try again.

@Aerijo
Copy link
Collaborator

Aerijo commented Jan 19, 2018

@PierreMarchand20 Maybe see if this guide I wrote can help. If it doesn't, let me know (there or here) and I'll do my best to improve it.

@PierreMarchand20
Copy link

Thank you ! it is an amazing work, I did not know about hyperclick and autocomplete, I will check it out. Actually I was using latextools, but thanks to your guide, I noticed it was not maintained and now I use latex.

I tried linter-spell-latex but, it just does not work. If I put an error, it does not find it. I do not understand why. May be my project is to big and it has an hard time spell-checking all my files, I do not know... I will check if there is an issue about it in the linter-spell-latex repo.

@Aerijo
Copy link
Collaborator

Aerijo commented Jan 19, 2018

@PierreMarchand20 My bad, I forgot an important package for the linting. You also need linter-iu-default, which is the one that actually shows the spelling mistakes (in the user interface). I'll update the guide to reflect this tomorrow.

@PierreMarchand20
Copy link

Ok I succeeded in using linter-spell-latex but it was not so easy. There is a bug, I think, when using aspell with multiple dictionaries, then I used hunspell but I had to add the dictionaries myself (I use macOS and I want to be able to use fr_FR and en_US). So now it is working, but having spell-check working is still a good idea for those who do not want to spend a lot of time on this kind of thing :-) Thank you for your help !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants