-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
[vscode] support AuthenticationForceNewSessionOptions #12752
Conversation
0292971
to
7d9d1d4
Compare
? nls.localizeByDefault("The extension '{0}' wants you to sign in again using {1}.", extensionName, providerName) | ||
: nls.localizeByDefault("The extension '{0}' wants to sign in using {1}.", extensionName, providerName); | ||
|
||
message = detail ? message + ' ' + detail : message; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of questions here:
- Shouldn't we include the detail as a parameter of the internationalized message?
- What kind of text is typically here: a whole paragraph, a single sentence?
- If this text can be longer, shouldn't it be separated from the main text at least with a line break?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point for the internationalization! The detail comes from the extension, so should we take care of it or should the detail message already be translated by the extension provider? Not too sure what is the usage here.
For the kind of text, I would expect a single sentence here, not a long paragraph. That's why I simply added after the basic message. That kept the message dialog compact. I think however vscode adds a line separator between the message and the dialog.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Internationalization should be performed by extension.
New line is under evaluation. Not trivial to add one currently. (tested '\n' and
without succes)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just checked in VS Code: they use a modal dialog and not an info dialog. Using a proper dialog would also allow to format as we like.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used a modal dialog rather than a notification. I still have a small issue on the "Allow" button internationalization of this dialog.
In the current version, I do not run any internationalization on "Allow" button.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While developing this PR, I stumbled onto an issue with localization. vscode uses the following code for the "Allow" button:
primaryButton: nls.localize({ key: 'allow', comment: ['&& denotes a mnemonic'] }, "&&Allow")
I have the same kind of code on the dialog, using nls.localizeByDefault("&&Allow"). As I do not have any locale on my debug environement, I get "&&Allow" as the text of the button.
@msujew, would you have an idea how I could get the correct text?
https://github.com/eclipse-theia/theia/blob/master/packages/core/src/common/nls.ts#L35 => this part of the code is skipped, as localization is undefined. So we don't normalize the string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tsmaeder, in the current state, I think the internationalization of the button should not remain an issue, as it can be fixed later on. This would let us work on the final steps before the release, asupdating DEFAULT_SUPPORTED_API_VERSION and the other linked elements. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Theia strips any mnemonics off of vscode's original text. You should be able to just use nls.localizeByDefault('Allow')
(assuming it's in the nls.metadata.json
file).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, Mark! Removing the mnemonics worked.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rschnekenbu we have conflicts again. |
7d9d1d4
to
e376243
Compare
I will fix the lint issues. |
30a847f
to
60921c4
Compare
@rschnekenbu the dialog has no title. That's just odd. |
@tsmaeder, indeed! That is the same as vscode, but vscode has a 'default' title to the dialog. |
60921c4
to
a27a795
Compare
a27a795
to
25e16da
Compare
…sage * Defines and supports this new type in the authentification service. * Updates prompt when new session is forced if detail message is present. Contributed on behalf of STMicroelectronics
Thanks for your reviews, @tsmaeder! |
25e16da
to
716274e
Compare
What it does
Support of AuthenticationForceNewSessionOptions
A detailed message may be now given rather than a simple boolan when forcing a new session.
Fixes #12612
Contributed on behalf of ST Microelectronics
How to test
Install following extension:
authentification-test-0.0.1.zip
authentification-test-0.0.1-src.zip
The extension provides a set of commands that simulate the login using a dummy authentification provider. These commands all have a label starting with 'Auth-Test'.
true
). Prompt a message with default content.On
master
theia, after creating an new session. Invoke Get session with forceNewSession command or Get session with forceNewSession and detail command will always lead to the same result. The message dialog to allow the new session always have the same message.Switch to this PR and run the same tests. The dialog will contain additional detail in the prompt dialog: 'Message based on detail for the force New Session' if Get session with forceNewSession and detail command is invoked.
Review checklist
Reminder for reviewers