imahungry
imahungry

Reputation: 126

Sublime 3 auto completion scope certain files

Is there a way of setting the scope attribute of a sublime-completion file for only specific JavaScript files?

{
  "scope": "source.js - targetonlyserializer.js",
  "completions: [
       { "trigger": "normalize (modelClass, resourceHash, prop)", "contents": "normalize(modelClass, resourceHash, prop) {\n\n}" }
   ]
}

I read the TextMate documentation, and it says that it is similar to CSS, but I didn't see anything on file selectors.

Upvotes: 0

Views: 142

Answers (1)

Darrick Herwehe
Darrick Herwehe

Reputation: 3722

No. This is not possible. Sublime Text scope is defined by regexes in language files. None of which uses the file name (or any classes/methods/functions) as part of the scope. From the documentation (emphasis mine):

Sublime Text will try to match these patterns against a buffer’s text and attach the corresponding scope name to all occurrences.

So, language files are only run against the text of the file. No other information is taken into account.

This is confirmed by using Scope Hunter on a keymap file. This screenshot shows the scope under the cursor. Note that the scope does not include the name of the file.

enter image description here

Upvotes: 1

Related Questions