Home Download Buy Blog Forum Support

css snippet

css snippet

Postby prmaple on Thu Nov 15, 2012 12:44 pm

For CSS files, there's a key mapping:
Code: Select all
{ "keys": [":"], "command": "insert_snippet", "args": {"contents": ":$0;"}, "context":
      { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
      { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
      { "key": "selector", "operator": "equal", "operand": "source.css - meta.selector.css", "match_all": true },
      { "key": "following_text", "operator": "regex_contains", "operand": "^(?:\t| |\\}|$)", "match_all": true }

There's a problem I saw on the issue list of the plugin Emmet's github page,
where one says when he types ":"
even though when the caret is around somewhere like div, so "div:"
there's still a ";" automatically added. It becomes "div:|;", "|" indicates the caret.
This is not a problem caused by Emmet.
I tried it, and yes, this still happens when Emmet is disabled.

If it's something about sublime,
I thought the scope filter in { "key": "selector", "operator": "equal", "operand": "source.css - meta.selector.css", "match_all": true },
"source.css - meta.selector.css" should have already handled this situation,
am I wrong? or there's other stuff that interferes with the scope filter?

FYI, I don't think I had this problem last time I wrote css stuff, which was quite few months ago.

Maybe it's just a flaw from the scope filter.
I tried this:
| <-when the caret is here, I type "a:", it works as expected.

| <- not here though. so maybe it's just a problem about scope. ??
Posts: 84
Joined: Sun Dec 25, 2011 11:06 am
Location: Melbourne

Return to General Discussion

Who is online

Users browsing this forum: Yahoo [Bot] and 23 guests