Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
619dc7bd
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,发现更多精彩内容 >>
提交
619dc7bd
编写于
6月 25, 2020
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
textfiles - do not have VSBuffer on the layer of ITextFiles
上级
c7ea388c
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
9 addition
and
19 deletion
+9
-19
src/vs/workbench/services/bulkEdit/browser/bulkFileEdits.ts
src/vs/workbench/services/bulkEdit/browser/bulkFileEdits.ts
+5
-5
src/vs/workbench/services/textfile/browser/textFileService.ts
...vs/workbench/services/textfile/browser/textFileService.ts
+3
-3
src/vs/workbench/services/textfile/common/textfiles.ts
src/vs/workbench/services/textfile/common/textfiles.ts
+1
-1
src/vs/workbench/services/textfile/test/electron-browser/textFileService.io.test.ts
...textfile/test/electron-browser/textFileService.io.test.ts
+0
-10
未找到文件。
src/vs/workbench/services/bulkEdit/browser/bulkFileEdits.ts
浏览文件 @
619dc7bd
...
...
@@ -14,7 +14,6 @@ import { IWorkspaceUndoRedoElement, UndoRedoElementType, IUndoRedoService } from
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
ILogService
}
from
'
vs/platform/log/common/log
'
;
import
{
VSBuffer
}
from
'
vs/base/common/buffer
'
;
interface
IFileOperation
{
uris
:
URI
[];
...
...
@@ -55,7 +54,7 @@ class CreateOperation implements IFileOperation {
constructor
(
readonly
newUri
:
URI
,
readonly
options
:
WorkspaceFileEditOptions
,
readonly
contents
:
VSBuffer
|
undefined
,
readonly
contents
:
string
|
undefined
,
@
IFileService
private
readonly
_fileService
:
IFileService
,
@
ITextFileService
private
readonly
_textFileService
:
ITextFileService
,
@
IInstantiationService
private
readonly
_instaService
:
IInstantiationService
,
...
...
@@ -82,9 +81,10 @@ class DeleteOperation implements IFileOperation {
readonly
options
:
WorkspaceFileEditOptions
,
@
IWorkingCopyFileService
private
readonly
_workingCopyFileService
:
IWorkingCopyFileService
,
@
IFileService
private
readonly
_fileService
:
IFileService
,
@
ITextFileService
private
readonly
_textFileService
:
ITextFileService
,
@
IConfigurationService
private
readonly
_configurationService
:
IConfigurationService
,
@
IInstantiationService
private
readonly
_instaService
:
IInstantiationService
,
@
ILogService
private
readonly
_logService
:
ILogService
,
@
ILogService
private
readonly
_logService
:
ILogService
)
{
}
get
uris
()
{
...
...
@@ -100,9 +100,9 @@ class DeleteOperation implements IFileOperation {
return
new
Noop
();
}
let
contents
:
VSBuffer
|
undefined
;
let
contents
:
string
|
undefined
;
try
{
contents
=
(
await
this
.
_
fileService
.
readFile
(
this
.
oldUri
)).
value
;
contents
=
(
await
this
.
_
textFileService
.
read
(
this
.
oldUri
)).
value
;
}
catch
(
err
)
{
this
.
_logService
.
critical
(
err
);
}
...
...
src/vs/workbench/services/textfile/browser/textFileService.ts
浏览文件 @
619dc7bd
...
...
@@ -152,7 +152,7 @@ export abstract class AbstractTextFileService extends Disposable implements ITex
}
}
async
create
(
resource
:
URI
,
value
?:
string
|
ITextSnapshot
|
VSBuffer
,
options
?:
ICreateFileOptions
):
Promise
<
IFileStatWithMetadata
>
{
async
create
(
resource
:
URI
,
value
?:
string
|
ITextSnapshot
,
options
?:
ICreateFileOptions
):
Promise
<
IFileStatWithMetadata
>
{
// file operation participation
await
this
.
workingCopyFileService
.
runFileOperationParticipants
([{
target
:
resource
,
source
:
undefined
}],
FileOperation
.
CREATE
);
...
...
@@ -175,8 +175,8 @@ export abstract class AbstractTextFileService extends Disposable implements ITex
return
stat
;
}
protected
doCreate
(
resource
:
URI
,
value
?:
string
|
ITextSnapshot
|
VSBuffer
,
options
?:
ICreateFileOptions
):
Promise
<
IFileStatWithMetadata
>
{
return
this
.
fileService
.
createFile
(
resource
,
value
instanceof
VSBuffer
?
value
:
toBufferOrReadable
(
value
),
options
);
protected
doCreate
(
resource
:
URI
,
value
?:
string
|
ITextSnapshot
,
options
?:
ICreateFileOptions
):
Promise
<
IFileStatWithMetadata
>
{
return
this
.
fileService
.
createFile
(
resource
,
toBufferOrReadable
(
value
),
options
);
}
async
write
(
resource
:
URI
,
value
:
string
|
ITextSnapshot
,
options
?:
IWriteTextFileOptions
):
Promise
<
IFileStatWithMetadata
>
{
...
...
src/vs/workbench/services/textfile/common/textfiles.ts
浏览文件 @
619dc7bd
...
...
@@ -104,7 +104,7 @@ export interface ITextFileService extends IDisposable {
* Create a file. If the file exists it will be overwritten with the contents if
* the options enable to overwrite.
*/
create
(
resource
:
URI
,
contents
?:
string
|
ITextSnapshot
|
VSBuffer
,
options
?:
{
overwrite
?:
boolean
}):
Promise
<
IFileStatWithMetadata
>
;
create
(
resource
:
URI
,
contents
?:
string
|
ITextSnapshot
,
options
?:
{
overwrite
?:
boolean
}):
Promise
<
IFileStatWithMetadata
>
;
}
export
interface
IReadTextFileOptions
extends
IReadFileOptions
{
...
...
src/vs/workbench/services/textfile/test/electron-browser/textFileService.io.test.ts
浏览文件 @
619dc7bd
...
...
@@ -27,7 +27,6 @@ import { isWindows } from 'vs/base/common/platform';
import
{
readFileSync
,
statSync
}
from
'
fs
'
;
import
{
detectEncodingByBOM
}
from
'
vs/workbench/services/textfile/test/node/encoding/encoding.test
'
;
import
{
workbenchInstantiationService
,
TestNativeTextFileServiceWithEncodingOverrides
}
from
'
vs/workbench/test/electron-browser/workbenchTestServices
'
;
import
{
VSBuffer
}
from
'
vs/base/common/buffer
'
;
suite
(
'
Files - TextFileService i/o
'
,
function
()
{
const
parentDir
=
getRandomTestPath
(
tmpdir
(),
'
vsctests
'
,
'
textfileservice
'
);
...
...
@@ -101,15 +100,6 @@ suite('Files - TextFileService i/o', function () {
assert
.
equal
((
await
readFile
(
resource
.
fsPath
)).
toString
(),
'
Hello World
'
);
});
test
(
'
create - no encoding - content provided (VSBuffer)
'
,
async
()
=>
{
const
resource
=
URI
.
file
(
join
(
testDir
,
'
small_new.txt
'
));
await
service
.
create
(
resource
,
VSBuffer
.
fromString
(
'
Hello World
'
));
assert
.
equal
(
await
exists
(
resource
.
fsPath
),
true
);
assert
.
equal
((
await
readFile
(
resource
.
fsPath
)).
toString
(),
'
Hello World
'
);
});
test
(
'
create - UTF 16 LE - no content
'
,
async
()
=>
{
const
resource
=
URI
.
file
(
join
(
testDir
,
'
small_new.utf16le
'
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录