Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
cd4c1b3a
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,发现更多精彩内容 >>
提交
cd4c1b3a
编写于
9月 08, 2017
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Also support MarkdownString in signature help, #11877
上级
e4ce4453
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
107 addition
and
25 deletion
+107
-25
src/vs/editor/common/modes.ts
src/vs/editor/common/modes.ts
+2
-2
src/vs/editor/contrib/parameterHints/browser/parameterHintsWidget.ts
...or/contrib/parameterHints/browser/parameterHintsWidget.ts
+20
-4
src/vs/monaco.d.ts
src/vs/monaco.d.ts
+2
-2
src/vs/vscode.d.ts
src/vs/vscode.d.ts
+4
-4
src/vs/workbench/api/node/extHost.api.impl.ts
src/vs/workbench/api/node/extHost.api.impl.ts
+1
-2
src/vs/workbench/api/node/extHostTypeConverters.ts
src/vs/workbench/api/node/extHostTypeConverters.ts
+47
-5
src/vs/workbench/api/node/extHostTypes.ts
src/vs/workbench/api/node/extHostTypes.ts
+26
-5
src/vs/workbench/test/electron-browser/api/extHostLanguageFeatures.test.ts
...test/electron-browser/api/extHostLanguageFeatures.test.ts
+5
-1
未找到文件。
src/vs/editor/common/modes.ts
浏览文件 @
cd4c1b3a
...
...
@@ -285,7 +285,7 @@ export interface ParameterInformation {
* The human-readable doc-comment of this signature. Will be shown
* in the UI but can be omitted.
*/
documentation
?:
string
;
documentation
?:
string
|
IMarkdownString
;
}
/**
* Represents the signature of something callable. A signature
...
...
@@ -302,7 +302,7 @@ export interface SignatureInformation {
* The human-readable doc-comment of this signature. Will be shown
* in the UI but can be omitted.
*/
documentation
?:
string
;
documentation
?:
string
|
IMarkdownString
;
/**
* The parameters of this signature.
*/
...
...
src/vs/editor/contrib/parameterHints/browser/parameterHintsWidget.ts
浏览文件 @
cd4c1b3a
...
...
@@ -26,6 +26,9 @@ import { IConfigurationChangedEvent } from 'vs/editor/common/config/editorOption
import
{
ICursorSelectionChangedEvent
}
from
'
vs/editor/common/controller/cursorEvents
'
;
import
{
registerThemingParticipant
,
HIGH_CONTRAST
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
editorHoverBackground
,
editorHoverBorder
}
from
'
vs/platform/theme/common/colorRegistry
'
;
import
{
IOpenerService
}
from
'
vs/platform/opener/common/opener
'
;
import
{
IModeService
}
from
'
vs/editor/common/services/modeService
'
;
import
{
MarkdownRenderer
}
from
'
vs/editor/contrib/markdown/browser/markdownRenderer
'
;
const
$
=
dom
.
$
;
...
...
@@ -170,6 +173,7 @@ export class ParameterHintsWidget implements IContentWidget, IDisposable {
private
static
ID
=
'
editor.widget.parameterHintsWidget
'
;
private
markdownRenderer
:
MarkdownRenderer
;
private
model
:
ParameterHintsModel
;
private
keyVisible
:
IContextKey
<
boolean
>
;
private
keyMultipleSignatures
:
IContextKey
<
boolean
>
;
...
...
@@ -187,7 +191,13 @@ export class ParameterHintsWidget implements IContentWidget, IDisposable {
// Editor.IContentWidget.allowEditorOverflow
allowEditorOverflow
=
true
;
constructor
(
private
editor
:
ICodeEditor
,
@
IContextKeyService
contextKeyService
:
IContextKeyService
)
{
constructor
(
private
editor
:
ICodeEditor
,
@
IContextKeyService
contextKeyService
:
IContextKeyService
,
@
IOpenerService
openerService
:
IOpenerService
,
@
IModeService
modeService
:
IModeService
,
)
{
this
.
markdownRenderer
=
new
MarkdownRenderer
(
editor
,
modeService
,
openerService
);
this
.
model
=
new
ParameterHintsModel
(
editor
);
this
.
keyVisible
=
Context
.
Visible
.
bindTo
(
contextKeyService
);
this
.
keyMultipleSignatures
=
Context
.
MultipleSignatures
.
bindTo
(
contextKeyService
);
...
...
@@ -325,14 +335,20 @@ export class ParameterHintsWidget implements IContentWidget, IDisposable {
if
(
activeParameter
&&
activeParameter
.
documentation
)
{
const
documentation
=
$
(
'
span.documentation
'
);
documentation
.
textContent
=
activeParameter
.
documentation
;
if
(
typeof
activeParameter
.
documentation
===
'
string
'
)
{
documentation
.
textContent
=
activeParameter
.
documentation
;
}
else
{
documentation
.
appendChild
(
this
.
markdownRenderer
.
render
(
activeParameter
.
documentation
));
}
dom
.
append
(
this
.
docs
,
$
(
'
p
'
,
null
,
documentation
));
}
dom
.
toggleClass
(
this
.
signature
,
'
has-docs
'
,
!!
signature
.
documentation
);
if
(
signature
.
documentation
)
{
if
(
typeof
signature
.
documentation
===
'
string
'
)
{
dom
.
append
(
this
.
docs
,
$
(
'
p
'
,
null
,
signature
.
documentation
));
}
else
{
dom
.
append
(
this
.
docs
,
this
.
markdownRenderer
.
render
(
signature
.
documentation
));
}
let
currentOverload
=
String
(
this
.
currentSignature
+
1
);
...
...
@@ -491,4 +507,4 @@ registerThemingParticipant((theme, collector) => {
if
(
background
)
{
collector
.
addRule
(
`.monaco-editor .parameter-hints-widget { background-color:
${
background
}
; }`
);
}
});
\ No newline at end of file
});
src/vs/monaco.d.ts
浏览文件 @
cd4c1b3a
...
...
@@ -4459,7 +4459,7 @@ declare module monaco.languages {
* The human-readable doc-comment of this signature. Will be shown
* in the UI but can be omitted.
*/
documentation
?:
string
;
documentation
?:
string
|
IMarkdownString
;
}
/**
...
...
@@ -4477,7 +4477,7 @@ declare module monaco.languages {
* The human-readable doc-comment of this signature. Will be shown
* in the UI but can be omitted.
*/
documentation
?:
string
;
documentation
?:
string
|
IMarkdownString
;
/**
* The parameters of this signature.
*/
...
...
src/vs/vscode.d.ts
浏览文件 @
cd4c1b3a
...
...
@@ -2458,7 +2458,7 @@ declare module 'vscode' {
* The human-readable doc-comment of this signature. Will be shown
* in the UI but can be omitted.
*/
documentation
?:
string
;
documentation
?:
string
|
MarkdownString
;
/**
* Creates a new parameter information object.
...
...
@@ -2466,7 +2466,7 @@ declare module 'vscode' {
* @param label A label string.
* @param documentation A doc string.
*/
constructor
(
label
:
string
,
documentation
?:
string
);
constructor
(
label
:
string
,
documentation
?:
string
|
MarkdownString
);
}
/**
...
...
@@ -2486,7 +2486,7 @@ declare module 'vscode' {
* The human-readable doc-comment of this signature. Will be shown
* in the UI but can be omitted.
*/
documentation
?:
string
;
documentation
?:
string
|
MarkdownString
;
/**
* The parameters of this signature.
...
...
@@ -2499,7 +2499,7 @@ declare module 'vscode' {
* @param label A label string.
* @param documentation A doc string.
*/
constructor
(
label
:
string
,
documentation
?:
string
);
constructor
(
label
:
string
,
documentation
?:
string
|
MarkdownString
);
}
/**
...
...
src/vs/workbench/api/node/extHost.api.impl.ts
浏览文件 @
cd4c1b3a
...
...
@@ -53,7 +53,6 @@ import { TextEditorCursorStyle } from 'vs/editor/common/config/editorOptions';
import
{
ExtHostThreadService
}
from
'
vs/workbench/services/thread/node/extHostThreadService
'
;
import
{
ProxyIdentifier
}
from
'
vs/workbench/services/thread/common/threadService
'
;
import
{
ExtHostDialogs
}
from
'
vs/workbench/api/node/extHostDialogs
'
;
import
{
MarkdownString
}
from
'
vs/base/common/htmlContent
'
;
export
interface
IExtensionApiFactory
{
(
extension
:
IExtensionDescription
):
typeof
vscode
;
...
...
@@ -567,7 +566,7 @@ export function createApiFactory(
Hover
:
extHostTypes
.
Hover
,
IndentAction
:
languageConfiguration
.
IndentAction
,
Location
:
extHostTypes
.
Location
,
MarkdownString
:
MarkdownString
,
MarkdownString
:
extHostTypes
.
MarkdownString
,
OverviewRulerLane
:
EditorCommon
.
OverviewRulerLane
,
ParameterInformation
:
extHostTypes
.
ParameterInformation
,
Position
:
extHostTypes
.
Position
,
...
...
src/vs/workbench/api/node/extHostTypeConverters.ts
浏览文件 @
cd4c1b3a
...
...
@@ -354,7 +354,7 @@ export namespace Suggest {
result
.
insertText
=
suggestion
.
insertText
;
result
.
kind
=
CompletionItemKind
.
to
(
suggestion
.
type
);
result
.
detail
=
suggestion
.
detail
;
result
.
documentation
=
typeof
suggestion
.
documentation
===
'
string
'
?
suggestion
.
documentation
:
MarkdownString
.
to
(
suggestion
.
documentation
)
;
result
.
documentation
=
htmlContent
.
isMarkdownString
(
suggestion
.
documentation
)
?
MarkdownString
.
to
(
suggestion
.
documentation
)
:
suggestion
.
documentation
;
result
.
sortText
=
suggestion
.
sortText
;
result
.
filterText
=
suggestion
.
filterText
;
...
...
@@ -381,14 +381,56 @@ export namespace Suggest {
}
};
export
namespace
ParameterInformation
{
export
function
from
(
info
:
types
.
ParameterInformation
):
modes
.
ParameterInformation
{
return
{
label
:
info
.
label
,
documentation
:
info
.
documentation
&&
MarkdownString
.
from
(
info
.
documentation
)
};
}
export
function
to
(
info
:
modes
.
ParameterInformation
):
types
.
ParameterInformation
{
return
{
label
:
info
.
label
,
documentation
:
htmlContent
.
isMarkdownString
(
info
.
documentation
)
?
MarkdownString
.
to
(
info
.
documentation
)
:
info
.
documentation
};
}
}
export
namespace
SignatureInformation
{
export
function
from
(
info
:
types
.
SignatureInformation
):
modes
.
SignatureInformation
{
return
{
label
:
info
.
label
,
documentation
:
info
.
documentation
&&
MarkdownString
.
from
(
info
.
documentation
),
parameters
:
info
.
parameters
&&
info
.
parameters
.
map
(
ParameterInformation
.
from
)
};
}
export
function
to
(
info
:
modes
.
SignatureInformation
):
types
.
SignatureInformation
{
return
{
label
:
info
.
label
,
documentation
:
htmlContent
.
isMarkdownString
(
info
.
documentation
)
?
MarkdownString
.
to
(
info
.
documentation
)
:
info
.
documentation
,
parameters
:
info
.
parameters
&&
info
.
parameters
.
map
(
ParameterInformation
.
to
)
};
}
}
export
namespace
SignatureHelp
{
export
function
from
(
signatureHelp
:
types
.
SignatureHelp
):
modes
.
SignatureHelp
{
return
signatureHelp
;
export
function
from
(
help
:
types
.
SignatureHelp
):
modes
.
SignatureHelp
{
return
{
activeSignature
:
help
.
activeSignature
,
activeParameter
:
help
.
activeParameter
,
signatures
:
help
.
signatures
&&
help
.
signatures
.
map
(
SignatureInformation
.
from
)
};
}
export
function
to
(
hints
:
modes
.
SignatureHelp
):
types
.
SignatureHelp
{
return
hints
;
export
function
to
(
help
:
modes
.
SignatureHelp
):
types
.
SignatureHelp
{
return
{
activeSignature
:
help
.
activeSignature
,
activeParameter
:
help
.
activeParameter
,
signatures
:
help
.
signatures
&&
help
.
signatures
.
map
(
SignatureInformation
.
to
)
};
}
}
...
...
src/vs/workbench/api/node/extHostTypes.ts
浏览文件 @
cd4c1b3a
...
...
@@ -824,12 +824,33 @@ export class CodeLens {
}
}
export
class
MarkdownString
{
value
:
string
;
isTrusted
?:
boolean
;
constructor
(
value
?:
string
)
{
this
.
value
=
value
||
''
;
}
appendText
(
value
:
string
):
MarkdownString
{
// escape markdown syntax tokens: http://daringfireball.net/projects/markdown/syntax#backslash
this
.
value
+=
value
.
replace
(
/
[\\
`*_{}[
\]
()#+
\-
.!
]
/g
,
'
\\
$&
'
);
return
this
;
}
appendMarkdown
(
value
:
string
):
MarkdownString
{
this
.
value
+=
value
;
return
this
;
}
}
export
class
ParameterInformation
{
label
:
string
;
documentation
?:
string
;
documentation
?:
string
|
MarkdownString
;
constructor
(
label
:
string
,
documentation
?:
string
)
{
constructor
(
label
:
string
,
documentation
?:
string
|
MarkdownString
)
{
this
.
label
=
label
;
this
.
documentation
=
documentation
;
}
...
...
@@ -838,10 +859,10 @@ export class ParameterInformation {
export
class
SignatureInformation
{
label
:
string
;
documentation
?:
string
;
documentation
?:
string
|
MarkdownString
;
parameters
:
ParameterInformation
[];
constructor
(
label
:
string
,
documentation
?:
string
)
{
constructor
(
label
:
string
,
documentation
?:
string
|
MarkdownString
)
{
this
.
label
=
label
;
this
.
documentation
=
documentation
;
this
.
parameters
=
[];
...
...
@@ -892,7 +913,7 @@ export class CompletionItem {
label
:
string
;
kind
:
CompletionItemKind
;
detail
:
string
;
documentation
:
string
|
vscode
.
MarkdownString
;
documentation
:
string
|
MarkdownString
;
sortText
:
string
;
filterText
:
string
;
insertText
:
string
|
SnippetString
;
...
...
src/vs/workbench/test/electron-browser/api/extHostLanguageFeatures.test.ts
浏览文件 @
cd4c1b3a
...
...
@@ -811,7 +811,11 @@ suite('ExtHostLanguageFeatures', function () {
disposables
.
push
(
extHost
.
registerSignatureHelpProvider
(
defaultSelector
,
<
vscode
.
SignatureHelpProvider
>
{
provideSignatureHelp
():
vscode
.
SignatureHelp
{
return
new
types
.
SignatureHelp
();
return
{
signatures
:
[],
activeParameter
:
0
,
activeSignature
:
0
};
}
},
[]));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录