microsoft / typescript-lit-html-plugin

TypeScript server plugin that adds intellisense for lit-html template strings
MIT License
255 stars 22 forks source link

Quick info hover consistent look #14

Closed justinribeiro closed 6 years ago

justinribeiro commented 6 years ago

This addresses https://github.com/mjbvz/vscode-lit-html/issues/37 and another bug I found in the process.

First, this brings the quick info hover closer in terms of the expected styled look (see gif below). I will point out this is not exactly the same look; I re-used ts.QuickInfo.displayParts within translateHover as pushing lang-specific markdown into ts.QuickInfo.documentation did not give the same look. If this is the wrong approach, let me know and I can adjust.

output

Second, there was an issue where the first property rule would also return the <style> tag itself: image

I am not 100% certain why this occurs to begin with; the hover.contents that are returned from cssLanguageService.doHover() have the style tag in it, though that's not the behavior I see when working in a regular html file. To work around that, I added a check to remove that <style> and any newline/spaces (you can see the fix in action in the gif above as well).

mjbvz commented 6 years ago

Thanks! Will publish this in the next update