File tree 3 files changed +14
-5
lines changed
workbench/services/hover/browser
3 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -210,7 +210,11 @@ export class IconLabel extends Disposable {
210
210
} ;
211
211
const resolvedTooltip = await tooltip ;
212
212
if ( resolvedTooltip ) {
213
- hoverOptions = { text : resolvedTooltip , target, anchorPosition : AnchorPosition . BELOW } ;
213
+ hoverOptions = {
214
+ text : resolvedTooltip ,
215
+ target,
216
+ anchorPosition : AnchorPosition . BELOW
217
+ } ;
214
218
}
215
219
}
216
220
if ( hoverOptions ) {
Original file line number Diff line number Diff line change @@ -15,6 +15,11 @@ export interface IMarkdownString {
15
15
uris ?: { [ href : string ] : UriComponents } ;
16
16
}
17
17
18
+ export const enum MarkdownStringTextNewlineStyle {
19
+ Paragraph = 0 ,
20
+ Break = 1 ,
21
+ }
22
+
18
23
export class MarkdownString implements IMarkdownString {
19
24
private readonly _isTrusted : boolean ;
20
25
private readonly _supportThemeIcons : boolean ;
@@ -41,11 +46,11 @@ export class MarkdownString implements IMarkdownString {
41
46
get isTrusted ( ) { return this . _isTrusted ; }
42
47
get supportThemeIcons ( ) { return this . _supportThemeIcons ; }
43
48
44
- appendText ( value : string ) : MarkdownString {
49
+ appendText ( value : string , newlineStyle : MarkdownStringTextNewlineStyle = MarkdownStringTextNewlineStyle . Paragraph ) : MarkdownString {
45
50
// escape markdown syntax tokens: http://daringfireball.net/projects/markdown/syntax#backslash
46
51
this . _value += ( this . _supportThemeIcons ? escapeCodicons ( value ) : value )
47
52
. replace ( / [ \\ ` * _ { } [ \] ( ) # + \- . ! ] / g, '\\$&' )
48
- . replace ( / \n / g, '\n\n' ) ;
53
+ . replace ( / \n / g, newlineStyle === MarkdownStringTextNewlineStyle . Break ? '\\\n' : '\n\n' ) ;
49
54
50
55
return this ;
51
56
}
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ import { Widget } from 'vs/base/browser/ui/widget';
16
16
import { AnchorPosition } from 'vs/base/browser/ui/contextview/contextview' ;
17
17
import { IOpenerService } from 'vs/platform/opener/common/opener' ;
18
18
import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService' ;
19
- import { MarkdownString } from 'vs/base/common/htmlContent' ;
19
+ import { MarkdownString , MarkdownStringTextNewlineStyle } from 'vs/base/common/htmlContent' ;
20
20
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation' ;
21
21
import { MarkdownRenderer } from 'vs/editor/browser/core/markdownRenderer' ;
22
22
@@ -82,7 +82,7 @@ export class HoverWidget extends Widget {
82
82
83
83
const rowElement = $ ( 'div.hover-row.markdown-hover' ) ;
84
84
const contentsElement = $ ( 'div.hover-contents' ) ;
85
- const markdown = typeof options . text === 'string' ? new MarkdownString ( ) . appendText ( options . text ) : options . text ;
85
+ const markdown = typeof options . text === 'string' ? new MarkdownString ( ) . appendText ( options . text , MarkdownStringTextNewlineStyle . Break ) : options . text ;
86
86
87
87
const mdRenderer = this . _instantiationService . createInstance (
88
88
MarkdownRenderer ,
You can’t perform that action at this time.
0 commit comments