Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
77dee3ef
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,发现更多精彩内容 >>
提交
77dee3ef
编写于
12月 19, 2017
作者:
I
isidor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
autoSaveNotAfterDelayContext
上级
df38fac4
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
29 addition
and
34 deletion
+29
-34
src/vs/workbench/parts/files/common/files.ts
src/vs/workbench/parts/files/common/files.ts
+0
-2
src/vs/workbench/parts/files/electron-browser/fileCommands.ts
...vs/workbench/parts/files/electron-browser/fileCommands.ts
+7
-25
src/vs/workbench/services/textfile/common/textFileService.ts
src/vs/workbench/services/textfile/common/textFileService.ts
+11
-2
src/vs/workbench/services/textfile/common/textfiles.ts
src/vs/workbench/services/textfile/common/textfiles.ts
+3
-1
src/vs/workbench/services/textfile/electron-browser/textFileService.ts
...nch/services/textfile/electron-browser/textFileService.ts
+4
-2
src/vs/workbench/test/workbenchTestServices.ts
src/vs/workbench/test/workbenchTestServices.ts
+4
-2
未找到文件。
src/vs/workbench/parts/files/common/files.ts
浏览文件 @
77dee3ef
...
...
@@ -44,7 +44,6 @@ const openEditorsVisibleId = 'openEditorsVisible';
const
openEditorsFocusId
=
'
openEditorsFocus
'
;
const
explorerViewletFocusId
=
'
explorerViewletFocus
'
;
const
explorerResourceIsFolderId
=
'
explorerResourceIsFolder
'
;
const
autoSaveDisabled
=
'
autoSaveDisabled
'
;
export
const
ExplorerViewletVisibleContext
=
new
RawContextKey
<
boolean
>
(
explorerViewletVisibleId
,
true
);
export
const
ExplorerFolderContext
=
new
RawContextKey
<
boolean
>
(
explorerResourceIsFolderId
,
false
);
...
...
@@ -52,7 +51,6 @@ export const FilesExplorerFocusedContext = new RawContextKey<boolean>(filesExplo
export
const
OpenEditorsVisibleContext
=
new
RawContextKey
<
boolean
>
(
openEditorsVisibleId
,
false
);
export
const
OpenEditorsFocusedContext
=
new
RawContextKey
<
boolean
>
(
openEditorsFocusId
,
true
);
export
const
ExplorerFocusedContext
=
new
RawContextKey
<
boolean
>
(
explorerViewletFocusId
,
true
);
export
const
AutoSaveDisabledContext
=
new
RawContextKey
<
boolean
>
(
autoSaveDisabled
,
true
);
export
const
OpenEditorsVisibleCondition
=
ContextKeyExpr
.
has
(
openEditorsVisibleId
);
export
const
FilesExplorerFocusCondition
=
ContextKeyExpr
.
and
(
ContextKeyExpr
.
has
(
explorerViewletVisibleId
),
ContextKeyExpr
.
has
(
filesExplorerFocusId
),
ContextKeyExpr
.
not
(
InputFocusedContextKey
));
...
...
src/vs/workbench/parts/files/electron-browser/fileCommands.ts
浏览文件 @
77dee3ef
...
...
@@ -19,14 +19,14 @@ import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation
import
{
IViewletService
}
from
'
vs/workbench/services/viewlet/browser/viewlet
'
;
import
{
IWorkspaceContextService
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
ExplorerViewlet
}
from
'
vs/workbench/parts/files/electron-browser/explorerViewlet
'
;
import
{
VIEWLET_ID
,
explorerItemToFileResource
,
AutoSaveDisabledContext
}
from
'
vs/workbench/parts/files/common/files
'
;
import
{
VIEWLET_ID
,
explorerItemToFileResource
}
from
'
vs/workbench/parts/files/common/files
'
;
import
{
FileStat
,
OpenEditor
}
from
'
vs/workbench/parts/files/common/explorerModel
'
;
import
errors
=
require
(
'
vs/base/common/errors
'
);
import
{
ITree
}
from
'
vs/base/parts/tree/browser/tree
'
;
import
{
IClipboardService
}
from
'
vs/platform/clipboard/common/clipboardService
'
;
import
{
IEditorGroupService
}
from
'
vs/workbench/services/group/common/groupService
'
;
import
{
IMessageService
,
Severity
}
from
'
vs/platform/message/common/message
'
;
import
{
ITextFileService
}
from
'
vs/workbench/services/textfile/common/textfiles
'
;
import
{
ITextFileService
,
AutoSaveNotAfterDelayContext
}
from
'
vs/workbench/services/textfile/common/textfiles
'
;
import
{
toErrorMessage
}
from
'
vs/base/common/errorMessage
'
;
import
{
basename
}
from
'
vs/base/common/paths
'
;
import
{
IListService
}
from
'
vs/platform/list/browser/listService
'
;
...
...
@@ -695,7 +695,7 @@ function registerMenuItems(): void {
id
:
SAVE_FILE_COMMAND_ID
,
title
:
SAVE_FILE_LABEL
},
when
:
ContextKeyExpr
.
and
(
EditorFocusedInOpenEditorsContext
)
when
:
ContextKeyExpr
.
and
(
EditorFocusedInOpenEditorsContext
,
AutoSaveNotAfterDelayContext
)
});
MenuRegistry
.
appendMenuItem
(
MenuId
.
OpenEditorsContext
,
{
...
...
@@ -705,7 +705,7 @@ function registerMenuItems(): void {
id
:
REVERT_FILE_COMMAND_ID
,
title
:
nls
.
localize
(
'
revert
'
,
"
Revert File
"
)
},
when
:
ContextKeyExpr
.
and
(
EditorFocusedInOpenEditorsContext
,
AutoSave
Disabled
Context
,
UntitledEditorNotFocusedInOpenEditorsContext
)
when
:
ContextKeyExpr
.
and
(
EditorFocusedInOpenEditorsContext
,
AutoSave
NotAfterDelay
Context
,
UntitledEditorNotFocusedInOpenEditorsContext
)
});
MenuRegistry
.
appendMenuItem
(
MenuId
.
OpenEditorsContext
,
{
...
...
@@ -717,31 +717,13 @@ function registerMenuItems(): void {
when
:
ContextKeyExpr
.
and
(
EditorFocusedInOpenEditorsContext
,
UntitledEditorFocusedInOpenEditorsContext
)
});
MenuRegistry
.
appendMenuItem
(
MenuId
.
OpenEditorsContext
,
{
group
:
'
2_save
'
,
command
:
{
id
:
SAVE_ALL_COMMAND_ID
,
title
:
SAVE_ALL_LABEL
},
when
:
ContextKeyExpr
.
and
(
EditorFocusedInOpenEditorsContext
)
});
MenuRegistry
.
appendMenuItem
(
MenuId
.
OpenEditorsContext
,
{
group
:
'
2_save
'
,
command
:
{
id
:
SAVE_ALL_IN_GROUP_COMMAND_ID
,
title
:
SAVE_ALL_IN_GROUP_LABEL
},
when
:
ContextKeyExpr
.
and
(
GroupFocusedInOpenEditorsContext
)
});
MenuRegistry
.
appendMenuItem
(
MenuId
.
OpenEditorsContext
,
{
group
:
'
2_save
'
,
command
:
{
id
:
SAVE_FILES_COMMAND_ID
,
title
:
SAVE_FILES_LABEL
},
when
:
ContextKeyExpr
.
and
(
EditorFocusedInOpenEditorsContext
)
when
:
ContextKeyExpr
.
and
(
GroupFocusedInOpenEditorsContext
,
AutoSaveNotAfterDelayContext
)
});
MenuRegistry
.
appendMenuItem
(
MenuId
.
OpenEditorsContext
,
{
...
...
@@ -751,7 +733,7 @@ function registerMenuItems(): void {
id
:
COMPARE_WITH_SAVED_COMMAND_ID
,
title
:
nls
.
localize
(
'
compareWithSaved
'
,
"
Compare with Saved
"
)
},
when
:
EditorFocusedInOpenEditorsContext
when
:
ContextKeyExpr
.
and
(
EditorFocusedInOpenEditorsContext
,
UntitledEditorNotFocusedInOpenEditorsContext
)
});
MenuRegistry
.
appendMenuItem
(
MenuId
.
OpenEditorsContext
,
{
...
...
@@ -761,7 +743,7 @@ function registerMenuItems(): void {
id
:
COMPARE_RESOURCE_COMMAND_ID
,
title
:
nls
.
localize
(
'
compareWithChosen
'
,
"
Compare With Chosen
"
)
},
when
:
EditorFocusedInOpenEditorsContext
when
:
ContextKeyExpr
.
and
(
EditorFocusedInOpenEditorsContext
,
)
});
MenuRegistry
.
appendMenuItem
(
MenuId
.
OpenEditorsContext
,
{
...
...
src/vs/workbench/services/textfile/common/textFileService.ts
浏览文件 @
77dee3ef
...
...
@@ -14,7 +14,7 @@ import Event, { Emitter } from 'vs/base/common/event';
import
platform
=
require
(
'
vs/base/common/platform
'
);
import
{
IWindowsService
}
from
'
vs/platform/windows/common/windows
'
;
import
{
IBackupFileService
}
from
'
vs/workbench/services/backup/common/backup
'
;
import
{
IResult
,
ITextFileOperationResult
,
ITextFileService
,
IRawTextContent
,
IAutoSaveConfiguration
,
AutoSaveMode
,
SaveReason
,
ITextFileEditorModelManager
,
ITextFileEditorModel
,
ModelState
,
ISaveOptions
}
from
'
vs/workbench/services/textfile/common/textfiles
'
;
import
{
IResult
,
ITextFileOperationResult
,
ITextFileService
,
IRawTextContent
,
IAutoSaveConfiguration
,
AutoSaveMode
,
SaveReason
,
ITextFileEditorModelManager
,
ITextFileEditorModel
,
ModelState
,
ISaveOptions
,
AutoSaveNotAfterDelayContext
}
from
'
vs/workbench/services/textfile/common/textfiles
'
;
import
{
ConfirmResult
}
from
'
vs/workbench/common/editor
'
;
import
{
ILifecycleService
,
ShutdownReason
}
from
'
vs/platform/lifecycle/common/lifecycle
'
;
import
{
IWorkspaceContextService
,
WorkbenchState
}
from
'
vs/platform/workspace/common/workspace
'
;
...
...
@@ -31,6 +31,7 @@ import { ResourceMap } from 'vs/base/common/map';
import
{
Schemas
}
from
'
vs/base/common/network
'
;
import
{
IHistoryService
}
from
'
vs/workbench/services/history/common/history
'
;
import
{
IRevertOptions
}
from
'
vs/platform/editor/common/editor
'
;
import
{
IContextKey
,
IContextKeyService
}
from
'
vs/platform/contextkey/common/contextkey
'
;
export
interface
IBackupResult
{
didBackup
:
boolean
;
...
...
@@ -56,6 +57,8 @@ export abstract class TextFileService implements ITextFileService {
private
configuredAutoSaveOnFocusChange
:
boolean
;
private
configuredAutoSaveOnWindowChange
:
boolean
;
private
autoSaveNotAfterDelayContext
:
IContextKey
<
boolean
>
;
private
configuredHotExit
:
string
;
constructor
(
...
...
@@ -69,7 +72,8 @@ export abstract class TextFileService implements ITextFileService {
protected
environmentService
:
IEnvironmentService
,
private
backupFileService
:
IBackupFileService
,
private
windowsService
:
IWindowsService
,
private
historyService
:
IHistoryService
private
historyService
:
IHistoryService
,
contextKeyService
:
IContextKeyService
)
{
this
.
toUnbind
=
[];
...
...
@@ -80,6 +84,7 @@ export abstract class TextFileService implements ITextFileService {
this
.
toUnbind
.
push
(
this
.
_onFilesAssociationChange
);
this
.
_models
=
this
.
instantiationService
.
createInstance
(
TextFileEditorModelManager
);
this
.
autoSaveNotAfterDelayContext
=
AutoSaveNotAfterDelayContext
.
bindTo
(
contextKeyService
);
const
configuration
=
this
.
configurationService
.
getValue
<
IFilesConfiguration
>
();
this
.
currentFilesAssociationConfig
=
configuration
&&
configuration
.
files
&&
configuration
.
files
.
associations
;
...
...
@@ -311,24 +316,28 @@ export abstract class TextFileService implements ITextFileService {
this
.
configuredAutoSaveDelay
=
configuration
&&
configuration
.
files
&&
configuration
.
files
.
autoSaveDelay
;
this
.
configuredAutoSaveOnFocusChange
=
false
;
this
.
configuredAutoSaveOnWindowChange
=
false
;
this
.
autoSaveNotAfterDelayContext
.
set
(
false
);
break
;
case
AutoSaveConfiguration
.
ON_FOCUS_CHANGE
:
this
.
configuredAutoSaveDelay
=
void
0
;
this
.
configuredAutoSaveOnFocusChange
=
true
;
this
.
configuredAutoSaveOnWindowChange
=
false
;
this
.
autoSaveNotAfterDelayContext
.
set
(
true
);
break
;
case
AutoSaveConfiguration
.
ON_WINDOW_CHANGE
:
this
.
configuredAutoSaveDelay
=
void
0
;
this
.
configuredAutoSaveOnFocusChange
=
false
;
this
.
configuredAutoSaveOnWindowChange
=
true
;
this
.
autoSaveNotAfterDelayContext
.
set
(
true
);
break
;
default
:
this
.
configuredAutoSaveDelay
=
void
0
;
this
.
configuredAutoSaveOnFocusChange
=
false
;
this
.
configuredAutoSaveOnWindowChange
=
false
;
this
.
autoSaveNotAfterDelayContext
.
set
(
true
);
break
;
}
...
...
src/vs/workbench/services/textfile/common/textfiles.ts
浏览文件 @
77dee3ef
...
...
@@ -14,6 +14,7 @@ import { createDecorator } from 'vs/platform/instantiation/common/instantiation'
import
{
ITextEditorModel
}
from
'
vs/editor/common/services/resolverService
'
;
import
{
IRawTextSource
}
from
'
vs/editor/common/model/textSource
'
;
import
{
IRevertOptions
}
from
'
vs/platform/editor/common/editor
'
;
import
{
RawContextKey
}
from
'
vs/platform/contextkey/common/contextkey
'
;
/**
* The save error handler can be installed on the text text file editor model to install code that executes when save errors occur.
...
...
@@ -90,6 +91,7 @@ export class TextFileModelChangeEvent {
}
export
const
TEXT_FILE_SERVICE_ID
=
'
textFileService
'
;
export
const
AutoSaveNotAfterDelayContext
=
new
RawContextKey
<
boolean
>
(
'
autoSaveNotAfterDelayContext
'
,
true
);
export
interface
ITextFileOperationResult
{
results
:
IResult
[];
...
...
src/vs/workbench/services/textfile/electron-browser/textFileService.ts
浏览文件 @
77dee3ef
...
...
@@ -29,6 +29,7 @@ import { IBackupFileService } from 'vs/workbench/services/backup/common/backup';
import
{
IWindowsService
,
IWindowService
}
from
'
vs/platform/windows/common/windows
'
;
import
{
IHistoryService
}
from
'
vs/workbench/services/history/common/history
'
;
import
{
mnemonicButtonLabel
}
from
'
vs/base/common/labels
'
;
import
{
IContextKeyService
}
from
'
vs/platform/contextkey/common/contextkey
'
;
export
class
TextFileService
extends
AbstractTextFileService
{
...
...
@@ -47,9 +48,10 @@ export class TextFileService extends AbstractTextFileService {
@
IMessageService
messageService
:
IMessageService
,
@
IBackupFileService
backupFileService
:
IBackupFileService
,
@
IWindowsService
windowsService
:
IWindowsService
,
@
IHistoryService
historyService
:
IHistoryService
@
IHistoryService
historyService
:
IHistoryService
,
@
IContextKeyService
contextKeyService
:
IContextKeyService
)
{
super
(
lifecycleService
,
contextService
,
configurationService
,
fileService
,
untitledEditorService
,
instantiationService
,
messageService
,
environmentService
,
backupFileService
,
windowsService
,
historyService
);
super
(
lifecycleService
,
contextService
,
configurationService
,
fileService
,
untitledEditorService
,
instantiationService
,
messageService
,
environmentService
,
backupFileService
,
windowsService
,
historyService
,
contextKeyService
);
}
public
resolveTextContent
(
resource
:
URI
,
options
?:
IResolveContentOptions
):
TPromise
<
IRawTextContent
>
{
...
...
src/vs/workbench/test/workbenchTestServices.ts
浏览文件 @
77dee3ef
...
...
@@ -59,6 +59,7 @@ import { ITextResourceConfigurationService } from 'vs/editor/common/services/res
import
{
IPosition
,
Position
as
EditorPosition
}
from
'
vs/editor/common/core/position
'
;
import
{
ICommandAction
}
from
'
vs/platform/actions/common/actions
'
;
import
{
IHashService
}
from
'
vs/workbench/services/hash/common/hashService
'
;
import
{
IContextKeyService
}
from
'
vs/platform/contextkey/common/contextkey
'
;
export
function
createFileInput
(
instantiationService
:
IInstantiationService
,
resource
:
URI
):
FileEditorInput
{
return
instantiationService
.
createInstance
(
FileEditorInput
,
resource
,
void
0
);
...
...
@@ -175,9 +176,10 @@ export class TestTextFileService extends TextFileService {
@
IMessageService
messageService
:
IMessageService
,
@
IBackupFileService
backupFileService
:
IBackupFileService
,
@
IWindowsService
windowsService
:
IWindowsService
,
@
IHistoryService
historyService
:
IHistoryService
@
IHistoryService
historyService
:
IHistoryService
,
@
IContextKeyService
contextKeyService
:
IContextKeyService
)
{
super
(
lifecycleService
,
contextService
,
configurationService
,
fileService
,
untitledEditorService
,
instantiationService
,
messageService
,
TestEnvironmentService
,
backupFileService
,
windowsService
,
historyService
);
super
(
lifecycleService
,
contextService
,
configurationService
,
fileService
,
untitledEditorService
,
instantiationService
,
messageService
,
TestEnvironmentService
,
backupFileService
,
windowsService
,
historyService
,
contextKeyService
);
}
public
setPromptPath
(
path
:
string
):
void
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录