【问题标题】:Hook IntelliSense completion list挂钩 IntelliSense 完成列表
【发布时间】:2018-10-07 16:02:47
【问题描述】:

是否可以挂钩完成列表显示功能?

我主要想创建一个扩展,当显示完成列表时,获取第一个建议并将其存储在文件中。

【问题讨论】:

    标签: hook intellisense visual-studio-extensions


    【解决方案1】:

    我发现,可以使用complex commands API 获取建议列表。

    命令名称为:vscode.executeCompletionItemProvider,我们可以使用vscode.commands.executeCommand调用它

    // the Position object gives you the line and character where the cursor is
    const position = editor.selection.active;
    
    // Get document Uri
    const docUri = vscode.window.activeTextEditor.document.uri;
    
    completionList = vscode.commands.executeCommand(
       'vscode.executeCompletionItemProvider',
        docUri,
        position
    )
    

    【讨论】:

    • 感谢您在这里分享您的解决方案,您可以Accept it as an Answer。这可能对阅读此主题的其他社区成员有所帮助。
    猜你喜欢
    • 2016-02-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-04-27
    • 1970-01-01
    • 1970-01-01
    • 2012-01-23
    • 1970-01-01
    相关资源
    最近更新 更多