Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
763abb9c
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,发现更多精彩内容 >>
提交
763abb9c
编写于
2月 09, 2016
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Extract ParameterHintsSupport to its own file
上级
d042a49c
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
66 addition
and
47 deletion
+66
-47
src/vs/editor/common/modes.ts
src/vs/editor/common/modes.ts
+0
-6
src/vs/editor/common/modes/supports.ts
src/vs/editor/common/modes/supports.ts
+0
-35
src/vs/editor/common/modes/supports/parameterHintsSupport.ts
src/vs/editor/common/modes/supports/parameterHintsSupport.ts
+55
-0
src/vs/editor/common/services/modeService.ts
src/vs/editor/common/services/modeService.ts
+2
-1
src/vs/editor/common/services/modeServiceImpl.ts
src/vs/editor/common/services/modeServiceImpl.ts
+3
-2
src/vs/languages/html/common/html.ts
src/vs/languages/html/common/html.ts
+2
-1
src/vs/languages/javascript/common/javascript.ts
src/vs/languages/javascript/common/javascript.ts
+2
-1
src/vs/languages/typescript/common/typescriptMode.ts
src/vs/languages/typescript/common/typescriptMode.ts
+2
-1
未找到文件。
src/vs/editor/common/modes.ts
浏览文件 @
763abb9c
...
...
@@ -438,12 +438,6 @@ export interface IParameterHints {
signatures
:
ISignature
[];
}
export
interface
IParameterHintsContribution
{
triggerCharacters
:
string
[];
excludeTokens
:
string
[];
getParameterHints
:
(
resource
:
URI
,
position
:
EditorCommon
.
IPosition
)
=>
TPromise
<
IParameterHints
>
;
}
/**
* Interface used to get parameter hints.
*/
...
...
src/vs/editor/common/modes/supports.ts
浏览文件 @
763abb9c
...
...
@@ -189,42 +189,7 @@ export function getBracketFor(tokenType:string, tokenText:string, mode:Modes.IMo
export
class
ParameterHintsSupport
extends
AbstractSupport
implements
Modes
.
IParameterHintsSupport
{
private
contribution
:
Modes
.
IParameterHintsContribution
;
constructor
(
mode
:
Modes
.
IMode
,
contribution
:
Modes
.
IParameterHintsContribution
)
{
super
(
mode
);
this
.
contribution
=
contribution
;
}
public
getParameterHintsTriggerCharacters
():
string
[]
{
return
this
.
contribution
.
triggerCharacters
;
}
public
shouldTriggerParameterHints
(
context
:
Modes
.
ILineContext
,
offset
:
number
):
boolean
{
return
handleEvent
(
context
,
offset
,
(
nestedMode
:
Modes
.
IMode
,
context
:
Modes
.
ILineContext
,
offset
:
number
)
=>
{
if
(
this
.
mode
===
nestedMode
)
{
if
(
!
Array
.
isArray
(
this
.
contribution
.
excludeTokens
))
{
return
true
;
}
if
(
this
.
contribution
.
excludeTokens
.
length
===
1
&&
this
.
contribution
.
excludeTokens
[
0
]
===
'
*
'
)
{
return
false
;
}
return
!
isLineToken
(
context
,
offset
-
1
,
this
.
contribution
.
excludeTokens
);
}
else
if
(
nestedMode
.
parameterHintsSupport
)
{
return
nestedMode
.
parameterHintsSupport
.
shouldTriggerParameterHints
(
context
,
offset
);
}
else
{
return
false
;
}
});
}
public
getParameterHints
(
resource
:
URI
,
position
:
EditorCommon
.
IPosition
):
TPromise
<
Modes
.
IParameterHints
>
{
return
this
.
contribution
.
getParameterHints
(
resource
,
position
);
}
}
export
interface
ISuggestContribution
{
triggerCharacters
:
string
[];
...
...
src/vs/editor/common/modes/supports/parameterHintsSupport.ts
0 → 100644
浏览文件 @
763abb9c
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'
use strict
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
*
as
Modes
from
'
vs/editor/common/modes
'
;
import
EditorCommon
=
require
(
'
vs/editor/common/editorCommon
'
);
import
URI
from
'
vs/base/common/uri
'
;
import
{
handleEvent
,
isLineToken
}
from
'
vs/editor/common/modes/supports
'
;
export
interface
IParameterHintsContribution
{
triggerCharacters
:
string
[];
excludeTokens
:
string
[];
getParameterHints
:
(
resource
:
URI
,
position
:
EditorCommon
.
IPosition
)
=>
TPromise
<
Modes
.
IParameterHints
>
;
}
export
class
ParameterHintsSupport
implements
Modes
.
IParameterHintsSupport
{
private
_modeId
:
string
;
private
contribution
:
IParameterHintsContribution
;
constructor
(
modeId
:
string
,
contribution
:
IParameterHintsContribution
)
{
this
.
_modeId
=
modeId
;
this
.
contribution
=
contribution
;
}
public
getParameterHintsTriggerCharacters
():
string
[]
{
return
this
.
contribution
.
triggerCharacters
;
}
public
shouldTriggerParameterHints
(
context
:
Modes
.
ILineContext
,
offset
:
number
):
boolean
{
return
handleEvent
(
context
,
offset
,
(
nestedMode
:
Modes
.
IMode
,
context
:
Modes
.
ILineContext
,
offset
:
number
)
=>
{
if
(
this
.
_modeId
===
nestedMode
.
getId
())
{
if
(
!
Array
.
isArray
(
this
.
contribution
.
excludeTokens
))
{
return
true
;
}
if
(
this
.
contribution
.
excludeTokens
.
length
===
1
&&
this
.
contribution
.
excludeTokens
[
0
]
===
'
*
'
)
{
return
false
;
}
return
!
isLineToken
(
context
,
offset
-
1
,
this
.
contribution
.
excludeTokens
);
}
else
if
(
nestedMode
.
parameterHintsSupport
)
{
return
nestedMode
.
parameterHintsSupport
.
shouldTriggerParameterHints
(
context
,
offset
);
}
else
{
return
false
;
}
});
}
public
getParameterHints
(
resource
:
URI
,
position
:
EditorCommon
.
IPosition
):
TPromise
<
Modes
.
IParameterHints
>
{
return
this
.
contribution
.
getParameterHints
(
resource
,
position
);
}
}
src/vs/editor/common/services/modeService.ts
浏览文件 @
763abb9c
...
...
@@ -14,6 +14,7 @@ import {IDisposable} from 'vs/base/common/lifecycle';
import
{
IRichEditConfiguration
}
from
'
vs/editor/common/modes/supports/richEditSupport
'
;
import
{
IDeclarationContribution
}
from
'
vs/editor/common/modes/supports/declarationSupport
'
;
import
{
IReferenceContribution
}
from
'
vs/editor/common/modes/supports/referenceSupport
'
;
import
{
IParameterHintsContribution
}
from
'
vs/editor/common/modes/supports/parameterHintsSupport
'
;
export
var
IModeService
=
createDecorator
<
IModeService
>
(
'
modeService
'
);
...
...
@@ -44,7 +45,7 @@ export interface IModeService {
registerInplaceReplaceSupport
(
modeId
:
string
,
support
:
Modes
.
IInplaceReplaceSupport
):
IDisposable
;
registerOccurrencesSupport
(
modeId
:
string
,
support
:
Modes
.
IOccurrencesSupport
):
IDisposable
;
registerOutlineSupport
(
modeId
:
string
,
support
:
Modes
.
IOutlineSupport
):
IDisposable
;
registerDeclarativeParameterHintsSupport
(
modeId
:
string
,
support
:
Modes
.
IParameterHintsContribution
):
IDisposable
;
registerDeclarativeParameterHintsSupport
(
modeId
:
string
,
support
:
IParameterHintsContribution
):
IDisposable
;
registerQuickFixSupport
(
modeId
:
string
,
support
:
Modes
.
IQuickFixSupport
):
IDisposable
;
registerDeclarativeReferenceSupport
(
modeId
:
string
,
contribution
:
IReferenceContribution
):
IDisposable
;
registerRenameSupport
(
modeId
:
string
,
support
:
Modes
.
IRenameSupport
):
IDisposable
;
...
...
src/vs/editor/common/services/modeServiceImpl.ts
浏览文件 @
763abb9c
...
...
@@ -28,6 +28,7 @@ import {createAsyncDescriptor0, createAsyncDescriptor1} from 'vs/platform/instan
import
{
RichEditSupport
,
IRichEditConfiguration
}
from
'
vs/editor/common/modes/supports/richEditSupport
'
;
import
{
DeclarationSupport
,
IDeclarationContribution
}
from
'
vs/editor/common/modes/supports/declarationSupport
'
;
import
{
ReferenceSupport
,
IReferenceContribution
}
from
'
vs/editor/common/modes/supports/referenceSupport
'
;
import
{
ParameterHintsSupport
,
IParameterHintsContribution
}
from
'
vs/editor/common/modes/supports/parameterHintsSupport
'
;
interface
IModeConfigurationMap
{
[
modeId
:
string
]:
any
;
}
...
...
@@ -307,8 +308,8 @@ export class ModeServiceImpl implements IModeService {
return
this
.
registerModeSupport
(
modeId
,
'
outlineSupport
'
,
(
mode
)
=>
support
);
}
public
registerDeclarativeParameterHintsSupport
(
modeId
:
string
,
support
:
Modes
.
IParameterHintsContribution
):
IDisposable
{
return
this
.
registerModeSupport
(
modeId
,
'
parameterHintsSupport
'
,
(
mode
)
=>
new
Supports
.
ParameterHintsSupport
(
mode
,
support
));
public
registerDeclarativeParameterHintsSupport
(
modeId
:
string
,
support
:
IParameterHintsContribution
):
IDisposable
{
return
this
.
registerModeSupport
(
modeId
,
'
parameterHintsSupport
'
,
(
mode
)
=>
new
ParameterHintsSupport
(
modeId
,
support
));
}
public
registerQuickFixSupport
(
modeId
:
string
,
support
:
Modes
.
IQuickFixSupport
):
IDisposable
{
...
...
src/vs/languages/html/common/html.ts
浏览文件 @
763abb9c
...
...
@@ -29,6 +29,7 @@ import {RichEditSupport} from 'vs/editor/common/modes/supports/richEditSupport';
import
{
TokenizationSupport
,
IEnteringNestedModeData
,
ILeavingNestedModeData
,
ITokenizationCustomization
}
from
'
vs/editor/common/modes/supports/tokenizationSupport
'
;
// import {DeclarationSupport} from 'vs/editor/common/modes/supports/declarationSupport';
import
{
ReferenceSupport
}
from
'
vs/editor/common/modes/supports/referenceSupport
'
;
import
{
ParameterHintsSupport
}
from
'
vs/editor/common/modes/supports/parameterHintsSupport
'
;
export
{
htmlTokenTypes
};
// export to be used by Razor. We are the main module, so Razor should get ot from use.
export
{
EMPTY_ELEMENTS
};
// export to be used by Razor. We are the main module, so Razor should get ot from use.
...
...
@@ -310,7 +311,7 @@ export class HTMLMode<W extends htmlWorker.HTMLWorker> extends AbstractMode<W> i
findReferences
:
(
resource
,
position
,
includeDeclaration
)
=>
this
.
findReferences
(
resource
,
position
,
includeDeclaration
)});
this
.
logicalSelectionSupport
=
this
;
this
.
parameterHintsSupport
=
new
supports
.
ParameterHintsSupport
(
this
,
{
this
.
parameterHintsSupport
=
new
ParameterHintsSupport
(
this
.
getId
()
,
{
triggerCharacters
:
[
'
(
'
,
'
,
'
],
excludeTokens
:
[
'
*
'
],
getParameterHints
:
(
resource
,
position
)
=>
this
.
getParameterHints
(
resource
,
position
)});
...
...
src/vs/languages/javascript/common/javascript.ts
浏览文件 @
763abb9c
...
...
@@ -22,6 +22,7 @@ import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry';
import
{
RichEditSupport
}
from
'
vs/editor/common/modes/supports/richEditSupport
'
;
import
{
DeclarationSupport
}
from
'
vs/editor/common/modes/supports/declarationSupport
'
;
import
{
ReferenceSupport
}
from
'
vs/editor/common/modes/supports/referenceSupport
'
;
import
{
ParameterHintsSupport
}
from
'
vs/editor/common/modes/supports/parameterHintsSupport
'
;
export
class
JSMode
extends
typescriptMode
.
TypeScriptMode
<
javascriptWorker
.
JavaScriptWorker
>
{
...
...
@@ -50,7 +51,7 @@ export class JSMode extends typescriptMode.TypeScriptMode<javascriptWorker.JavaS
tokens
:
[],
findDeclaration
:
(
resource
,
position
)
=>
this
.
findDeclaration
(
resource
,
position
)});
this
.
parameterHintsSupport
=
new
supports
.
ParameterHintsSupport
(
this
,
{
this
.
parameterHintsSupport
=
new
ParameterHintsSupport
(
this
.
getId
()
,
{
triggerCharacters
:
[
'
(
'
,
'
,
'
],
excludeTokens
:
[
'
string.js
'
,
'
string.escape.js
'
],
getParameterHints
:
(
resource
,
position
)
=>
this
.
getParameterHints
(
resource
,
position
)});
...
...
src/vs/languages/typescript/common/typescriptMode.ts
浏览文件 @
763abb9c
...
...
@@ -29,6 +29,7 @@ import {IInstantiationService} from 'vs/platform/instantiation/common/instantiat
import
{
RichEditSupport
}
from
'
vs/editor/common/modes/supports/richEditSupport
'
;
import
{
DeclarationSupport
}
from
'
vs/editor/common/modes/supports/declarationSupport
'
;
import
{
ReferenceSupport
}
from
'
vs/editor/common/modes/supports/referenceSupport
'
;
import
{
ParameterHintsSupport
}
from
'
vs/editor/common/modes/supports/parameterHintsSupport
'
;
class
SemanticValidator
{
...
...
@@ -262,7 +263,7 @@ export class TypeScriptMode<W extends typescriptWorker.TypeScriptWorker2> extend
tokens
:
[
'
identifier.ts
'
,
'
string.ts
'
,
'
attribute.value.vs
'
],
findDeclaration
:
(
resource
,
position
)
=>
this
.
findDeclaration
(
resource
,
position
)});
this
.
parameterHintsSupport
=
new
supports
.
ParameterHintsSupport
(
this
,
{
this
.
parameterHintsSupport
=
new
ParameterHintsSupport
(
this
.
getId
()
,
{
triggerCharacters
:
[
'
(
'
,
'
,
'
],
excludeTokens
:
[
'
string.ts
'
],
getParameterHints
:
(
resource
,
position
)
=>
this
.
getParameterHints
(
resource
,
position
)});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录