eclipse-theia / theia

Eclipse Theia is a cloud & desktop IDE framework implemented in TypeScript.
http://theia-ide.org
Eclipse Public License 2.0
20.05k stars 2.5k forks source link

[vscode] support activation events #4199

Closed dehru closed 1 year ago

dehru commented 5 years ago

Hello, I've got a vscode extension running in theia version "next" ( "version": "0.4.0-next.e2f3ec66" ). But there's a slight difference in when the activation() lifecycle method gets called.

The vscode extension was built with "vscode": "1.1.28", and has this info in it's package.json

        "activationEvents": [
        "onCommand:extension.execute-command"
    ],
    "main": "./out/extension.js",
    "contributes": {
        "commands": [{
            "command": "extension.execute-command",
            "title": "Hello Execute Command"
        }]
    },

And a very simple extension.ts that looks like this.

import * as vscode from 'vscode';

export function activate(context: vscode.ExtensionContext) {
    console.log('activate called');
    vscode.commands.executeCommand('setContext', 'thisContext', true);
}

export function deactivate() {}

When running in vscode, the activate method is not called until the command is actually triggered through the vscode command palette.

When running inside theia, the activate method is called as soon as the browser is connected / opened. This makes debugging the activate method a little more challenging. And could lead to different behavior with vscode extensions.

akosyakov commented 5 years ago

Activation events are not supported yet, VS Code extensions are activated eagerly for now.

akosyakov commented 5 years ago

Hit it again trying to debug LS process of vetur VS Code extension. It's really hard since debug configuration rely on lazy loading of extensions :(

akosyakov commented 5 years ago

For rust extension, it is necessary to fix it, otherwise it starts contributing UI elements regardless whether rust project opened or not.

akosyakov commented 5 years ago
akosyakov commented 5 years ago

Docs:

akosyakov commented 5 years ago

For onView event we need to integrate new view containers in the plugin system first, since it should be fired on expansion on the view. If we do it now we need to reimplement it later again.

akosyakov commented 5 years ago

I will stop working on it. onView and onWebview require substantial refactoring in the plugin system to integrate them properly with the shell. Regarding the rest of events i have not seen them in practice used a lot and will wait for some extension to come around.

akosyakov commented 5 years ago

onView is covered in https://github.com/theia-ide/theia/pull/5665

akosyakov commented 4 years ago

onWebviewPanel is covered in https://github.com/eclipse-theia/theia/pull/6465

akosyakov commented 4 years ago

onFileSystem is covered in https://github.com/eclipse-theia/theia/pull/7908

tsmaeder commented 1 year ago

Closing this omnibus issue, as we generally support activation events.

alvsan09 commented 1 year ago

@tsmaeder, We are missing the support of multiple activation events as reflected under the following comment: https://github.com/eclipse-theia/theia/issues/4199#issuecomment-507253188

How can we track those? A newer issue, perhaps ?

tsmaeder commented 1 year ago

The list is at least partially out of date ("onRenderer"). If we have missing activation events, they should be tracked by separate issues and linked to the VS Code API version where they appear. This old issue is not useful, IMO.

alvsan09 commented 1 year ago

The list is at least partially out of date ("onRenderer"). If we have missing activation events, they should be tracked by separate issues and linked to the VS Code API version where they appear. This old issue is not useful, IMO.

@tsmaeder , Unfortunately the activation events are independent of the vscode API, and would therefore need a parallel tracking, I think we need parallel tacking of the following vscode interfaces.

1) vscode API, (already tracked) 2) vscode Proposed APIs (Discussion @ https://github.com/eclipse-theia/theia/discussions/12450) 3) vscode Activation Events 4) vscode Contribution points