Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
10cf7b12
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,发现更多精彩内容 >>
提交
10cf7b12
编写于
9月 20, 2018
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
less TPromise.as/wrap/wrapError
上级
b1219d5b
变更
9
显示空白变更内容
内联
并排
Showing
9 changed file
with
24 addition
and
26 deletion
+24
-26
src/vs/base/test/common/event.test.ts
src/vs/base/test/common/event.test.ts
+1
-1
src/vs/editor/test/browser/services/decorationRenderOptions.test.ts
...tor/test/browser/services/decorationRenderOptions.test.ts
+2
-3
src/vs/editor/test/browser/services/openerService.test.ts
src/vs/editor/test/browser/services/openerService.test.ts
+2
-2
src/vs/workbench/test/electron-browser/api/extHostApiCommands.test.ts
...ench/test/electron-browser/api/extHostApiCommands.test.ts
+2
-2
src/vs/workbench/test/electron-browser/api/extHostDocumentData.test.ts
...nch/test/electron-browser/api/extHostDocumentData.test.ts
+1
-2
src/vs/workbench/test/electron-browser/api/extHostDocumentSaveParticipant.test.ts
...ectron-browser/api/extHostDocumentSaveParticipant.test.ts
+9
-9
src/vs/workbench/test/electron-browser/api/extHostTextEditor.test.ts
...bench/test/electron-browser/api/extHostTextEditor.test.ts
+2
-2
src/vs/workbench/test/electron-browser/api/extHostTextEditors.test.ts
...ench/test/electron-browser/api/extHostTextEditors.test.ts
+1
-1
src/vs/workbench/test/electron-browser/api/mainThreadEditors.test.ts
...bench/test/electron-browser/api/mainThreadEditors.test.ts
+4
-4
未找到文件。
src/vs/base/test/common/event.test.ts
浏览文件 @
10cf7b12
...
...
@@ -417,7 +417,7 @@ suite('Event utils', () => {
test
(
'
should emit when done
'
,
()
=>
{
let
count
=
0
;
const
event
=
fromPromise
(
TPromise
.
as
(
null
));
const
event
=
fromPromise
(
Promise
.
resolve
(
null
));
event
(()
=>
count
++
);
assert
.
equal
(
count
,
0
);
...
...
src/vs/editor/test/browser/services/decorationRenderOptions.test.ts
浏览文件 @
10cf7b12
...
...
@@ -12,7 +12,6 @@ import { IDecorationRenderOptions } from 'vs/editor/common/editorCommon';
import
{
TestTheme
,
TestThemeService
}
from
'
vs/platform/theme/test/common/testThemeService
'
;
import
{
ICodeEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
IResourceInput
}
from
'
vs/platform/editor/common/editor
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
const
themeServiceMock
=
new
TestThemeService
();
...
...
@@ -21,8 +20,8 @@ export class TestCodeEditorServiceImpl extends CodeEditorServiceImpl {
return
null
;
}
openCodeEditor
(
input
:
IResourceInput
,
source
:
ICodeEditor
,
sideBySide
?:
boolean
):
T
Promise
<
ICodeEditor
>
{
return
TPromise
.
as
(
null
);
openCodeEditor
(
input
:
IResourceInput
,
source
:
ICodeEditor
,
sideBySide
?:
boolean
):
Promise
<
ICodeEditor
>
{
return
Promise
.
resolve
(
null
);
}
}
...
...
src/vs/editor/test/browser/services/openerService.test.ts
浏览文件 @
10cf7b12
...
...
@@ -22,7 +22,7 @@ suite('OpenerService', function () {
onWillExecuteCommand
=
()
=>
({
dispose
:
()
=>
{
}
});
executeCommand
(
id
:
string
,
...
args
:
any
[]):
TPromise
<
any
>
{
lastCommand
=
{
id
,
args
};
return
TPromise
.
as
(
undefined
);
return
Promise
.
resolve
(
undefined
);
}
};
...
...
src/vs/workbench/test/electron-browser/api/extHostApiCommands.test.ts
浏览文件 @
10cf7b12
...
...
@@ -75,10 +75,10 @@ suite('ExtHostLanguageFeatureCommands', function () {
_serviceBrand
:
undefined
,
executeCommand
(
id
:
string
,
args
:
any
):
any
{
if
(
!
CommandsRegistry
.
getCommands
()[
id
])
{
return
TPromise
.
wrapError
(
new
Error
(
id
+
'
NOT known
'
));
return
Promise
.
reject
(
new
Error
(
id
+
'
NOT known
'
));
}
let
{
handler
}
=
CommandsRegistry
.
getCommands
()[
id
];
return
TPromise
.
as
(
instantiationService
.
invokeFunction
(
handler
,
args
));
return
Promise
.
resolve
(
instantiationService
.
invokeFunction
(
handler
,
args
));
}
});
instantiationService
.
stub
(
IMarkerService
,
new
MarkerService
());
...
...
src/vs/workbench/test/electron-browser/api/extHostDocumentData.test.ts
浏览文件 @
10cf7b12
...
...
@@ -11,7 +11,6 @@ import { ExtHostDocumentData } from 'vs/workbench/api/node/extHostDocumentData';
import
{
Position
}
from
'
vs/workbench/api/node/extHostTypes
'
;
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
import
{
MainThreadDocumentsShape
}
from
'
vs/workbench/api/node/extHost.protocol
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
IModelChangedEvent
}
from
'
vs/editor/common/model/mirrorTextModel
'
;
import
{
mock
}
from
'
vs/workbench/test/electron-browser/api/mock
'
;
...
...
@@ -56,7 +55,7 @@ suite('ExtHostDocumentData', () => {
$trySaveDocument
(
uri
:
URI
)
{
assert
.
ok
(
!
saved
);
saved
=
uri
;
return
TPromise
.
as
(
true
);
return
Promise
.
resolve
(
true
);
}
},
URI
.
parse
(
'
foo:bar
'
),
[],
'
\n
'
,
'
text
'
,
1
,
true
);
...
...
src/vs/workbench/test/electron-browser/api/extHostDocumentSaveParticipant.test.ts
浏览文件 @
10cf7b12
...
...
@@ -248,7 +248,7 @@ suite('ExtHostDocumentSaveParticipant', () => {
const
participant
=
new
ExtHostDocumentSaveParticipant
(
nullLogService
,
documents
,
mainThreadEditors
);
let
sub1
=
participant
.
getOnWillSaveTextDocumentEvent
(
nullExtensionDescription
)(
function
(
e
)
{
e
.
waitUntil
(
TPromise
.
wrapError
(
new
Error
(
'
dddd
'
)));
e
.
waitUntil
(
Promise
.
reject
(
new
Error
(
'
dddd
'
)));
});
let
event
:
vscode
.
TextDocumentWillSaveEvent
;
...
...
@@ -269,13 +269,13 @@ suite('ExtHostDocumentSaveParticipant', () => {
const
participant
=
new
ExtHostDocumentSaveParticipant
(
nullLogService
,
documents
,
new
class
extends
mock
<
MainThreadTextEditorsShape
>
()
{
$tryApplyWorkspaceEdit
(
_edits
:
WorkspaceEditDto
)
{
dto
=
_edits
;
return
TPromise
.
as
(
true
);
return
Promise
.
resolve
(
true
);
}
});
let
sub
=
participant
.
getOnWillSaveTextDocumentEvent
(
nullExtensionDescription
)(
function
(
e
)
{
e
.
waitUntil
(
TPromise
.
as
([
TextEdit
.
insert
(
new
Position
(
0
,
0
),
'
bar
'
)]));
e
.
waitUntil
(
TPromise
.
as
([
TextEdit
.
setEndOfLine
(
EndOfLine
.
CRLF
)]));
e
.
waitUntil
(
Promise
.
resolve
([
TextEdit
.
insert
(
new
Position
(
0
,
0
),
'
bar
'
)]));
e
.
waitUntil
(
Promise
.
resolve
([
TextEdit
.
setEndOfLine
(
EndOfLine
.
CRLF
)]));
});
return
participant
.
$participateInSave
(
resource
,
SaveReason
.
EXPLICIT
).
then
(()
=>
{
...
...
@@ -293,7 +293,7 @@ suite('ExtHostDocumentSaveParticipant', () => {
const
participant
=
new
ExtHostDocumentSaveParticipant
(
nullLogService
,
documents
,
new
class
extends
mock
<
MainThreadTextEditorsShape
>
()
{
$tryApplyWorkspaceEdit
(
_edits
:
WorkspaceEditDto
)
{
edits
=
_edits
;
return
TPromise
.
as
(
true
);
return
Promise
.
resolve
(
true
);
}
});
...
...
@@ -311,7 +311,7 @@ suite('ExtHostDocumentSaveParticipant', () => {
versionId
:
2
},
true
);
e
.
waitUntil
(
TPromise
.
as
([
TextEdit
.
insert
(
new
Position
(
0
,
0
),
'
bar
'
)]));
e
.
waitUntil
(
Promise
.
resolve
([
TextEdit
.
insert
(
new
Position
(
0
,
0
),
'
bar
'
)]));
});
return
participant
.
$participateInSave
(
resource
,
SaveReason
.
EXPLICIT
).
then
(
values
=>
{
...
...
@@ -348,7 +348,7 @@ suite('ExtHostDocumentSaveParticipant', () => {
}
}
return
TPromise
.
as
(
true
);
return
Promise
.
resolve
(
true
);
}
});
...
...
@@ -359,7 +359,7 @@ suite('ExtHostDocumentSaveParticipant', () => {
assert
.
equal
(
document
.
version
,
1
);
assert
.
equal
(
document
.
getText
(),
'
foo
'
);
e
.
waitUntil
(
TPromise
.
as
([
TextEdit
.
insert
(
new
Position
(
0
,
0
),
'
bar
'
)]));
e
.
waitUntil
(
Promise
.
resolve
([
TextEdit
.
insert
(
new
Position
(
0
,
0
),
'
bar
'
)]));
});
let
sub2
=
participant
.
getOnWillSaveTextDocumentEvent
(
nullExtensionDescription
)(
function
(
e
)
{
...
...
@@ -367,7 +367,7 @@ suite('ExtHostDocumentSaveParticipant', () => {
assert
.
equal
(
document
.
version
,
2
);
assert
.
equal
(
document
.
getText
(),
'
barfoo
'
);
e
.
waitUntil
(
TPromise
.
as
([
TextEdit
.
insert
(
new
Position
(
0
,
0
),
'
bar
'
)]));
e
.
waitUntil
(
Promise
.
resolve
([
TextEdit
.
insert
(
new
Position
(
0
,
0
),
'
bar
'
)]));
});
return
participant
.
$participateInSave
(
resource
,
SaveReason
.
EXPLICIT
).
then
(
values
=>
{
...
...
src/vs/workbench/test/electron-browser/api/extHostTextEditor.test.ts
浏览文件 @
10cf7b12
...
...
@@ -46,7 +46,7 @@ suite('ExtHostTextEditor', () => {
let
editor
=
new
ExtHostTextEditor
(
new
class
extends
mock
<
MainThreadTextEditorsShape
>
()
{
$tryApplyEdits
():
TPromise
<
boolean
>
{
applyCount
+=
1
;
return
TPromise
.
wrap
(
true
);
return
Promise
.
resolve
(
true
);
}
},
'
edt1
'
,
doc
,
[],
{
cursorStyle
:
0
,
insertSpaces
:
true
,
lineNumbers
:
1
,
tabSize
:
4
},
[],
1
);
...
...
@@ -73,7 +73,7 @@ suite('ExtHostTextEditorOptions', () => {
$trySetOptions
:
(
id
:
string
,
options
:
ITextEditorConfigurationUpdate
)
=>
{
assert
.
equal
(
id
,
'
1
'
);
calls
.
push
(
options
);
return
TPromise
.
as
(
void
0
);
return
Promise
.
resolve
(
void
0
);
},
$tryShowTextDocument
:
undefined
,
$registerTextEditorDecorationType
:
undefined
,
...
...
src/vs/workbench/test/electron-browser/api/extHostTextEditors.test.ts
浏览文件 @
10cf7b12
...
...
@@ -28,7 +28,7 @@ suite('ExtHostTextEditors.applyWorkspaceEdit', () => {
rpcProtocol
.
set
(
MainContext
.
MainThreadTextEditors
,
new
class
extends
mock
<
MainThreadTextEditorsShape
>
()
{
$tryApplyWorkspaceEdit
(
_workspaceResourceEdits
:
WorkspaceEditDto
):
TPromise
<
boolean
>
{
workspaceResourceEdits
=
_workspaceResourceEdits
;
return
TPromise
.
as
(
true
);
return
Promise
.
resolve
(
true
);
}
});
const
documentsAndEditors
=
new
ExtHostDocumentsAndEditors
(
SingleProxyRPCProtocol
(
null
));
...
...
src/vs/workbench/test/electron-browser/api/mainThreadEditors.test.ts
浏览文件 @
10cf7b12
...
...
@@ -57,15 +57,15 @@ suite('MainThreadEditors', () => {
isDirty
()
{
return
false
;
}
create
(
uri
:
URI
,
contents
?:
string
,
options
?:
any
)
{
createdResources
.
add
(
uri
);
return
TPromise
.
as
(
void
0
);
return
Promise
.
resolve
(
void
0
);
}
delete
(
resource
:
URI
)
{
deletedResources
.
add
(
resource
);
return
TPromise
.
as
(
void
0
);
return
Promise
.
resolve
(
void
0
);
}
move
(
source
:
URI
,
target
:
URI
)
{
movedResources
.
set
(
source
,
target
);
return
TPromise
.
as
(
void
0
);
return
Promise
.
resolve
(
void
0
);
}
models
=
<
any
>
{
onModelSaved
:
Event
.
None
,
...
...
@@ -81,7 +81,7 @@ suite('MainThreadEditors', () => {
textEditorModel
=
modelService
.
getModel
(
resource
);
};
textEditorModel
.
isReadonly
=
()
=>
false
;
return
TPromise
.
as
(
new
ImmortalReference
(
textEditorModel
));
return
Promise
.
resolve
(
new
ImmortalReference
(
textEditorModel
));
}
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录