Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
951164ae
V
vscode
项目概览
xxadev
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
951164ae
编写于
4月 14, 2020
作者:
M
Martin Aeschlimann
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
product icons definition files: show icon in hover
上级
1897f26c
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
32 addition
and
5 deletion
+32
-5
extensions/json-language-features/client/src/jsonMain.ts
extensions/json-language-features/client/src/jsonMain.ts
+31
-5
src/vs/platform/theme/common/iconRegistry.ts
src/vs/platform/theme/common/iconRegistry.ts
+1
-0
未找到文件。
extensions/json-language-features/client/src/jsonMain.ts
浏览文件 @
951164ae
...
...
@@ -13,12 +13,12 @@ const localize = nls.loadMessageBundle();
import
{
workspace
,
window
,
languages
,
commands
,
ExtensionContext
,
extensions
,
Uri
,
LanguageConfiguration
,
Diagnostic
,
StatusBarAlignment
,
TextEditor
,
TextDocument
,
FormattingOptions
,
CancellationToken
,
ProviderResult
,
TextEdit
,
Range
,
Position
,
Disposable
,
CompletionItem
,
CompletionList
,
CompletionContext
ProviderResult
,
TextEdit
,
Range
,
Position
,
Disposable
,
CompletionItem
,
CompletionList
,
CompletionContext
,
Hover
,
MarkdownString
,
MarkedString
}
from
'
vscode
'
;
import
{
LanguageClient
,
LanguageClientOptions
,
RequestType
,
ServerOptions
,
TransportKind
,
NotificationType
,
DidChangeConfigurationNotification
,
HandleDiagnosticsSignature
,
ResponseError
,
DocumentRangeFormattingParams
,
DocumentRangeFormattingRequest
,
ProvideCompletionItemsSignature
DocumentRangeFormattingRequest
,
ProvideCompletionItemsSignature
,
ProvideHoverSignature
}
from
'
vscode-languageclient
'
;
import
TelemetryReporter
from
'
vscode-extension-telemetry
'
;
...
...
@@ -153,25 +153,41 @@ export function activate(context: ExtensionContext) {
},
// testing the replace / insert mode
provideCompletionItem
(
document
:
TextDocument
,
position
:
Position
,
context
:
CompletionContext
,
token
:
CancellationToken
,
next
:
ProvideCompletionItemsSignature
):
ProviderResult
<
CompletionItem
[]
|
CompletionList
>
{
function
update
Ranges
(
item
:
CompletionItem
)
{
function
update
(
item
:
CompletionItem
)
{
const
range
=
item
.
range
;
if
(
range
instanceof
Range
&&
range
.
end
.
isAfter
(
position
)
&&
range
.
start
.
isBeforeOrEqual
(
position
))
{
item
.
range
=
{
inserting
:
new
Range
(
range
.
start
,
position
),
replacing
:
range
};
}
if
(
item
.
documentation
instanceof
MarkdownString
)
{
item
.
documentation
=
updateMarkdownString
(
item
.
documentation
);
}
}
function
updateProposals
(
r
:
CompletionItem
[]
|
CompletionList
|
null
|
undefined
):
CompletionItem
[]
|
CompletionList
|
null
|
undefined
{
if
(
r
)
{
(
Array
.
isArray
(
r
)
?
r
:
r
.
items
).
forEach
(
update
Ranges
);
(
Array
.
isArray
(
r
)
?
r
:
r
.
items
).
forEach
(
update
);
}
return
r
;
}
const
isThenable
=
<
T
>
(
obj
:
ProviderResult
<
T
>
):
obj
is
Thenable
<
T
>
=>
obj
&&
(
<
any
>
obj
)[
'
then
'
];
const
r
=
next
(
document
,
position
,
context
,
token
);
if
(
isThenable
<
CompletionItem
[]
|
CompletionList
|
null
|
undefined
>
(
r
))
{
return
r
.
then
(
updateProposals
);
}
return
updateProposals
(
r
);
},
provideHover
(
document
:
TextDocument
,
position
:
Position
,
token
:
CancellationToken
,
next
:
ProvideHoverSignature
)
{
function
updateHover
(
r
:
Hover
|
null
|
undefined
):
Hover
|
null
|
undefined
{
if
(
r
&&
Array
.
isArray
(
r
.
contents
))
{
r
.
contents
=
r
.
contents
.
map
(
h
=>
h
instanceof
MarkdownString
?
updateMarkdownString
(
h
)
:
h
);
}
return
r
;
}
const
r
=
next
(
document
,
position
,
token
);
if
(
isThenable
<
Hover
|
null
|
undefined
>
(
r
))
{
return
r
.
then
(
updateHover
);
}
return
updateHover
(
r
);
}
}
};
...
...
@@ -492,3 +508,13 @@ function readJSONFile(location: string) {
return
{};
}
}
function
isThenable
<
T
>
(
obj
:
ProviderResult
<
T
>
):
obj
is
Thenable
<
T
>
{
return
obj
&&
(
<
any
>
obj
)[
'
then
'
];
}
function
updateMarkdownString
(
h
:
MarkdownString
):
MarkdownString
{
const
n
=
new
MarkdownString
(
h
.
value
,
true
);
n
.
isTrusted
=
h
.
isTrusted
;
return
n
;
}
src/vs/platform/theme/common/iconRegistry.ts
浏览文件 @
951164ae
...
...
@@ -99,6 +99,7 @@ class IconRegistry implements IIconRegistry {
if
(
deprecationMessage
)
{
propertySchema
.
deprecationMessage
=
deprecationMessage
;
}
propertySchema
.
markdownDescription
=
localize
(
'
iconPreview
'
,
"
Current icon: {0}
"
,
`$(
${
id
}
)`
);
this
.
iconSchema
.
properties
[
id
]
=
propertySchema
;
this
.
iconReferenceSchema
.
enum
.
push
(
id
);
this
.
iconReferenceSchema
.
enumDescriptions
.
push
(
description
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录