-
Notifications
You must be signed in to change notification settings - Fork 79
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
Make StoppedEvent's 'reason' attribute robust against translations #105
Comments
Didn't it always either say exception, unknown or paused on breakpoint? I couldn't get any other strings to show even if I wanted to when I implemented the stopped event. |
@WebFreak001 I've just tried this by adding a 'XXX' to the reason strings returned from node-debug and here is the result: This proves that the 'reason' text is shown in the UI as is. But from an i18n perspective it is probably better to have the |
Yeah, isn't this just a string enum like |
@felixfbecker it looks a bit like a string enum, but the TypeScript declarations shows that it is not: /** The reason for the event (such as: 'step', 'breakpoint', 'exception', 'pause').
This string is shown in the UI. */
reason: string; But if you have assumed that it is a string enum, then my proposal will work for you because the php debugger most likely does not translate these values, correct? |
@weinand The typings were written before TypeScript had string literals iirc, so I assumed they were an enum. The PHP debugger only ever sends these values: I would suggest you just turn this into a real string enum. |
@felixfbecker the value set has some predefined values but is extensible ("open"). I'll have to figure out how to express this as a JSON schema... |
@weinand sounds like a good plan to me |
I'm slightly confused - isn't it Code that will fall back to |
@DanTup yes, if you are not returning a translated But if you are translating the And if you want to have more control over what gets displayed in the UI, you can return the I've added these 3 items to the proposal from above. |
Thanks for clarifying! 👍 |
@weinand - What's the meaning of "has some predefined values but is extensible"? If the Going by other notes in the protocol, I think the following are necessary enum values: |
@andrewcrawley currently only a single predefined value ('exception') will be interpreted by the client. All other predefined values are not (yet) interpreted but they are displayed in fallback mode (if no 'description' attribute is given). |
Why would a debugger "need" to introduce an additional reason if no host interprets that reason to mean anything? It sounds like that would be a case for someone to file an issue and request a new enum value. Plus, VS does differentiate between reasons - stopping on a breakpoint is different from stopping on an exception, which is different from stopping on entry, etc. |
@andrewcrawley For compatibility. |
Today StoppedEvent's
reason
attribute is the onlyreason
attribute that is shown in the UI. As a consequence debug adapters are expected to provide different translations for its value (but I'm only aware of a single fully translated debug adapter: node-debug).A translated
reason
value makes it difficult for a client to interpret the value. Previously VS Code did not interpret the value but with the advent of microsoft/vscode#16860 VS Code has to do this (and other clients might want to do this as well).So there is a need to have the
reason
information both in a translated and untranslated form.To address this we propose the following:
reason
attribute from being used in the UI to become the untranslated form. This means we will remove the comment "This string is shown in the UI" from the description of thereason
attribute. With this the semantics of the StoppedEvent'sreason
attribute starts to match the otherreason
attributes.description
for the translated valued. This description will be shown in the UI 'as is', and it is not embedded in some other string. If this attribute is missing, clients are expected to fall back to use thereason
attribute like before.For debug extension authors this means the following:
Comments, opinions?
@delmyers @gregg-miskelly @DanTup @WebFreak001 @roblourens @andysterland @hbenl @ramya-rao-a @felixfbecker @daviwil @rkeithhill @DonJayamanne @rebornix @isidorn @dlebu @michelkaporin @richardstanton @andrewcrawley @DavidKarlas
The text was updated successfully, but these errors were encountered: