How to open a new read-only text file on a tab and paste formatted text into it using the studio visual code API.
I did not find any example regarding this to add plain text
Below is my code that opens some untitled file.
var setting: vscode.Uri = vscode.Uri.parse("untitled:" + "C:\summary.txt");
vscode.workspace.openTextDocument(setting).then((a: vscode.TextDocument) => {
vscode.window.showTextDocument(a, 1, false);
}, (error: any) => {
console.error(error);
debugger;
});
Please provide a simple example that you can add to these lines to add text. Since official examples are a little complicated.
source
share