How to change the active text editor of vscode?

Viewed 782

I am making an extension for vscode. My extension created files at specific directories which are set by user. The files are being created successfully at correct location. How I can open the newly created file in the a new editor also also focus it. I have full path of the file and also the name.

1 Answers

Ok I was just searching and I got the correct result. Here is how I did it. You need to convert the path of file to Uri and then use vscode.open command. If any better or alternative solution please mention

const Uri = vscode.Uri.file(fullPath);
vscode.commands.executeCommand<vscode.TextDocumentShowOptions>("vscode.open",Uri);
Related