microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
161.63k stars 28.4k forks source link

Specify terminal group for integrated terminal in launch configuration #68123

Open markm77 opened 5 years ago

markm77 commented 5 years ago

It is great to see that task configurations now allow the specification of terminal group (https://github.com/Microsoft/vscode/issues/47265) - works well from my initial testing. Can you please also allow launch configurations to specify terminal group when using the integrated terminal for debug and start/stop?

See my comment here: https://github.com/Microsoft/vscode/issues/47265#issuecomment-449993673

vscodebot[bot] commented 5 years ago

(Experimental duplicate detection) Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:

markm77 commented 5 years ago

A further comment: I guess perhaps the most logical thing would be to simply support the same presentation group of options as for tasks (applicable only when using integrated terminal)...?

https://code.visualstudio.com/docs/editor/tasks#_output-behavior

Tyriar commented 5 years ago

I'm not sure we want this group concept proliferating to everything @alexr00? Split APIs for the terminal will likely look more like the view column APIs.

markm77 commented 5 years ago

Please when considering this realise how currently painful it is with compound launch configs that launch multiple integrated terminals. You are forever switching between terminals (whose order is a bit random). Anything that allows a compound launch config to launch integrated terminals in side-by-side clusters to group related terminals visually would do the job. Groups seemed the perfect solution but then I don't understand how the view column APIs work (are they for creation of a dynamic grid of terminals like the group concept or just a static grid? These two concepts are different and complementary). Also fragmentation between the operation of integrated terminals for tasks and launch configurations doesn't seem good?

markm77 commented 5 years ago

Just to give some thoughts on the concepts and possible roadmap here.

I think there is a need to support a dynamic grid of terminals that grows and shrinks as associated tasks or debug configs are started/stopped etc. (Growing or shrinking refers here to number of terminals not UI boundaries which are assumed fixed.) That is for me what the whole group concept is about. I think the group concept is great and could usefully be extended to be a 2D grid and support position ordering etc.

This group concept can be seen as completely independent of and complementary to the useful idea of a static UI arrangement of terminals which persists between sessions of VS Code and which could ultimately be 3D (i.e. stacks of 2D grids like we have stacks of 1D grids today) or something else you are working on. Each terminal in the static arrangement could itself be a group - possibly empty (a placeholder) and awaiting its first dynamic member (task or launch config starting). Note that creating a static mapping between a particular terminal and a task or launch config, a useful function which cannot be done today, is then as simple as assigning a group name to both.

Ultimate support for static arrangements of terminals with nested dynamic grids (groups) as described here seems to me a possible ultimate aspiration and would be very powerful indeed. It creates a flexible way of expressing the relationships between terminals and tasks/debug configs that use them. Which increases the usefulness and usability of both integrated terminals and tasks/debug configs. Done well, I think this would be a killer feature for VS Code vs other IDEs.

weinand commented 5 years ago

@markfinlabs Please be aware that in contrast to tasks, launch configurations do not know anything about terminals. If a debugger supports launching in the integrated terminal, this is an implementation detail of the debugger. And the launch config properties related to terminals are part of the debugger's JSON schema, not part of VS Code's schema. So VS Code is not in a position to introduce a "terminal group" property in all launch configs. Only debugger extensions could start to support this property.

The only thing we (VS Code) could do is to add the notion of a "terminal group" to the DAP request "runInTerminal" that many debug adapters use to run something in the integrated terminal.

markm77 commented 5 years ago

Thanks for the reply and the additional info. Would it make sense to expose the same presentation property (https://code.visualstudio.com/docs/editor/tasks#_output-behavior) used by tasks as a runInTerminal argument when argument kind is set to integrated terminal? (Would help unify use of integrated terminals between tasks and debug.)

presentation would capture current and future options relating to the group feature and other terminal display choices and ensure we don't have this discussion about alignment again. : )

weinand commented 5 years ago

A specified "presentation property" in the "runInTerminal" request makes only sense if the specification is "universal" (independent from VS Code). If it is very specific to VS Code, we do not want to include it in the DAP. But in that case we could consider to support passing an opaque option bag via the "runInTerminal" request.

markm77 commented 5 years ago

Okay, got it, DAP is a general protocol which I didn't know much about which I guess allows people to create debug profiles that work with multiple IDEs. So I see why this has to be an IDE-specific option bag for enhanced experience with VS Code.

I would definitely support adding presentation or similar as an opaque option bag : ).

markm77 commented 4 years ago

Just to note, on StackOverflow, there is a desire to be able to clear the integrated terminal when starting debugging. https://stackoverflow.com/questions/56619836/vscode-clear-integrated-terminal-when-debug-starts I also need this functionality, particularly when using Jest for unit testing. I believe the above proposal for support of presentation via an opaque option bag would solve this issue. 😀

tommitytom commented 4 years ago

Has there been any progress made on this? I just started working with compound debugging and it seemed obvious that they would start in terminals side by side! Is there a way to manually arrange the terminals once debugging has started?

ldarshan1991 commented 3 years ago

Has there been any progress made on this? I just started working with compound debugging and it seemed obvious that they would start in terminals side by side! Is there a way to manually arrange the terminals once debugging has started?

Is there a way to merge the 2 integrated terminals into one integrated terminal so that they split into two? At least as a temporary workaround until a cleaner solution is provided.

samuelms1 commented 3 years ago

Is there any update on this? Like @tommitytom, I just got started on compound debugging and it would be really nice to have them split. There doesn't appear to be a way to split them after they've started to run like @ldarshan1991 suggested. Thanks for hearing me out. :D

jSadoski commented 2 years ago

Because this shows up first for me when searching, it seems like presentation is now available on debug tasks & compounds:

presentation - using the order, group, and hidden attributes in the presentation object, you can sort, group, and hide configurations and compounds in the Debug configuration dropdown and in the Debug quick pick.

However, I couldn't get this to work, despite the string between tasks.json and launch.json. I'm hoping to see some way to do this soon.

https://code.visualstudio.com/docs/editor/debugging#_launchjson-attributes

roblourens commented 1 year ago

That presentation group is not related to the terminal group. We still need DAP support for something like this.

nbelakovski commented 1 year ago

Just wanted to add that I've come up with something of a workaround for this using editor group and editor terminals. After I launch my compound debug and the new integrated terminals are created, I drag them out into the editor area to make them separate tabs, and then use View -> Editor Layout -> Grid 2x2 so that I can see both terminals side by side.

Would be great if they could launch directly into split panes, but this works for now.

airstrike commented 8 months ago

I was just digging into this as I start Advent of Code with ReScript which requires two scripts to run in parallel npm run res:dev and npm run dev. It seems to be achievable with vscode today, so sharing the below in case helpful.

I'm actually using bun instead of npm and it works fine too (just comment / uncomment the two lines accordingly)

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "ReScript Watcher",
            // "type": "npm",
            // "script": "res:dev",
            "type": "shell",
            "command": "bun run res:dev",
            "isBackground": true,
            "problemMatcher": [],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "presentation": {
                "group": "dev",
            }
        },
        {
            "label": "Vite Server",
            // "type": "npm",
            // "script": "dev",
            "type": "shell",
            "command": "bun run dev",
            "isBackground": true,
            "problemMatcher": [],
            "group": "build",
            "presentation": {
                "group": "dev",
            }
        },
        {
            "label": "Run dev tasks",
            "dependsOn": [
                "ReScript Watcher",
                "Vite Server"
            ],
            "dependsOrder": "parallel",
            "problemMatcher": [],
            "presentation": {
                "group": "dev",
                "reveal": "always",
                "panel": "shared"
            }
        }
    ]
}
leobaldoneto commented 4 months ago

