-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
feat/docs(editorconfig): add support for spelling_language #28638
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good on first glance, thanks! Will give it a test whenever you mark it ready for review.
Can you please also update |
Looks like I forgot to add some parameters. It's weird because when I ran |
spelling_language = en | ||
[long_spelling_language.txt] | ||
spelling_language = en-US |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably should test something other than the default
c63c911
to
af67eb2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay. Just needs a rebase onto the new news.txt
file and then should be good.
af67eb2
to
221693f
Compare
The `test_case` method presumed that all options set by editorconfig were *buffer-local* so it called `nvim_get_option_value` with `{ buf = 0 }` even for *window-local* options such as `spell`. Now `nvim_get_option_info2` is used to get the scope of the option. This scope can be: "global", "win" or "buf".
A *GOOD* example of spelling_language is en-US. ('-' must be used as a separator) A *BAD* example of spelling_language is en/US or en_US.
These were changed to use something other than the default values.
221693f
to
f077966
Compare
runtime/doc/news.txt
Outdated
@@ -130,6 +130,9 @@ PLUGINS | |||
|
|||
• TODO | |||
|
|||
• Editorconfig |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit
• Editorconfig | |
• EditorConfig |
Can also delete the TODO
just above
runtime/lua/editorconfig.lua
Outdated
@@ -190,6 +190,29 @@ function properties.insert_final_newline(bufnr, val) | |||
end | |||
end | |||
|
|||
--- A code of the format ss or ss-TT, where ss is an ISO 639 language code and TT is an ISO 3166 territory identifier. | |||
--- Sets the 'spell' and 'spelllang' options. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure how I feel about this also setting 'spell'
. Someone may want to apply spelling_language
globally (using a [*]
glob) so that when they do enable spell checking, it will use the specified language. But that does not imply they necessarily want spell checking always enabled.
I think we should remove 'spell'
for now and set only 'spelllang'
. This is reversible if we need to re-enable it later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The spec also doesn't say anything about enabling spell checking.
Sets the natural language that should be used...
A spelling_language key-value pair in an editorconfig-file should only set `spelllang` and leave `spell` as is.
The `spell` option shouldn't be checked by spelling_language-tests since spelling_language should only change the `spelllang` option.
07da01a
to
f8cbb90
Compare
I could also try to tidy the commit history a bit if you think it's needed. |
Thanks! |
This fixes #28626.
For the other editorconfig properties it's easier to check for validity since they are either a number or part of an enum with few elements. The problem for
spelling_language
is that it is part of a greater enum since it's a concatenation of a ISO 639 language code and an optional ISO 3166 territory identifier.For now the code only checks that the value provided in
spelling_language
is of the format [a-z][a-z] or [a-z][a-z]-[a-z][a-z] (regex), but it doesn't check whether it is a valid ISO639/ISO3166 code and thus when inputting an invalid value thespelllang
option is also set to an unknown language (this results in a prompt asking you to download the unknown language and then failing and continuing if accepted).