SublimeText/Tag — Issue #6: CTOS: Move activation logic into keymap
Author: spadgos
Created: 2011-11-09 09:49:57+00:00
State: open

In the CloseTagOnSlash package, the command is being activated on every `/` keypress, regardless of the context, and then internally, it is checking to see whether closing the tag is appropriate.

I'd recommend moving that logic into the keymap file itself, by way of the `context` option, for example:

```javascript
[
{"keys": ["/"], "command": "tag_close_tag_on_slash", "context": [
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true},
{ "key": "selector", "operator": "equal", "operand": "text.html", "match_all": true},
{ "key": "preceding_text", "operator": "regex_contains", "operand": "<$", "match_all": true}
]}
]
```

Then, the extra checking of the scope and previous characters is not needed in the python file itself.