Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
20654ccc
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
20654ccc
编写于
10月 08, 2019
作者:
M
Matt Bierner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Marking IMarkdownString.value and isTrusted as readonly
上级
90b66c88
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
21 addition
and
20 deletion
+21
-20
src/vs/base/common/htmlContent.ts
src/vs/base/common/htmlContent.ts
+17
-13
src/vs/editor/contrib/links/links.ts
src/vs/editor/contrib/links/links.ts
+1
-2
src/vs/monaco.d.ts
src/vs/monaco.d.ts
+2
-2
src/vs/workbench/api/common/extHostTypeConverters.ts
src/vs/workbench/api/common/extHostTypeConverters.ts
+1
-3
未找到文件。
src/vs/base/common/htmlContent.ts
浏览文件 @
20654ccc
...
...
@@ -7,23 +7,27 @@ import { equals } from 'vs/base/common/arrays';
import
{
UriComponents
}
from
'
vs/base/common/uri
'
;
export
interface
IMarkdownString
{
value
:
string
;
isTrusted
?:
boolean
;
readonly
value
:
string
;
readonly
isTrusted
?:
boolean
;
uris
?:
{
[
href
:
string
]:
UriComponents
};
}
export
class
MarkdownString
implements
IMarkdownString
{
value
:
string
;
isTrusted
?
:
boolean
;
private
_
value
:
string
;
private
_isTrusted
:
boolean
;
constructor
(
value
:
string
=
''
)
{
this
.
value
=
value
;
constructor
(
value
:
string
=
''
,
isTrusted
=
false
)
{
this
.
_value
=
value
;
this
.
_isTrusted
=
isTrusted
;
}
get
value
()
{
return
this
.
_value
;
}
get
isTrusted
()
{
return
this
.
_isTrusted
;
}
appendText
(
value
:
string
):
MarkdownString
{
// escape markdown syntax tokens: http://daringfireball.net/projects/markdown/syntax#backslash
this
.
value
+=
value
this
.
_
value
+=
value
.
replace
(
/
[\\
`*_{}[
\]
()#+
\-
.!
]
/g
,
'
\\
$&
'
)
.
replace
(
'
\n
'
,
'
\n\n
'
);
...
...
@@ -31,16 +35,16 @@ export class MarkdownString implements IMarkdownString {
}
appendMarkdown
(
value
:
string
):
MarkdownString
{
this
.
value
+=
value
;
this
.
_
value
+=
value
;
return
this
;
}
appendCodeblock
(
langId
:
string
,
code
:
string
):
MarkdownString
{
this
.
value
+=
'
\n
```
'
;
this
.
value
+=
langId
;
this
.
value
+=
'
\n
'
;
this
.
value
+=
code
;
this
.
value
+=
'
\n
```
\n
'
;
this
.
_
value
+=
'
\n
```
'
;
this
.
_
value
+=
langId
;
this
.
_
value
+=
'
\n
'
;
this
.
_
value
+=
code
;
this
.
_
value
+=
'
\n
```
\n
'
;
return
this
;
}
}
...
...
src/vs/editor/contrib/links/links.ts
浏览文件 @
20654ccc
...
...
@@ -44,8 +44,7 @@ function getHoverMessage(link: Link, useMetaKey: boolean): MarkdownString {
:
nls
.
localize
(
'
links.navigate.kb.alt
'
,
"
alt + click
"
);
if
(
link
.
url
)
{
const
hoverMessage
=
new
MarkdownString
().
appendMarkdown
(
`[
${
label
}
](
${
link
.
url
.
toString
()}
) (
${
kb
}
)`
);
hoverMessage
.
isTrusted
=
true
;
const
hoverMessage
=
new
MarkdownString
(
''
,
true
).
appendMarkdown
(
`[
${
label
}
](
${
link
.
url
.
toString
()}
) (
${
kb
}
)`
);
return
hoverMessage
;
}
else
{
return
new
MarkdownString
().
appendText
(
`
${
label
}
(
${
kb
}
)`
);
...
...
src/vs/monaco.d.ts
浏览文件 @
20654ccc
...
...
@@ -379,8 +379,8 @@ declare namespace monaco {
}
export
interface
IMarkdownString
{
value
:
string
;
isTrusted
?:
boolean
;
readonly
value
:
string
;
readonly
isTrusted
?:
boolean
;
uris
?:
{
[
href
:
string
]:
UriComponents
;
};
...
...
src/vs/workbench/api/common/extHostTypeConverters.ts
浏览文件 @
20654ccc
...
...
@@ -303,9 +303,7 @@ export namespace MarkdownString {
}
export
function
to
(
value
:
htmlContent
.
IMarkdownString
):
vscode
.
MarkdownString
{
const
ret
=
new
htmlContent
.
MarkdownString
(
value
.
value
);
ret
.
isTrusted
=
value
.
isTrusted
;
return
ret
;
return
new
htmlContent
.
MarkdownString
(
value
.
value
,
value
.
isTrusted
);
}
export
function
fromStrict
(
value
:
string
|
types
.
MarkdownString
):
undefined
|
string
|
htmlContent
.
IMarkdownString
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录