Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
407e2668
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,发现更多精彩内容 >>
提交
407e2668
编写于
4月 18, 2019
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix #72343
上级
fe31e7bf
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
27 addition
and
14 deletion
+27
-14
src/vs/platform/files/common/files.ts
src/vs/platform/files/common/files.ts
+5
-0
src/vs/workbench/services/files/common/fileService.ts
src/vs/workbench/services/files/common/fileService.ts
+4
-4
src/vs/workbench/services/textfile/common/textFileEditorModel.ts
...workbench/services/textfile/common/textFileEditorModel.ts
+18
-9
src/vs/workbench/services/textfile/common/textFileService.ts
src/vs/workbench/services/textfile/common/textFileService.ts
+0
-1
未找到文件。
src/vs/platform/files/common/files.ts
浏览文件 @
407e2668
...
...
@@ -753,6 +753,11 @@ export enum FileKind {
export
const
MIN_MAX_MEMORY_SIZE_MB
=
2048
;
export
const
FALLBACK_MAX_MEMORY_SIZE_MB
=
4096
;
/**
* A hint to disable etag checking for reading/writing.
*/
export
const
ETAG_DISABLED
=
''
;
export
function
etag
(
mtime
:
number
,
size
:
number
):
string
;
export
function
etag
(
mtime
:
number
|
undefined
,
size
:
number
|
undefined
):
string
|
undefined
;
export
function
etag
(
mtime
:
number
|
undefined
,
size
:
number
|
undefined
):
string
|
undefined
{
...
...
src/vs/workbench/services/files/common/fileService.ts
浏览文件 @
407e2668
...
...
@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import
{
Disposable
,
IDisposable
,
toDisposable
,
combinedDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
IFileService
,
IResolveFileOptions
,
FileChangesEvent
,
FileOperationEvent
,
IFileSystemProviderRegistrationEvent
,
IFileSystemProvider
,
IFileStat
,
IResolveFileResult
,
ICreateFileOptions
,
IFileSystemProviderActivationEvent
,
FileOperationError
,
FileOperationResult
,
FileOperation
,
FileSystemProviderCapabilities
,
FileType
,
toFileSystemProviderErrorCode
,
FileSystemProviderErrorCode
,
IStat
,
IFileStatWithMetadata
,
IResolveMetadataFileOptions
,
etag
,
hasReadWriteCapability
,
hasFileFolderCopyCapability
,
hasOpenReadWriteCloseCapability
,
toFileOperationResult
,
IFileSystemProviderWithOpenReadWriteCloseCapability
,
IFileSystemProviderWithFileReadWriteCapability
,
IResolveFileResultWithMetadata
,
IWatchOptions
,
IWriteFileOptions
,
IReadFileOptions
,
IFileStreamContent
,
IFileContent
}
from
'
vs/platform/files/common/files
'
;
import
{
IFileService
,
IResolveFileOptions
,
FileChangesEvent
,
FileOperationEvent
,
IFileSystemProviderRegistrationEvent
,
IFileSystemProvider
,
IFileStat
,
IResolveFileResult
,
ICreateFileOptions
,
IFileSystemProviderActivationEvent
,
FileOperationError
,
FileOperationResult
,
FileOperation
,
FileSystemProviderCapabilities
,
FileType
,
toFileSystemProviderErrorCode
,
FileSystemProviderErrorCode
,
IStat
,
IFileStatWithMetadata
,
IResolveMetadataFileOptions
,
etag
,
hasReadWriteCapability
,
hasFileFolderCopyCapability
,
hasOpenReadWriteCloseCapability
,
toFileOperationResult
,
IFileSystemProviderWithOpenReadWriteCloseCapability
,
IFileSystemProviderWithFileReadWriteCapability
,
IResolveFileResultWithMetadata
,
IWatchOptions
,
IWriteFileOptions
,
IReadFileOptions
,
IFileStreamContent
,
IFileContent
,
ETAG_DISABLED
}
from
'
vs/platform/files/common/files
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
Event
,
Emitter
}
from
'
vs/base/common/event
'
;
import
{
ServiceIdentifier
}
from
'
vs/platform/instantiation/common/instantiation
'
;
...
...
@@ -337,7 +337,7 @@ export class FileService extends Disposable implements IFileService {
// check for size is a weaker check because it can return a false negative if the file has changed
// but to the same length. This is a compromise we take to avoid having to produce checksums of
// the file content for comparison which would be much slower to compute.
if
(
options
&&
typeof
options
.
mtime
===
'
number
'
&&
typeof
options
.
etag
===
'
string
'
&&
options
.
mtime
<
stat
.
mtime
&&
options
.
etag
!==
etag
(
stat
.
size
,
options
.
mtime
))
{
if
(
options
&&
typeof
options
.
mtime
===
'
number
'
&&
typeof
options
.
etag
===
'
string
'
&&
options
.
etag
!==
ETAG_DISABLED
&&
options
.
mtime
<
stat
.
mtime
&&
options
.
etag
!==
etag
(
stat
.
size
,
options
.
mtime
))
{
throw
new
FileOperationError
(
localize
(
'
fileModifiedError
'
,
"
File Modified Since
"
),
FileOperationResult
.
FILE_MODIFIED_SINCE
,
options
);
}
...
...
@@ -375,7 +375,7 @@ export class FileService extends Disposable implements IFileService {
// due to the likelyhood of hitting a NOT_MODIFIED_SINCE result.
// otherwise, we let it run in parallel to the file reading for
// optimal startup performance.
if
(
options
&&
options
.
etag
)
{
if
(
options
&&
typeof
options
.
etag
===
'
string
'
&&
options
.
etag
!==
ETAG_DISABLED
)
{
await
statPromise
;
}
...
...
@@ -493,7 +493,7 @@ export class FileService extends Disposable implements IFileService {
}
// Return early if file not modified since
if
(
options
&&
options
.
etag
&&
options
.
etag
===
stat
.
etag
)
{
if
(
options
&&
options
.
etag
===
stat
.
etag
)
{
throw
new
FileOperationError
(
localize
(
'
fileNotModifiedError
'
,
"
File not modified since
"
),
FileOperationResult
.
FILE_NOT_MODIFIED_SINCE
,
options
);
}
...
...
src/vs/workbench/services/textfile/common/textFileEditorModel.ts
浏览文件 @
407e2668
...
...
@@ -16,7 +16,7 @@ import { ITextFileService, IAutoSaveConfiguration, ModelState, ITextFileEditorMo
import
{
EncodingMode
}
from
'
vs/workbench/common/editor
'
;
import
{
BaseTextEditorModel
}
from
'
vs/workbench/common/editor/textEditorModel
'
;
import
{
IBackupFileService
}
from
'
vs/workbench/services/backup/common/backup
'
;
import
{
IFileService
,
FileOperationError
,
FileOperationResult
,
CONTENT_CHANGE_EVENT_BUFFER_DELAY
,
FileChangesEvent
,
FileChangeType
,
IFileStatWithMetadata
,
etag
}
from
'
vs/platform/files/common/files
'
;
import
{
IFileService
,
FileOperationError
,
FileOperationResult
,
CONTENT_CHANGE_EVENT_BUFFER_DELAY
,
FileChangesEvent
,
FileChangeType
,
IFileStatWithMetadata
,
ETAG_DISABLED
}
from
'
vs/platform/files/common/files
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IModeService
,
ILanguageSelection
}
from
'
vs/editor/common/services/modeService
'
;
import
{
IModelService
}
from
'
vs/editor/common/services/modelService
'
;
...
...
@@ -55,26 +55,35 @@ export class TextFileEditorModel extends BaseTextEditorModel implements ITextFil
get
onDidStateChange
():
Event
<
StateChange
>
{
return
this
.
_onDidStateChange
.
event
;
}
private
resource
:
URI
;
private
contentEncoding
:
string
;
// encoding as reported from disk
private
preferredEncoding
:
string
;
// encoding as chosen by the user
private
dirty
:
boolean
;
private
versionId
:
number
;
private
bufferSavedVersionId
:
number
;
private
lastResolvedDiskStat
:
IFileStatWithMetadata
;
private
blockModelContentChange
:
boolean
;
private
createTextEditorModelPromise
:
Promise
<
TextFileEditorModel
>
|
null
;
private
lastResolvedDiskStat
:
IFileStatWithMetadata
;
private
autoSaveAfterMillies
?:
number
;
private
autoSaveAfterMilliesEnabled
:
boolean
;
private
autoSaveDisposable
?:
IDisposable
;
private
contentChangeEventScheduler
:
RunOnceScheduler
;
private
orphanedChangeEventScheduler
:
RunOnceScheduler
;
private
saveSequentializer
:
SaveSequentializer
;
private
disposed
:
boolean
;
private
lastSaveAttemptTime
:
number
;
private
createTextEditorModelPromise
:
Promise
<
TextFileEditorModel
>
|
null
;
private
contentChangeEventScheduler
:
RunOnceScheduler
;
private
orphanedChangeEventScheduler
:
RunOnceScheduler
;
private
dirty
:
boolean
;
private
inConflictMode
:
boolean
;
private
inOrphanMode
:
boolean
;
private
inErrorMode
:
boolean
;
private
disposed
:
boolean
;
constructor
(
resource
:
URI
,
preferredEncoding
:
string
,
...
...
@@ -271,8 +280,8 @@ export class TextFileEditorModel extends BaseTextEditorModel implements ITextFil
name
:
basename
(
this
.
resource
),
mtime
:
Date
.
now
(),
size
:
0
,
etag
:
etag
(
Date
.
now
(),
0
),
value
:
createTextBufferFactory
(
''
),
/
* will be filled later from backup */
etag
:
ETAG_DISABLED
,
// always allow to save content restored from a backup (see https://github.com/Microsoft/vscode/issues/72343)
value
:
createTextBufferFactory
(
''
),
/
/ will be filled later from backup
encoding
:
this
.
textFileService
.
encoding
.
getPreferredWriteEncoding
(
this
.
resource
,
this
.
preferredEncoding
).
encoding
,
isReadonly
:
false
};
...
...
src/vs/workbench/services/textfile/common/textFileService.ts
浏览文件 @
407e2668
...
...
@@ -510,7 +510,6 @@ export abstract class TextFileService extends Disposable implements ITextFileSer
}));
}
// Soft revert the dirty source files if any
await
this
.
revertAll
(
dirtySourceModels
.
map
(
dirtySourceModel
=>
dirtySourceModel
.
getResource
()),
{
soft
:
true
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录