Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
fdf2dec5
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,发现更多精彩内容 >>
提交
fdf2dec5
编写于
10月 09, 2018
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove usage of TPromise from public editor API (#53526)
上级
6daba771
变更
10
显示空白变更内容
内联
并排
Showing
10 changed file
with
19 addition
and
27 deletion
+19
-27
build/monaco/api.js
build/monaco/api.js
+0
-1
build/monaco/api.ts
build/monaco/api.ts
+0
-1
src/vs/editor/browser/widget/codeEditorWidget.ts
src/vs/editor/browser/widget/codeEditorWidget.ts
+2
-2
src/vs/editor/common/editorAction.ts
src/vs/editor/common/editorAction.ts
+5
-6
src/vs/editor/common/editorCommon.ts
src/vs/editor/common/editorCommon.ts
+1
-2
src/vs/editor/standalone/browser/colorizer.ts
src/vs/editor/standalone/browser/colorizer.ts
+4
-5
src/vs/editor/standalone/browser/quickOpen/quickCommand.ts
src/vs/editor/standalone/browser/quickOpen/quickCommand.ts
+1
-2
src/vs/editor/standalone/browser/standaloneCodeEditor.ts
src/vs/editor/standalone/browser/standaloneCodeEditor.ts
+3
-5
src/vs/editor/standalone/browser/standaloneEditor.ts
src/vs/editor/standalone/browser/standaloneEditor.ts
+2
-2
src/vs/workbench/parts/quickopen/browser/commandsHandler.ts
src/vs/workbench/parts/quickopen/browser/commandsHandler.ts
+1
-1
未找到文件。
build/monaco/api.js
浏览文件 @
fdf2dec5
...
@@ -315,7 +315,6 @@ function generateDeclarationFile(out, inputFiles, recipe) {
...
@@ -315,7 +315,6 @@ function generateDeclarationFile(out, inputFiles, recipe) {
var
resultTxt
=
result
.
join
(
endl
);
var
resultTxt
=
result
.
join
(
endl
);
resultTxt
=
resultTxt
.
replace
(
/
\b
URI
\b
/g
,
'
Uri
'
);
resultTxt
=
resultTxt
.
replace
(
/
\b
URI
\b
/g
,
'
Uri
'
);
resultTxt
=
resultTxt
.
replace
(
/
\b
Event</g
,
'
IEvent<
'
);
resultTxt
=
resultTxt
.
replace
(
/
\b
Event</g
,
'
IEvent<
'
);
resultTxt
=
resultTxt
.
replace
(
/
\b
TPromise</g
,
'
Promise<
'
);
resultTxt
=
format
(
resultTxt
);
resultTxt
=
format
(
resultTxt
);
return
[
return
[
resultTxt
,
resultTxt
,
...
...
build/monaco/api.ts
浏览文件 @
fdf2dec5
...
@@ -366,7 +366,6 @@ function generateDeclarationFile(out: string, inputFiles: { [file: string]: stri
...
@@ -366,7 +366,6 @@ function generateDeclarationFile(out: string, inputFiles: { [file: string]: stri
let
resultTxt
=
result
.
join
(
endl
);
let
resultTxt
=
result
.
join
(
endl
);
resultTxt
=
resultTxt
.
replace
(
/
\b
URI
\b
/g
,
'
Uri
'
);
resultTxt
=
resultTxt
.
replace
(
/
\b
URI
\b
/g
,
'
Uri
'
);
resultTxt
=
resultTxt
.
replace
(
/
\b
Event</g
,
'
IEvent<
'
);
resultTxt
=
resultTxt
.
replace
(
/
\b
Event</g
,
'
IEvent<
'
);
resultTxt
=
resultTxt
.
replace
(
/
\b
TPromise</g
,
'
Promise<
'
);
resultTxt
=
format
(
resultTxt
);
resultTxt
=
format
(
resultTxt
);
...
...
src/vs/editor/browser/widget/codeEditorWidget.ts
浏览文件 @
fdf2dec5
...
@@ -287,9 +287,9 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
...
@@ -287,9 +287,9 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
action
.
label
,
action
.
label
,
action
.
alias
,
action
.
alias
,
action
.
precondition
,
action
.
precondition
,
():
void
|
T
Promise
<
void
>
=>
{
():
Promise
<
void
>
=>
{
return
this
.
_instantiationService
.
invokeFunction
((
accessor
)
=>
{
return
this
.
_instantiationService
.
invokeFunction
((
accessor
)
=>
{
return
action
.
runEditorCommand
(
accessor
,
this
,
null
);
return
Promise
.
resolve
(
action
.
runEditorCommand
(
accessor
,
this
,
null
)
);
});
});
},
},
this
.
_contextKeyService
this
.
_contextKeyService
...
...
src/vs/editor/common/editorAction.ts
浏览文件 @
fdf2dec5
...
@@ -3,7 +3,6 @@
...
@@ -3,7 +3,6 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
*--------------------------------------------------------------------------------------------*/
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
IEditorAction
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IEditorAction
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IContextKeyService
,
ContextKeyExpr
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
IContextKeyService
,
ContextKeyExpr
}
from
'
vs/platform/contextkey/common/contextkey
'
;
...
@@ -14,7 +13,7 @@ export class InternalEditorAction implements IEditorAction {
...
@@ -14,7 +13,7 @@ export class InternalEditorAction implements IEditorAction {
public
readonly
alias
:
string
;
public
readonly
alias
:
string
;
private
readonly
_precondition
:
ContextKeyExpr
;
private
readonly
_precondition
:
ContextKeyExpr
;
private
readonly
_run
:
()
=>
void
|
T
Promise
<
void
>
;
private
readonly
_run
:
()
=>
Promise
<
void
>
;
private
readonly
_contextKeyService
:
IContextKeyService
;
private
readonly
_contextKeyService
:
IContextKeyService
;
constructor
(
constructor
(
...
@@ -22,7 +21,7 @@ export class InternalEditorAction implements IEditorAction {
...
@@ -22,7 +21,7 @@ export class InternalEditorAction implements IEditorAction {
label
:
string
,
label
:
string
,
alias
:
string
,
alias
:
string
,
precondition
:
ContextKeyExpr
,
precondition
:
ContextKeyExpr
,
run
:
()
=>
void
,
run
:
()
=>
Promise
<
void
>
,
contextKeyService
:
IContextKeyService
contextKeyService
:
IContextKeyService
)
{
)
{
this
.
id
=
id
;
this
.
id
=
id
;
...
@@ -37,12 +36,12 @@ export class InternalEditorAction implements IEditorAction {
...
@@ -37,12 +36,12 @@ export class InternalEditorAction implements IEditorAction {
return
this
.
_contextKeyService
.
contextMatchesRules
(
this
.
_precondition
);
return
this
.
_contextKeyService
.
contextMatchesRules
(
this
.
_precondition
);
}
}
public
run
():
T
Promise
<
void
>
{
public
run
():
Promise
<
void
>
{
if
(
!
this
.
isSupported
())
{
if
(
!
this
.
isSupported
())
{
return
TPromise
.
as
(
void
0
);
return
Promise
.
resolve
(
void
0
);
}
}
const
r
=
this
.
_run
();
const
r
=
this
.
_run
();
return
r
?
r
:
TPromise
.
as
(
void
0
);
return
r
?
r
:
Promise
.
resolve
(
void
0
);
}
}
}
}
src/vs/editor/common/editorCommon.ts
浏览文件 @
fdf2dec5
...
@@ -5,7 +5,6 @@
...
@@ -5,7 +5,6 @@
import
{
IMarkdownString
}
from
'
vs/base/common/htmlContent
'
;
import
{
IMarkdownString
}
from
'
vs/base/common/htmlContent
'
;
import
{
URI
,
UriComponents
}
from
'
vs/base/common/uri
'
;
import
{
URI
,
UriComponents
}
from
'
vs/base/common/uri
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
Position
,
IPosition
}
from
'
vs/editor/common/core/position
'
;
import
{
Position
,
IPosition
}
from
'
vs/editor/common/core/position
'
;
import
{
Range
,
IRange
}
from
'
vs/editor/common/core/range
'
;
import
{
Range
,
IRange
}
from
'
vs/editor/common/core/range
'
;
...
@@ -185,7 +184,7 @@ export interface IEditorAction {
...
@@ -185,7 +184,7 @@ export interface IEditorAction {
readonly
label
:
string
;
readonly
label
:
string
;
readonly
alias
:
string
;
readonly
alias
:
string
;
isSupported
():
boolean
;
isSupported
():
boolean
;
run
():
T
Promise
<
void
>
;
run
():
Promise
<
void
>
;
}
}
export
type
IEditorModel
=
ITextModel
|
IDiffEditorModel
;
export
type
IEditorModel
=
ITextModel
|
IDiffEditorModel
;
...
...
src/vs/editor/standalone/browser/colorizer.ts
浏览文件 @
fdf2dec5
...
@@ -4,7 +4,6 @@
...
@@ -4,7 +4,6 @@
*--------------------------------------------------------------------------------------------*/
*--------------------------------------------------------------------------------------------*/
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
ITextModel
}
from
'
vs/editor/common/model
'
;
import
{
ITextModel
}
from
'
vs/editor/common/model
'
;
import
{
ColorId
,
MetadataConsts
,
FontStyle
,
TokenizationRegistry
,
ITokenizationSupport
}
from
'
vs/editor/common/modes
'
;
import
{
ColorId
,
MetadataConsts
,
FontStyle
,
TokenizationRegistry
,
ITokenizationSupport
}
from
'
vs/editor/common/modes
'
;
import
{
IModeService
}
from
'
vs/editor/common/services/modeService
'
;
import
{
IModeService
}
from
'
vs/editor/common/services/modeService
'
;
...
@@ -26,7 +25,7 @@ export interface IColorizerElementOptions extends IColorizerOptions {
...
@@ -26,7 +25,7 @@ export interface IColorizerElementOptions extends IColorizerOptions {
export
class
Colorizer
{
export
class
Colorizer
{
public
static
colorizeElement
(
themeService
:
IStandaloneThemeService
,
modeService
:
IModeService
,
domNode
:
HTMLElement
,
options
:
IColorizerElementOptions
):
T
Promise
<
void
>
{
public
static
colorizeElement
(
themeService
:
IStandaloneThemeService
,
modeService
:
IModeService
,
domNode
:
HTMLElement
,
options
:
IColorizerElementOptions
):
Promise
<
void
>
{
options
=
options
||
{};
options
=
options
||
{};
let
theme
=
options
.
theme
||
'
vs
'
;
let
theme
=
options
.
theme
||
'
vs
'
;
let
mimeType
=
options
.
mimeType
||
domNode
.
getAttribute
(
'
lang
'
)
||
domNode
.
getAttribute
(
'
data-lang
'
);
let
mimeType
=
options
.
mimeType
||
domNode
.
getAttribute
(
'
lang
'
)
||
domNode
.
getAttribute
(
'
data-lang
'
);
...
@@ -45,7 +44,7 @@ export class Colorizer {
...
@@ -45,7 +44,7 @@ export class Colorizer {
return
this
.
colorize
(
modeService
,
text
,
mimeType
,
options
).
then
(
render
,
(
err
)
=>
console
.
error
(
err
));
return
this
.
colorize
(
modeService
,
text
,
mimeType
,
options
).
then
(
render
,
(
err
)
=>
console
.
error
(
err
));
}
}
public
static
colorize
(
modeService
:
IModeService
,
text
:
string
,
mimeType
:
string
,
options
:
IColorizerOptions
):
T
Promise
<
string
>
{
public
static
colorize
(
modeService
:
IModeService
,
text
:
string
,
mimeType
:
string
,
options
:
IColorizerOptions
):
Promise
<
string
>
{
if
(
strings
.
startsWithUTF8BOM
(
text
))
{
if
(
strings
.
startsWithUTF8BOM
(
text
))
{
text
=
text
.
substr
(
1
);
text
=
text
.
substr
(
1
);
}
}
...
@@ -62,10 +61,10 @@ export class Colorizer {
...
@@ -62,10 +61,10 @@ export class Colorizer {
let
tokenizationSupport
=
TokenizationRegistry
.
get
(
language
);
let
tokenizationSupport
=
TokenizationRegistry
.
get
(
language
);
if
(
tokenizationSupport
)
{
if
(
tokenizationSupport
)
{
return
TPromise
.
as
(
_colorize
(
lines
,
options
.
tabSize
,
tokenizationSupport
));
return
Promise
.
resolve
(
_colorize
(
lines
,
options
.
tabSize
,
tokenizationSupport
));
}
}
return
new
T
Promise
<
string
>
((
resolve
,
reject
)
=>
{
return
new
Promise
<
string
>
((
resolve
,
reject
)
=>
{
let
listener
:
IDisposable
=
null
;
let
listener
:
IDisposable
=
null
;
let
timeout
:
TimeoutTimer
=
null
;
let
timeout
:
TimeoutTimer
=
null
;
...
...
src/vs/editor/standalone/browser/quickOpen/quickCommand.ts
浏览文件 @
fdf2dec5
...
@@ -6,7 +6,6 @@
...
@@ -6,7 +6,6 @@
import
*
as
nls
from
'
vs/nls
'
;
import
*
as
nls
from
'
vs/nls
'
;
import
{
onUnexpectedError
}
from
'
vs/base/common/errors
'
;
import
{
onUnexpectedError
}
from
'
vs/base/common/errors
'
;
import
{
matchesFuzzy
}
from
'
vs/base/common/filters
'
;
import
{
matchesFuzzy
}
from
'
vs/base/common/filters
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
IContext
,
IHighlight
,
QuickOpenEntryGroup
,
QuickOpenModel
}
from
'
vs/base/parts/quickopen/browser/quickOpenModel
'
;
import
{
IContext
,
IHighlight
,
QuickOpenEntryGroup
,
QuickOpenModel
}
from
'
vs/base/parts/quickopen/browser/quickOpenModel
'
;
import
{
IAutoFocus
,
Mode
}
from
'
vs/base/parts/quickopen/common/quickOpen
'
;
import
{
IAutoFocus
,
Mode
}
from
'
vs/base/parts/quickopen/common/quickOpen
'
;
import
{
IKeybindingService
}
from
'
vs/platform/keybinding/common/keybinding
'
;
import
{
IKeybindingService
}
from
'
vs/platform/keybinding/common/keybinding
'
;
...
@@ -55,7 +54,7 @@ export class EditorActionCommandEntry extends QuickOpenEntryGroup {
...
@@ -55,7 +54,7 @@ export class EditorActionCommandEntry extends QuickOpenEntryGroup {
this
.
editor
.
focus
();
this
.
editor
.
focus
();
try
{
try
{
let
promise
=
this
.
action
.
run
()
||
TPromise
.
as
(
null
);
let
promise
=
this
.
action
.
run
()
||
Promise
.
resolve
(
);
promise
.
then
(
null
,
onUnexpectedError
);
promise
.
then
(
null
,
onUnexpectedError
);
}
catch
(
error
)
{
}
catch
(
error
)
{
onUnexpectedError
(
error
);
onUnexpectedError
(
error
);
...
...
src/vs/editor/standalone/browser/standaloneCodeEditor.ts
浏览文件 @
fdf2dec5
...
@@ -4,7 +4,6 @@
...
@@ -4,7 +4,6 @@
*--------------------------------------------------------------------------------------------*/
*--------------------------------------------------------------------------------------------*/
import
{
Disposable
,
IDisposable
,
combinedDisposable
,
toDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
Disposable
,
IDisposable
,
combinedDisposable
,
toDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
IContextViewService
}
from
'
vs/platform/contextview/browser/contextView
'
;
import
{
IContextViewService
}
from
'
vs/platform/contextview/browser/contextView
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
CommandsRegistry
,
ICommandService
,
ICommandHandler
}
from
'
vs/platform/commands/common/commands
'
;
import
{
CommandsRegistry
,
ICommandService
,
ICommandHandler
}
from
'
vs/platform/commands/common/commands
'
;
...
@@ -72,7 +71,7 @@ export interface IActionDescriptor {
...
@@ -72,7 +71,7 @@ export interface IActionDescriptor {
* Method that will be executed when the action is triggered.
* Method that will be executed when the action is triggered.
* @param editor The editor instance is passed in as a convinience
* @param editor The editor instance is passed in as a convinience
*/
*/
run
(
editor
:
ICodeEditor
):
void
|
T
Promise
<
void
>
;
run
(
editor
:
ICodeEditor
):
void
|
Promise
<
void
>
;
}
}
/**
/**
...
@@ -221,9 +220,8 @@ export class StandaloneCodeEditor extends CodeEditorWidget implements IStandalon
...
@@ -221,9 +220,8 @@ export class StandaloneCodeEditor extends CodeEditorWidget implements IStandalon
);
);
const
contextMenuGroupId
=
_descriptor
.
contextMenuGroupId
||
null
;
const
contextMenuGroupId
=
_descriptor
.
contextMenuGroupId
||
null
;
const
contextMenuOrder
=
_descriptor
.
contextMenuOrder
||
0
;
const
contextMenuOrder
=
_descriptor
.
contextMenuOrder
||
0
;
const
run
=
():
TPromise
<
void
>
=>
{
const
run
=
():
Promise
<
void
>
=>
{
const
r
=
_descriptor
.
run
(
this
);
return
Promise
.
resolve
(
_descriptor
.
run
(
this
));
return
r
?
r
:
TPromise
.
as
(
void
0
);
};
};
...
...
src/vs/editor/standalone/browser/standaloneEditor.ts
浏览文件 @
fdf2dec5
...
@@ -240,14 +240,14 @@ export function createWebWorker<T>(opts: IWebWorkerOptions): MonacoWebWorker<T>
...
@@ -240,14 +240,14 @@ export function createWebWorker<T>(opts: IWebWorkerOptions): MonacoWebWorker<T>
/**
/**
* Colorize the contents of `domNode` using attribute `data-lang`.
* Colorize the contents of `domNode` using attribute `data-lang`.
*/
*/
export
function
colorizeElement
(
domNode
:
HTMLElement
,
options
:
IColorizerElementOptions
):
T
Promise
<
void
>
{
export
function
colorizeElement
(
domNode
:
HTMLElement
,
options
:
IColorizerElementOptions
):
Promise
<
void
>
{
return
Colorizer
.
colorizeElement
(
StaticServices
.
standaloneThemeService
.
get
(),
StaticServices
.
modeService
.
get
(),
domNode
,
options
);
return
Colorizer
.
colorizeElement
(
StaticServices
.
standaloneThemeService
.
get
(),
StaticServices
.
modeService
.
get
(),
domNode
,
options
);
}
}
/**
/**
* Colorize `text` using language `languageId`.
* Colorize `text` using language `languageId`.
*/
*/
export
function
colorize
(
text
:
string
,
languageId
:
string
,
options
:
IColorizerOptions
):
T
Promise
<
string
>
{
export
function
colorize
(
text
:
string
,
languageId
:
string
,
options
:
IColorizerOptions
):
Promise
<
string
>
{
return
Colorizer
.
colorize
(
StaticServices
.
modeService
.
get
(),
text
,
languageId
,
options
);
return
Colorizer
.
colorize
(
StaticServices
.
modeService
.
get
(),
text
,
languageId
,
options
);
}
}
...
...
src/vs/workbench/parts/quickopen/browser/commandsHandler.ts
浏览文件 @
fdf2dec5
...
@@ -304,7 +304,7 @@ abstract class BaseCommandEntry extends QuickOpenEntryGroup {
...
@@ -304,7 +304,7 @@ abstract class BaseCommandEntry extends QuickOpenEntryGroup {
}
}
*/
*/
this
.
telemetryService
.
publicLog
(
'
workbenchActionExecuted
'
,
{
id
:
action
.
id
,
from
:
'
quick open
'
});
this
.
telemetryService
.
publicLog
(
'
workbenchActionExecuted
'
,
{
id
:
action
.
id
,
from
:
'
quick open
'
});
(
action
.
run
()
||
TPromise
.
as
(
null
)).
then
(()
=>
{
(
action
.
run
()
||
Promise
.
resolve
(
)).
then
(()
=>
{
if
(
action
instanceof
Action
)
{
if
(
action
instanceof
Action
)
{
action
.
dispose
();
action
.
dispose
();
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录