[spell-check] Should allow the user to more easily spell-check only part of a buffer #1135
Closed
1 task done
Labels
enhancement
New feature or request
Have you checked for existing feature requests?
Summary
A user on Discord reports that they're not able to enable spellchecking in Python in only specific scopes — comments, strings, and docstrings. That's because the
spell-check.grammars
setting accepts an array of scopes, but assumes that they'll only be root language scopes.One could use the
spell-check.excludeScopes
setting to prevent spell-checking on things that aren’t strings or comments, but that's tedious, and it would apply in all grammars, not just Python.There isn't a good way to do this, but there ought to be!
What benefits does this feature provide?
The scenario that the user wants (described above) makes total sense and would be useful, so we should support it.
One option would be to allow the
spell-check.grammars
setting to specify scopes more broadly, much as can be done in asnippets.cson
: e.g.,.source.python .comment
,.source.python .string
. If we keep the constraint that each entry must begin with a root language scope, it's still possible to turn this value into a flat list of languages for which spellchecking is enabled (so the package knows whether it should be active at all for a given buffer), but also use it as a way of winnowing the included scopes in the same code path thatspell-check.exclusions
is consulted.Any alternatives?
There could be a separate
includedScopes
setting to mirrorexcludedScopes
, but this would mean all inclusions would be global — instead of what we want here, which is a language-specific filter.Other examples:
No response
The text was updated successfully, but these errors were encountered: