Sublime Text 3 - Language specific Goto definition Keyboard Shortcut

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-12 14:54:33

问题


How can I set "Goto Definition" work according to the language I'm working on.

For example:

In Python I want to use PythonIDE's go to definition:

{
        "keys": ["ctrl+d"],
        "command": "python_goto_definition"
    },

And, for any other language, for instance Go, I want to use GoSublime's go to definition:

{
        "keys": ["ctrl+d"],
        "command": "go_sublime_goto_definition"
    },

I'm wondering how can I set the context?


回答1:


The context that you want is for selector:

{
    "keys": ["ctrl+d"],
    "command": "python_goto_definition",
    "context": [
        { "key": "selector", "operator": "equal", "operand": "source.python" }
    ]
},

You can add more or less specificity as needed. Use Ctrl+Shift+Alt+P or Shift+Ctrl+P (MacOS) to view the scope selector for the current position.



来源:https://stackoverflow.com/questions/38791826/sublime-text-3-language-specific-goto-definition-keyboard-shortcut

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