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
remove extra margins on completion hovers with markdown #59786
Changes from all commits
beaffac
6eece65
61d331d
e8edae5
370a916
1e1fcda
8e458c6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -226,7 +226,7 @@ | |
opacity: 0.7; | ||
word-break: break-all; | ||
margin: 0; | ||
padding: 4px 0 4px 5px; | ||
padding: 4px 0 12px 5px; | ||
} | ||
|
||
.monaco-editor .suggest-widget .details > .monaco-scrollable-element > .body > .docs { | ||
|
@@ -236,9 +236,23 @@ | |
} | ||
|
||
.monaco-editor .suggest-widget .details > .monaco-scrollable-element > .body > .docs.markdown-docs { | ||
padding: 0; | ||
white-space: initial; | ||
} | ||
|
||
.monaco-editor .suggest-widget .details > .monaco-scrollable-element > .body > .docs.markdown-docs > div, | ||
.monaco-editor .suggest-widget .details > .monaco-scrollable-element > .body > .docs.markdown-docs > span:not(:empty) { | ||
padding: 4px 5px; | ||
} | ||
|
||
.monaco-editor .suggest-widget .details > .monaco-scrollable-element > .body > .docs.markdown-docs > div > p:first-child { | ||
margin-top: 0; | ||
} | ||
|
||
.monaco-editor .suggest-widget .details > .monaco-scrollable-element > .body > .docs.markdown-docs > div > p:last-child { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just curious, why do you need to use a specific rule like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @soleo I think there was some copy/paste problem with your comment above |
||
margin-bottom: 0; | ||
} | ||
|
||
.monaco-editor .suggest-widget .details > .monaco-scrollable-element > .body > .docs .code { | ||
white-space: pre-wrap; | ||
word-wrap: break-word; | ||
|
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.
Last question :)
Why are we moving the padding from
.docs.markdown-docs
to.docs.markdown-docs > div
?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.
Hehe, no problem!
I'll try to explain it:
Problem:
padding-bottom
in order to provide space between the widget's header and content:.markdown-docs
padding
to provide space between the content and the widget borders:.markdown-docs
padding
generates this unwanted effect:Solution:
When the suggestion docs has
markdown
content, this function is being called in order to render it's contents:https://github.com/Microsoft/vscode/blob/e8edae54aa99d06ddb37211bebc6faffb20ff1fb/src/vs/editor/contrib/suggest/suggestWidget.ts#L262
This one ends up calling the
createElement
in thehtmlContentRenderer
class, which eventually generates the html element that will be added as the.markdown-docs
children:https://github.com/Microsoft/vscode/blob/e8edae54aa99d06ddb37211bebc6faffb20ff1fb/src/vs/base/browser/htmlContentRenderer.ts#L30
When there is no content to show, the
options.inline
property becomestrue
and an emptyspan
is added to the.markdown-docs
. Here we shouldn't addpadding
.In order to consider this scenario and avoid adding the problematic
padding
we can apply thepadding
to the.markdown-docs
's immediate children instead of applying it to the.markdown-docs
element itself. To do that we need to differentiate two cases:div
element and we should always add paddingspan
element and we should only add padding it thespan
is not empty (I didn't found any suggestion widget withmarkdown-docs
and a non-emptyspan
as children but I think we should handle it, just in case).That's why I moved the padding from
.docs.markdown-docs
to.docs.markdown-docs > div
(and also added another rule to handle the span:non(:empty) case).Hope I was able to explain myself in a clear way.
Kr