I was just digging into this as I start Advent of Code with ReScript which requires two scripts to run in parallel npm run res:dev and npm run dev. It seems to be achievable with vscode today, so sharing the below in case helpful.

I'm actually using bun instead of npm and it works fine too (just comment / uncomment the two lines accordingly)

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "ReScript Watcher",
            // "type": "npm",
            // "script": "res:dev",
            "type": "shell",
            "command": "bun run res:dev",
            "isBackground": true,
            "problemMatcher": [],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "presentation": {
                "group": "dev",
            }
        },
        {
            "label": "Vite Server",
            // "type": "npm",
            // "script": "dev",
            "type": "shell",
            "command": "bun run dev",
            "isBackground": true,
            "problemMatcher": [],
            "group": "build",
            "presentation": {
                "group": "dev",
            }
        },
        {
            "label": "Run dev tasks",
            "dependsOn": [
                "ReScript Watcher",
                "Vite Server"
            ],
            "dependsOrder": "parallel",
            "problemMatcher": [],
            "presentation": {
                "group": "dev",
                "reveal": "always",
                "panel": "shared"
            }
        }
    ]
}

It works with tasks.json, but don't with launch.json in configurations and compounds.

ashikns commented 2 months ago

Did anyone ever figure out a solution for this? I'm trying to launch a node-terminal and debugpy in split terminals.