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

Design reusable HTML error block for tooltips #945

Open
shouples opened this issue Jan 21, 2025 · 0 comments
Open

Design reusable HTML error block for tooltips #945

shouples opened this issue Jan 21, 2025 · 0 comments
Assignees

Comments

@shouples
Copy link
Contributor

Initial use-case for an error block is in the Resources view for any "direct" connections that return a FAILED connection status, starting with #944:

Image

So far we've only used markdown in tooltip content, but VS Code also supports tooltips with HTML (when enabled by the extension). We may be able to add some better styling to the error block based on available tags and attributes.

Any adjustments to our existing tooltips will likely need to explicitly set supportHtml for the MarkdownString instance or override the default:

/**
* This is a custom tooltip class that extends `vscode.MarkdownString` to add constructor arguments
* for additional properties that are not available in the base class.
* @param value Optional, initial value.
* @param isTrusted Whether the markdown content is trusted or not (e.g. to support embedding
* command-markdown syntax). (Default is `true`.)
* @param supportHtml Whether the tooltip supports HTML content. (Default is `false`.)
* @param supportThemeIcons Whether the tooltip supports the extension's custom contributed icons in
* the markdown string (e.g. `$(confluent-environment)`). (Default is `true`.)
*/
export class CustomMarkdownString extends vscode.MarkdownString {
constructor(
value?: string,
public isTrusted: boolean = true,
public supportHtml: boolean = false,
public supportThemeIcons: boolean = true,
) {
super(value, supportThemeIcons);
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants