SublimeText / PackageDev

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

Commands: Add support for the platform key #332

Closed UltraInstinct05 closed 3 years ago

UltraInstinct05 commented 3 years ago

This PR

  1. Adds support for the platform key in .sublime-commands introduced in Build 4094 to support platform specific entries in the command palette.
  2. Added completions for platform names.

This is essentially just a copy of what exists for the .sublime-menu file (Both the contexts and the completions). Maybe we need a way to reuse them ?

UltraInstinct05 commented 3 years ago

@FichteFoll regarding the tests, I wanted to add them but it seems the test file is a .json file. Does that mean I have to manually add the .sublime- specific scopes ?

FichteFoll commented 3 years ago

I don't understand the question regarding the test file? The file works like any other, but does not have the .sublime-commands extension so it isn't picked up by ST as a resource file.

UltraInstinct05 commented 3 years ago

it isn't picked up by ST as a resource file.

That makes sense, but what I am saying is suppose I have the "platform" in the syntax_test_commands.json and use PD to ^ and get the scope completions. It completes it as meta.sequence.json meta.mapping.key.json string.quoted.double.json rather than keyword.other.main.sublime-commands (so the .sublime- specific scopes are missing). I was wondering if I am doing something wrong.

FichteFoll commented 3 years ago

Did you set the file to use the correct syntax?

FichteFoll commented 3 years ago

I realized that the invalid scope probably makes the experience while typing quite uncomfortable and will likely tame that to a generic string instead.