Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
1ed63585
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,发现更多精彩内容 >>
提交
1ed63585
编写于
11月 07, 2018
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
debt - more TPromise removal #53526
上级
ddd7926f
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
27 addition
and
35 deletion
+27
-35
src/vs/base/test/node/pfs.test.ts
src/vs/base/test/node/pfs.test.ts
+3
-4
src/vs/base/test/node/utils.ts
src/vs/base/test/node/utils.ts
+3
-4
src/vs/editor/standalone/browser/simpleServices.ts
src/vs/editor/standalone/browser/simpleServices.ts
+8
-9
src/vs/platform/url/node/urlIpc.ts
src/vs/platform/url/node/urlIpc.ts
+2
-3
src/vs/workbench/parts/codeEditor/electron-browser/textMate/inspectTMScopes.ts
...s/codeEditor/electron-browser/textMate/inspectTMScopes.ts
+1
-2
src/vs/workbench/parts/html/electron-browser/htmlPreviewPart.ts
.../workbench/parts/html/electron-browser/htmlPreviewPart.ts
+3
-4
src/vs/workbench/services/textMate/electron-browser/TMSyntax.ts
.../workbench/services/textMate/electron-browser/TMSyntax.ts
+6
-7
src/vs/workbench/services/textMate/electron-browser/textMateService.ts
...nch/services/textMate/electron-browser/textMateService.ts
+1
-2
未找到文件。
src/vs/base/test/node/pfs.test.ts
浏览文件 @
1ed63585
...
...
@@ -2,7 +2,6 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
*
as
assert
from
'
assert
'
;
import
*
as
os
from
'
os
'
;
...
...
@@ -46,7 +45,7 @@ suite('PFS', () => {
return
pfs
.
mkdirp
(
newDir
,
493
).
then
(()
=>
{
assert
.
ok
(
fs
.
existsSync
(
newDir
));
return
TPromise
.
join
([
return
Promise
.
all
([
pfs
.
writeFile
(
testFile1
,
'
Hello World 1
'
,
null
),
pfs
.
writeFile
(
testFile2
,
'
Hello World 2
'
,
null
),
pfs
.
writeFile
(
testFile3
,
'
Hello World 3
'
,
null
),
...
...
@@ -73,7 +72,7 @@ suite('PFS', () => {
return
pfs
.
mkdirp
(
newDir
,
493
).
then
(()
=>
{
assert
.
ok
(
fs
.
existsSync
(
newDir
));
return
TPromise
.
join
([
return
Promise
.
all
([
pfs
.
writeFile
(
testFile
,
'
Hello World 1
'
,
null
),
pfs
.
writeFile
(
testFile
,
'
Hello World 2
'
,
null
),
timeout
(
10
).
then
(()
=>
pfs
.
writeFile
(
testFile
,
'
Hello World 3
'
,
null
)),
...
...
@@ -119,4 +118,4 @@ suite('PFS', () => {
});
});
});
});
\ No newline at end of file
});
src/vs/base/test/node/utils.ts
浏览文件 @
1ed63585
...
...
@@ -3,7 +3,6 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
generateUuid
}
from
'
vs/base/common/uuid
'
;
import
{
join
}
from
'
path
'
;
import
{
tmpdir
}
from
'
os
'
;
...
...
@@ -11,10 +10,10 @@ import { mkdirp, del } from 'vs/base/node/pfs';
export
interface
ITestFileResult
{
testFile
:
string
;
cleanUp
:
()
=>
T
Promis
e
<
void
>
;
cleanUp
:
()
=>
T
henabl
e
<
void
>
;
}
export
function
testFile
(
folder
:
string
,
file
:
string
):
T
Promis
e
<
ITestFileResult
>
{
export
function
testFile
(
folder
:
string
,
file
:
string
):
T
henabl
e
<
ITestFileResult
>
{
const
id
=
generateUuid
();
const
parentDir
=
join
(
tmpdir
(),
'
vsctests
'
,
id
);
const
newDir
=
join
(
parentDir
,
'
config
'
,
id
);
...
...
@@ -26,4 +25,4 @@ export function testFile(folder: string, file: string): TPromise<ITestFileResult
cleanUp
:
()
=>
del
(
parentDir
,
tmpdir
())
}
as
ITestFileResult
;
});
}
\ No newline at end of file
}
src/vs/editor/standalone/browser/simpleServices.ts
浏览文件 @
1ed63585
...
...
@@ -12,7 +12,6 @@ import { IDisposable, IReference, ImmortalReference, combinedDisposable, toDispo
import
{
OS
,
isLinux
,
isMacintosh
}
from
'
vs/base/common/platform
'
;
import
Severity
from
'
vs/base/common/severity
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
ICodeEditor
,
IDiffEditor
,
isCodeEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
IBulkEditOptions
,
IBulkEditResult
,
IBulkEditService
}
from
'
vs/editor/browser/services/bulkEditService
'
;
import
{
isDiffEditorConfigurationKey
,
isEditorConfigurationKey
}
from
'
vs/editor/common/config/commonEditorConfig
'
;
...
...
@@ -58,8 +57,8 @@ export class SimpleModel implements ITextEditorModel {
return
this
.
_onDispose
.
event
;
}
public
load
():
T
Promise
<
SimpleModel
>
{
return
TPromise
.
as
(
this
);
public
load
():
Promise
<
SimpleModel
>
{
return
Promise
.
resolve
(
this
);
}
public
get
textEditorModel
():
ITextModel
{
...
...
@@ -98,7 +97,7 @@ export class SimpleEditorModelResolverService implements ITextModelService {
this
.
editor
=
editor
;
}
public
createModelReference
(
resource
:
URI
):
T
Promise
<
IReference
<
ITextEditorModel
>>
{
public
createModelReference
(
resource
:
URI
):
Promise
<
IReference
<
ITextEditorModel
>>
{
let
model
:
ITextModel
;
model
=
withTypedEditor
(
this
.
editor
,
...
...
@@ -107,10 +106,10 @@ export class SimpleEditorModelResolverService implements ITextModelService {
);
if
(
!
model
)
{
return
TPromise
.
as
(
new
ImmortalReference
(
null
));
return
Promise
.
resolve
(
new
ImmortalReference
(
null
));
}
return
TPromise
.
as
(
new
ImmortalReference
(
new
SimpleModel
(
model
)));
return
Promise
.
resolve
(
new
ImmortalReference
(
new
SimpleModel
(
model
)));
}
public
registerTextModelContentProvider
(
scheme
:
string
,
provider
:
ITextModelContentProvider
):
IDisposable
{
...
...
@@ -482,11 +481,11 @@ export class StandaloneTelemetryService implements ITelemetryService {
public
isOptedIn
=
false
;
public
publicLog
(
eventName
:
string
,
data
?:
any
):
T
Promise
<
void
>
{
return
TPromise
.
wrap
<
void
>
(
null
);
public
publicLog
(
eventName
:
string
,
data
?:
any
):
Promise
<
void
>
{
return
Promise
.
resolve
(
null
);
}
public
getTelemetryInfo
():
T
Promise
<
ITelemetryInfo
>
{
public
getTelemetryInfo
():
Promise
<
ITelemetryInfo
>
{
return
null
;
}
}
...
...
src/vs/platform/url/node/urlIpc.ts
浏览文件 @
1ed63585
...
...
@@ -3,7 +3,6 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
IChannel
}
from
'
vs/base/parts/ipc/node/ipc
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
...
...
@@ -73,7 +72,7 @@ export class URLHandlerChannelClient implements IURLHandler {
constructor
(
private
channel
:
IChannel
)
{
}
handleURL
(
uri
:
URI
):
T
Promis
e
<
boolean
>
{
return
TPromise
.
wrap
(
this
.
channel
.
call
(
'
handleURL
'
,
uri
.
toJSON
()
));
handleURL
(
uri
:
URI
):
T
henabl
e
<
boolean
>
{
return
this
.
channel
.
call
(
'
handleURL
'
,
uri
.
toJSON
(
));
}
}
src/vs/workbench/parts/codeEditor/electron-browser/textMate/inspectTMScopes.ts
浏览文件 @
1ed63585
...
...
@@ -11,7 +11,6 @@ import { Color } from 'vs/base/common/color';
import
{
KeyCode
}
from
'
vs/base/common/keyCodes
'
;
import
{
Disposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
escape
}
from
'
vs/base/common/strings
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
ContentWidgetPositionPreference
,
IActiveCodeEditor
,
ICodeEditor
,
IContentWidget
,
IContentWidgetPosition
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
EditorAction
,
ServicesAccessor
,
registerEditorAction
,
registerEditorContribution
}
from
'
vs/editor/browser/editorExtensions
'
;
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
...
...
@@ -180,7 +179,7 @@ class InspectTMScopesWidget extends Disposable implements IContentWidget {
private
readonly
_notificationService
:
INotificationService
;
private
readonly
_model
:
ITextModel
;
private
readonly
_domNode
:
HTMLElement
;
private
readonly
_grammar
:
T
Promise
<
IGrammar
>
;
private
readonly
_grammar
:
Promise
<
IGrammar
>
;
constructor
(
editor
:
IActiveCodeEditor
,
...
...
src/vs/workbench/parts/html/electron-browser/htmlPreviewPart.ts
浏览文件 @
1ed63585
...
...
@@ -4,7 +4,6 @@
*--------------------------------------------------------------------------------------------*/
import
{
localize
}
from
'
vs/nls
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
ITextModel
}
from
'
vs/editor/common/model
'
;
import
{
Disposable
,
IDisposable
,
dispose
,
IReference
}
from
'
vs/base/common/lifecycle
'
;
import
{
EditorOptions
,
EditorInput
,
IEditorMemento
}
from
'
vs/workbench/common/editor
'
;
...
...
@@ -179,7 +178,7 @@ export class HtmlPreviewPart extends BaseWebviewEditor {
public
setInput
(
input
:
EditorInput
,
options
:
EditorOptions
,
token
:
CancellationToken
):
Thenable
<
void
>
{
if
(
this
.
input
&&
this
.
input
.
matches
(
input
)
&&
this
.
_hasValidModel
()
&&
this
.
input
instanceof
HtmlInput
&&
input
instanceof
HtmlInput
&&
areHtmlInputOptionsEqual
(
this
.
input
.
options
,
input
.
options
))
{
return
TPromise
.
as
(
undefined
);
return
Promise
.
resolve
(
undefined
);
}
let
oldOptions
:
HtmlInputOptions
|
undefined
=
undefined
;
...
...
@@ -197,7 +196,7 @@ export class HtmlPreviewPart extends BaseWebviewEditor {
this
.
_modelChangeSubscription
.
dispose
();
if
(
!
(
input
instanceof
HtmlInput
))
{
return
TPromise
.
wrapError
<
void
>
(
new
Error
(
'
Invalid input
'
));
return
Promise
.
reject
(
new
Error
(
'
Invalid input
'
));
}
return
super
.
setInput
(
input
,
options
,
token
).
then
(()
=>
{
...
...
@@ -213,7 +212,7 @@ export class HtmlPreviewPart extends BaseWebviewEditor {
}
if
(
!
this
.
model
)
{
return
TPromise
.
wrapError
<
void
>
(
new
Error
(
localize
(
'
html.voidInput
'
,
"
Invalid editor input.
"
)));
return
Promise
.
reject
(
new
Error
(
localize
(
'
html.voidInput
'
,
"
Invalid editor input.
"
)));
}
if
(
oldOptions
&&
!
areHtmlInputOptionsEqual
(
oldOptions
,
input
.
options
))
{
...
...
src/vs/workbench/services/textMate/electron-browser/TMSyntax.ts
浏览文件 @
1ed63585
...
...
@@ -11,7 +11,6 @@ import { Emitter, Event } from 'vs/base/common/event';
import
*
as
resources
from
'
vs/base/common/resources
'
;
import
*
as
types
from
'
vs/base/common/types
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
TokenizationResult
,
TokenizationResult2
}
from
'
vs/editor/common/core/token
'
;
import
{
IState
,
ITokenizationSupport
,
LanguageId
,
TokenMetadata
,
TokenizationRegistry
}
from
'
vs/editor/common/modes
'
;
import
{
nullTokenize2
}
from
'
vs/editor/common/modes/nullMode
'
;
...
...
@@ -136,7 +135,7 @@ interface ICreateGrammarResult {
export
class
TextMateService
implements
ITextMateService
{
public
_serviceBrand
:
any
;
private
_grammarRegistry
:
T
Promise
<
[
Registry
,
StackElement
]
>
;
private
_grammarRegistry
:
Promise
<
[
Registry
,
StackElement
]
>
;
private
_modeService
:
IModeService
;
private
_themeService
:
IWorkbenchThemeService
;
private
_fileService
:
IFileService
;
...
...
@@ -213,9 +212,9 @@ export class TextMateService implements ITextMateService {
});
}
private
_getOrCreateGrammarRegistry
():
T
Promise
<
[
Registry
,
StackElement
]
>
{
private
_getOrCreateGrammarRegistry
():
Promise
<
[
Registry
,
StackElement
]
>
{
if
(
!
this
.
_grammarRegistry
)
{
this
.
_grammarRegistry
=
TPromise
.
wrap
(
import
(
'
vscode-textmate
'
)
).
then
(({
Registry
,
INITIAL
,
parseRawGrammar
})
=>
{
this
.
_grammarRegistry
=
import
(
'
vscode-textmate
'
).
then
(({
Registry
,
INITIAL
,
parseRawGrammar
})
=>
{
const
grammarRegistry
=
new
Registry
({
loadGrammar
:
(
scopeName
:
string
)
=>
{
const
location
=
this
.
_scopeRegistry
.
getGrammarLocation
(
scopeName
);
...
...
@@ -369,16 +368,16 @@ export class TextMateService implements ITextMateService {
return
result
;
}
public
createGrammar
(
modeId
:
string
):
T
Promise
<
IGrammar
>
{
public
createGrammar
(
modeId
:
string
):
Promise
<
IGrammar
>
{
return
this
.
_createGrammar
(
modeId
).
then
(
r
=>
r
.
grammar
);
}
private
_createGrammar
(
modeId
:
string
):
T
Promise
<
ICreateGrammarResult
>
{
private
_createGrammar
(
modeId
:
string
):
Promise
<
ICreateGrammarResult
>
{
let
scopeName
=
this
.
_languageToScope
.
get
(
modeId
);
let
languageRegistration
=
this
.
_scopeRegistry
.
getLanguageRegistration
(
scopeName
);
if
(
!
languageRegistration
)
{
// No TM grammar defined
return
TPromise
.
wrapError
<
ICreateGrammarResult
>
(
new
Error
(
nls
.
localize
(
'
no-tm-grammar
'
,
"
No TM Grammar registered for this language.
"
)));
return
Promise
.
reject
(
new
Error
(
nls
.
localize
(
'
no-tm-grammar
'
,
"
No TM Grammar registered for this language.
"
)));
}
let
embeddedLanguages
=
this
.
_resolveEmbeddedLanguages
(
languageRegistration
.
embeddedLanguages
);
let
rawInjectedEmbeddedLanguages
=
this
.
_injectedEmbeddedLanguages
[
scopeName
];
...
...
src/vs/workbench/services/textMate/electron-browser/textMateService.ts
浏览文件 @
1ed63585
...
...
@@ -4,7 +4,6 @@
*--------------------------------------------------------------------------------------------*/
import
{
Event
}
from
'
vs/base/common/event
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
LanguageId
}
from
'
vs/editor/common/modes
'
;
import
{
createDecorator
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IGrammar
}
from
'
vscode-textmate
'
;
...
...
@@ -16,5 +15,5 @@ export interface ITextMateService {
onDidEncounterLanguage
:
Event
<
LanguageId
>
;
createGrammar
(
modeId
:
string
):
T
Promise
<
IGrammar
>
;
createGrammar
(
modeId
:
string
):
Promise
<
IGrammar
>
;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录