Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
762cc769
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,发现更多精彩内容 >>
提交
762cc769
编写于
11月 07, 2017
作者:
M
Matt Bierner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Enable noImplicitThis compiler option
上级
c3a8519e
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
83 addition
and
82 deletion
+83
-82
src/tsconfig.json
src/tsconfig.json
+1
-0
src/vs/base/common/decorators.ts
src/vs/base/common/decorators.ts
+1
-1
src/vs/base/common/functional.ts
src/vs/base/common/functional.ts
+1
-1
src/vs/base/test/common/types.test.ts
src/vs/base/test/common/types.test.ts
+1
-1
src/vs/base/test/common/utils.ts
src/vs/base/test/common/utils.ts
+1
-1
src/vs/base/test/node/flow.test.ts
src/vs/base/test/node/flow.test.ts
+18
-18
src/vs/platform/telemetry/test/electron-browser/telemetryService.test.ts
.../telemetry/test/electron-browser/telemetryService.test.ts
+13
-13
src/vs/workbench/parts/files/test/browser/fileEditorInput.test.ts
...orkbench/parts/files/test/browser/fileEditorInput.test.ts
+18
-18
src/vs/workbench/parts/files/test/browser/fileEditorTracker.test.ts
...kbench/parts/files/test/browser/fileEditorTracker.test.ts
+15
-15
src/vs/workbench/services/editor/test/browser/editorService.test.ts
...kbench/services/editor/test/browser/editorService.test.ts
+10
-10
src/vs/workbench/services/files/node/fileService.ts
src/vs/workbench/services/files/node/fileService.ts
+2
-2
src/vs/workbench/services/textfile/test/textFileService.test.ts
.../workbench/services/textfile/test/textFileService.test.ts
+1
-1
src/vs/workbench/services/themes/electron-browser/workbenchThemeService.ts
...services/themes/electron-browser/workbenchThemeService.ts
+1
-1
未找到文件。
src/tsconfig.json
浏览文件 @
762cc769
...
...
@@ -11,6 +11,7 @@
"declaration"
:
true
,
"noImplicitReturns"
:
true
,
"noUnusedLocals"
:
true
,
"noImplicitThis"
:
true
,
"baseUrl"
:
"."
,
"typeRoots"
:
[
"typings"
...
...
src/vs/base/common/decorators.ts
浏览文件 @
762cc769
...
...
@@ -62,7 +62,7 @@ export function debounce(delay: number): Function {
return
createDecorator
((
fn
,
key
)
=>
{
const
timerKey
=
`$debounce$
${
key
}
`
;
return
function
(...
args
:
any
[])
{
return
function
(
this
:
any
,
...
args
:
any
[])
{
clearTimeout
(
this
[
timerKey
]);
this
[
timerKey
]
=
setTimeout
(()
=>
fn
.
apply
(
this
,
args
),
delay
);
};
...
...
src/vs/base/common/functional.ts
浏览文件 @
762cc769
...
...
@@ -10,7 +10,7 @@ export function not(fn: Function): Function {
return
(...
args
)
=>
!
fn
(...
args
);
}
export
function
once
<
T
extends
Function
>
(
fn
:
T
):
T
{
export
function
once
<
T
extends
Function
>
(
this
:
any
,
fn
:
T
):
T
{
const
_this
=
this
;
let
didCall
=
false
;
let
result
:
any
;
...
...
src/vs/base/test/common/types.test.ts
浏览文件 @
762cc769
...
...
@@ -198,7 +198,7 @@ suite('Types', () => {
assert
(
types
.
create
(
zeroConstructor
)
instanceof
zeroConstructor
);
assert
(
types
.
isObject
(
types
.
create
(
zeroConstructor
)));
let
manyArgConstructor
=
function
(
foo
,
bar
)
{
let
manyArgConstructor
=
function
(
this
:
any
,
foo
,
bar
)
{
this
.
foo
=
foo
;
this
.
bar
=
bar
;
};
...
...
src/vs/base/test/common/utils.ts
浏览文件 @
762cc769
...
...
@@ -85,6 +85,6 @@ export function onError(error: Error, done: () => void): void {
done
();
}
export
function
toResource
(
path
)
{
export
function
toResource
(
this
:
any
,
path
:
string
)
{
return
URI
.
file
(
paths
.
join
(
'
C:
\\
'
,
new
Buffer
(
this
.
test
.
fullTitle
()).
toString
(
'
base64
'
),
path
));
}
src/vs/base/test/node/flow.test.ts
浏览文件 @
762cc769
...
...
@@ -27,7 +27,7 @@ suite('Flow', () => {
callback
(
error
,
null
);
},
function
getFirst
()
{
function
getFirst
(
this
:
any
)
{
syncThrowsError
(
this
);
},
...
...
@@ -176,17 +176,17 @@ suite('Flow', () => {
errorCount
++
;
},
function
getFirst
()
{
function
getFirst
(
this
:
any
)
{
syncGet
(
'
1
'
,
this
);
},
function
handleFirst
(
first
)
{
function
handleFirst
(
this
:
any
,
first
)
{
assert
.
deepEqual
(
'
1
'
,
first
);
assertionCount
++
;
syncGet
(
'
2
'
,
this
);
},
function
handleSecond
(
second
)
{
function
handleSecond
(
this
:
any
,
second
)
{
assert
.
deepEqual
(
'
2
'
,
second
);
assertionCount
++
;
syncGet
(
null
,
this
);
...
...
@@ -212,17 +212,17 @@ suite('Flow', () => {
errorCount
++
;
},
function
getFirst
()
{
function
getFirst
(
this
:
any
)
{
asyncGet
(
'
1
'
,
this
);
},
function
handleFirst
(
first
)
{
function
handleFirst
(
this
:
any
,
first
)
{
assert
.
deepEqual
(
'
1
'
,
first
);
assertionCount
++
;
asyncGet
(
'
2
'
,
this
);
},
function
handleSecond
(
second
)
{
function
handleSecond
(
this
:
any
,
second
)
{
assert
.
deepEqual
(
'
2
'
,
second
);
assertionCount
++
;
asyncGet
(
null
,
this
);
...
...
@@ -252,11 +252,11 @@ suite('Flow', () => {
done
();
},
function
getFirst
()
{
function
getFirst
(
this
:
any
)
{
syncGet
(
'
1
'
,
this
);
},
function
handleFirst
(
first
)
{
function
handleFirst
(
this
:
any
,
first
)
{
assert
.
deepEqual
(
'
1
'
,
first
);
assertionCount
++
;
syncGet
(
'
2
'
,
this
);
...
...
@@ -289,11 +289,11 @@ suite('Flow', () => {
done
();
},
function
getFirst
()
{
function
getFirst
(
this
:
any
)
{
syncGet
(
'
1
'
,
this
);
},
function
handleFirst
(
first
)
{
function
handleFirst
(
this
:
any
,
first
)
{
assert
.
deepEqual
(
'
1
'
,
first
);
assertionCount
++
;
syncGetError
(
'
2
'
,
this
);
...
...
@@ -318,11 +318,11 @@ suite('Flow', () => {
done
();
},
function
getFirst
()
{
function
getFirst
(
this
:
any
)
{
asyncGet
(
'
1
'
,
this
);
},
function
handleFirst
(
first
)
{
function
handleFirst
(
this
:
any
,
first
)
{
assert
.
deepEqual
(
'
1
'
,
first
);
assertionCount
++
;
asyncGet
(
'
2
'
,
this
);
...
...
@@ -355,11 +355,11 @@ suite('Flow', () => {
done
();
},
function
getFirst
()
{
function
getFirst
(
this
:
any
)
{
asyncGet
(
'
1
'
,
this
);
},
function
handleFirst
(
first
)
{
function
handleFirst
(
this
:
any
,
first
)
{
assert
.
deepEqual
(
'
1
'
,
first
);
assertionCount
++
;
asyncGetError
(
'
2
'
,
this
);
...
...
@@ -377,7 +377,7 @@ suite('Flow', () => {
done
();
},
function
getFirst
()
{
function
getFirst
(
this
:
any
)
{
syncSequenceGetThrowsError
(
'
1
'
,
this
);
}
);
...
...
@@ -392,11 +392,11 @@ suite('Flow', () => {
errorCount
++
;
},
function
getFirst
()
{
function
getFirst
(
this
:
any
)
{
this
(
true
);
},
function
getSecond
(
result
)
{
function
getSecond
(
this
:
any
,
result
)
{
assert
.
equal
(
result
,
true
);
this
(
false
);
},
...
...
src/vs/platform/telemetry/test/electron-browser/telemetryService.test.ts
浏览文件 @
762cc769
...
...
@@ -203,7 +203,7 @@ suite('TelemetryService', () => {
});
}));
test
(
'
Error events
'
,
sinon
.
test
(
function
()
{
test
(
'
Error events
'
,
sinon
.
test
(
function
(
this
:
any
)
{
let
origErrorHandler
=
Errors
.
errorHandler
.
getUnexpectedErrorHandler
();
Errors
.
setUnexpectedErrorHandler
(()
=>
{
});
...
...
@@ -262,7 +262,7 @@ suite('TelemetryService', () => {
// }
// }));
test
(
'
Handle global errors
'
,
sinon
.
test
(
function
()
{
test
(
'
Handle global errors
'
,
sinon
.
test
(
function
(
this
:
any
)
{
let
errorStub
=
sinon
.
stub
();
window
.
onerror
=
errorStub
;
...
...
@@ -289,7 +289,7 @@ suite('TelemetryService', () => {
service
.
dispose
();
}));
test
(
'
Uncaught Error Telemetry removes PII from filename
'
,
sinon
.
test
(
function
()
{
test
(
'
Uncaught Error Telemetry removes PII from filename
'
,
sinon
.
test
(
function
(
this
:
any
)
{
let
errorStub
=
sinon
.
stub
();
window
.
onerror
=
errorStub
;
let
settings
=
new
ErrorTestingSettings
();
...
...
@@ -318,7 +318,7 @@ suite('TelemetryService', () => {
service
.
dispose
();
}));
test
(
'
Unexpected Error Telemetry removes PII
'
,
sinon
.
test
(
function
()
{
test
(
'
Unexpected Error Telemetry removes PII
'
,
sinon
.
test
(
function
(
this
:
any
)
{
let
origErrorHandler
=
Errors
.
errorHandler
.
getUnexpectedErrorHandler
();
Errors
.
setUnexpectedErrorHandler
(()
=>
{
});
try
{
...
...
@@ -348,7 +348,7 @@ suite('TelemetryService', () => {
}
}));
test
(
'
Uncaught Error Telemetry removes PII
'
,
sinon
.
test
(
function
()
{
test
(
'
Uncaught Error Telemetry removes PII
'
,
sinon
.
test
(
function
(
this
:
any
)
{
let
errorStub
=
sinon
.
stub
();
window
.
onerror
=
errorStub
;
let
settings
=
new
ErrorTestingSettings
();
...
...
@@ -374,7 +374,7 @@ suite('TelemetryService', () => {
service
.
dispose
();
}));
test
(
'
Unexpected Error Telemetry removes PII but preserves Code file path
'
,
sinon
.
test
(
function
()
{
test
(
'
Unexpected Error Telemetry removes PII but preserves Code file path
'
,
sinon
.
test
(
function
(
this
:
any
)
{
let
origErrorHandler
=
Errors
.
errorHandler
.
getUnexpectedErrorHandler
();
Errors
.
setUnexpectedErrorHandler
(()
=>
{
});
...
...
@@ -409,7 +409,7 @@ suite('TelemetryService', () => {
}
}));
test
(
'
Uncaught Error Telemetry removes PII but preserves Code file path
'
,
sinon
.
test
(
function
()
{
test
(
'
Uncaught Error Telemetry removes PII but preserves Code file path
'
,
sinon
.
test
(
function
(
this
:
any
)
{
let
errorStub
=
sinon
.
stub
();
window
.
onerror
=
errorStub
;
let
settings
=
new
ErrorTestingSettings
();
...
...
@@ -437,7 +437,7 @@ suite('TelemetryService', () => {
service
.
dispose
();
}));
test
(
'
Unexpected Error Telemetry removes PII but preserves Code file path when PIIPath is configured
'
,
sinon
.
test
(
function
()
{
test
(
'
Unexpected Error Telemetry removes PII but preserves Code file path when PIIPath is configured
'
,
sinon
.
test
(
function
(
this
:
any
)
{
let
origErrorHandler
=
Errors
.
errorHandler
.
getUnexpectedErrorHandler
();
Errors
.
setUnexpectedErrorHandler
(()
=>
{
});
...
...
@@ -472,7 +472,7 @@ suite('TelemetryService', () => {
}
}));
test
(
'
Uncaught Error Telemetry removes PII but preserves Code file path when PIIPath is configured
'
,
sinon
.
test
(
function
()
{
test
(
'
Uncaught Error Telemetry removes PII but preserves Code file path when PIIPath is configured
'
,
sinon
.
test
(
function
(
this
:
any
)
{
let
errorStub
=
sinon
.
stub
();
window
.
onerror
=
errorStub
;
let
settings
=
new
ErrorTestingSettings
();
...
...
@@ -500,7 +500,7 @@ suite('TelemetryService', () => {
service
.
dispose
();
}));
test
(
'
Unexpected Error Telemetry removes PII but preserves Missing Model error message
'
,
sinon
.
test
(
function
()
{
test
(
'
Unexpected Error Telemetry removes PII but preserves Missing Model error message
'
,
sinon
.
test
(
function
(
this
:
any
)
{
let
origErrorHandler
=
Errors
.
errorHandler
.
getUnexpectedErrorHandler
();
Errors
.
setUnexpectedErrorHandler
(()
=>
{
});
...
...
@@ -535,7 +535,7 @@ suite('TelemetryService', () => {
}
}));
test
(
'
Uncaught Error Telemetry removes PII but preserves Missing Model error message
'
,
sinon
.
test
(
function
()
{
test
(
'
Uncaught Error Telemetry removes PII but preserves Missing Model error message
'
,
sinon
.
test
(
function
(
this
:
any
)
{
let
errorStub
=
sinon
.
stub
();
window
.
onerror
=
errorStub
;
let
settings
=
new
ErrorTestingSettings
();
...
...
@@ -564,7 +564,7 @@ suite('TelemetryService', () => {
service
.
dispose
();
}));
test
(
'
Unexpected Error Telemetry removes PII but preserves No Such File error message
'
,
sinon
.
test
(
function
()
{
test
(
'
Unexpected Error Telemetry removes PII but preserves No Such File error message
'
,
sinon
.
test
(
function
(
this
:
any
)
{
let
origErrorHandler
=
Errors
.
errorHandler
.
getUnexpectedErrorHandler
();
Errors
.
setUnexpectedErrorHandler
(()
=>
{
});
...
...
@@ -599,7 +599,7 @@ suite('TelemetryService', () => {
}
}));
test
(
'
Uncaught Error Telemetry removes PII but preserves No Such File error message
'
,
sinon
.
test
(
function
()
{
test
(
'
Uncaught Error Telemetry removes PII but preserves No Such File error message
'
,
sinon
.
test
(
function
(
this
:
any
)
{
let
origErrorHandler
=
Errors
.
errorHandler
.
getUnexpectedErrorHandler
();
Errors
.
setUnexpectedErrorHandler
(()
=>
{
});
...
...
src/vs/workbench/parts/files/test/browser/fileEditorInput.test.ts
浏览文件 @
762cc769
...
...
@@ -19,8 +19,8 @@ import { Verbosity } from 'vs/platform/editor/common/editor';
import
{
IEditorGroupService
}
from
'
vs/workbench/services/group/common/groupService
'
;
import
{
IModelService
}
from
'
vs/editor/common/services/modelService
'
;
function
toResource
(
path
)
{
return
URI
.
file
(
join
(
'
C:
\\
'
,
new
Buffer
(
this
.
test
.
fullTitle
()).
toString
(
'
base64
'
),
path
));
function
toResource
(
self
,
path
)
{
return
URI
.
file
(
join
(
'
C:
\\
'
,
new
Buffer
(
self
.
test
.
fullTitle
()).
toString
(
'
base64
'
),
path
));
}
class
ServiceAccessor
{
...
...
@@ -44,9 +44,9 @@ suite('Files - FileEditorInput', () => {
});
test
(
'
Basics
'
,
function
(
done
)
{
let
input
=
instantiationService
.
createInstance
(
FileEditorInput
,
toResource
.
call
(
this
,
'
/foo/bar/file.js
'
),
void
0
);
const
otherInput
=
instantiationService
.
createInstance
(
FileEditorInput
,
toResource
.
call
(
this
,
'
foo/bar/otherfile.js
'
),
void
0
);
const
otherInputSame
=
instantiationService
.
createInstance
(
FileEditorInput
,
toResource
.
call
(
this
,
'
foo/bar/file.js
'
),
void
0
);
let
input
=
instantiationService
.
createInstance
(
FileEditorInput
,
toResource
(
this
,
'
/foo/bar/file.js
'
),
void
0
);
const
otherInput
=
instantiationService
.
createInstance
(
FileEditorInput
,
toResource
(
this
,
'
foo/bar/otherfile.js
'
),
void
0
);
const
otherInputSame
=
instantiationService
.
createInstance
(
FileEditorInput
,
toResource
(
this
,
'
foo/bar/file.js
'
),
void
0
);
assert
(
input
.
matches
(
input
));
assert
(
input
.
matches
(
otherInputSame
));
...
...
@@ -58,13 +58,13 @@ suite('Files - FileEditorInput', () => {
assert
.
strictEqual
(
'
file.js
'
,
input
.
getName
());
assert
.
strictEqual
(
toResource
.
call
(
this
,
'
/foo/bar/file.js
'
).
fsPath
,
input
.
getResource
().
fsPath
);
assert
.
strictEqual
(
toResource
(
this
,
'
/foo/bar/file.js
'
).
fsPath
,
input
.
getResource
().
fsPath
);
assert
(
input
.
getResource
()
instanceof
URI
);
input
=
instantiationService
.
createInstance
(
FileEditorInput
,
toResource
.
call
(
this
,
'
/foo/bar.html
'
),
void
0
);
input
=
instantiationService
.
createInstance
(
FileEditorInput
,
toResource
(
this
,
'
/foo/bar.html
'
),
void
0
);
const
inputToResolve
:
FileEditorInput
=
instantiationService
.
createInstance
(
FileEditorInput
,
toResource
.
call
(
this
,
'
/foo/bar/file.js
'
),
void
0
);
const
sameOtherInput
:
FileEditorInput
=
instantiationService
.
createInstance
(
FileEditorInput
,
toResource
.
call
(
this
,
'
/foo/bar/file.js
'
),
void
0
);
const
inputToResolve
:
FileEditorInput
=
instantiationService
.
createInstance
(
FileEditorInput
,
toResource
(
this
,
'
/foo/bar/file.js
'
),
void
0
);
const
sameOtherInput
:
FileEditorInput
=
instantiationService
.
createInstance
(
FileEditorInput
,
toResource
(
this
,
'
/foo/bar/file.js
'
),
void
0
);
return
inputToResolve
.
resolve
(
true
).
then
(
resolved
=>
{
assert
.
ok
(
inputToResolve
.
isResolved
());
...
...
@@ -108,10 +108,10 @@ suite('Files - FileEditorInput', () => {
});
test
(
'
matches
'
,
function
()
{
const
input1
=
instantiationService
.
createInstance
(
FileEditorInput
,
toResource
.
call
(
this
,
'
/foo/bar/updatefile.js
'
),
void
0
);
const
input2
=
instantiationService
.
createInstance
(
FileEditorInput
,
toResource
.
call
(
this
,
'
/foo/bar/updatefile.js
'
),
void
0
);
const
input3
=
instantiationService
.
createInstance
(
FileEditorInput
,
toResource
.
call
(
this
,
'
/foo/bar/other.js
'
),
void
0
);
const
input2Upper
=
instantiationService
.
createInstance
(
FileEditorInput
,
toResource
.
call
(
this
,
'
/foo/bar/UPDATEFILE.js
'
),
void
0
);
const
input1
=
instantiationService
.
createInstance
(
FileEditorInput
,
toResource
(
this
,
'
/foo/bar/updatefile.js
'
),
void
0
);
const
input2
=
instantiationService
.
createInstance
(
FileEditorInput
,
toResource
(
this
,
'
/foo/bar/updatefile.js
'
),
void
0
);
const
input3
=
instantiationService
.
createInstance
(
FileEditorInput
,
toResource
(
this
,
'
/foo/bar/other.js
'
),
void
0
);
const
input2Upper
=
instantiationService
.
createInstance
(
FileEditorInput
,
toResource
(
this
,
'
/foo/bar/UPDATEFILE.js
'
),
void
0
);
assert
.
strictEqual
(
input1
.
matches
(
null
),
false
);
assert
.
strictEqual
(
input1
.
matches
(
input1
),
true
);
...
...
@@ -122,7 +122,7 @@ suite('Files - FileEditorInput', () => {
});
test
(
'
getEncoding/setEncoding
'
,
function
(
done
)
{
const
input
=
instantiationService
.
createInstance
(
FileEditorInput
,
toResource
.
call
(
this
,
'
/foo/bar/updatefile.js
'
),
void
0
);
const
input
=
instantiationService
.
createInstance
(
FileEditorInput
,
toResource
(
this
,
'
/foo/bar/updatefile.js
'
),
void
0
);
input
.
setEncoding
(
'
utf16
'
,
EncodingMode
.
Encode
);
assert
.
equal
(
input
.
getEncoding
(),
'
utf16
'
);
...
...
@@ -137,7 +137,7 @@ suite('Files - FileEditorInput', () => {
});
test
(
'
save
'
,
function
(
done
)
{
const
input
=
instantiationService
.
createInstance
(
FileEditorInput
,
toResource
.
call
(
this
,
'
/foo/bar/updatefile.js
'
),
void
0
);
const
input
=
instantiationService
.
createInstance
(
FileEditorInput
,
toResource
(
this
,
'
/foo/bar/updatefile.js
'
),
void
0
);
return
input
.
resolve
(
true
).
then
((
resolved
:
TextFileEditorModel
)
=>
{
resolved
.
textEditorModel
.
setValue
(
'
changed
'
);
...
...
@@ -154,7 +154,7 @@ suite('Files - FileEditorInput', () => {
});
test
(
'
revert
'
,
function
(
done
)
{
const
input
=
instantiationService
.
createInstance
(
FileEditorInput
,
toResource
.
call
(
this
,
'
/foo/bar/updatefile.js
'
),
void
0
);
const
input
=
instantiationService
.
createInstance
(
FileEditorInput
,
toResource
(
this
,
'
/foo/bar/updatefile.js
'
),
void
0
);
return
input
.
resolve
(
true
).
then
((
resolved
:
TextFileEditorModel
)
=>
{
resolved
.
textEditorModel
.
setValue
(
'
changed
'
);
...
...
@@ -171,7 +171,7 @@ suite('Files - FileEditorInput', () => {
});
test
(
'
resolve handles binary files
'
,
function
(
done
)
{
const
input
=
instantiationService
.
createInstance
(
FileEditorInput
,
toResource
.
call
(
this
,
'
/foo/bar/updatefile.js
'
),
void
0
);
const
input
=
instantiationService
.
createInstance
(
FileEditorInput
,
toResource
(
this
,
'
/foo/bar/updatefile.js
'
),
void
0
);
accessor
.
textFileService
.
setResolveTextContentErrorOnce
(
new
FileOperationError
(
'
error
'
,
FileOperationResult
.
FILE_IS_BINARY
));
...
...
@@ -185,7 +185,7 @@ suite('Files - FileEditorInput', () => {
});
test
(
'
disposes model when not open anymore
'
,
function
(
done
)
{
const
resource
=
toResource
.
call
(
this
,
'
/path/index.txt
'
);
const
resource
=
toResource
(
this
,
'
/path/index.txt
'
);
const
input
=
createFileInput
(
instantiationService
,
resource
);
...
...
src/vs/workbench/parts/files/test/browser/fileEditorTracker.test.ts
浏览文件 @
762cc769
...
...
@@ -27,8 +27,8 @@ class TestFileEditorTracker extends FileEditorTracker {
}
}
function
toResource
(
path
)
{
return
URI
.
file
(
join
(
'
C:
\\
'
,
new
Buffer
(
this
.
test
.
fullTitle
()).
toString
(
'
base64
'
),
path
));
function
toResource
(
self
:
any
,
path
:
string
)
{
return
URI
.
file
(
join
(
'
C:
\\
'
,
new
Buffer
(
self
.
test
.
fullTitle
()).
toString
(
'
base64
'
),
path
));
}
class
ServiceAccessor
{
...
...
@@ -58,8 +58,8 @@ suite('Files - FileEditorTracker', () => {
const
tracker
=
instantiationService
.
createInstance
(
FileEditorTracker
);
assert
.
ok
(
tracker
);
const
parent
=
toResource
.
call
(
this
,
'
/foo/bar
'
);
const
resource
=
toResource
.
call
(
this
,
'
/foo/bar/updatefile.js
'
);
const
parent
=
toResource
(
this
,
'
/foo/bar
'
);
const
resource
=
toResource
(
this
,
'
/foo/bar/updatefile.js
'
);
let
input
=
instantiationService
.
createInstance
(
FileEditorInput
,
resource
,
void
0
);
group
.
openEditor
(
input
);
...
...
@@ -72,7 +72,7 @@ suite('Files - FileEditorTracker', () => {
input
=
instantiationService
.
createInstance
(
FileEditorInput
,
resource
,
void
0
);
group
.
openEditor
(
input
);
const
other
=
toResource
.
call
(
this
,
'
/foo/barfoo
'
);
const
other
=
toResource
(
this
,
'
/foo/barfoo
'
);
accessor
.
fileService
.
fireAfterOperation
(
new
FileOperationEvent
(
other
,
FileOperation
.
DELETE
));
assert
.
ok
(
!
input
.
isDisposed
());
...
...
@@ -81,7 +81,7 @@ suite('Files - FileEditorTracker', () => {
assert
.
ok
(
input
.
isDisposed
());
// Move
const
to
=
toResource
.
call
(
this
,
'
/foo/barfoo/change.js
'
);
const
to
:
any
=
toResource
(
this
,
'
/foo/barfoo/change.js
'
);
accessor
.
fileService
.
fireAfterOperation
(
new
FileOperationEvent
(
resource
,
FileOperation
.
MOVE
,
to
));
assert
.
ok
(
input
.
isDisposed
());
...
...
@@ -96,8 +96,8 @@ suite('Files - FileEditorTracker', () => {
tracker
.
setCloseOnFileDelete
(
false
);
assert
.
ok
(
tracker
);
const
parent
=
toResource
.
call
(
this
,
'
/foo/bar
'
);
const
resource
=
toResource
.
call
(
this
,
'
/foo/bar/updatefile.js
'
);
const
parent
=
toResource
(
this
,
'
/foo/bar
'
);
const
resource
=
toResource
(
this
,
'
/foo/bar/updatefile.js
'
);
let
input
=
instantiationService
.
createInstance
(
FileEditorInput
,
resource
,
void
0
);
group
.
openEditor
(
input
);
...
...
@@ -110,7 +110,7 @@ suite('Files - FileEditorTracker', () => {
input
=
instantiationService
.
createInstance
(
FileEditorInput
,
resource
,
void
0
);
group
.
openEditor
(
input
);
const
other
=
toResource
.
call
(
this
,
'
/foo/barfoo
'
);
const
other
=
toResource
(
this
,
'
/foo/barfoo
'
);
accessor
.
fileService
.
fireAfterOperation
(
new
FileOperationEvent
(
other
,
FileOperation
.
DELETE
));
assert
.
ok
(
!
input
.
isDisposed
());
...
...
@@ -119,7 +119,7 @@ suite('Files - FileEditorTracker', () => {
assert
.
ok
(
input
.
isDisposed
());
// Move
const
to
=
toResource
.
call
(
this
,
'
/foo/barfoo/change.js
'
);
const
to
:
any
=
toResource
(
this
,
'
/foo/barfoo/change.js
'
);
accessor
.
fileService
.
fireAfterOperation
(
new
FileOperationEvent
(
resource
,
FileOperation
.
MOVE
,
to
));
assert
.
ok
(
input
.
isDisposed
());
...
...
@@ -133,8 +133,8 @@ suite('Files - FileEditorTracker', () => {
const
tracker
=
instantiationService
.
createInstance
(
FileEditorTracker
);
assert
.
ok
(
tracker
);
const
parent
=
toResource
.
call
(
this
,
'
/foo/bar
'
);
const
resource
=
toResource
.
call
(
this
,
'
/foo/bar/updatefile.js
'
);
const
parent
=
toResource
(
this
,
'
/foo/bar
'
);
const
resource
=
toResource
(
this
,
'
/foo/bar/updatefile.js
'
);
let
input
=
instantiationService
.
createInstance
(
FileEditorInput
,
resource
,
void
0
);
group
.
openEditor
(
input
);
...
...
@@ -149,7 +149,7 @@ suite('Files - FileEditorTracker', () => {
input
=
instantiationService
.
createInstance
(
FileEditorInput
,
resource
,
void
0
);
group
.
openEditor
(
input
);
const
other
=
toResource
.
call
(
this
,
'
/foo/barfoo
'
);
const
other
=
toResource
(
this
,
'
/foo/barfoo
'
);
accessor
.
fileService
.
fireFileChanges
(
new
FileChangesEvent
([{
resource
:
other
,
type
:
FileChangeType
.
DELETED
}]));
assert
.
ok
(
!
input
.
isDisposed
());
...
...
@@ -173,7 +173,7 @@ suite('Files - FileEditorTracker', () => {
tracker
.
setCloseOnFileDelete
(
false
);
assert
.
ok
(
tracker
);
const
resource
=
toResource
.
call
(
this
,
'
/foo/bar/updatefile.js
'
);
const
resource
=
toResource
(
this
,
'
/foo/bar/updatefile.js
'
);
let
input
=
instantiationService
.
createInstance
(
FileEditorInput
,
resource
,
void
0
);
group
.
openEditor
(
input
);
...
...
@@ -187,7 +187,7 @@ suite('Files - FileEditorTracker', () => {
test
(
'
file change event updates model
'
,
function
(
done
)
{
const
tracker
=
instantiationService
.
createInstance
(
FileEditorTracker
);
const
resource
=
toResource
.
call
(
this
,
'
/path/index.txt
'
);
const
resource
=
toResource
(
this
,
'
/path/index.txt
'
);
accessor
.
textFileService
.
models
.
loadOrCreate
(
resource
).
then
((
model
:
TextFileEditorModel
)
=>
{
model
.
textEditorModel
.
setValue
(
'
Super Good
'
);
...
...
src/vs/workbench/services/editor/test/browser/editorService.test.ts
浏览文件 @
762cc769
...
...
@@ -32,8 +32,8 @@ function toResource(path) {
return
URI
.
from
({
scheme
:
'
custom
'
,
path
});
}
function
toFileResource
(
path
)
{
return
URI
.
file
(
paths
.
join
(
'
C:
\\
'
,
new
Buffer
(
this
.
test
.
fullTitle
()).
toString
(
'
base64
'
),
path
));
function
toFileResource
(
self
,
path
)
{
return
URI
.
file
(
paths
.
join
(
'
C:
\\
'
,
new
Buffer
(
self
.
test
.
fullTitle
()).
toString
(
'
base64
'
),
path
));
}
class
TestEditorPart
implements
IEditorPart
{
...
...
@@ -94,7 +94,7 @@ suite('WorkbenchEditorService', () => {
test
(
'
basics
'
,
function
()
{
let
instantiationService
=
workbenchInstantiationService
();
let
activeInput
:
EditorInput
=
instantiationService
.
createInstance
(
FileEditorInput
,
toFileResource
.
call
(
this
,
'
/something.js
'
),
void
0
);
let
activeInput
:
EditorInput
=
instantiationService
.
createInstance
(
FileEditorInput
,
toFileResource
(
this
,
'
/something.js
'
),
void
0
);
let
testEditorPart
=
new
TestEditorPart
();
testEditorPart
.
setActiveEditorInput
(
activeInput
);
...
...
@@ -121,12 +121,12 @@ suite('WorkbenchEditorService', () => {
});
// Open Untyped Input (file)
service
.
openEditor
({
resource
:
toFileResource
.
call
(
this
,
'
/index.html
'
),
options
:
{
selection
:
{
startLineNumber
:
1
,
startColumn
:
1
}
}
}).
then
((
editor
)
=>
{
service
.
openEditor
({
resource
:
toFileResource
(
this
,
'
/index.html
'
),
options
:
{
selection
:
{
startLineNumber
:
1
,
startColumn
:
1
}
}
}).
then
((
editor
)
=>
{
assert
.
strictEqual
(
editor
,
activeEditor
);
assert
(
openedEditorInput
instanceof
FileEditorInput
);
let
contentInput
=
<
FileEditorInput
>
openedEditorInput
;
assert
.
strictEqual
(
contentInput
.
getResource
().
fsPath
,
toFileResource
.
call
(
this
,
'
/index.html
'
).
fsPath
);
assert
.
strictEqual
(
contentInput
.
getResource
().
fsPath
,
toFileResource
(
this
,
'
/index.html
'
).
fsPath
);
assert
(
openedEditorOptions
instanceof
TextEditorOptions
);
let
textEditorOptions
=
<
TextEditorOptions
>
openedEditorOptions
;
...
...
@@ -134,7 +134,7 @@ suite('WorkbenchEditorService', () => {
});
// Open Untyped Input (file, encoding)
service
.
openEditor
({
resource
:
toFileResource
.
call
(
this
,
'
/index.html
'
),
encoding
:
'
utf16le
'
,
options
:
{
selection
:
{
startLineNumber
:
1
,
startColumn
:
1
}
}
}).
then
((
editor
)
=>
{
service
.
openEditor
({
resource
:
toFileResource
(
this
,
'
/index.html
'
),
encoding
:
'
utf16le
'
,
options
:
{
selection
:
{
startLineNumber
:
1
,
startColumn
:
1
}
}
}).
then
((
editor
)
=>
{
assert
.
strictEqual
(
editor
,
activeEditor
);
assert
(
openedEditorInput
instanceof
FileEditorInput
);
...
...
@@ -179,18 +179,18 @@ suite('WorkbenchEditorService', () => {
test
(
'
caching
'
,
function
()
{
let
instantiationService
=
workbenchInstantiationService
();
let
activeInput
:
EditorInput
=
instantiationService
.
createInstance
(
FileEditorInput
,
toFileResource
.
call
(
this
,
'
/something.js
'
),
void
0
);
let
activeInput
:
EditorInput
=
instantiationService
.
createInstance
(
FileEditorInput
,
toFileResource
(
this
,
'
/something.js
'
),
void
0
);
let
testEditorPart
=
new
TestEditorPart
();
testEditorPart
.
setActiveEditorInput
(
activeInput
);
let
service
:
WorkbenchEditorService
=
<
any
>
instantiationService
.
createInstance
(
<
any
>
WorkbenchEditorService
,
testEditorPart
);
// Cached Input (Files)
const
fileResource1
=
toFileResource
.
call
(
this
,
'
/foo/bar/cache1.js
'
);
const
fileResource1
=
toFileResource
(
this
,
'
/foo/bar/cache1.js
'
);
const
fileInput1
=
service
.
createInput
({
resource
:
fileResource1
});
assert
.
ok
(
fileInput1
);
const
fileResource2
=
toFileResource
.
call
(
this
,
'
/foo/bar/cache2.js
'
);
const
fileResource2
=
toFileResource
(
this
,
'
/foo/bar/cache2.js
'
);
const
fileInput2
=
service
.
createInput
({
resource
:
fileResource2
});
assert
.
ok
(
fileInput2
);
...
...
@@ -232,7 +232,7 @@ suite('WorkbenchEditorService', () => {
test
(
'
delegate
'
,
function
(
done
)
{
let
instantiationService
=
workbenchInstantiationService
();
let
activeInput
:
EditorInput
=
instantiationService
.
createInstance
(
FileEditorInput
,
toFileResource
.
call
(
this
,
'
/something.js
'
),
void
0
);
let
activeInput
:
EditorInput
=
instantiationService
.
createInstance
(
FileEditorInput
,
toFileResource
(
this
,
'
/something.js
'
),
void
0
);
let
testEditorPart
=
new
TestEditorPart
();
testEditorPart
.
setActiveEditorInput
(
activeInput
);
...
...
src/vs/workbench/services/files/node/fileService.ts
浏览文件 @
762cc769
...
...
@@ -919,11 +919,11 @@ export class StatResolver {
clb
(
null
,
null
);
// return - we might not have permissions to read the folder or stat the file
},
function
stat
():
void
{
function
stat
(
this
:
any
):
void
{
fs
.
stat
(
fileResource
.
fsPath
,
this
);
},
function
countChildren
(
fsstat
:
fs
.
Stats
):
void
{
function
countChildren
(
this
:
any
,
fsstat
:
fs
.
Stats
):
void
{
fileStat
=
fsstat
;
if
(
fileStat
.
isDirectory
())
{
...
...
src/vs/workbench/services/textfile/test/textFileService.test.ts
浏览文件 @
762cc769
...
...
@@ -371,7 +371,7 @@ suite('Files - TextFileService', () => {
});
});
function
hotExitTest
(
setting
:
string
,
shutdownReason
:
ShutdownReason
,
multipleWindows
:
boolean
,
workspace
:
true
,
shouldVeto
:
boolean
,
done
:
()
=>
void
):
void
{
function
hotExitTest
(
this
:
any
,
setting
:
string
,
shutdownReason
:
ShutdownReason
,
multipleWindows
:
boolean
,
workspace
:
true
,
shouldVeto
:
boolean
,
done
:
()
=>
void
):
void
{
model
=
instantiationService
.
createInstance
(
TextFileEditorModel
,
toResource
.
call
(
this
,
'
/path/file.txt
'
),
'
utf8
'
);
(
<
TextFileEditorModelManager
>
accessor
.
textFileService
.
models
).
add
(
model
.
getResource
(),
model
);
...
...
src/vs/workbench/services/themes/electron-browser/workbenchThemeService.ts
浏览文件 @
762cc769
...
...
@@ -477,7 +477,7 @@ export class WorkbenchThemeService implements IWorkbenchThemeService {
}
}
function
_applyIconTheme
(
data
:
FileIconThemeData
,
onApply
:
(
theme
:
FileIconThemeData
)
=>
TPromise
<
IFileIconTheme
>
):
TPromise
<
IFileIconTheme
>
{
function
_applyIconTheme
(
this
:
any
,
data
:
FileIconThemeData
,
onApply
:
(
theme
:
FileIconThemeData
)
=>
TPromise
<
IFileIconTheme
>
):
TPromise
<
IFileIconTheme
>
{
if
(
!
data
)
{
_applyRules
(
''
,
iconThemeRulesClassName
);
return
TPromise
.
as
(
onApply
(
data
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录