Skip to content
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

Webview contents keeps showing #44589

Closed
jrieken opened this issue Feb 27, 2018 · 1 comment
Closed

Webview contents keeps showing #44589

jrieken opened this issue Feb 27, 2018 · 1 comment
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug verified Verification succeeded webview Webview issues
Milestone

Comments

@jrieken
Copy link
Member

jrieken commented Feb 27, 2018

re #44466

Run the attached extension snippets, have an untitled file open and toggle between that and the webview.

feb-27-2018 15-49-13

'use strict';
// The module 'vscode' contains the VS Code extensibility API
// Import the module and reference it with the alias vscode in your code below
import * as vscode from 'vscode';

// this method is called when your extension is activated
// your extension is activated the very first time the command is executed
export function activate(context: vscode.ExtensionContext) {

    // 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 "webview" is now active!');

    const webview = vscode.window.createWebview(
        vscode.Uri.parse('foo:bar/bazz'), 
        vscode.ViewColumn.One, 
        { enableScripts: true, enableCommandUris: true, retainContextWhenHidden: true }
    );
    
    // 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
    let disposable = vscode.commands.registerCommand('extension.sayHello', () => {
        // The code you place here will be executed every time your command is executed
        
        webview.title = 'webview';    
        webview.html = '<p id="fff">Test</p><script>setInterval(() => { document.getElementById("fff").innerHTML += " " + Math.random() }, 1000)</script>';
        // webview.show(vscode.ViewColumn.Three);
        // Display a message box to the user
        // vscode.window.showInformationMessage('Hello World!');
    });

    context.subscriptions.push(disposable);
}

// this method is called when your extension is deactivated
export function deactivate() {
}
@mjbvz mjbvz added this to the February 2018 milestone Feb 27, 2018
@mjbvz mjbvz added webview Webview issues bug Issue identified by VS Code Team member as probable bug labels Feb 27, 2018
@mjbvz mjbvz closed this as completed in 66aa34b Feb 27, 2018
@mjbvz
Copy link
Collaborator

mjbvz commented Feb 27, 2018

Good find. Was related to retainContextWhenHidden. Should be fixed now

@jrieken jrieken added the verified Verification succeeded label Feb 28, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators Apr 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug verified Verification succeeded webview Webview issues
Projects
None yet
Development

No branches or pull requests

2 participants