Skip to content

Commit 60892e5

Browse files
committed
1 parent 39c26ad commit 60892e5

2 files changed

Lines changed: 5 additions & 13 deletions

File tree

src/vs/base/common/htmlContent.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,11 @@ export class MarkdownString implements IMarkdownString {
3333
}
3434

3535
appendText(value: string): this {
36-
this.value += textToMarkedString(value);
36+
// escape markdown syntax tokens: http://daringfireball.net/projects/markdown/syntax#backslash
37+
this.value += value.replace(/[\\`*_{}[\]()#+\-.!]/g, '\\$&');
3738
return this;
3839
}
3940

40-
// appendMarkdown(value: string): this {
41-
// this.value += value;
42-
// return this;
43-
// }
44-
4541
appendCodeblock(langId: string, code: string): this {
4642
this.value += '```';
4743
this.value += langId;
@@ -76,10 +72,6 @@ function markdownStringEqual(a: IMarkdownString, b: IMarkdownString): boolean {
7672
}
7773
}
7874

79-
export function textToMarkedString(text: string): string {
80-
return text.replace(/[\\`*_{}[\]()#+\-.!]/g, '\\$&'); // escape markdown syntax tokens: http://daringfireball.net/projects/markdown/syntax#backslash
81-
}
82-
8375
export function removeMarkdownEscapes(text: string): string {
8476
if (!text) {
8577
return text;

src/vs/editor/common/services/modelServiceImpl.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import * as nls from 'vs/nls';
88
import network = require('vs/base/common/network');
99
import Event, { Emitter } from 'vs/base/common/event';
1010
import { EmitterEvent } from 'vs/base/common/eventEmitter';
11-
import { IMarkdownString } from 'vs/base/common/htmlContent';
11+
import { MarkdownString } from 'vs/base/common/htmlContent';
1212
import { IDisposable } from 'vs/base/common/lifecycle';
1313
import Severity from 'vs/base/common/severity';
1414
import URI from 'vs/base/common/uri';
@@ -136,7 +136,7 @@ class ModelMarkerHandler {
136136
break;
137137
}
138138

139-
let hoverMessage: IMarkdownString = null;
139+
let hoverMessage: MarkdownString = null;
140140
let { message, source } = marker;
141141

142142
if (typeof message === 'string') {
@@ -150,7 +150,7 @@ class ModelMarkerHandler {
150150
}
151151
}
152152

153-
hoverMessage = { value: '```_\n' + message + '\n```' };
153+
hoverMessage = new MarkdownString().appendCodeblock('_', message);
154154
}
155155

156156
return {

0 commit comments

Comments
 (0)