Sublime Forum

Css snippet

#1

For CSS files, there’s a key mapping:

[code]
{ “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 }
]

}[/code]
There’s a problem I saw on the issue list of the plugin Emmet’s github page,
https://github.com/sergeche/emmet-sublime/issues/130
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.

Edit:
Maybe it’s just a flaw from the scope filter.
I tried this:
body{
}
| <-when the caret is here, I type “a:”, it works as expected.
div{
}

| <- not here though. so maybe it’s just a problem about scope. ??

0 Likes