my vscode extension has a list of workspace files that should all be opened in the text editor, using showTextDocument
.... i'm finding that only the last file in the set is actually shown in an editor tab....
i'm not interested in splitting the screen into "one-group-per-file"
if i do this manually, of course, i need to "double-click" the files to ensure they are not in preview mode; otherwise, the tab is simple replaced.... i can also manually use the Pin
action on the tab's context menu....
but i want to do this programmatically, and am not sure how to execute the equivalent of the Pin
action in my extension.... in reality, i would like multiple editor tabs that are each "readonly"....
suggestions???
To make a file read-only in the session (i.e., not in the fileSystem) try running this when that file is the active editor:
vscode.commands.executeCommand('workbench.action.files.setActiveEditorReadonlyInSession');
For why only the last file shown is visible, do you have the preview
option set to false in the TextDocumentShowOptions
?
You should use a version of showTextDocument()
that can take a TextDocumentShowOptions
argument. And in that argument set preview
and preserveFocus
to false
.
const showOptions: vscode.TextDocumentShowOptions = { preserveFocus: false, preview: false, etc. }