rescript-lang / rescript-lang/rescript-vscode

Start build on the client via ProcessExecution

Open
#1,095 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
ReScript
Stars
354
Forks
63
Avg merge
11h 29m
Merged PRs (30d)
1

Description

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() {}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the VS Code extension activation code and the current watch-build handling in the LSP server. Read the VS Code TaskProvider and ProcessExecution APIs, then trace how the watch build is launched today. Done means the extension starts the watch build through a task, without requiring a separate rescript -w terminal.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, vscode
Domain
developer-experience, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.