Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
c0bddd3f
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,发现更多精彩内容 >>
提交
c0bddd3f
编写于
10月 01, 2018
作者:
I
isidor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
workbench/browser: TPromise.as -> Promise.resolve
上级
f3662d06
变更
29
隐藏空白更改
内联
并排
Showing
29 changed file
with
73 addition
and
75 deletion
+73
-75
src/vs/workbench/browser/actions.ts
src/vs/workbench/browser/actions.ts
+2
-2
src/vs/workbench/browser/actions/toggleCenteredLayout.ts
src/vs/workbench/browser/actions/toggleCenteredLayout.ts
+1
-1
src/vs/workbench/browser/actions/toggleEditorLayout.ts
src/vs/workbench/browser/actions/toggleEditorLayout.ts
+2
-2
src/vs/workbench/browser/actions/toggleZenMode.ts
src/vs/workbench/browser/actions/toggleZenMode.ts
+1
-1
src/vs/workbench/browser/actions/workspaceActions.ts
src/vs/workbench/browser/actions/workspaceActions.ts
+1
-1
src/vs/workbench/browser/composite.ts
src/vs/workbench/browser/composite.ts
+2
-2
src/vs/workbench/browser/dnd.ts
src/vs/workbench/browser/dnd.ts
+3
-3
src/vs/workbench/browser/parts/activitybar/activitybarActions.ts
...workbench/browser/parts/activitybar/activitybarActions.ts
+4
-4
src/vs/workbench/browser/parts/compositeBar.ts
src/vs/workbench/browser/parts/compositeBar.ts
+1
-1
src/vs/workbench/browser/parts/compositeBarActions.ts
src/vs/workbench/browser/parts/compositeBarActions.ts
+4
-4
src/vs/workbench/browser/parts/compositePart.ts
src/vs/workbench/browser/parts/compositePart.ts
+6
-6
src/vs/workbench/browser/parts/editor/breadcrumbsPicker.ts
src/vs/workbench/browser/parts/editor/breadcrumbsPicker.ts
+2
-2
src/vs/workbench/browser/parts/editor/resourceViewer.ts
src/vs/workbench/browser/parts/editor/resourceViewer.ts
+2
-2
src/vs/workbench/browser/parts/editor/titleControl.ts
src/vs/workbench/browser/parts/editor/titleControl.ts
+1
-2
src/vs/workbench/browser/parts/notifications/notificationsActions.ts
...bench/browser/parts/notifications/notificationsActions.ts
+8
-8
src/vs/workbench/browser/parts/notifications/notificationsList.ts
...orkbench/browser/parts/notifications/notificationsList.ts
+1
-2
src/vs/workbench/browser/parts/panel/panelActions.ts
src/vs/workbench/browser/parts/panel/panelActions.ts
+3
-3
src/vs/workbench/browser/parts/panel/panelPart.ts
src/vs/workbench/browser/parts/panel/panelPart.ts
+1
-1
src/vs/workbench/browser/parts/quickopen/quickOpenController.ts
.../workbench/browser/parts/quickopen/quickOpenController.ts
+2
-2
src/vs/workbench/browser/parts/quickopen/quickopen.ts
src/vs/workbench/browser/parts/quickopen/quickopen.ts
+2
-2
src/vs/workbench/browser/parts/sidebar/sidebarPart.ts
src/vs/workbench/browser/parts/sidebar/sidebarPart.ts
+3
-3
src/vs/workbench/browser/parts/statusbar/statusbarPart.ts
src/vs/workbench/browser/parts/statusbar/statusbarPart.ts
+1
-1
src/vs/workbench/browser/parts/titlebar/titlebarPart.ts
src/vs/workbench/browser/parts/titlebar/titlebarPart.ts
+1
-1
src/vs/workbench/browser/parts/views/customView.ts
src/vs/workbench/browser/parts/views/customView.ts
+9
-9
src/vs/workbench/browser/parts/views/panelViewlet.ts
src/vs/workbench/browser/parts/views/panelViewlet.ts
+1
-1
src/vs/workbench/browser/parts/views/views.ts
src/vs/workbench/browser/parts/views/views.ts
+2
-2
src/vs/workbench/browser/parts/views/viewsViewlet.ts
src/vs/workbench/browser/parts/views/viewsViewlet.ts
+2
-2
src/vs/workbench/browser/quickopen.ts
src/vs/workbench/browser/quickopen.ts
+2
-2
src/vs/workbench/browser/viewlet.ts
src/vs/workbench/browser/viewlet.ts
+3
-3
未找到文件。
src/vs/workbench/browser/actions.ts
浏览文件 @
c0bddd3f
...
...
@@ -106,7 +106,7 @@ export class ContributableActionProvider implements IActionProvider {
}
}
return
TPromise
.
as
(
prepareActions
(
actions
));
return
Promise
.
resolve
(
prepareActions
(
actions
));
}
hasSecondaryActions
(
tree
:
ITree
,
element
:
any
):
boolean
{
...
...
@@ -136,7 +136,7 @@ export class ContributableActionProvider implements IActionProvider {
}
}
return
TPromise
.
as
(
prepareActions
(
actions
));
return
Promise
.
resolve
(
prepareActions
(
actions
));
}
getActionItem
(
tree
:
ITree
,
element
:
any
,
action
:
Action
):
BaseActionItem
{
...
...
src/vs/workbench/browser/actions/toggleCenteredLayout.ts
浏览文件 @
c0bddd3f
...
...
@@ -28,7 +28,7 @@ class ToggleCenteredLayout extends Action {
run
():
TPromise
<
any
>
{
this
.
partService
.
centerEditorLayout
(
!
this
.
partService
.
isEditorLayoutCentered
());
return
TPromise
.
as
(
null
);
return
Promise
.
resolve
(
null
);
}
}
...
...
src/vs/workbench/browser/actions/toggleEditorLayout.ts
浏览文件 @
c0bddd3f
...
...
@@ -52,7 +52,7 @@ export class ToggleEditorLayoutAction extends Action {
const
newOrientation
=
(
this
.
editorGroupService
.
orientation
===
GroupOrientation
.
VERTICAL
)
?
GroupOrientation
.
HORIZONTAL
:
GroupOrientation
.
VERTICAL
;
this
.
editorGroupService
.
setGroupOrientation
(
newOrientation
);
return
TPromise
.
as
(
null
);
return
Promise
.
resolve
(
null
);
}
dispose
():
void
{
...
...
@@ -68,7 +68,7 @@ CommandsRegistry.registerCommand('_workbench.editor.setGroupOrientation', functi
editorGroupService
.
setGroupOrientation
(
orientation
);
return
TPromise
.
as
<
void
>
(
null
);
return
Promise
.
resolve
(
null
);
});
const
registry
=
Registry
.
as
<
IWorkbenchActionRegistry
>
(
Extensions
.
WorkbenchActions
);
...
...
src/vs/workbench/browser/actions/toggleZenMode.ts
浏览文件 @
c0bddd3f
...
...
@@ -28,7 +28,7 @@ class ToggleZenMode extends Action {
run
():
TPromise
<
any
>
{
this
.
partService
.
toggleZenMode
();
return
TPromise
.
as
(
null
);
return
Promise
.
resolve
(
null
);
}
}
...
...
src/vs/workbench/browser/actions/workspaceActions.ts
浏览文件 @
c0bddd3f
...
...
@@ -122,7 +122,7 @@ export class GlobalRemoveRootFolderAction extends Action {
});
}
return
TPromise
.
as
(
true
);
return
Promise
.
resolve
(
true
);
}
}
...
...
src/vs/workbench/browser/composite.ts
浏览文件 @
c0bddd3f
...
...
@@ -92,7 +92,7 @@ export abstract class Composite extends Component implements IComposite {
create
(
parent
:
HTMLElement
):
TPromise
<
void
>
{
this
.
parent
=
parent
;
return
TPromise
.
as
(
null
);
return
Promise
.
resolve
(
null
);
}
updateStyles
():
void
{
...
...
@@ -121,7 +121,7 @@ export abstract class Composite extends Component implements IComposite {
setVisible
(
visible
:
boolean
):
TPromise
<
void
>
{
this
.
visible
=
visible
;
return
TPromise
.
as
(
null
);
return
Promise
.
resolve
(
null
);
}
/**
...
...
src/vs/workbench/browser/dnd.ts
浏览文件 @
c0bddd3f
...
...
@@ -225,7 +225,7 @@ export class ResourcesDropHandler {
}
}
return
TPromise
.
as
(
false
);
return
Promise
.
resolve
(
false
);
}
private
handleDirtyEditorDrop
(
droppedDirtyEditor
:
IDraggedEditor
):
TPromise
<
boolean
>
{
...
...
@@ -237,7 +237,7 @@ export class ResourcesDropHandler {
// Return early if the resource is already dirty in target or opened already
if
(
this
.
textFileService
.
isDirty
(
droppedDirtyEditor
.
resource
)
||
this
.
editorService
.
isOpen
({
resource
:
droppedDirtyEditor
.
resource
}))
{
return
TPromise
.
as
(
false
);
return
Promise
.
resolve
(
false
);
}
// Resolve the contents of the dropped dirty resource from source
...
...
@@ -293,7 +293,7 @@ export class ResourcesDropHandler {
// Open in separate windows if we drop workspaces or just one folder
if
(
workspaces
.
length
>
0
||
folders
.
length
===
1
)
{
workspacesToOpen
=
TPromise
.
as
([...
workspaces
,
...
folders
].
map
(
resources
=>
resources
));
workspacesToOpen
=
Promise
.
resolve
([...
workspaces
,
...
folders
].
map
(
resources
=>
resources
));
}
// Multiple folders: Create new workspace with folders and open
...
...
src/vs/workbench/browser/parts/activitybar/activitybarActions.ts
浏览文件 @
c0bddd3f
...
...
@@ -43,13 +43,13 @@ export class ViewletActivityAction extends ActivityAction {
run
(
event
:
any
):
TPromise
<
any
>
{
if
(
event
instanceof
MouseEvent
&&
event
.
button
===
2
)
{
return
TPromise
.
as
(
false
);
// do not run on right click
return
Promise
.
resolve
(
false
);
// do not run on right click
}
// prevent accident trigger on a doubleclick (to help nervous people)
const
now
=
Date
.
now
();
if
(
now
>
this
.
lastRun
/* https://github.com/Microsoft/vscode/issues/25830 */
&&
now
-
this
.
lastRun
<
ViewletActivityAction
.
preventDoubleClickDelay
)
{
return
TPromise
.
as
(
true
);
return
Promise
.
resolve
(
true
);
}
this
.
lastRun
=
now
;
...
...
@@ -155,7 +155,7 @@ export class GlobalActivityActionItem extends ActivityActionItem {
this
.
contextMenuService
.
showContextMenu
({
getAnchor
:
()
=>
location
,
getActions
:
()
=>
TPromise
.
as
(
actions
),
getActions
:
()
=>
Promise
.
resolve
(
actions
),
onHide
:
()
=>
dispose
(
actions
)
});
}
...
...
@@ -253,4 +253,4 @@ registerThemingParticipant((theme: ITheme, collector: ICssStyleCollector) => {
`
);
}
}
});
\ No newline at end of file
});
src/vs/workbench/browser/parts/compositeBar.ts
浏览文件 @
c0bddd3f
...
...
@@ -399,7 +399,7 @@ export class CompositeBar extends Widget implements ICompositeBar {
const
event
=
new
StandardMouseEvent
(
e
);
this
.
contextMenuService
.
showContextMenu
({
getAnchor
:
()
=>
{
return
{
x
:
event
.
posx
,
y
:
event
.
posy
};
},
getActions
:
()
=>
TPromise
.
as
(
this
.
getContextMenuActions
())
getActions
:
()
=>
Promise
.
resolve
(
this
.
getContextMenuActions
())
});
}
...
...
src/vs/workbench/browser/parts/compositeBarActions.ts
浏览文件 @
c0bddd3f
...
...
@@ -343,7 +343,7 @@ export class CompositeOverflowActivityAction extends ActivityAction {
run
(
event
:
any
):
TPromise
<
any
>
{
this
.
showMenu
();
return
TPromise
.
as
(
true
);
return
Promise
.
resolve
(
true
);
}
}
...
...
@@ -372,7 +372,7 @@ export class CompositeOverflowActivityActionItem extends ActivityActionItem {
this
.
contextMenuService
.
showContextMenu
({
getAnchor
:
()
=>
this
.
element
,
getActions
:
()
=>
TPromise
.
as
(
this
.
actions
),
getActions
:
()
=>
Promise
.
resolve
(
this
.
actions
),
onHide
:
()
=>
dispose
(
this
.
actions
)
});
}
...
...
@@ -597,7 +597,7 @@ export class CompositeActionItem extends ActivityActionItem {
this
.
contextMenuService
.
showContextMenu
({
getAnchor
:
()
=>
anchor
,
getActionsContext
:
()
=>
this
.
activity
.
id
,
getActions
:
()
=>
TPromise
.
as
(
actions
)
getActions
:
()
=>
Promise
.
resolve
(
actions
)
});
}
...
...
@@ -664,6 +664,6 @@ export class ToggleCompositePinnedAction extends Action {
this
.
compositeBar
.
pin
(
id
);
}
return
TPromise
.
as
(
true
);
return
Promise
.
resolve
(
true
);
}
}
src/vs/workbench/browser/parts/compositePart.ts
浏览文件 @
c0bddd3f
...
...
@@ -106,7 +106,7 @@ export abstract class CompositePart<T extends Composite> extends Part {
}
// Fullfill promise with composite that is being opened
return
TPromise
.
as
(
this
.
activeComposite
);
return
Promise
.
resolve
(
this
.
activeComposite
);
}
// Open
...
...
@@ -124,7 +124,7 @@ export abstract class CompositePart<T extends Composite> extends Part {
if
(
this
.
activeComposite
)
{
hidePromise
=
this
.
hideActiveComposite
();
}
else
{
hidePromise
=
TPromise
.
as
(
null
);
hidePromise
=
Promise
.
resolve
(
null
);
}
return
hidePromise
.
then
(()
=>
{
...
...
@@ -137,7 +137,7 @@ export abstract class CompositePart<T extends Composite> extends Part {
// Check if another composite opened meanwhile and return in that case
if
((
this
.
currentCompositeOpenToken
!==
currentCompositeOpenToken
)
||
(
this
.
activeComposite
&&
this
.
activeComposite
.
getId
()
!==
composite
.
getId
()))
{
return
TPromise
.
as
(
null
);
return
Promise
.
resolve
(
null
);
}
// Check if composite already visible and just focus in that case
...
...
@@ -147,7 +147,7 @@ export abstract class CompositePart<T extends Composite> extends Part {
}
// Fullfill promise with composite that is being opened
return
TPromise
.
as
(
composite
);
return
Promise
.
resolve
(
composite
);
}
// Show Composite and Focus
...
...
@@ -235,7 +235,7 @@ export abstract class CompositePart<T extends Composite> extends Part {
// Composite already exists but is hidden
else
{
createCompositePromise
=
TPromise
.
as
(
null
);
createCompositePromise
=
Promise
.
resolve
(
null
);
}
// Report progress for slow loading composites (but only if we did not create the composites before already)
...
...
@@ -375,7 +375,7 @@ export abstract class CompositePart<T extends Composite> extends Part {
protected
hideActiveComposite
():
TPromise
<
Composite
>
{
if
(
!
this
.
activeComposite
)
{
return
TPromise
.
as
(
null
);
// Nothing to do
return
Promise
.
resolve
(
null
);
// Nothing to do
}
const
composite
=
this
.
activeComposite
;
...
...
src/vs/workbench/browser/parts/editor/breadcrumbsPicker.ts
浏览文件 @
c0bddd3f
...
...
@@ -228,7 +228,7 @@ export class FileDataSource implements IDataSource {
getChildren
(
tree
:
ITree
,
element
:
IWorkspace
|
IWorkspaceFolder
|
IFileStat
|
URI
):
TPromise
<
IWorkspaceFolder
[]
|
IFileStat
[]
>
{
if
(
IWorkspace
.
isIWorkspace
(
element
))
{
return
TPromise
.
as
(
element
.
folders
).
then
(
folders
=>
{
return
Promise
.
resolve
(
element
.
folders
).
then
(
folders
=>
{
for
(
let
child
of
folders
)
{
this
.
_parents
.
set
(
element
,
child
);
}
...
...
@@ -252,7 +252,7 @@ export class FileDataSource implements IDataSource {
}
getParent
(
tree
:
ITree
,
element
:
IWorkspace
|
URI
|
IWorkspaceFolder
|
IFileStat
):
TPromise
<
IWorkspaceFolder
|
IFileStat
>
{
return
TPromise
.
as
(
this
.
_parents
.
get
(
element
));
return
Promise
.
resolve
(
this
.
_parents
.
get
(
element
));
}
}
...
...
src/vs/workbench/browser/parts/editor/resourceViewer.ts
浏览文件 @
c0bddd3f
...
...
@@ -284,7 +284,7 @@ class ZoomStatusbarItem extends Themable implements IStatusbarItem {
DOM
.
addDisposableListener
(
this
.
statusBarItem
,
DOM
.
EventType
.
CLICK
,
()
=>
{
this
.
contextMenuService
.
showContextMenu
({
getAnchor
:
()
=>
container
,
getActions
:
()
=>
TPromise
.
as
(
this
.
zoomActions
)
getActions
:
()
=>
Promise
.
resolve
(
this
.
zoomActions
)
});
});
}
...
...
@@ -567,7 +567,7 @@ class InlineImageView {
private
static
imageSrc
(
descriptor
:
IResourceDescriptor
,
fileService
:
IFileService
):
TPromise
<
string
>
{
if
(
descriptor
.
resource
.
scheme
===
Schemas
.
data
)
{
return
TPromise
.
as
(
descriptor
.
resource
.
toString
(
true
/* skip encoding */
));
return
Promise
.
resolve
(
descriptor
.
resource
.
toString
(
true
/* skip encoding */
));
}
return
fileService
.
resolveContent
(
descriptor
.
resource
,
{
encoding
:
'
base64
'
}).
then
(
data
=>
{
...
...
src/vs/workbench/browser/parts/editor/titleControl.ts
浏览文件 @
c0bddd3f
...
...
@@ -14,7 +14,6 @@ import { Action, IAction, IRunEvent } from 'vs/base/common/actions';
import
*
as
arrays
from
'
vs/base/common/arrays
'
;
import
{
ResolvedKeybinding
}
from
'
vs/base/common/keyCodes
'
;
import
{
dispose
,
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
'
vs/css!./media/titlecontrol
'
;
import
{
getCodeEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
localize
}
from
'
vs/nls
'
;
...
...
@@ -304,7 +303,7 @@ export abstract class TitleControl extends Themable {
// Show it
this
.
contextMenuService
.
showContextMenu
({
getAnchor
:
()
=>
anchor
,
getActions
:
()
=>
TPromise
.
as
(
actions
),
getActions
:
()
=>
Promise
.
resolve
(
actions
),
getActionsContext
:
()
=>
({
groupId
:
this
.
group
.
id
,
editorIndex
:
this
.
group
.
getIndexOfEditor
(
editor
)
}
as
IEditorCommandsContext
),
getKeyBinding
:
(
action
)
=>
this
.
getKeybinding
(
action
),
onHide
:
()
=>
{
...
...
src/vs/workbench/browser/parts/notifications/notificationsActions.ts
浏览文件 @
c0bddd3f
...
...
@@ -32,7 +32,7 @@ export class ClearNotificationAction extends Action {
run
(
notification
:
INotificationViewItem
):
TPromise
<
any
>
{
this
.
commandService
.
executeCommand
(
CLEAR_NOTIFICATION
,
notification
);
return
TPromise
.
as
(
void
0
);
return
Promise
.
resolve
(
void
0
);
}
}
...
...
@@ -52,7 +52,7 @@ export class ClearAllNotificationsAction extends Action {
run
(
notification
:
INotificationViewItem
):
TPromise
<
any
>
{
this
.
commandService
.
executeCommand
(
CLEAR_ALL_NOTIFICATIONS
);
return
TPromise
.
as
(
void
0
);
return
Promise
.
resolve
(
void
0
);
}
}
...
...
@@ -72,7 +72,7 @@ export class HideNotificationsCenterAction extends Action {
run
(
notification
:
INotificationViewItem
):
TPromise
<
any
>
{
this
.
commandService
.
executeCommand
(
HIDE_NOTIFICATIONS_CENTER
);
return
TPromise
.
as
(
void
0
);
return
Promise
.
resolve
(
void
0
);
}
}
...
...
@@ -92,7 +92,7 @@ export class ExpandNotificationAction extends Action {
run
(
notification
:
INotificationViewItem
):
TPromise
<
any
>
{
this
.
commandService
.
executeCommand
(
EXPAND_NOTIFICATION
,
notification
);
return
TPromise
.
as
(
void
0
);
return
Promise
.
resolve
(
void
0
);
}
}
...
...
@@ -112,7 +112,7 @@ export class CollapseNotificationAction extends Action {
run
(
notification
:
INotificationViewItem
):
TPromise
<
any
>
{
this
.
commandService
.
executeCommand
(
COLLAPSE_NOTIFICATION
,
notification
);
return
TPromise
.
as
(
void
0
);
return
Promise
.
resolve
(
void
0
);
}
}
...
...
@@ -150,7 +150,7 @@ export class CopyNotificationMessageAction extends Action {
run
(
notification
:
INotificationViewItem
):
TPromise
<
any
>
{
this
.
clipboardService
.
writeText
(
notification
.
message
.
raw
);
return
TPromise
.
as
(
void
0
);
return
Promise
.
resolve
(
void
0
);
}
}
...
...
@@ -176,6 +176,6 @@ export class NotificationActionRunner extends ActionRunner {
// Run and make sure to notify on any error again
super
.
runAction
(
action
,
context
).
then
(
null
,
error
=>
this
.
notificationService
.
error
(
error
));
return
TPromise
.
as
(
void
0
);
return
Promise
.
resolve
(
void
0
);
}
}
\ No newline at end of file
}
src/vs/workbench/browser/parts/notifications/notificationsList.ts
浏览文件 @
c0bddd3f
...
...
@@ -18,7 +18,6 @@ import { NotificationsListDelegate, NotificationRenderer } from 'vs/workbench/br
import
{
NotificationActionRunner
,
CopyNotificationMessageAction
}
from
'
vs/workbench/browser/parts/notifications/notificationsActions
'
;
import
{
NotificationFocusedContext
}
from
'
vs/workbench/browser/parts/notifications/notificationsCommands
'
;
import
{
IContextMenuService
}
from
'
vs/platform/contextview/browser/contextView
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
export
class
NotificationsList
extends
Themable
{
private
listContainer
:
HTMLElement
;
...
...
@@ -86,7 +85,7 @@ export class NotificationsList extends Themable {
this
.
_register
((
this
.
list
.
onContextMenu
(
e
=>
{
this
.
contextMenuService
.
showContextMenu
({
getAnchor
:
()
=>
e
.
anchor
,
getActions
:
()
=>
TPromise
.
as
([
copyAction
]),
getActions
:
()
=>
Promise
.
resolve
([
copyAction
]),
getActionsContext
:
()
=>
e
.
element
,
actionRunner
});
...
...
src/vs/workbench/browser/parts/panel/panelActions.ts
浏览文件 @
c0bddd3f
...
...
@@ -79,7 +79,7 @@ class FocusPanelAction extends Action {
if
(
panel
)
{
panel
.
focus
();
}
return
TPromise
.
as
(
true
);
return
Promise
.
resolve
(
true
);
}
}
...
...
@@ -145,8 +145,8 @@ export class ToggleMaximizedPanelAction extends Action {
}
run
():
TPromise
<
any
>
{
return
(
!
this
.
partService
.
isVisible
(
Parts
.
PANEL_PART
)
?
this
.
partService
.
setPanelHidden
(
false
)
:
TPromise
.
as
(
null
))
.
then
(()
=>
this
.
partService
.
toggleMaximizedPanel
());
const
thenable
:
Thenable
<
void
>
=
!
this
.
partService
.
isVisible
(
Parts
.
PANEL_PART
)
?
this
.
partService
.
setPanelHidden
(
false
)
:
Promise
.
resolve
(
null
);
return
thenable
.
then
(()
=>
this
.
partService
.
toggleMaximizedPanel
());
}
dispose
():
void
{
...
...
src/vs/workbench/browser/parts/panel/panelPart.ts
浏览文件 @
c0bddd3f
...
...
@@ -167,7 +167,7 @@ export class PanelPart extends CompositePart<Panel> implements IPanelService {
openPanel
(
id
:
string
,
focus
?:
boolean
):
TPromise
<
Panel
>
{
if
(
this
.
blockOpeningPanel
)
{
return
TPromise
.
as
(
null
);
// Workaround against a potential race condition
return
Promise
.
resolve
(
null
);
// Workaround against a potential race condition
}
// First check if panel is hidden and show if so
...
...
src/vs/workbench/browser/parts/quickopen/quickOpenController.ts
浏览文件 @
c0bddd3f
...
...
@@ -506,7 +506,7 @@ export class QuickOpenController extends Component implements IQuickOpenService
const
model
=
new
QuickOpenModel
([
new
PlaceholderQuickOpenEntry
(
placeHolderLabel
)],
this
.
actionProvider
);
this
.
showModel
(
model
,
resolvedHandler
.
getAutoFocus
(
value
,
{
model
,
quickNavigateConfiguration
:
this
.
quickOpenWidget
.
getQuickNavigateConfiguration
()
}),
resolvedHandler
.
getAriaLabel
());
return
TPromise
.
as
(
null
);
return
Promise
.
resolve
(
null
);
}
// Support extra class from handler
...
...
@@ -594,7 +594,7 @@ export class QuickOpenController extends Component implements IQuickOpenService
}
// Otherwise load and create
return
this
.
mapResolvedHandlersToPrefix
[
id
]
=
TPromise
.
as
(
handler
.
instantiate
(
this
.
instantiationService
));
return
this
.
mapResolvedHandlersToPrefix
[
id
]
=
Promise
.
resolve
(
handler
.
instantiate
(
this
.
instantiationService
));
}
layout
(
dimension
:
Dimension
):
void
{
...
...
src/vs/workbench/browser/parts/quickopen/quickopen.ts
浏览文件 @
c0bddd3f
...
...
@@ -60,7 +60,7 @@ export class BaseQuickOpenNavigateAction extends Action {
this
.
quickOpenService
.
navigate
(
this
.
next
,
quickNavigate
);
this
.
quickInputService
.
navigate
(
this
.
next
,
quickNavigate
);
return
TPromise
.
as
(
true
);
return
Promise
.
resolve
(
true
);
}
}
...
...
@@ -140,4 +140,4 @@ export class QuickOpenSelectPreviousAction extends BaseQuickOpenNavigateAction {
)
{
super
(
id
,
label
,
false
,
false
,
quickOpenService
,
quickInputService
,
keybindingService
);
}
}
\ No newline at end of file
}
src/vs/workbench/browser/parts/sidebar/sidebarPart.ts
浏览文件 @
c0bddd3f
...
...
@@ -105,7 +105,7 @@ export class SidebarPart extends CompositePart<Viewlet> {
openViewlet
(
id
:
string
,
focus
?:
boolean
):
TPromise
<
Viewlet
>
{
if
(
this
.
blockOpeningViewlet
)
{
return
TPromise
.
as
(
null
);
// Workaround against a potential race condition
return
Promise
.
resolve
(
null
);
// Workaround against a potential race condition
}
// First check if sidebar is hidden and show if so
...
...
@@ -150,7 +150,7 @@ export class SidebarPart extends CompositePart<Viewlet> {
const
anchor
:
{
x
:
number
,
y
:
number
}
=
{
x
:
event
.
posx
,
y
:
event
.
posy
};
this
.
contextMenuService
.
showContextMenu
({
getAnchor
:
()
=>
anchor
,
getActions
:
()
=>
TPromise
.
as
(
contextMenuActions
),
getActions
:
()
=>
Promise
.
resolve
(
contextMenuActions
),
getActionItem
:
action
=>
this
.
actionItemProvider
(
action
as
Action
),
actionRunner
:
activeViewlet
.
getActionRunner
()
});
...
...
@@ -185,7 +185,7 @@ class FocusSideBarAction extends Action {
if
(
viewlet
)
{
viewlet
.
focus
();
}
return
TPromise
.
as
(
true
);
return
Promise
.
resolve
(
true
);
}
}
...
...
src/vs/workbench/browser/parts/statusbar/statusbarPart.ts
浏览文件 @
c0bddd3f
...
...
@@ -288,7 +288,7 @@ class StatusBarEntryItem implements IStatusbarItem {
this
.
contextMenuService
.
showContextMenu
({
getAnchor
:
()
=>
el
,
getActionsContext
:
()
=>
this
.
entry
.
extensionId
,
getActions
:
()
=>
TPromise
.
as
([
manageExtensionAction
])
getActions
:
()
=>
Promise
.
resolve
([
manageExtensionAction
])
});
}));
}
...
...
src/vs/workbench/browser/parts/titlebar/titlebarPart.ts
浏览文件 @
c0bddd3f
...
...
@@ -463,7 +463,7 @@ export class TitlebarPart extends Part implements ITitleService {
if
(
actions
.
length
)
{
this
.
contextMenuService
.
showContextMenu
({
getAnchor
:
()
=>
anchor
,
getActions
:
()
=>
TPromise
.
as
(
actions
),
getActions
:
()
=>
Promise
.
resolve
(
actions
),
onHide
:
()
=>
actions
.
forEach
(
a
=>
a
.
dispose
())
});
}
...
...
src/vs/workbench/browser/parts/views/customView.ts
浏览文件 @
c0bddd3f
...
...
@@ -229,7 +229,7 @@ export class CustomTreeViewer extends Disposable implements ITreeViewer {
this
.
_dataProvider
=
new
class
implements
ITreeViewDataProvider
{
getChildren
(
node
?:
ITreeItem
):
TPromise
<
ITreeItem
[]
>
{
if
(
node
&&
node
.
children
)
{
return
TPromise
.
as
(
node
.
children
);
return
Promise
.
resolve
(
node
.
children
);
}
const
promise
=
node
instanceof
Root
?
dataProvider
.
getChildren
()
:
dataProvider
.
getChildren
(
node
);
return
promise
.
then
(
children
=>
{
...
...
@@ -362,7 +362,7 @@ export class CustomTreeViewer extends Disposable implements ITreeViewer {
this
.
elementsToRefresh
.
push
(...
elements
);
}
}
return
TPromise
.
as
(
null
);
return
Promise
.
resolve
(
null
);
}
reveal
(
item
:
ITreeItem
,
parentChain
:
ITreeItem
[],
options
?:
{
select
?:
boolean
,
focus
?:
boolean
}):
TPromise
<
void
>
{
...
...
@@ -372,9 +372,9 @@ export class CustomTreeViewer extends Disposable implements ITreeViewer {
const
focus
=
isUndefinedOrNull
(
options
.
focus
)
?
false
:
options
.
focus
;
const
root
:
Root
=
this
.
tree
.
getInput
();
const
promise
=
root
.
children
?
TPromise
.
as
(
null
)
:
this
.
refresh
();
// Refresh if root is not populated
const
promise
:
Thenable
<
void
>
=
root
.
children
?
Promise
.
resolve
(
null
)
:
this
.
refresh
();
// Refresh if root is not populated
return
promise
.
then
(()
=>
{
var
result
=
TPromise
.
as
(
null
);
var
result
=
Promise
.
resolve
(
null
);
parentChain
.
forEach
((
e
)
=>
{
result
=
result
.
then
(()
=>
this
.
tree
.
expand
(
e
));
});
...
...
@@ -390,7 +390,7 @@ export class CustomTreeViewer extends Disposable implements ITreeViewer {
});
});
}
return
TPromise
.
as
(
null
);
return
Promise
.
resolve
(
null
);
}
private
activate
()
{
...
...
@@ -404,7 +404,7 @@ export class CustomTreeViewer extends Disposable implements ITreeViewer {
if
(
this
.
tree
)
{
return
TPromise
.
join
(
elements
.
map
(
e
=>
this
.
tree
.
refresh
(
e
))).
then
(()
=>
null
);
}
return
TPromise
.
as
(
null
);
return
Promise
.
resolve
(
null
);
}
private
onSelection
({
payload
}:
any
):
void
{
...
...
@@ -447,7 +447,7 @@ class TreeDataSource implements IDataSource {
if
(
this
.
treeView
.
dataProvider
)
{
return
this
.
progressService
.
withProgress
({
location
:
this
.
container
},
()
=>
this
.
treeView
.
dataProvider
.
getChildren
(
node
));
}
return
TPromise
.
as
([]);
return
Promise
.
resolve
([]);
}
shouldAutoexpand
(
tree
:
ITree
,
node
:
ITreeItem
):
boolean
{
...
...
@@ -455,7 +455,7 @@ class TreeDataSource implements IDataSource {
}
getParent
(
tree
:
ITree
,
node
:
any
):
TPromise
<
any
>
{
return
TPromise
.
as
(
null
);
return
Promise
.
resolve
(
null
);
}
}
...
...
@@ -635,7 +635,7 @@ class TreeController extends WorkbenchTreeController {
getAnchor
:
()
=>
anchor
,
getActions
:
()
=>
{
return
TPromise
.
as
(
actions
);
return
Promise
.
resolve
(
actions
);
},
getActionItem
:
(
action
)
=>
{
...
...
src/vs/workbench/browser/parts/views/panelViewlet.ts
浏览文件 @
c0bddd3f
...
...
@@ -230,7 +230,7 @@ export class PanelViewlet extends Viewlet {
let
anchor
:
{
x
:
number
,
y
:
number
}
=
{
x
:
event
.
posx
,
y
:
event
.
posy
};
this
.
contextMenuService
.
showContextMenu
({
getAnchor
:
()
=>
anchor
,
getActions
:
()
=>
TPromise
.
as
(
this
.
getContextMenuActions
())
getActions
:
()
=>
Promise
.
resolve
(
this
.
getContextMenuActions
())
});
}
...
...
src/vs/workbench/browser/parts/views/views.ts
浏览文件 @
c0bddd3f
...
...
@@ -535,7 +535,7 @@ export class ViewsService extends Disposable implements IViewsService {
});
}
}
return
TPromise
.
as
(
null
);
return
Promise
.
resolve
(
null
);
}
private
onDidRegisterViewContainer
(
viewContainer
:
ViewContainer
):
void
{
...
...
@@ -614,4 +614,4 @@ export class ViewsService extends Disposable implements IViewsService {
private
getStorageScope
():
StorageScope
{
return
this
.
workspaceContextService
.
getWorkbenchState
()
===
WorkbenchState
.
EMPTY
?
StorageScope
.
GLOBAL
:
StorageScope
.
WORKSPACE
;
}
}
\ No newline at end of file
}
src/vs/workbench/browser/parts/views/viewsViewlet.ts
浏览文件 @
c0bddd3f
...
...
@@ -211,7 +211,7 @@ export abstract class ViewContainerViewlet extends PanelViewlet implements IView
if
(
focus
)
{
view
.
focus
();
}
return
TPromise
.
as
(
view
);
return
Promise
.
resolve
(
view
);
}
movePanel
(
from
:
ViewletPanel
,
to
:
ViewletPanel
):
void
{
...
...
@@ -330,7 +330,7 @@ export abstract class ViewContainerViewlet extends PanelViewlet implements IView
let
anchor
:
{
x
:
number
,
y
:
number
}
=
{
x
:
event
.
posx
,
y
:
event
.
posy
};
this
.
contextMenuService
.
showContextMenu
({
getAnchor
:
()
=>
anchor
,
getActions
:
()
=>
TPromise
.
as
(
actions
)
getActions
:
()
=>
Promise
.
resolve
(
actions
)
});
}
...
...
src/vs/workbench/browser/quickopen.ts
浏览文件 @
c0bddd3f
...
...
@@ -45,7 +45,7 @@ export class QuickOpenHandler {
* results in terms of performance when many items are shown.
*/
getResults
(
searchValue
:
string
,
token
:
CancellationToken
):
TPromise
<
IModel
<
any
>>
{
return
TPromise
.
as
(
null
);
return
Promise
.
resolve
(
null
);
}
/**
...
...
@@ -331,6 +331,6 @@ export class QuickOpenAction extends Action {
// Show with prefix
this
.
quickOpenService
.
show
(
this
.
prefix
);
return
TPromise
.
as
(
null
);
return
Promise
.
resolve
(
null
);
}
}
src/vs/workbench/browser/viewlet.ts
浏览文件 @
c0bddd3f
...
...
@@ -145,7 +145,7 @@ export class ShowViewletAction extends Action {
// Otherwise pass focus to editor group
this
.
editorGroupService
.
activeGroup
.
focus
();
return
TPromise
.
as
(
true
);
return
Promise
.
resolve
(
true
);
}
private
otherViewletShowing
():
boolean
{
...
...
@@ -168,7 +168,7 @@ export class CollapseAction extends Action {
constructor
(
viewer
:
ITree
,
enabled
:
boolean
,
clazz
:
string
)
{
super
(
'
workbench.action.collapse
'
,
nls
.
localize
(
'
collapse
'
,
"
Collapse All
"
),
clazz
,
enabled
,
(
context
:
any
)
=>
{
if
(
viewer
.
getHighlight
())
{
return
TPromise
.
as
(
null
);
// Global action disabled if user is in edit mode from another action
return
Promise
.
resolve
(
null
);
// Global action disabled if user is in edit mode from another action
}
viewer
.
collapseAll
();
...
...
@@ -177,7 +177,7 @@ export class CollapseAction extends Action {
viewer
.
domFocus
();
viewer
.
focusFirst
();
return
TPromise
.
as
(
null
);
return
Promise
.
resolve
(
null
);
});
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录