Skip to content

Start build on the client via ProcessExecution #1095

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

Open
nojaf opened this issue May 19, 2025 · 0 comments
Open

Start build on the client via ProcessExecution #1095

nojaf opened this issue May 19, 2025 · 0 comments

Comments

@nojaf
Copy link
Contributor

nojaf commented May 19, 2025

It has never been really obvious to me that this build

Image

is a watch build and you don't need to run rescript -w in a separate terminal anymore.

What would you think of the idea of running this in the vscode extension (instead of the LSP server) and use the TaskProvider instead.

(something along the lines of)

import * as vscode from 'vscode';

export function activate(context: vscode.ExtensionContext) {

    let disposable = vscode.commands.registerCommand('myExtension.runProcessTask', async () => {
        // Define the command to run
        // On Windows, you might need to specify the full path to echo.
        // For cross-platform compatibility, consider using a nodejs process
        // or checking the platform. For this example, 'echo' works on most systems.
        const command = 'echo';
        const args = ['Hello from VS Code Task (ProcessExecution)!'];

        // Create the task using ProcessExecution
        const task = new vscode.Task(
            { type: 'process', task: 'myProcessTask' }, // Task definition (type changed to 'process')
            vscode.TaskScope.Workspace,              // Task scope
            'My Process Task (ProcessExecution)',    // Task name
            'My Extension',                          // Task source
            new vscode.ProcessExecution(command, args),  // Execution details using ProcessExecution
            {                                        // Presentation options
                reveal: vscode.TaskRevealKind.Always,
                panel: vscode.TaskPanelKind.Dedicated,
                clear: true
            }
        );

        // Execute the task
        try {
            await vscode.tasks.executeTask(task);
        } catch (error: any) {
            vscode.window.showErrorMessage(`Failed to execute task: ${error.message}`);
        }
    });

    context.subscriptions.push(disposable);
}

export function deactivate() {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant