Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
4c2c3ca1
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
4c2c3ca1
编写于
7月 07, 2021
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
editors - make `resource` a required property of untitled untyped inputs (#127792)
上级
d6cfa5f8
变更
16
隐藏空白更改
内联
并排
Showing
16 changed file
with
36 addition
and
28 deletion
+36
-28
src/vs/workbench/browser/dnd.ts
src/vs/workbench/browser/dnd.ts
+1
-0
src/vs/workbench/browser/layout.ts
src/vs/workbench/browser/layout.ts
+4
-4
src/vs/workbench/browser/parts/editor/editorGroupView.ts
src/vs/workbench/browser/parts/editor/editorGroupView.ts
+1
-0
src/vs/workbench/browser/parts/editor/tabsTitleControl.ts
src/vs/workbench/browser/parts/editor/tabsTitleControl.ts
+1
-0
src/vs/workbench/common/editor.ts
src/vs/workbench/common/editor.ts
+1
-1
src/vs/workbench/common/editor/diffEditorInput.ts
src/vs/workbench/common/editor/diffEditorInput.ts
+1
-1
src/vs/workbench/contrib/codeEditor/browser/inspectKeybindings.ts
...orkbench/contrib/codeEditor/browser/inspectKeybindings.ts
+2
-2
src/vs/workbench/contrib/files/browser/fileCommands.ts
src/vs/workbench/contrib/files/browser/fileCommands.ts
+2
-2
src/vs/workbench/contrib/files/test/browser/textFileEditorTracker.test.ts
.../contrib/files/test/browser/textFileEditorTracker.test.ts
+1
-1
src/vs/workbench/contrib/themes/browser/themes.contribution.ts
...s/workbench/contrib/themes/browser/themes.contribution.ts
+1
-1
src/vs/workbench/electron-sandbox/window.ts
src/vs/workbench/electron-sandbox/window.ts
+3
-3
src/vs/workbench/services/editor/browser/editorService.ts
src/vs/workbench/services/editor/browser/editorService.ts
+8
-4
src/vs/workbench/services/editor/common/editorService.ts
src/vs/workbench/services/editor/common/editorService.ts
+1
-0
src/vs/workbench/services/editor/test/browser/editorService.test.ts
...kbench/services/editor/test/browser/editorService.test.ts
+6
-6
src/vs/workbench/services/extensions/common/extensionHostManager.ts
...kbench/services/extensions/common/extensionHostManager.ts
+1
-1
src/vs/workbench/services/workingCopy/test/browser/workingCopyBackupTracker.test.ts
...workingCopy/test/browser/workingCopyBackupTracker.test.ts
+2
-2
未找到文件。
src/vs/workbench/browser/dnd.ts
浏览文件 @
4c2c3ca1
...
...
@@ -173,6 +173,7 @@ export class ResourcesDropHandler {
const
targetGroup
=
resolveTargetGroup
();
await
this
.
editorService
.
openEditors
(
editors
.
map
(
editor
=>
({
...
editor
,
resource
:
editor
.
resource
,
options
:
{
...
editor
.
options
,
pinned
:
true
,
...
...
src/vs/workbench/browser/layout.ts
浏览文件 @
4c2c3ca1
...
...
@@ -10,7 +10,7 @@ import { onDidChangeFullscreen, isFullscreen } from 'vs/base/browser/browser';
import
{
IWorkingCopyBackupService
}
from
'
vs/workbench/services/workingCopy/common/workingCopyBackup
'
;
import
{
Registry
}
from
'
vs/platform/registry/common/platform
'
;
import
{
isWindows
,
isLinux
,
isMacintosh
,
isWeb
,
isNative
,
isIOS
}
from
'
vs/base/common/platform
'
;
import
{
I
ResourceDiffEditorInput
,
I
UntypedEditorInput
,
pathsToEditors
}
from
'
vs/workbench/common/editor
'
;
import
{
IUntypedEditorInput
,
pathsToEditors
}
from
'
vs/workbench/common/editor
'
;
import
{
SideBySideEditorInput
}
from
'
vs/workbench/common/editor/sideBySideEditorInput
'
;
import
{
SidebarPart
}
from
'
vs/workbench/browser/parts/sidebar/sidebarPart
'
;
import
{
PanelPart
}
from
'
vs/workbench/browser/parts/panel/panelPart
'
;
...
...
@@ -596,12 +596,12 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
this
.
state
.
editor
.
restoreEditors
=
!!
forceRestoreEditors
||
initialFilesToOpen
===
undefined
;
// Files to open, diff or create
if
(
initialFilesToOpen
!==
undefined
)
{
if
(
initialFilesToOpen
)
{
// Files to diff is exclusive
return
pathsToEditors
(
initialFilesToOpen
.
filesToDiff
,
fileService
).
then
(
filesToDiff
=>
{
if
(
filesToDiff
.
length
===
2
)
{
const
diffEditorInput
:
I
ResourceDiff
EditorInput
[]
=
[{
const
diffEditorInput
:
I
Untyped
EditorInput
[]
=
[{
original
:
{
resource
:
filesToDiff
[
0
].
resource
},
modified
:
{
resource
:
filesToDiff
[
1
].
resource
},
options
:
{
pinned
:
true
},
...
...
@@ -627,7 +627,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
return
[];
// do not open any empty untitled file if we have backups to restore
}
return
[
Object
.
create
(
null
)
];
// open empty untitled file
return
[
{
resource
:
undefined
}
];
// open empty untitled file
});
}
...
...
src/vs/workbench/browser/parts/editor/editorGroupView.ts
浏览文件 @
4c2c3ca1
...
...
@@ -292,6 +292,7 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
EventHelper
.
stop
(
e
);
this
.
editorService
.
openEditor
({
resource
:
undefined
,
forceUntitled
:
true
,
options
:
{
pinned
:
true
,
...
...
src/vs/workbench/browser/parts/editor/tabsTitleControl.ts
浏览文件 @
4c2c3ca1
...
...
@@ -235,6 +235,7 @@ export class TabsTitleControl extends TitleControl {
EventHelper
.
stop
(
e
);
this
.
editorService
.
openEditor
({
resource
:
undefined
,
forceUntitled
:
true
,
options
:
{
pinned
:
true
,
...
...
src/vs/workbench/common/editor.ts
浏览文件 @
4c2c3ca1
...
...
@@ -292,7 +292,7 @@ export interface IUntitledTextResourceEditorInput extends IBaseTextResourceEdito
* force use the provided resource as associated path. As such, the resource will be used when saving
* the untitled editor.
*/
readonly
resource
?:
URI
;
readonly
resource
:
URI
|
undefined
;
}
export
interface
IResourceDiffEditorInput
extends
IBaseResourceEditorInput
{
...
...
src/vs/workbench/common/editor/diffEditorInput.ts
浏览文件 @
4c2c3ca1
...
...
@@ -141,7 +141,7 @@ export class DiffEditorInput extends SideBySideEditorInput {
const
originalResourceEditorInput
=
this
.
secondary
.
toUntyped
(
group
,
context
);
const
modifiedResourceEditorInput
=
this
.
primary
.
toUntyped
(
group
,
context
);
if
(
originalResourceEditorInput
&&
modifiedResourceEditorInput
)
{
if
(
originalResourceEditorInput
&&
modifiedResourceEditorInput
&&
!
isResourceDiffEditorInput
(
originalResourceEditorInput
)
&&
!
isResourceDiffEditorInput
(
modifiedResourceEditorInput
)
)
{
return
{
label
:
this
.
name
,
description
:
this
.
description
,
...
...
src/vs/workbench/contrib/codeEditor/browser/inspectKeybindings.ts
浏览文件 @
4c2c3ca1
...
...
@@ -26,7 +26,7 @@ class InspectKeyMap extends EditorAction {
const
keybindingService
=
accessor
.
get
(
IKeybindingService
);
const
editorService
=
accessor
.
get
(
IEditorService
);
editorService
.
openEditor
({
contents
:
keybindingService
.
_dumpDebugInfo
(),
options
:
{
pinned
:
true
}
});
editorService
.
openEditor
({
resource
:
undefined
,
contents
:
keybindingService
.
_dumpDebugInfo
(),
options
:
{
pinned
:
true
}
});
}
}
...
...
@@ -47,7 +47,7 @@ class InspectKeyMapJSON extends Action2 {
const
editorService
=
accessor
.
get
(
IEditorService
);
const
keybindingService
=
accessor
.
get
(
IKeybindingService
);
await
editorService
.
openEditor
({
contents
:
keybindingService
.
_dumpDebugInfoJSON
(),
options
:
{
pinned
:
true
}
});
await
editorService
.
openEditor
({
resource
:
undefined
,
contents
:
keybindingService
.
_dumpDebugInfoJSON
(),
options
:
{
pinned
:
true
}
});
}
}
...
...
src/vs/workbench/contrib/files/browser/fileCommands.ts
浏览文件 @
4c2c3ca1
...
...
@@ -683,9 +683,9 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
const
editorGroupsService
=
accessor
.
get
(
IEditorGroupsService
);
const
group
=
editorGroupsService
.
activeGroup
;
await
editorService
.
openEditor
({
options
:
{
override
:
args
.
viewType
,
pinned
:
true
}
},
group
);
await
editorService
.
openEditor
({
resource
:
undefined
,
options
:
{
override
:
args
.
viewType
,
pinned
:
true
}
},
group
);
}
else
{
await
editorService
.
openEditor
({
options
:
{
pinned
:
true
}
});
// untitled are always pinned
await
editorService
.
openEditor
({
resource
:
undefined
,
options
:
{
pinned
:
true
}
});
// untitled are always pinned
}
}
});
...
...
src/vs/workbench/contrib/files/test/browser/textFileEditorTracker.test.ts
浏览文件 @
4c2c3ca1
...
...
@@ -147,7 +147,7 @@ suite('Files - TextFileEditorTracker', () => {
test
(
'
dirty untitled text file model opens as editor
'
,
async
function
()
{
const
accessor
=
await
createTracker
();
const
untitledTextEditor
=
accessor
.
editorService
.
createEditorInput
({
forceUntitled
:
true
})
as
UntitledTextEditorInput
;
const
untitledTextEditor
=
accessor
.
editorService
.
createEditorInput
({
resource
:
undefined
,
forceUntitled
:
true
})
as
UntitledTextEditorInput
;
const
model
=
disposables
.
add
(
await
untitledTextEditor
.
resolve
());
assert
.
ok
(
!
accessor
.
editorService
.
isOpened
(
untitledTextEditor
));
...
...
src/vs/workbench/contrib/themes/browser/themes.contribution.ts
浏览文件 @
4c2c3ca1
...
...
@@ -332,7 +332,7 @@ class GenerateColorThemeAction extends Action {
},
null
,
'
\t
'
);
contents
=
contents
.
replace
(
/
\"
__/g
,
'
//"
'
);
return
this
.
editorService
.
openEditor
({
contents
,
mode
:
'
jsonc
'
,
options
:
{
pinned
:
true
}
});
return
this
.
editorService
.
openEditor
({
resource
:
undefined
,
contents
,
mode
:
'
jsonc
'
,
options
:
{
pinned
:
true
}
});
}
}
...
...
src/vs/workbench/electron-sandbox/window.ts
浏览文件 @
4c2c3ca1
...
...
@@ -19,7 +19,7 @@ import { IWorkbenchThemeService } from 'vs/workbench/services/themes/common/work
import
{
applyZoom
}
from
'
vs/platform/windows/electron-sandbox/window
'
;
import
{
setFullscreen
,
getZoomLevel
}
from
'
vs/base/browser/browser
'
;
import
{
ICommandService
,
CommandsRegistry
}
from
'
vs/platform/commands/common/commands
'
;
import
{
I
BaseResourceEditorInput
,
I
ResourceEditorInput
}
from
'
vs/platform/editor/common/editor
'
;
import
{
IResourceEditorInput
}
from
'
vs/platform/editor/common/editor
'
;
import
{
ipcRenderer
}
from
'
vs/base/parts/sandbox/electron-sandbox/globals
'
;
import
{
env
}
from
'
vs/base/common/process
'
;
import
{
IWorkspaceEditingService
}
from
'
vs/workbench/services/workspaces/common/workspaceEditing
'
;
...
...
@@ -631,7 +631,7 @@ export class NativeWindow extends Disposable {
}
private
async
onOpenFiles
(
request
:
INativeOpenFileRequest
):
Promise
<
void
>
{
const
inputs
:
IUntypedEditorInput
[]
=
[];
const
inputs
:
Array
<
IResourceEditorInput
|
IUntitledTextResourceEditorInput
>
=
[];
const
diffMode
=
!!
(
request
.
filesToDiff
&&
(
request
.
filesToDiff
.
length
===
2
));
if
(
!
diffMode
&&
request
.
filesToOpenOrCreate
)
{
...
...
@@ -664,7 +664,7 @@ export class NativeWindow extends Disposable {
}
private
async
openResources
(
resources
:
Array
<
IResourceEditorInput
|
IUntitledTextResourceEditorInput
>
,
diffMode
:
boolean
):
Promise
<
unknown
>
{
const
editors
:
I
BaseResource
EditorInput
[]
=
[];
const
editors
:
I
Untyped
EditorInput
[]
=
[];
// In diffMode we open 2 resources as diff
if
(
diffMode
&&
resources
.
length
===
2
&&
resources
[
0
].
resource
&&
resources
[
1
].
resource
)
{
...
...
src/vs/workbench/services/editor/browser/editorService.ts
浏览文件 @
4c2c3ca1
...
...
@@ -515,6 +515,7 @@ export class EditorService extends Disposable implements EditorServiceImpl {
//#region openEditor()
openEditor
(
editor
:
IEditorInput
,
options
?:
IEditorOptions
,
group
?:
OpenInEditorGroup
):
Promise
<
IEditorPane
|
undefined
>
;
openEditor
(
editor
:
IUntypedEditorInput
,
group
?:
OpenInEditorGroup
):
Promise
<
IEditorPane
|
undefined
>
;
openEditor
(
editor
:
IResourceEditorInput
,
group
?:
OpenInEditorGroup
):
Promise
<
IEditorPane
|
undefined
>
;
openEditor
(
editor
:
ITextResourceEditorInput
|
IUntitledTextResourceEditorInput
,
group
?:
OpenInEditorGroup
):
Promise
<
ITextEditorPane
|
undefined
>
;
openEditor
(
editor
:
IResourceDiffEditorInput
,
group
?:
OpenInEditorGroup
):
Promise
<
ITextDiffEditorPane
|
undefined
>
;
...
...
@@ -642,8 +643,10 @@ export class EditorService extends Disposable implements EditorServiceImpl {
return
[
group
,
activation
];
}
private
doFindTargetGroup
(
editor
:
IEditorInputWithOptions
|
IUntypedEditorInput
,
preferredGroup
:
OpenInEditorGroup
|
undefined
):
IEditorGroup
{
private
doFindTargetGroup
(
input
:
IEditorInputWithOptions
|
IUntypedEditorInput
,
preferredGroup
:
OpenInEditorGroup
|
undefined
):
IEditorGroup
{
let
group
:
IEditorGroup
|
undefined
;
let
editor
=
isEditorInputWithOptions
(
input
)
?
input
.
editor
:
input
;
let
options
=
input
.
options
;
// Group: Instance of Group
if
(
preferredGroup
&&
typeof
preferredGroup
!==
'
number
'
)
{
...
...
@@ -661,11 +664,11 @@ export class EditorService extends Disposable implements EditorServiceImpl {
}
// Group: Unspecified without a specific index to open
else
if
(
!
editor
.
options
||
typeof
editor
.
options
.
index
!==
'
number
'
)
{
else
if
(
!
options
||
typeof
options
.
index
!==
'
number
'
)
{
const
groupsByLastActive
=
this
.
editorGroupService
.
getGroups
(
GroupsOrder
.
MOST_RECENTLY_ACTIVE
);
// Respect option to reveal an editor if it is already visible in any group
if
(
editor
.
options
?.
revealIfVisible
)
{
if
(
options
?.
revealIfVisible
)
{
for
(
const
lastActiveGroup
of
groupsByLastActive
)
{
if
(
lastActiveGroup
.
isActive
(
editor
))
{
group
=
lastActiveGroup
;
...
...
@@ -677,7 +680,7 @@ export class EditorService extends Disposable implements EditorServiceImpl {
// Respect option to reveal an editor if it is open (not necessarily visible)
// Still prefer to reveal an editor in a group where the editor is active though.
if
(
!
group
)
{
if
(
editor
.
options
?.
revealIfOpened
||
this
.
configurationService
.
getValue
<
boolean
>
(
'
workbench.editor.revealIfOpen
'
))
{
if
(
options
?.
revealIfOpened
||
this
.
configurationService
.
getValue
<
boolean
>
(
'
workbench.editor.revealIfOpen
'
))
{
let
groupWithInputActive
:
IEditorGroup
|
undefined
=
undefined
;
let
groupWithInputOpened
:
IEditorGroup
|
undefined
=
undefined
;
...
...
@@ -728,6 +731,7 @@ export class EditorService extends Disposable implements EditorServiceImpl {
openEditors
(
editors
:
IEditorInputWithOptions
[],
group
?:
OpenInEditorGroup
,
options
?:
IOpenEditorsOptions
):
Promise
<
IEditorPane
[]
>
;
openEditors
(
editors
:
IUntypedEditorInput
[],
group
?:
OpenInEditorGroup
,
options
?:
IOpenEditorsOptions
):
Promise
<
IEditorPane
[]
>
;
openEditors
(
editors
:
Array
<
IEditorInputWithOptions
|
IUntypedEditorInput
>
,
group
?:
OpenInEditorGroup
,
options
?:
IOpenEditorsOptions
):
Promise
<
IEditorPane
[]
>
;
async
openEditors
(
editors
:
Array
<
IEditorInputWithOptions
|
IUntypedEditorInput
>
,
preferredGroup
?:
OpenInEditorGroup
,
options
?:
IOpenEditorsOptions
):
Promise
<
IEditorPane
[]
>
{
// Pass all editors to trust service to determine if
...
...
src/vs/workbench/services/editor/common/editorService.ts
浏览文件 @
4c2c3ca1
...
...
@@ -175,6 +175,7 @@ export interface IEditorService {
openEditor
(
editor
:
IResourceEditorInput
,
group
?:
IEditorGroup
|
GroupIdentifier
|
SIDE_GROUP_TYPE
|
ACTIVE_GROUP_TYPE
):
Promise
<
IEditorPane
|
undefined
>
;
openEditor
(
editor
:
ITextResourceEditorInput
|
IUntitledTextResourceEditorInput
,
group
?:
IEditorGroup
|
GroupIdentifier
|
SIDE_GROUP_TYPE
|
ACTIVE_GROUP_TYPE
):
Promise
<
ITextEditorPane
|
undefined
>
;
openEditor
(
editor
:
IResourceDiffEditorInput
,
group
?:
IEditorGroup
|
GroupIdentifier
|
SIDE_GROUP_TYPE
|
ACTIVE_GROUP_TYPE
):
Promise
<
ITextDiffEditorPane
|
undefined
>
;
openEditor
(
editor
:
IUntypedEditorInput
,
group
?:
IEditorGroup
|
GroupIdentifier
|
SIDE_GROUP_TYPE
|
ACTIVE_GROUP_TYPE
):
Promise
<
IEditorPane
|
undefined
>
;
/**
* Open editors in an editor group.
...
...
src/vs/workbench/services/editor/test/browser/editorService.test.ts
浏览文件 @
4c2c3ca1
...
...
@@ -713,7 +713,7 @@ suite('EditorService', () => {
{
// untyped untitled editor, no options, no group
{
let
untypedEditor
:
IUntitledTextResourceEditorInput
=
{
options
:
{
override
:
TEST_EDITOR_INPUT_ID
}
};
let
untypedEditor
:
IUntitledTextResourceEditorInput
=
{
resource
:
undefined
,
options
:
{
override
:
TEST_EDITOR_INPUT_ID
}
};
let
pane
=
await
openEditor
(
untypedEditor
);
assert
.
strictEqual
(
pane
?.
group
,
rootGroup
);
...
...
@@ -733,7 +733,7 @@ suite('EditorService', () => {
// untyped untitled editor, no options, SIDE_GROUP
{
let
untypedEditor
:
IUntitledTextResourceEditorInput
=
{
options
:
{
override
:
TEST_EDITOR_INPUT_ID
}
};
let
untypedEditor
:
IUntitledTextResourceEditorInput
=
{
resource
:
undefined
,
options
:
{
override
:
TEST_EDITOR_INPUT_ID
}
};
let
pane
=
await
openEditor
(
untypedEditor
,
SIDE_GROUP
);
assert
.
strictEqual
(
accessor
.
editorGroupService
.
groups
.
length
,
2
);
...
...
@@ -780,7 +780,7 @@ suite('EditorService', () => {
// untyped untitled editor, options (sticky: true, preserveFocus: true), no group
{
let
untypedEditor
:
IUntitledTextResourceEditorInput
=
{
options
:
{
sticky
:
true
,
preserveFocus
:
true
,
override
:
TEST_EDITOR_INPUT_ID
}
};
let
untypedEditor
:
IUntitledTextResourceEditorInput
=
{
resource
:
undefined
,
options
:
{
sticky
:
true
,
preserveFocus
:
true
,
override
:
TEST_EDITOR_INPUT_ID
}
};
let
pane
=
await
openEditor
(
untypedEditor
);
assert
.
strictEqual
(
pane
?.
group
,
rootGroup
);
...
...
@@ -1301,7 +1301,7 @@ suite('EditorService', () => {
assert
.
strictEqual
(
contentInput
.
getPreferredMode
(),
'
text
'
);
// Untyped Input (untitled)
input
=
service
.
createEditorInput
({
options
:
{
selection
:
{
startLineNumber
:
1
,
startColumn
:
1
}
}
});
input
=
service
.
createEditorInput
({
resource
:
undefined
,
options
:
{
selection
:
{
startLineNumber
:
1
,
startColumn
:
1
}
}
});
assert
(
input
instanceof
UntitledTextEditorInput
);
// Untyped Input (untitled with contents)
...
...
@@ -1313,7 +1313,7 @@ suite('EditorService', () => {
assert
.
strictEqual
(
model
.
textEditorModel
?.
getValue
(),
'
Hello Untitled
'
);
// Untyped Input (untitled with mode)
input
=
service
.
createEditorInput
({
mode
,
options
:
{
selection
:
{
startLineNumber
:
1
,
startColumn
:
1
}
}
});
input
=
service
.
createEditorInput
({
resource
:
undefined
,
mode
,
options
:
{
selection
:
{
startLineNumber
:
1
,
startColumn
:
1
}
}
});
assert
(
input
instanceof
UntitledTextEditorInput
);
model
=
await
input
.
resolve
()
as
UntitledTextEditorModel
;
assert
.
strictEqual
(
model
.
getMode
(),
mode
);
...
...
@@ -1725,7 +1725,7 @@ suite('EditorService', () => {
const
[,
service
]
=
await
createEditorService
();
// Open untitled input
let
editor
=
await
service
.
openEditor
({});
let
editor
=
await
service
.
openEditor
({
resource
:
undefined
});
assert
.
strictEqual
(
service
.
activeEditorPane
,
editor
);
assert
.
strictEqual
(
service
.
activeTextEditorControl
,
editor
?.
getControl
());
...
...
src/vs/workbench/services/extensions/common/extensionHostManager.ts
浏览文件 @
4c2c3ca1
...
...
@@ -452,7 +452,7 @@ registerAction2(class MeasureExtHostLatencyAction extends Action2 {
const
editorService
=
accessor
.
get
(
IEditorService
);
const
measurements
=
await
Promise
.
all
(
getLatencyTestProviders
().
map
(
provider
=>
provider
.
measure
()));
editorService
.
openEditor
({
contents
:
measurements
.
map
(
MeasureExtHostLatencyAction
.
_print
).
join
(
'
\n\n
'
),
options
:
{
pinned
:
true
}
});
editorService
.
openEditor
({
resource
:
undefined
,
contents
:
measurements
.
map
(
MeasureExtHostLatencyAction
.
_print
).
join
(
'
\n\n
'
),
options
:
{
pinned
:
true
}
});
}
private
static
_print
(
m
:
ExtHostLatencyResult
|
null
):
string
{
...
...
src/vs/workbench/services/workingCopy/test/browser/workingCopyBackupTracker.test.ts
浏览文件 @
4c2c3ca1
...
...
@@ -108,7 +108,7 @@ suite('WorkingCopyBackupTracker (browser)', function () {
return
{
accessor
,
part
,
tracker
,
workingCopyBackupService
:
workingCopyBackupService
,
instantiationService
,
cleanup
:
()
=>
disposables
.
dispose
()
};
}
async
function
untitledBackupTest
(
untitled
:
IUntitledTextResourceEditorInput
=
{}):
Promise
<
void
>
{
async
function
untitledBackupTest
(
untitled
:
IUntitledTextResourceEditorInput
=
{
resource
:
undefined
}):
Promise
<
void
>
{
const
{
accessor
,
cleanup
,
workingCopyBackupService
}
=
await
createTracker
();
const
untitledTextEditor
=
(
await
accessor
.
editorService
.
openEditor
(
untitled
))?.
input
as
UntitledTextEditorInput
;
...
...
@@ -137,7 +137,7 @@ suite('WorkingCopyBackupTracker (browser)', function () {
});
test
(
'
Track backups (untitled with initial contents)
'
,
function
()
{
return
untitledBackupTest
({
contents
:
'
Foo Bar
'
});
return
untitledBackupTest
({
resource
:
undefined
,
contents
:
'
Foo Bar
'
});
});
test
(
'
Track backups (custom)
'
,
async
function
()
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录