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

[spell-check] Should allow the user to more easily spell-check only part of a buffer #1135

Closed
1 task done
savetheclocktower opened this issue Nov 14, 2024 · 0 comments · Fixed by #1147
Closed
1 task done
Labels
enhancement New feature or request

Comments

@savetheclocktower
Copy link
Contributor

Have you checked for existing feature requests?

  • Completed

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 a snippets.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 that spell-check.exclusions is consulted.

Any alternatives?

There could be a separate includedScopes setting to mirror excludedScopes, 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

@savetheclocktower savetheclocktower added the enhancement New feature or request label Nov 14, 2024
savetheclocktower added a commit to savetheclocktower/pulsar that referenced this issue Dec 1, 2024
…for spellchecking on a per-language basis.

This opens up things that aren't really possible with the `excludedScopes` setting. For instance: you can specify `source.python comment, source.python string, source.js comment`; this will enable spellchecking in Python files for both comments and strings, while enabling spellchecking in JavaScript files for _only_ comments.

Closes pulsar-edit#1135.
savetheclocktower added a commit that referenced this issue Dec 27, 2024
…for spellchecking on a per-language basis.

This opens up things that aren't really possible with the `excludedScopes` setting. For instance: you can specify `source.python comment, source.python string, source.js comment`; this will enable spellchecking in Python files for both comments and strings, while enabling spellchecking in JavaScript files for _only_ comments.

Closes #1135.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant