0

I am trying to make a VS code extension.

In this extension I am interested in printing VS Code IntelliSense suggestions as an array to the debug console when the user types or ask for suggestions with ctrl+space.

Is this possible and if so where should I look?

  • You probably have to write an extension. See also [How to write to log from vscode extension?](/q/34085330) – starball Jan 28 '23 at 09:09
  • Yes, thank you for your feedback. My questions was not clearly formulated enough. I allready have a "Hello world" extenstion and my question is where to move from here. I have just editet the questions so it reflects this. – Martin Brodersen Jan 28 '23 at 09:36
  • Possibly related GitHub issue ticket: https://github.com/Microsoft/vscode/issues/578 – starball Jan 28 '23 at 09:43
  • 1
    To answer part of your question: see [Hook IntelliSense completion list](/a/52706307). – starball Jan 28 '23 at 09:49

1 Answers1

0

This help me to a solution: Hook IntelliSense

let disposable2 = vscode.workspace.onDidChangeTextDocument((event) => {
    const editor = vscode.window.activeTextEditor;
    // the Position object gives you the line and character where the cursor is
    const position = editor?.selection.active;

    // Get document Uri
    const docUri = editor?.document.uri;
    let completionList = vscode.commands.executeCommand(
        'vscode.executeCompletionItemProvider',
            docUri,
            position
        );
     completionList.then((value: any) => {
     for (let i of value.items) {
        console.log(i)
     }
     });
    });