【问题标题】:Sublime Text tab closes auto-complete windowSublime Text 选项卡关闭自动完成窗口
【发布时间】:2014-02-26 19:32:35
【问题描述】:

我希望这是一个简短的问题。

当我开始输入 Sublime Text 2/3 时,会出现自动完成窗口。如果我按tab,我会开始循环浏览我所拥有的选项,这正是我想要的。但是,在我按下tab 的同时,自动完成弹出窗口就会关闭。

是否有一些选项可以使弹出窗口保持活动状态,向我显示我当前所在的项目。 (与down 键的行为相同)。所以我想在down 键和tab 键行为之间实现一些东西。

希望我已经足够准确地描述了这个问题。如果有不清楚的地方 - 我很乐意提供更多细节。

谢谢!

【问题讨论】:

    标签: autocomplete tabs sublimetext


    【解决方案1】:

    我不太了解您正在寻找的行为,但这些是Preferences.sublime-settings 中可用的完成设置:

    {   
        // When enabled, pressing tab will insert the best matching completion.
        // When disabled, tab will only trigger snippets or insert a tab.
        // Shift+tab can be used to insert an explicit tab when tab_completion is
        // enabled.
        "tab_completion": true,
    
        // Enable auto complete to be triggered automatically when typing.
        "auto_complete": true,
    
        // The maximum file size where auto complete will be automatically triggered.
        "auto_complete_size_limit": 4194304,
    
        // The delay, in ms, before the auto complete window is shown after typing
        "auto_complete_delay": 50,
    
        // Controls what scopes auto complete will be triggered in
        "auto_complete_selector": "source - comment",
    
        // Additional situations to trigger auto complete
        "auto_complete_triggers": [ {"selector": "text.html", "characters": "<"} ],
    
        // By default, auto complete will commit the current completion on enter.
        // This setting can be used to make it complete on tab instead.
        // Completing on tab is generally a superior option, as it removes
        // ambiguity between committing the completion and inserting a newline.
        "auto_complete_commit_on_tab": false,
    
        // Controls if auto complete is shown when snippet fields are active.
        // Only relevant if auto_complete_commit_on_tab is true.
        "auto_complete_with_fields": false
    }
    

    您可以通过自定义它们来获得您想要的行为。

    【讨论】:

    • 嘿@inkdeep,谢谢你的回答,但我当然已经玩过那里的设置了。我无法实现所需的行为。因此,我发布了这个问题,以防有人和我有同样的想法。
    【解决方案2】:

    如果你使用AutoSave插件,这将是快速关闭弹出窗口的原因。尝试禁用此扩展程序。

    【讨论】:

      【解决方案3】:

      覆盖 Tab 键绑定

      我找到了以下内容来提供解决方案。它只是再次调用自动完成,从而选择下一个选项。

      { "keys": ["tab"], 
          "command": "auto_complete",
          "context":
          [
              { "key": "auto_complete_visible" },
              { "key": "setting.auto_complete_commit_on_tab", "operand": false }
          ]
      }
      

      如果这不是您唯一的键绑定,请记住添加逗号。

      【讨论】:

        【解决方案4】:

        我遇到了同样的问题 - 在他们的论坛中找到了这个解决方案:

        将此添加到您的键盘映射文件中:

        { "keys": ["tab"], "command": "insert", "args": {"characters": "\t"}, "context":
           [
              { "key": "auto_complete_visible" },
              { "key": "setting.tab_completion", "operator": "equal", "operand": false }
           ]
        }
        

        【讨论】:

        • 这只是插入一个新标签。它不会循环显示自动完成选项。
        猜你喜欢
        • 2013-08-29
        • 2014-10-05
        • 1970-01-01
        • 2012-11-13
        • 2014-07-26
        • 1970-01-01
        • 1970-01-01
        • 2014-10-29
        • 2012-09-21
        相关资源
        最近更新 更多