-
Notifications
You must be signed in to change notification settings - Fork 29.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
showTextDocument should support to open in the background #11247
Comments
|
@jrieken I believe we're saying the same thing. Let's say the focus was on editor A. Then I execute a command that opens a document and shows that document in a new editor B with preserveFocus set to true. Shouldn't editor B open but editor A still have focus? If true, then I'm not seeing that behavior, which leads me to believe preserveFocus isn't being observed. |
Try a file that's not opened in any other editor and show it in the same view column. |
Is that just a guess because also that works for me? Please provide reproduce steps that allow me to reproduce this |
// The module 'vscode' contains the VS Code extensibility API
// Import the module and reference it with the alias vscode in your code below
var vscode = require('vscode');
// this method is called when your extension is activated
// your extension is activated the very first time the command is executed
function activate(context) {
// Use the console to output diagnostic information (console.log) and errors (console.error)
// This line of code will only be executed once when your extension is activated
console.log('Congratulations, your extension "test-extension" is now active!');
// The command has been defined in the package.json file
// Now provide the implementation of the command with registerCommand
// The commandId parameter must match the command field in package.json
var disposable = vscode.commands.registerCommand('extension.sayHello', function () {
// The code you place here will be executed every time your command is executed
vscode.workspace.openTextDocument('/full/path/to/file.js').then(function(TextDocument){
vscode.window.showTextDocument(TextDocument, vscode.ViewColumn.One, true);
});
});
context.subscriptions.push(disposable);
}
exports.activate = activate;
// this method is called when your extension is deactivated
function deactivate() {
}
exports.deactivate = deactivate; |
You mean 'Open a file in that folder as the active editor in ViewColumn.One'? |
@jrieken Yes |
Ok. What you want is to open an editor in the background for which we currently don't have support |
preserveFocus
argument isn't being observed in showTextDocument
@bpasero Do we have support for the in the underlying API and how would/should it work in |
@jrieken that is right, for this behaviour it does not make a difference if you see tabs or not in the main editor area because you could be using the "open editors" view and will notice there how an editor opens "in the background". Since you have tabs disabled, in this case you would need to close the top most editor until you reach the one that was opened in the background (in the same way as you do when you have tabs enabled). |
I'm making a remote pair programming extension and want to allow a remote user to open a file and edit it without interrupting the local user. Here is the extension I'm using as a base: Motepair |
I am also waiting for this feature as i want to open the summary page to open in the background so user who is working on other tab should not get disturbed and through API i can add text on that other tab in the background. When user switch to that api he should see the extension summary. Extension - code-settings-sync ! |
yes |
The problem with this is that opening an editor in the background doesn't make an editor in the editor. Only documents that are current shown in an editor-widget are an editor in the API. So, when calling Closing this as dupe of #15178 which is about exposing the tab-model |
Steps to Reproduce:
openTextDocument
showTextDocument(TextDocument, vscode.ViewColumn.One, true)
The text was updated successfully, but these errors were encountered: