SublimeText / PackageDev

Tools to ease the creation of snippets, syntax definitions, etc. for Sublime Text.
MIT License
436 stars 83 forks source link

Fix float settings values completion #149

Closed deathaxe closed 7 years ago

deathaxe commented 7 years ago

This commit fixes #174 with following changes.

  1. Match 1. as float even without a decimal digit in order to not pop from numbers stack to early while typing.
  2. Extend the meta.mapping.value scope until the next none space character.
  3. Extend the VALUE_SCOPE by invalid.illegal.expected-value to enable value completion in empty region between : ,.
  4. Make sure to exclude VALUE_SCOPE from KEY_COMPLETIONS_SCOPE to avoid key completions within the value region.
FichteFoll commented 7 years ago

1) This is good. Edit: Actually, I'll have to think about this more. 2) I'm not sure about this. Expanding the value scope beyond the actual value includes matching comments and whitespace, which aren't actually part of the value and I like how precise the scopes are. On the other hand, if the value is a mapping or a sequence, whitespace within that gets scoped (which makes sense and shouldn't be debated here). An alternative would be to add a meta.expect-comma scope for the region after the value and the comma, including the latter. I believe that better matches our intent. 3) 👍 4) I specifically didn't exclude value scope because it breaks key completions in project files, where the entire settings dict is a value itself already. We might have to anchor VALUE_SCOPE to a settings mapping meta scope.

deathaxe commented 7 years ago
  1. Thought about something like the meta.expect-comma, too. Would fit into the system. Not sure where and how to do changes to not break anything when adding something like that. I think the meta scopes tend to become too detailed and small.
  2. ..
  3. Damn. It's the same thing as with menus and the meta.mapping.value stuff. Maybe its a good idea in general to create language specific meta.key and meta.value scopes instead of relying on json. This way JSON compatibility would be kept but the more specific needs of certain languages could be addressed.
FichteFoll commented 7 years ago

Don't worry, I have ideas about solving 2 and 4. I also wrote the imo well-structured albeit complex Sublime JSON definition, so I know where the I need to insert the new contexts.

Might only get around to doing it tomorrow, though.

deathaxe commented 7 years ago

well-structured albeit complex

It introduces interesting structures I've not seen anywhere else so far. I like the way you base anything onto JSON and reduce the repetition of matches/scopes. But it comes a long with quite a couple of complex structures - that's right.

FichteFoll commented 7 years ago

Fixed in f0bc60dba641c76240ae782d2e7fbc6082471dc2.