Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
6cb2f18d
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,发现更多精彩内容 >>
提交
6cb2f18d
编写于
6月 02, 2016
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
parameter hints: multiple signatures context
fixes #7137
上级
f3993616
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
51 addition
and
41 deletion
+51
-41
src/vs/editor/contrib/parameterHints/browser/parameterHints.ts
...s/editor/contrib/parameterHints/browser/parameterHints.ts
+36
-31
src/vs/editor/contrib/parameterHints/browser/parameterHintsWidget.ts
...or/contrib/parameterHints/browser/parameterHintsWidget.ts
+13
-9
src/vs/editor/contrib/parameterHints/common/parameterHints.ts
...vs/editor/contrib/parameterHints/common/parameterHints.ts
+2
-1
未找到文件。
src/vs/editor/contrib/parameterHints/browser/parameterHints.ts
浏览文件 @
6cb2f18d
...
...
@@ -10,7 +10,10 @@ import { TPromise } from 'vs/base/common/winjs.base';
import
{
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
EditorAction
}
from
'
vs/editor/common/editorAction
'
;
import
{
ICommonCodeEditor
,
IEditorActionDescriptorData
,
IEditorContribution
}
from
'
vs/editor/common/editorCommon
'
;
import
{
ICommonCodeEditor
,
IEditorActionDescriptorData
,
IEditorContribution
,
KEYBINDING_CONTEXT_EDITOR_TEXT_FOCUS
}
from
'
vs/editor/common/editorCommon
'
;
import
{
KbExpr
}
from
'
vs/platform/keybinding/common/keybindingService
'
;
import
{
KeybindingsRegistry
}
from
'
vs/platform/keybinding/common/keybindingsRegistry
'
;
import
{
withCodeEditorFromCommandHandler
}
from
'
vs/editor/common/config/config
'
;
import
{
CommonEditorRegistry
,
ContextKey
,
EditorActionDescriptor
}
from
'
vs/editor/common/editorCommonExtensions
'
;
import
{
ICodeEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
EditorBrowserRegistry
}
from
'
vs/editor/browser/editorBrowserExtensions
'
;
...
...
@@ -38,16 +41,16 @@ class ParameterHintsController implements IEditorContribution {
return
ParameterHintsController
.
ID
;
}
c
loseWidget
():
void
{
c
ancel
():
void
{
this
.
widget
.
cancel
();
}
showPrevHint
():
void
{
this
.
widget
.
selectP
revious
();
previous
():
void
{
this
.
widget
.
p
revious
();
}
showNextHin
t
():
void
{
this
.
widget
.
selectN
ext
();
nex
t
():
void
{
this
.
widget
.
n
ext
();
}
trigger
():
void
{
...
...
@@ -79,8 +82,10 @@ export class TriggerParameterHintsAction extends EditorAction {
const
weight
=
CommonEditorRegistry
.
commandWeight
(
75
);
function
handler
(
fn
:
(
controller
:
ParameterHintsController
)
=>
void
):
(
ctx
,
editor
:
ICommonCodeEditor
)
=>
void
{
return
(
ctx
,
editor
:
ICommonCodeEditor
)
=>
fn
(
ParameterHintsController
.
get
(
editor
));
function
handler
(
id
:
string
,
fn
:
(
controller
:
ParameterHintsController
)
=>
void
)
{
return
accessor
=>
withCodeEditorFromCommandHandler
(
id
,
accessor
,
editor
=>
{
fn
(
ParameterHintsController
.
get
(
editor
));
});
}
EditorBrowserRegistry
.
registerEditorContribution
(
ParameterHintsController
);
...
...
@@ -93,29 +98,29 @@ CommonEditorRegistry.registerEditorAction(new EditorActionDescriptor(
'
Trigger Parameter Hints
'
));
CommonEditorRegistry
.
registerEditorCommand
(
'
closeParameterHints
'
,
KeybindingsRegistry
.
registerCommandDesc
({
id
:
'
closeParameterHints
'
,
handler
:
handler
(
'
closeParameterHints
'
,
c
=>
c
.
cancel
()),
weight
,
{
primary
:
KeyCode
.
Escape
,
secondary
:
[
KeyMod
.
Shift
|
KeyCode
.
Escape
]
}
,
tru
e
,
Context
.
Visible
,
handler
(
c
=>
c
.
closeWidget
())
);
CommonEditorRegistry
.
registerEditorCommand
(
'
showPrevParameterHint
'
,
when
:
KbExpr
.
and
(
KbExpr
.
has
(
KEYBINDING_CONTEXT_EDITOR_TEXT_FOCUS
),
KbExpr
.
has
(
Context
.
Visible
))
,
primary
:
KeyCode
.
Escap
e
,
secondary
:
[
KeyMod
.
Shift
|
KeyCode
.
Escape
]
});
KeybindingsRegistry
.
registerCommandDesc
({
id
:
'
showPrevParameterHint
'
,
handler
:
handler
(
'
showPrevParameterHint
'
,
c
=>
c
.
previous
())
,
weight
,
{
primary
:
KeyCode
.
UpArrow
,
secondary
:
[
KeyMod
.
Alt
|
KeyCode
.
UpArrow
]
}
,
true
,
Context
.
Visible
,
handler
(
c
=>
c
.
showPrevHint
())
);
CommonEditorRegistry
.
registerEditorCommand
(
'
showNextParameterHint
'
,
when
:
KbExpr
.
and
(
KbExpr
.
has
(
KEYBINDING_CONTEXT_EDITOR_TEXT_FOCUS
),
KbExpr
.
has
(
Context
.
Visible
),
KbExpr
.
has
(
Context
.
MultipleSignatures
))
,
primary
:
KeyCode
.
UpArrow
,
secondary
:
[
KeyMod
.
Alt
|
KeyCode
.
UpArrow
]
});
KeybindingsRegistry
.
registerCommandDesc
({
id
:
'
showNextParameterHint
'
,
handler
:
handler
(
'
showNextParameterHint
'
,
c
=>
c
.
next
())
,
weight
,
{
primary
:
KeyCode
.
DownArrow
,
secondary
:
[
KeyMod
.
Alt
|
KeyCode
.
DownArrow
]
},
true
,
Context
.
Visible
,
handler
(
c
=>
c
.
showNextHint
())
);
when
:
KbExpr
.
and
(
KbExpr
.
has
(
KEYBINDING_CONTEXT_EDITOR_TEXT_FOCUS
),
KbExpr
.
has
(
Context
.
Visible
),
KbExpr
.
has
(
Context
.
MultipleSignatures
)),
primary
:
KeyCode
.
DownArrow
,
secondary
:
[
KeyMod
.
Alt
|
KeyCode
.
DownArrow
]
});
\ No newline at end of file
src/vs/editor/contrib/parameterHints/browser/parameterHintsWidget.ts
浏览文件 @
6cb2f18d
...
...
@@ -148,7 +148,8 @@ export class ParameterHintsWidget implements IContentWidget, IDisposable {
static
ID
=
'
editor.widget.parameterHintsWidget
'
;
private
model
:
ParameterHintsModel
;
private
parameterHintsVisible
:
IKeybindingContextKey
<
boolean
>
;
private
keyVisible
:
IKeybindingContextKey
<
boolean
>
;
private
keyMultipleSignatures
:
IKeybindingContextKey
<
boolean
>
;
private
element
:
HTMLElement
;
private
signatures
:
HTMLElement
;
private
overloads
:
HTMLElement
;
...
...
@@ -164,7 +165,8 @@ export class ParameterHintsWidget implements IContentWidget, IDisposable {
constructor
(
private
editor
:
ICodeEditor
,
@
IKeybindingService
keybindingService
:
IKeybindingService
)
{
this
.
model
=
new
ParameterHintsModel
(
editor
);
this
.
parameterHintsVisible
=
keybindingService
.
createKey
(
Context
.
Visible
,
false
);
this
.
keyVisible
=
keybindingService
.
createKey
(
Context
.
Visible
,
false
);
this
.
keyMultipleSignatures
=
keybindingService
.
createKey
(
Context
.
MultipleSignatures
,
false
);
this
.
visible
=
false
;
this
.
disposables
=
[];
...
...
@@ -183,7 +185,7 @@ export class ParameterHintsWidget implements IContentWidget, IDisposable {
this
.
element
=
$
(
'
.editor-widget.parameter-hints-widget
'
);
this
.
disposables
.
push
(
dom
.
addDisposableListener
(
this
.
element
,
'
click
'
,
()
=>
{
this
.
selectN
ext
();
this
.
n
ext
();
this
.
editor
.
focus
();
}));
...
...
@@ -195,13 +197,13 @@ export class ParameterHintsWidget implements IContentWidget, IDisposable {
this
.
disposables
.
push
(
dom
.
addDisposableListener
(
previous
,
'
click
'
,
e
=>
{
e
.
preventDefault
();
e
.
stopPropagation
();
this
.
selectP
revious
();
this
.
p
revious
();
}));
this
.
disposables
.
push
(
dom
.
addDisposableListener
(
next
,
'
click
'
,
e
=>
{
e
.
preventDefault
();
e
.
stopPropagation
();
this
.
selectN
ext
();
this
.
n
ext
();
}));
this
.
overloads
=
dom
.
append
(
wrapper
,
$
(
'
.overloads
'
));
...
...
@@ -225,7 +227,7 @@ export class ParameterHintsWidget implements IContentWidget, IDisposable {
return
;
}
this
.
parameterHints
Visible
.
set
(
true
);
this
.
key
Visible
.
set
(
true
);
this
.
visible
=
true
;
TPromise
.
timeout
(
100
).
done
(()
=>
dom
.
addClass
(
this
.
element
,
'
visible
'
));
this
.
editor
.
layoutContentWidget
(
this
);
...
...
@@ -236,7 +238,7 @@ export class ParameterHintsWidget implements IContentWidget, IDisposable {
return
;
}
this
.
parameterHints
Visible
.
reset
();
this
.
key
Visible
.
reset
();
this
.
visible
=
false
;
this
.
parameterHints
=
null
;
this
.
announcedLabel
=
null
;
...
...
@@ -280,6 +282,8 @@ export class ParameterHintsWidget implements IContentWidget, IDisposable {
height
+=
signatureHeight
;
}
this
.
keyMultipleSignatures
.
set
(
this
.
signatureViews
.
length
>
1
);
}
private
applyFont
(
element
:
HTMLElement
):
void
{
...
...
@@ -395,7 +399,7 @@ export class ParameterHintsWidget implements IContentWidget, IDisposable {
this
.
editor
.
layoutContentWidget
(
this
);
}
selectN
ext
():
boolean
{
n
ext
():
boolean
{
if
(
this
.
signatureViews
.
length
<
2
)
{
this
.
cancel
();
return
false
;
...
...
@@ -406,7 +410,7 @@ export class ParameterHintsWidget implements IContentWidget, IDisposable {
return
true
;
}
selectP
revious
():
boolean
{
p
revious
():
boolean
{
if
(
this
.
signatureViews
.
length
<
2
)
{
this
.
cancel
();
return
false
;
...
...
src/vs/editor/contrib/parameterHints/common/parameterHints.ts
浏览文件 @
6cb2f18d
...
...
@@ -13,7 +13,8 @@ import { asWinJsPromise } from 'vs/base/common/async';
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
export
const
Context
=
{
Visible
:
'
parameterHintsVisible
'
Visible
:
'
parameterHintsVisible
'
,
MultipleSignatures
:
'
parameterHintsMultipleSignatures
'
,
};
export
function
provideSignatureHelp
(
model
:
IReadOnlyModel
,
position
:
Position
):
TPromise
<
SignatureHelp
>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录