Sublime Text 2 double quote font-style depends on file extension?

你。 提交于 2019-12-25 02:42:51

问题


The auto-pairing of double quotes is a really strange issue that I thought I'd solved but still persists. The issue is that for files of the extension .php, .html, the default font-style of auto-paired double quotes is not parseable. To show you what I mean, notice the font-style of the double quotes in the <div> on the left. Whereas with .js and .css files, the double quote auto-pairing has the proper font-style as shown in the <div> on the right>.

This must be a setting somewhere but I don't know Sublime Text2 (Mac OSX) so well. Thoughts?


回答1:


With the huge help from @JamieJag I've isolated the problem. Shift+" was producing what Sublime calls "typographical" quotes and not the double quotes which are parseable as part of PHP or HTML code.

To fix the problem, I commented out everything in my SublimeText2 preferences->key bindings->user.

It's unclear to me whether one or all of these JSON object is responsible for the problematic behavior (though I'd guess the first JSON looks like the offender) but so far just commenting out the entire array solved my problem.

/*[

// Auto-pair typographical quotes
{ "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": "following_text", "operator": "regex_contains", "operand": "^(?:\t| |\\)|”|;|\\}|$)", "match_all": true },
      { "key": "selector", "operator": "equal", "operand": "text", "match_all": true }
   ]
},
{ "keys": ["\""], "command": "insert_snippet", "args": {"contents": "“${0:$SELECTION}”"}, "context":
   [
      { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
      { "key": "selection_empty", "operator": "equal", "operand": false, "match_all": true },
      { "key": "selector", "operator": "equal", "operand": "text", "match_all": true }
   ]
},
{ "keys": ["\""], "command": "move", "args": {"by": "characters", "forward": true}, "context":
   [
      { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
      { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
      { "key": "following_text", "operator": "regex_contains", "operand": "^\\”", "match_all": true },
      { "key": "selector", "operator": "equal", "operand": "text", "match_all": true }
   ]
},
// Smart quotes before & after word
{ "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": "following_text", "operator": "regex_contains", "operand": "^\\S", "match_all": true },
      { "key": "selector", "operator": "equal", "operand": "text", "match_all": true }
   ]
},
{ "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": "preceding_text", "operator": "regex_contains", "operand": "^\\S", "match_all": true },
      { "key": "selector", "operator": "equal", "operand": "text", "match_all": true }
   ]
}

]*/


来源:https://stackoverflow.com/questions/14960270/sublime-text-2-double-quote-font-style-depends-on-file-extension

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!