Skip to content
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

fix parenthesis encoding in unicode highlighting #146248

Merged
merged 1 commit into from Mar 30, 2022

Conversation

ambar
Copy link
Contributor

@ambar ambar commented Mar 29, 2022

This PR fixes #146225

@@ -510,6 +510,10 @@ export class UnicodeHighlighterHoverParticipant implements IEditorHoverParticipa
}
}

function fixedEncodeURIComponent(str: string): string {
return encodeURIComponent(str.replace(/[()]/g, escape));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This double-escapes the string though.

image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

@@ -496,7 +496,7 @@ export class UnicodeHighlighterHoverParticipant implements IEditorHoverParticipa

const adjustSettings = nls.localize('unicodeHighlight.adjustSettings', 'Adjust settings');
const contents: Array<IMarkdownString> = [{
value: `${reason} [${adjustSettings}](command:${ShowExcludeOptions.ID}?${encodeURIComponent(JSON.stringify(adjustSettingsArgs))})`,
value: `${reason} [${adjustSettings}](command:${ShowExcludeOptions.ID}?${fixedEncodeURIComponent(JSON.stringify(adjustSettingsArgs))})`,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, the issue actually is that the escaping conflicts with markdown.
I think the correct fix would be to use this helper:

appendLink(target: URI | string, label: string, title?: string): MarkdownString {

Sorry for only noticing now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replaced with MarkdownString

@hediet
Copy link
Member

hediet commented Mar 30, 2022

Thanks a lot!

@hediet hediet merged commit 4c5cbca into microsoft:main Mar 30, 2022
@github-actions github-actions bot locked and limited conversation to collaborators May 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect formatting in unicode highlighting
2 participants