Repository navigation
Conversation
|
@dead10ck are you ok with these changes? |
|
Narrowing the set of pairs for which an extra whitespace is added does make sense, but I think this calls for a more general solution. By and large, I think there are some pairs it doesn't really make sense to add the extra whitespace, such as quotation marks, but others really depend on the particular language. Square brackets were a primary use case for adding this feature to begin with, to pad list literals; but for some languages, like markdown, this is less likely to be desirable. I think it would make more sense to add another config option to choose which pairs will pad whitespace. Similar to For example, # config.toml
[editor]
whitespace-pairs = [
'(',
'{',
'[',
]
# languages.toml
[[language]]
name = "markdown"
[language.whitespace-pairs]
whitespace-pairs = [
'(',
'{',
]With this config, the default set of pairs would be all brackets, but Markdown would omit For consistency, it could also accept a boolean to turn off the feature completely. # config.toml
[editor]
whitespace-pairs = [
'(',
'{',
'[',
]
# languages.toml
[[language]]
name = "markdown"
[language.whitespace-pairs]
whitespace-pairs = falseThis would disable whitespace padding only for markdown. Similarly, setting the global setting to # config.toml
[editor]
whitespace-pairs = false
# languages.toml
[[language]]
name = "markdown"
[language.whitespace-pairs]
whitespace-pairs = [
'(',
'{',
]This would disable whitespace padding regardless of the markdown config. @archseer @the-mikedavis @pascalkuthe what do you guys think? |
Summary
Fixes #15806 by preventing unwanted whitespace padding inside square brackets, quotes, and backticks.
This preserves Markdown task lists such as "- [ ] item" without inserting an extra space.
Changes
Scope and verification
Split from #15976 following maintainer feedback to isolate independent fixes.
Closes #15806.