Settings: Improve completions of known values#258
Merged
FichteFoll merged 3 commits intoSublimeText:masterfrom Sep 19, 2019
deathaxe:pr/settings
Merged
Settings: Improve completions of known values#258FichteFoll merged 3 commits intoSublimeText:masterfrom deathaxe:pr/settings
FichteFoll merged 3 commits intoSublimeText:masterfrom
deathaxe:pr/settings
Conversation
added 3 commits
September 19, 2019 19:43
This commit modifies 8b904c6 by handling encoding completions exactly the same way as `color_scheme` and `theme` keys. Therefore the decision to return completions for `default_encoding` and `fallback_encoding` is made directly in the `_value_completions_for` method, which is meant to do exactly this. The if-branches are sorted by the key name rather than logical meaning. Same for the definition of the called methods. There is no need to merge comments and default values into the result if a complete list of values is already available. The `_known_completions()` method automatically marks the default encoding value.
This commit applies the `(default) ` mark to the default `color_scheme` and `theme` values.
Up to this commit color schemes with the "new" sublime-color-scheme format were not added to the completions for the `color_scheme` settings.
FichteFoll
approved these changes
Sep 19, 2019
Member
FichteFoll
left a comment
There was a problem hiding this comment.
Thanks for the fixes. I'll apply some formatting changes as I don't personally agree with this style of line splitting in some cases.
| completions.add(format_completion_item( | ||
| value=scheme_path, is_default=scheme_path == default, | ||
| label=file_name, description=package)) | ||
| label=name, description=package)) |
Member
There was a problem hiding this comment.
Now that I see this, tmTheme files need to be specified by path, not by name. I'll fix this. Nvm, the value is still correct.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Had a look at 8b904c6 and found some possible edge cases to fix.
While looking into it, I found the
(default)marker not to be added tocolor_schemeandthemecompletions. Fixed it by extending theformat_completion_item().Finally found the
color_schemecompletions missing thesublime-color-schemefiles and fixed it.Note:
The extended
format_completion_item()could be used in_completions_from_comment()and_completions_from_default()to add the(default)mark, which would result in_marked_default_completions()not being needed anymore. Left that for now as I am not sure whether it was the better alternative.The main reason for extending
format_completion_item()was to avoid breaking the description part of the completion label by calling_marked_default_completions()on color_scheme, encoding or theme completions.