-
-
Notifications
You must be signed in to change notification settings - Fork 97
reimplement button-to-open-in-new-tab + custom webview #133 (monorepo) #152
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
base: main
Are you sure you want to change the base?
Conversation
|
@yoavbls I ported the changes from I think this is enough of poc to confirm this works and is a better approach. Maybe we start with implementing it with the default dark/light highlighters |
|
wowwww I'm so excited to see that this POC is working! |
|
@yoavbls I think we still need these parts:
The main change is that instead of executing the We could embed it all in the command that creates the webview, but having the custom text document content provider forces a separation of concerns. Which I think is a good thing here. During prototyping of this and the l10n draft I ran into the issue that passing the diagnostic as a string and performing string replacements makes it quite difficult to reason about the state of the string and what is and isn't part of it. For example removing the I also suspect that the heavy use of regexes is part of the performance issues some people experience (although pretty sure it's also caused by huge projects with lots of files). So if there is a way to implement a more abstract representation of the (formatted) diagnostic, it could help, maybe not so much in this issue, but for future features and changes. Something more like: type FormattedDiagnosticPartType = 'text' | 'codeblock' | 'icon' | 'link';
type FormattedDiagnosticPart = { type: FormattedDiagnosticPartType, text: string }
interface FormattedDiagnostic {
parts: FormattedDiagnosticPart[];
code: number;
location: Uri;
range: Range;
}I don't think we need it in this implementation, but keeping it in mind while implementing could really help to figure out if we need it and how a consuming API would use a data structure instead of a string. |
|
The old implementation was pretty easy to stitch to the new one, the hardest parts were figuring out CSP and the way we link to a symbol had to change. It's a bit smarter now as well, so it wont open links in the preview in the same active panel. Code needs a bit of cleanup, but the feature is very close to complete. |


Reimplemented #133 but with the monorepo setup. Used a new branch to avoid having to solve the merge errors that would come from trying to merge
mainback into that branch.Whats left:
vscode-codeiconicon font (example)Open in new Tablink in the Markdown preview (its there, just not shown because the icons don't show up)typegrammarWe can also extend the. Some references are:markdown-itas @MichaelDimmitt also mentionedSome of the bugs/limitations can be discovered in how the markdown preview is implemented at markdown-language-features
This is does indicate that a custom webview could be a better option, as it would be a lot less limiting. As for placement, a custom webview can be rendered pretty much everywhere, as an editor tab or part of the activity bar, so we could add configuration to let the user choose where to render it, with a sensible default.