【问题标题】:how can we get which completion item is selected by the user我们如何获得用户选择了哪个完成项
【发布时间】:2023-02-14 09:28:46
【问题描述】:

我在用

provideCompletionItems

并给出建议列表我想知道当用户选择特定项目时如何添加回调。

这就是我的建议

{
      label: 'apple',
      insertText:'apple',
      kind: monaco.languages.CompletionItemKind.Event,
      insertTextRules: monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet,
      command: {
        id: 'editor.action.triggerSuggest',
        title: 'operator_additional_suggestions',
      },
      range,
      documentation: keyword?.description,
    }

【问题讨论】:

    标签: monaco-editor visual-studio-monaco


    【解决方案1】:

    你可以通过争论像这样对命令对象;

        command: {
            id: 'editor.action.triggerSuggest',
            title: 'operator_additional_suggestions',
            arguments:['apple']
          },
    

    并在注册的命令中访问它;

    
        editor.registerCommand('editor.action.triggerSuggest',(_:any,...args:any[])=>{
           // access the arguments here
         })
    
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-04-16
      • 1970-01-01
      • 1970-01-01
      • 2012-05-16
      • 1970-01-01
      • 2012-09-07
      • 1970-01-01
      • 2011-11-26
      相关资源
      最近更新 更多