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

Spellchecker gets confused by f-strings #43

Open
memeplex opened this issue Apr 10, 2018 · 1 comment · May be fixed by #81
Open

Spellchecker gets confused by f-strings #43

memeplex opened this issue Apr 10, 2018 · 1 comment · May be fixed by #81
Labels

Comments

@memeplex
Copy link

The spellchecker is considering f'this in f'this is a f-string as a potential dictionary word and thereby highlighting it as wrong.

@kfollstad
Copy link

Hi @nfnty and all the other contributors,

First off, I just wanted to say thanks for making such a great enhanced version of python syntax highlighting for vim. All the work that you guys have done to make this repo is so far ahead of upstream in terms of incorporating more coloring / new language features really shows.

As far as this issue is concerned, the problem is essentially this:

f"this"  # Will not be marked
r"this"  # Will not be marked
rf"this" # Will not be marked
rf'this' # Will be marked as spelling error
r'this'  # Will be marked as a spelling error
f'this'  # Will be marked as a spelling error

So I think what is happening is that spell check is being applied against the whole region including the start / end in all cases. However, in the case of the double quote (or triple double quotes) vim recognizes it as a word separation character and so checks "rf" and "this" as separate words. (R,f, rf, all pass). However in the case of a single quote, vim doesn't recognize it as a word separation character so it spellchecks the 'contraction' rf'this.

I think the solution is wall off the start and end of the region with matchgroup

Ref :help matchgroup
In a start or end pattern that is highlighted with "matchgroup" the contained items of the region are not used. This can be used to avoid that a contained item matches in the start or end pattern match.

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

Successfully merging a pull request may close this issue.

3 participants