-
Notifications
You must be signed in to change notification settings - Fork 134
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
Extend RunInTerminalRequestArguments to allow clearing the previous terminal history automatically #165
Comments
Where in the spec does it say that? My client doesn’t do this. |
i didn't see there is a spec to declare this, but at least VS Code client will try to reuse the same terminal to handle the request. |
Yes, the spec doesn't say anything about reusing terminals, but this does not prevent clients from implementing it like this. I suggest:
|
looks good to me. |
But should this flag really be ‘newTerminal’ or something that says this command is not related to the previous one? Otherwise just include a ‘clear’ command in your requests? clear screen is quite specific and seems like a workaround for the vscode terminal reuse behaviour. In practice I’m not sure How would a client implement that generically? Client might not even know how to issue a clear command for the terminal. Is ctrl-l universal? Does the clear command exist on $OS? Would it be legit to just start a new terminal and discard the existing one to ‘clear’ the old one? Either way I would advocate for not baking assumptions into the protocol based on what one particular client does today. If it’s required that runInTerminal starts a shell (it’s not afict) and that subsequent messages are commands in that shell (not currently, despite the recent clarification about cd commands, which I guess I now understand based on this context), then we should document that clearly before baking further potentially confusing knobs like this into the protocol. Just my opinion as a client maintainer . Vimspector starts the command in a terminal window. There is no ‘shell’ just the command running. The command is started with the WD as supplied and with the environment as supplied. So there is no 'cd’ (the other recent change). If the previous command has completed, then a new terminal buffer is started with the new command and the old one discarded. If the previous one is still running, then the terminal window is split to create 2. If that’s wrong in some way then I need to change it, but I don’t want to change it unless the protocol says clients must behave in a specific way and I don’t want servers to assume behaviour based on one specific client implementation. But if not, based on that, I would say this switch is not required. by adding it I have a total headache: rewrite my implementation to follow vscode odd behaviour, or fail to respect the switch, which could lead to problems down the line. Do you see my concern? |
After writing that essay I just noticed @weinand comment which as usual is right on point. 👍 I’m not a fan of these ‘hints’ but it certainly solves the problem to say that servers must not rely on them. |
@puremourning your implementation in Vimspector is totally correct and we don't want you to change anything. |
Yep, thanks. I totally missed your comment, which I pretty much wholly agree with :) |
In which scenarios would a debug adapter implementation want to set these hints? Not sure I see the advantage of having this as part of the protocol and up to the debug adapter implementations to influence instead of letting users configure the behavior in their dap-client? |
@mfussenegger you raised a good point: As already noted by others, the DAP spec says nothing about "reusing terminals". Lets try to find the pros and cons of the two approaches by having a more detailed look at the initial "clear terminal history" feature:
Here are some pros and cons for the two approaches:
@testforstephen @puremourning @mfussenegger any additional pros and cons? what do you think? |
I think there may be some desire from the users to control it on a per-workspace basis. If that requires flowing it through DAP for the sake of ease of implementation, it's not a hassle from the adapter perspective. But if VSCode can somehow do this transparently, without involving the adapter at all, I think that's preferable. I just can't think of a scenario where the adapter would want to control this, other than flowing through the setting from launch.json. |
Client only sounds more appropriate to me. There’s nothing stopping the setting/option working on a per-project/per config basis in the client:
|
I suggest that we close this DAP feature request in favour of a new VS Code request that asks for new settings to control how a terminal is reused when launching debuggees. @testforstephen is this OK for you? |
@weinand Sounds better to introduce a setting in client to control this. Thank you all for the great idea. I will close this request. |
The runInTerminal request will try to run the subsequent commands from the same terminal again, and the previous run history will remain on the current screen. This is not clean for some users who want to be able to automatically clear the old terminal output before running the new program.
One suggestion is to add a new property such as
clearTerminal
to theRunInTerminalRequestArguments
so that the client can perform additional clearing according to the new property.The text was updated successfully, but these errors were encountered: