Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
d46fa87e
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,发现更多精彩内容 >>
提交
d46fa87e
编写于
3月 12, 2020
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix #91701
上级
a18a9bf6
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
49 addition
and
66 deletion
+49
-66
src/vs/platform/environment/common/environment.ts
src/vs/platform/environment/common/environment.ts
+0
-1
src/vs/platform/environment/node/argv.ts
src/vs/platform/environment/node/argv.ts
+0
-1
src/vs/workbench/contrib/backup/electron-browser/backupTracker.ts
...orkbench/contrib/backup/electron-browser/backupTracker.ts
+33
-33
src/vs/workbench/contrib/backup/test/electron-browser/backupTracker.test.ts
...ontrib/backup/test/electron-browser/backupTracker.test.ts
+6
-7
src/vs/workbench/contrib/files/test/browser/editorAutoSave.test.ts
...rkbench/contrib/files/test/browser/editorAutoSave.test.ts
+2
-3
src/vs/workbench/contrib/files/test/browser/textFileEditor.test.ts
...rkbench/contrib/files/test/browser/textFileEditor.test.ts
+2
-3
src/vs/workbench/services/dialogs/browser/abstractFileDialogService.ts
...nch/services/dialogs/browser/abstractFileDialogService.ts
+2
-2
src/vs/workbench/services/dialogs/electron-browser/fileDialogService.ts
...ch/services/dialogs/electron-browser/fileDialogService.ts
+1
-11
src/vs/workbench/services/filesConfiguration/common/filesConfigurationService.ts
...es/filesConfiguration/common/filesConfigurationService.ts
+2
-4
src/vs/workbench/test/browser/workbenchTestServices.ts
src/vs/workbench/test/browser/workbenchTestServices.ts
+1
-1
未找到文件。
src/vs/platform/environment/common/environment.ts
浏览文件 @
d46fa87e
...
...
@@ -39,7 +39,6 @@ export interface ParsedArgs {
'
builtin-extensions-dir
'
?:
string
;
extensionDevelopmentPath
?:
string
[];
// // undefined or array of 1 or more local paths or URIs
extensionTestsPath
?:
string
;
// either a local path or a URI
'
extension-development-confirm-save
'
?:
boolean
;
'
inspect-extensions
'
?:
string
;
'
inspect-brk-extensions
'
?:
string
;
debugId
?:
string
;
...
...
src/vs/platform/environment/node/argv.ts
浏览文件 @
d46fa87e
...
...
@@ -80,7 +80,6 @@ export const OPTIONS: OptionDescriptions<Required<ParsedArgs>> = {
'
locate-extension
'
:
{
type
:
'
string[]
'
},
'
extensionDevelopmentPath
'
:
{
type
:
'
string[]
'
},
'
extensionTestsPath
'
:
{
type
:
'
string
'
},
'
extension-development-confirm-save
'
:
{
type
:
'
boolean
'
},
'
debugId
'
:
{
type
:
'
string
'
},
'
inspect-search
'
:
{
type
:
'
string
'
,
deprecates
:
'
debugSearch
'
},
'
inspect-brk-search
'
:
{
type
:
'
string
'
,
deprecates
:
'
debugBrkSearch
'
},
...
...
src/vs/workbench/contrib/backup/electron-browser/backupTracker.ts
浏览文件 @
d46fa87e
...
...
@@ -9,7 +9,6 @@ import { IWorkbenchContribution } from 'vs/workbench/common/contributions';
import
{
IFilesConfigurationService
,
AutoSaveMode
}
from
'
vs/workbench/services/filesConfiguration/common/filesConfigurationService
'
;
import
{
IWorkingCopyService
,
IWorkingCopy
,
WorkingCopyCapabilities
}
from
'
vs/workbench/services/workingCopy/common/workingCopyService
'
;
import
{
ILifecycleService
,
LifecyclePhase
,
ShutdownReason
}
from
'
vs/platform/lifecycle/common/lifecycle
'
;
import
{
IWorkbenchEnvironmentService
}
from
'
vs/workbench/services/environment/common/environmentService
'
;
import
{
ConfirmResult
,
IFileDialogService
,
IDialogService
}
from
'
vs/platform/dialogs/common/dialogs
'
;
import
Severity
from
'
vs/base/common/severity
'
;
import
{
WorkbenchState
,
IWorkspaceContextService
}
from
'
vs/platform/workspace/common/workspace
'
;
...
...
@@ -20,6 +19,7 @@ import { BackupTracker } from 'vs/workbench/contrib/backup/common/backupTracker'
import
{
ILogService
}
from
'
vs/platform/log/common/log
'
;
import
{
IEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
SaveReason
}
from
'
vs/workbench/common/editor
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
export
class
NativeBackupTracker
extends
BackupTracker
implements
IWorkbenchContribution
{
...
...
@@ -28,13 +28,13 @@ export class NativeBackupTracker extends BackupTracker implements IWorkbenchCont
@
IFilesConfigurationService
filesConfigurationService
:
IFilesConfigurationService
,
@
IWorkingCopyService
workingCopyService
:
IWorkingCopyService
,
@
ILifecycleService
lifecycleService
:
ILifecycleService
,
@
IWorkbenchEnvironmentService
private
readonly
environmentService
:
IWorkbenchEnvironmentService
,
@
IFileDialogService
private
readonly
fileDialogService
:
IFileDialogService
,
@
IDialogService
private
readonly
dialogService
:
IDialogService
,
@
IWorkspaceContextService
private
readonly
contextService
:
IWorkspaceContextService
,
@
IElectronService
private
readonly
electronService
:
IElectronService
,
@
ILogService
logService
:
ILogService
,
@
IEditorService
private
readonly
editorService
:
IEditorService
@
IEditorService
private
readonly
editorService
:
IEditorService
,
@
IEnvironmentService
private
readonly
environmentService
:
IEnvironmentService
)
{
super
(
backupFileService
,
filesConfigurationService
,
workingCopyService
,
logService
,
lifecycleService
);
}
...
...
@@ -120,32 +120,36 @@ export class NativeBackupTracker extends BackupTracker implements IWorkbenchCont
// ever activated when quit is requested.
let
doBackup
:
boolean
|
undefined
;
switch
(
reason
)
{
case
ShutdownReason
.
CLOSE
:
if
(
this
.
contextService
.
getWorkbenchState
()
!==
WorkbenchState
.
EMPTY
&&
this
.
filesConfigurationService
.
hotExitConfiguration
===
HotExitConfiguration
.
ON_EXIT_AND_WINDOW_CLOSE
)
{
doBackup
=
true
;
// backup if a folder is open and onExitAndWindowClose is configured
}
else
if
(
await
this
.
electronService
.
getWindowCount
()
>
1
||
isMacintosh
)
{
doBackup
=
false
;
// do not backup if a window is closed that does not cause quitting of the application
}
else
{
doBackup
=
true
;
// backup if last window is closed on win/linux where the application quits right after
}
break
;
case
ShutdownReason
.
QUIT
:
doBackup
=
true
;
// backup because next start we restore all backups
break
;
case
ShutdownReason
.
RELOAD
:
doBackup
=
true
;
// backup because after window reload, backups restore
break
;
case
ShutdownReason
.
LOAD
:
if
(
this
.
contextService
.
getWorkbenchState
()
!==
WorkbenchState
.
EMPTY
&&
this
.
filesConfigurationService
.
hotExitConfiguration
===
HotExitConfiguration
.
ON_EXIT_AND_WINDOW_CLOSE
)
{
doBackup
=
true
;
// backup if a folder is open and onExitAndWindowClose is configured
}
else
{
doBackup
=
false
;
// do not backup because we are switching contexts
}
break
;
if
(
this
.
environmentService
.
isExtensionDevelopment
)
{
doBackup
=
true
;
// always backup closing extension development window without asking to speed up debugging
}
else
{
switch
(
reason
)
{
case
ShutdownReason
.
CLOSE
:
if
(
this
.
contextService
.
getWorkbenchState
()
!==
WorkbenchState
.
EMPTY
&&
this
.
filesConfigurationService
.
hotExitConfiguration
===
HotExitConfiguration
.
ON_EXIT_AND_WINDOW_CLOSE
)
{
doBackup
=
true
;
// backup if a folder is open and onExitAndWindowClose is configured
}
else
if
(
await
this
.
electronService
.
getWindowCount
()
>
1
||
isMacintosh
)
{
doBackup
=
false
;
// do not backup if a window is closed that does not cause quitting of the application
}
else
{
doBackup
=
true
;
// backup if last window is closed on win/linux where the application quits right after
}
break
;
case
ShutdownReason
.
QUIT
:
doBackup
=
true
;
// backup because next start we restore all backups
break
;
case
ShutdownReason
.
RELOAD
:
doBackup
=
true
;
// backup because after window reload, backups restore
break
;
case
ShutdownReason
.
LOAD
:
if
(
this
.
contextService
.
getWorkbenchState
()
!==
WorkbenchState
.
EMPTY
&&
this
.
filesConfigurationService
.
hotExitConfiguration
===
HotExitConfiguration
.
ON_EXIT_AND_WINDOW_CLOSE
)
{
doBackup
=
true
;
// backup if a folder is open and onExitAndWindowClose is configured
}
else
{
doBackup
=
false
;
// do not backup because we are switching contexts
}
break
;
}
}
// Perform a backup of all dirty working copies unless a backup already exists
...
...
@@ -247,10 +251,6 @@ export class NativeBackupTracker extends BackupTracker implements IWorkbenchCont
return
false
;
// if editors have not restored, we are not up to speed with backups and thus should not discard them
}
if
(
this
.
environmentService
.
isExtensionDevelopment
)
{
return
false
;
// extension development does not track any backups
}
return
Promise
.
all
(
backupsToDiscard
.
map
(
workingCopy
=>
this
.
backupFileService
.
discardBackup
(
workingCopy
.
resource
))).
then
(()
=>
false
,
()
=>
false
);
}
}
src/vs/workbench/contrib/backup/test/electron-browser/backupTracker.test.ts
浏览文件 @
d46fa87e
...
...
@@ -32,7 +32,6 @@ import { IWorkingCopyService } from 'vs/workbench/services/workingCopy/common/wo
import
{
ILogService
}
from
'
vs/platform/log/common/log
'
;
import
{
HotExitConfiguration
}
from
'
vs/platform/files/common/files
'
;
import
{
ShutdownReason
,
ILifecycleService
,
BeforeShutdownEvent
}
from
'
vs/platform/lifecycle/common/lifecycle
'
;
import
{
IWorkbenchEnvironmentService
}
from
'
vs/workbench/services/environment/common/environmentService
'
;
import
{
IFileDialogService
,
ConfirmResult
,
IDialogService
}
from
'
vs/platform/dialogs/common/dialogs
'
;
import
{
IWorkspaceContextService
,
Workspace
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
IElectronService
}
from
'
vs/platform/electron/node/electron
'
;
...
...
@@ -42,9 +41,10 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import
{
UntitledTextEditorInput
}
from
'
vs/workbench/services/untitled/common/untitledTextEditorInput
'
;
import
{
TestConfigurationService
}
from
'
vs/platform/configuration/test/common/testConfigurationService
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
TestFilesConfigurationService
,
TestEnvironmentService
}
from
'
vs/workbench/test/browser/workbenchTestServices
'
;
import
{
TestFilesConfigurationService
}
from
'
vs/workbench/test/browser/workbenchTestServices
'
;
import
{
MockContextKeyService
}
from
'
vs/platform/keybinding/test/common/mockKeybindingService
'
;
import
{
IContextKeyService
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
const
userdataDir
=
getRandomTestPath
(
os
.
tmpdir
(),
'
vsctests
'
,
'
backuprestorer
'
);
const
backupHome
=
path
.
join
(
userdataDir
,
'
Backups
'
);
...
...
@@ -60,15 +60,15 @@ class TestBackupTracker extends NativeBackupTracker {
@
IFilesConfigurationService
filesConfigurationService
:
IFilesConfigurationService
,
@
IWorkingCopyService
workingCopyService
:
IWorkingCopyService
,
@
ILifecycleService
lifecycleService
:
ILifecycleService
,
@
IWorkbenchEnvironmentService
environmentService
:
IWorkbenchEnvironmentService
,
@
IFileDialogService
fileDialogService
:
IFileDialogService
,
@
IDialogService
dialogService
:
IDialogService
,
@
IWorkspaceContextService
contextService
:
IWorkspaceContextService
,
@
IElectronService
electronService
:
IElectronService
,
@
ILogService
logService
:
ILogService
,
@
IEditorService
editorService
:
IEditorService
@
IEditorService
editorService
:
IEditorService
,
@
IEnvironmentService
environmentService
:
IEnvironmentService
)
{
super
(
backupFileService
,
filesConfigurationService
,
workingCopyService
,
lifecycleService
,
environmentService
,
fileDialogService
,
dialogService
,
contextService
,
electronService
,
logService
,
editor
Service
);
super
(
backupFileService
,
filesConfigurationService
,
workingCopyService
,
lifecycleService
,
fileDialogService
,
dialogService
,
contextService
,
electronService
,
logService
,
editorService
,
environment
Service
);
// Reduce timeout for tests
BackupTracker
.
BACKUP_FROM_CONTENT_CHANGE_DELAY
=
10
;
...
...
@@ -131,8 +131,7 @@ suite('BackupTracker', () => {
instantiationService
.
stub
(
IFilesConfigurationService
,
new
TestFilesConfigurationService
(
<
IContextKeyService
>
instantiationService
.
createInstance
(
MockContextKeyService
),
configurationService
,
TestEnvironmentService
configurationService
));
const
part
=
instantiationService
.
createInstance
(
EditorPart
);
...
...
src/vs/workbench/contrib/files/test/browser/editorAutoSave.test.ts
浏览文件 @
d46fa87e
...
...
@@ -7,7 +7,7 @@ import * as assert from 'assert';
import
{
Event
}
from
'
vs/base/common/event
'
;
import
{
toResource
}
from
'
vs/base/test/common/utils
'
;
import
{
IEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
TestFilesConfigurationService
,
TestEnvironmentService
,
workbenchInstantiationService
,
TestServiceAccessor
}
from
'
vs/workbench/test/browser/workbenchTestServices
'
;
import
{
TestFilesConfigurationService
,
workbenchInstantiationService
,
TestServiceAccessor
}
from
'
vs/workbench/test/browser/workbenchTestServices
'
;
import
{
IResolvedTextFileEditorModel
,
ITextFileEditorModel
}
from
'
vs/workbench/services/textfile/common/textfiles
'
;
import
{
IEditorGroupsService
}
from
'
vs/workbench/services/editor/common/editorGroupsService
'
;
import
{
dispose
,
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
...
...
@@ -56,8 +56,7 @@ suite('EditorAutoSave', () => {
instantiationService
.
stub
(
IFilesConfigurationService
,
new
TestFilesConfigurationService
(
<
IContextKeyService
>
instantiationService
.
createInstance
(
MockContextKeyService
),
configurationService
,
TestEnvironmentService
configurationService
));
const
part
=
instantiationService
.
createInstance
(
EditorPart
);
...
...
src/vs/workbench/contrib/files/test/browser/textFileEditor.test.ts
浏览文件 @
d46fa87e
...
...
@@ -6,7 +6,7 @@
import
*
as
assert
from
'
assert
'
;
import
{
toResource
}
from
'
vs/base/test/common/utils
'
;
import
{
IEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
workbenchInstantiationService
,
TestServiceAccessor
,
TestFilesConfigurationService
,
TestEnvironmentService
}
from
'
vs/workbench/test/browser/workbenchTestServices
'
;
import
{
workbenchInstantiationService
,
TestServiceAccessor
,
TestFilesConfigurationService
}
from
'
vs/workbench/test/browser/workbenchTestServices
'
;
import
{
IEditorGroupsService
}
from
'
vs/workbench/services/editor/common/editorGroupsService
'
;
import
{
dispose
,
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
IEditorRegistry
,
EditorDescriptor
,
Extensions
as
EditorExtensions
}
from
'
vs/workbench/browser/editor
'
;
...
...
@@ -56,8 +56,7 @@ suite('Files - TextFileEditor', () => {
instantiationService
.
stub
(
IFilesConfigurationService
,
new
TestFilesConfigurationService
(
<
IContextKeyService
>
instantiationService
.
createInstance
(
MockContextKeyService
),
configurationService
,
TestEnvironmentService
configurationService
));
const
part
=
instantiationService
.
createInstance
(
EditorPart
);
...
...
src/vs/workbench/services/dialogs/browser/abstractFileDialogService.ts
浏览文件 @
d46fa87e
...
...
@@ -88,8 +88,8 @@ export abstract class AbstractFileDialogService implements IFileDialogService {
}
async
showSaveConfirm
(
fileNamesOrResources
:
(
string
|
URI
)[]):
Promise
<
ConfirmResult
>
{
if
(
this
.
environmentService
.
isExtensionDevelopment
)
{
return
ConfirmResult
.
DONT_SAVE
;
// no veto when we are in extension dev
mode because we cannot assume we run interactive (e.g. tests)
if
(
this
.
environmentService
.
isExtensionDevelopment
&&
this
.
environmentService
.
extensionTestsLocationURI
)
{
return
ConfirmResult
.
DONT_SAVE
;
// no veto when we are in extension dev
testing mode because we cannot assume we run interactive
}
return
this
.
doShowSaveConfirm
(
fileNamesOrResources
);
...
...
src/vs/workbench/services/dialogs/electron-browser/fileDialogService.ts
浏览文件 @
d46fa87e
...
...
@@ -6,7 +6,7 @@
import
{
SaveDialogOptions
,
OpenDialogOptions
}
from
'
electron
'
;
import
{
INativeOpenDialogOptions
}
from
'
vs/platform/dialogs/node/dialogs
'
;
import
{
IHostService
}
from
'
vs/workbench/services/host/browser/host
'
;
import
{
IPickAndOpenOptions
,
ISaveDialogOptions
,
IOpenDialogOptions
,
IFileDialogService
,
IDialogService
,
ConfirmResult
}
from
'
vs/platform/dialogs/common/dialogs
'
;
import
{
IPickAndOpenOptions
,
ISaveDialogOptions
,
IOpenDialogOptions
,
IFileDialogService
,
IDialogService
}
from
'
vs/platform/dialogs/common/dialogs
'
;
import
{
IWorkspaceContextService
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
IHistoryService
}
from
'
vs/workbench/services/history/common/history
'
;
import
{
IWorkbenchEnvironmentService
}
from
'
vs/workbench/services/environment/common/environmentService
'
;
...
...
@@ -190,16 +190,6 @@ export class FileDialogService extends AbstractFileDialogService implements IFil
// Don't allow untitled schema through.
return
schema
===
Schemas
.
untitled
?
[
Schemas
.
file
]
:
(
schema
!==
Schemas
.
file
?
[
schema
,
Schemas
.
file
]
:
[
schema
]);
}
async
showSaveConfirm
(
fileNamesOrResources
:
(
string
|
URI
)[]):
Promise
<
ConfirmResult
>
{
if
(
this
.
environmentService
.
isExtensionDevelopment
)
{
if
(
!
this
.
environmentService
.
args
[
'
extension-development-confirm-save
'
])
{
return
ConfirmResult
.
DONT_SAVE
;
// no veto when we are in extension dev mode because we cannot assume we run interactive (e.g. tests)
}
}
return
super
.
doShowSaveConfirm
(
fileNamesOrResources
);
}
}
registerSingleton
(
IFileDialogService
,
FileDialogService
,
true
);
src/vs/workbench/services/filesConfiguration/common/filesConfigurationService.ts
浏览文件 @
d46fa87e
...
...
@@ -11,7 +11,6 @@ import { RawContextKey, IContextKey, IContextKeyService } from 'vs/platform/cont
import
{
IConfigurationService
,
ConfigurationTarget
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
IFilesConfiguration
,
AutoSaveConfiguration
,
HotExitConfiguration
}
from
'
vs/platform/files/common/files
'
;
import
{
isUndefinedOrNull
}
from
'
vs/base/common/types
'
;
import
{
IWorkbenchEnvironmentService
}
from
'
vs/workbench/services/environment/common/environmentService
'
;
import
{
equals
}
from
'
vs/base/common/objects
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
isWeb
}
from
'
vs/base/common/platform
'
;
...
...
@@ -83,8 +82,7 @@ export class FilesConfigurationService extends Disposable implements IFilesConfi
constructor
(
@
IContextKeyService
contextKeyService
:
IContextKeyService
,
@
IConfigurationService
private
readonly
configurationService
:
IConfigurationService
,
@
IWorkbenchEnvironmentService
private
readonly
environmentService
:
IWorkbenchEnvironmentService
@
IConfigurationService
private
readonly
configurationService
:
IConfigurationService
)
{
super
();
...
...
@@ -203,7 +201,7 @@ export class FilesConfigurationService extends Disposable implements IFilesConfi
}
get
isHotExitEnabled
():
boolean
{
return
!
this
.
environmentService
.
isExtensionDevelopment
&&
this
.
currentHotExitConfig
!==
HotExitConfiguration
.
OFF
;
return
this
.
currentHotExitConfig
!==
HotExitConfiguration
.
OFF
;
}
get
hotExitConfiguration
():
string
{
...
...
src/vs/workbench/test/browser/workbenchTestServices.ts
浏览文件 @
d46fa87e
...
...
@@ -126,7 +126,7 @@ export function workbenchInstantiationService(overrides?: { textFileService?: (i
instantiationService
.
stub
(
IWorkspaceContextService
,
workspaceContextService
);
const
configService
=
new
TestConfigurationService
();
instantiationService
.
stub
(
IConfigurationService
,
configService
);
instantiationService
.
stub
(
IFilesConfigurationService
,
new
TestFilesConfigurationService
(
contextKeyService
,
configService
,
TestEnvironmentService
));
instantiationService
.
stub
(
IFilesConfigurationService
,
new
TestFilesConfigurationService
(
contextKeyService
,
configService
));
instantiationService
.
stub
(
ITextResourceConfigurationService
,
new
TestTextResourceConfigurationService
(
configService
));
instantiationService
.
stub
(
IUntitledTextEditorService
,
instantiationService
.
createInstance
(
UntitledTextEditorService
));
instantiationService
.
stub
(
IStorageService
,
new
TestStorageService
());
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录