Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
47372d50
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,体验更适合开发者的 AI 搜索 >>
提交
47372d50
编写于
4月 10, 2019
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
files2 -
💄
上级
d8b9a524
变更
13
显示空白变更内容
内联
并排
Showing
13 changed file
with
25 addition
and
25 deletion
+25
-25
src/vs/workbench/contrib/debug/electron-browser/debugConfigurationManager.ts
...ntrib/debug/electron-browser/debugConfigurationManager.ts
+1
-1
src/vs/workbench/contrib/extensions/electron-browser/extensionsActions.ts
.../contrib/extensions/electron-browser/extensionsActions.ts
+1
-1
src/vs/workbench/contrib/snippets/browser/configureSnippets.ts
...s/workbench/contrib/snippets/browser/configureSnippets.ts
+2
-2
src/vs/workbench/contrib/splash/electron-browser/partsSplash.contribution.ts
...ntrib/splash/electron-browser/partsSplash.contribution.ts
+1
-1
src/vs/workbench/services/configuration/common/configurationEditingService.ts
...vices/configuration/common/configurationEditingService.ts
+1
-2
src/vs/workbench/services/configuration/common/jsonEditingService.ts
...bench/services/configuration/common/jsonEditingService.ts
+1
-2
src/vs/workbench/services/configuration/test/electron-browser/configurationService.test.ts
...ration/test/electron-browser/configurationService.test.ts
+1
-2
src/vs/workbench/services/keybinding/common/keybindingEditing.ts
...workbench/services/keybinding/common/keybindingEditing.ts
+1
-1
src/vs/workbench/services/preferences/browser/preferencesService.ts
...kbench/services/preferences/browser/preferencesService.ts
+1
-1
src/vs/workbench/services/textfile/common/textFileEditorModel.ts
...workbench/services/textfile/common/textFileEditorModel.ts
+4
-4
src/vs/workbench/services/textfile/common/textFileService.ts
src/vs/workbench/services/textfile/common/textFileService.ts
+5
-3
src/vs/workbench/services/textfile/common/textfiles.ts
src/vs/workbench/services/textfile/common/textfiles.ts
+1
-1
src/vs/workbench/services/workspace/electron-browser/workspaceEditingService.ts
...ces/workspace/electron-browser/workspaceEditingService.ts
+5
-4
未找到文件。
src/vs/workbench/contrib/debug/electron-browser/debugConfigurationManager.ts
浏览文件 @
47372d50
...
...
@@ -576,7 +576,7 @@ class Launch extends AbstractLaunch implements ILaunch {
}
created
=
true
;
// pin only if config file is created #8727
return
this
.
textFileService
.
upda
te
(
resource
,
content
).
then
(()
=>
{
return
this
.
textFileService
.
wri
te
(
resource
,
content
).
then
(()
=>
{
// convert string into IContent; see #32135
return
content
;
});
...
...
src/vs/workbench/contrib/extensions/electron-browser/extensionsActions.ts
浏览文件 @
47372d50
...
...
@@ -2134,7 +2134,7 @@ export abstract class AbstractConfigureRecommendedExtensionsAction extends Actio
return
Promise
.
resolve
(
this
.
fileService
.
resolveContent
(
extensionsFileResource
)).
then
(
content
=>
{
return
{
created
:
false
,
extensionsFileResource
,
content
:
content
.
value
};
},
err
=>
{
return
this
.
textFileService
.
upda
te
(
extensionsFileResource
,
ExtensionsConfigurationInitialContent
).
then
(()
=>
{
return
this
.
textFileService
.
wri
te
(
extensionsFileResource
,
ExtensionsConfigurationInitialContent
).
then
(()
=>
{
return
{
created
:
true
,
extensionsFileResource
,
content
:
ExtensionsConfigurationInitialContent
};
});
});
...
...
src/vs/workbench/contrib/snippets/browser/configureSnippets.ts
浏览文件 @
47372d50
...
...
@@ -139,7 +139,7 @@ async function createSnippetFile(scope: string, defaultPath: URI, windowService:
return
undefined
;
}
await
textFileService
.
upda
te
(
resource
,
[
await
textFileService
.
wri
te
(
resource
,
[
'
{
'
,
'
\t
// Place your
'
+
scope
+
'
snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
'
,
'
\t
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
'
,
...
...
@@ -185,7 +185,7 @@ async function createLanguageSnippetFile(pick: ISnippetPick, fileService: IFileS
'
\t
// }
'
,
'
}
'
].
join
(
'
\n
'
);
await
textFileService
.
upda
te
(
URI
.
file
(
pick
.
filepath
),
contents
);
await
textFileService
.
wri
te
(
URI
.
file
(
pick
.
filepath
),
contents
);
}
CommandsRegistry
.
registerCommand
(
id
,
async
(
accessor
):
Promise
<
any
>
=>
{
...
...
src/vs/workbench/contrib/splash/electron-browser/partsSplash.contribution.ts
浏览文件 @
47372d50
...
...
@@ -78,7 +78,7 @@ class PartsSplash {
sideBarWidth
:
getTotalWidth
(
this
.
_layoutService
.
getContainer
(
Parts
.
SIDEBAR_PART
)),
statusBarHeight
:
getTotalHeight
(
this
.
_layoutService
.
getContainer
(
Parts
.
STATUSBAR_PART
)),
};
this
.
_textFileService
.
upda
te
(
this
.
_textFileService
.
wri
te
(
URI
.
file
(
join
(
this
.
_envService
.
userDataPath
,
'
rapid_render.json
'
)),
JSON
.
stringify
({
id
:
PartsSplash
.
_splashElementId
,
...
...
src/vs/workbench/services/configuration/common/configurationEditingService.ts
浏览文件 @
47372d50
...
...
@@ -29,7 +29,6 @@ import { INotificationService, Severity } from 'vs/platform/notification/common/
import
{
IPreferencesService
}
from
'
vs/workbench/services/preferences/common/preferences
'
;
import
{
withUndefinedAsNull
,
withNullAsUndefined
}
from
'
vs/base/common/types
'
;
import
{
IRemoteAgentService
}
from
'
vs/workbench/services/remote/common/remoteAgentService
'
;
import
{
VSBuffer
}
from
'
vs/base/common/buffer
'
;
export
const
enum
ConfigurationEditingErrorCode
{
...
...
@@ -376,7 +375,7 @@ export class ConfigurationEditingService {
private
async
resolveModelReference
(
resource
:
URI
):
Promise
<
IReference
<
IResolvedTextEditorModel
>>
{
const
exists
=
await
this
.
fileService
.
exists
(
resource
);
if
(
!
exists
)
{
await
this
.
fileService
.
writeFile
(
resource
,
VSBuffer
.
fromString
(
'
{}
'
)
);
await
this
.
textFileService
.
write
(
resource
,
'
{}
'
);
}
return
this
.
textModelResolverService
.
createModelReference
(
resource
);
}
...
...
src/vs/workbench/services/configuration/common/jsonEditingService.ts
浏览文件 @
47372d50
...
...
@@ -20,7 +20,6 @@ import { ITextModelService, IResolvedTextEditorModel } from 'vs/editor/common/se
import
{
IJSONEditingService
,
IJSONValue
,
JSONEditingError
,
JSONEditingErrorCode
}
from
'
vs/workbench/services/configuration/common/jsonEditing
'
;
import
{
ITextModel
}
from
'
vs/editor/common/model
'
;
import
{
registerSingleton
}
from
'
vs/platform/instantiation/common/extensions
'
;
import
{
VSBuffer
}
from
'
vs/base/common/buffer
'
;
export
class
JSONEditingService
implements
IJSONEditingService
{
...
...
@@ -87,7 +86,7 @@ export class JSONEditingService implements IJSONEditingService {
private
async
resolveModelReference
(
resource
:
URI
):
Promise
<
IReference
<
IResolvedTextEditorModel
>>
{
const
exists
=
await
this
.
fileService
.
exists
(
resource
);
if
(
!
exists
)
{
await
this
.
fileService
.
writeFile
(
resource
,
VSBuffer
.
fromString
(
'
{}
'
)
);
await
this
.
textFileService
.
write
(
resource
,
'
{}
'
);
}
return
this
.
textModelResolverService
.
createModelReference
(
resource
);
}
...
...
src/vs/workbench/services/configuration/test/electron-browser/configurationService.test.ts
浏览文件 @
47372d50
...
...
@@ -43,7 +43,6 @@ import { NullLogService } from 'vs/platform/log/common/log';
import
{
DiskFileSystemProvider
}
from
'
vs/workbench/services/files2/node/diskFileSystemProvider
'
;
import
{
ConfigurationCache
}
from
'
vs/workbench/services/configuration/node/configurationCache
'
;
import
{
ConfigurationFileService
}
from
'
vs/workbench/services/configuration/node/configurationFileService
'
;
import
{
VSBuffer
}
from
'
vs/base/common/buffer
'
;
class
SettingsTestEnvironmentService
extends
EnvironmentService
{
...
...
@@ -367,7 +366,7 @@ suite('WorkspaceContextService - Workspace Editing', () => {
});
const
workspace
=
{
folders
:
[{
path
:
folders
[
0
].
uri
.
fsPath
},
{
path
:
folders
[
1
].
uri
.
fsPath
}]
};
await
instantiationService
.
get
(
I
FileService
).
writeFile
(
testObject
.
getWorkspace
().
configuration
!
,
VSBuffer
.
fromString
(
JSON
.
stringify
(
workspace
,
null
,
'
\t
'
)
));
await
instantiationService
.
get
(
I
TextFileService
).
write
(
testObject
.
getWorkspace
().
configuration
!
,
JSON
.
stringify
(
workspace
,
null
,
'
\t
'
));
});
test
(
'
update folders (remove last and add to end)
'
,
()
=>
{
...
...
src/vs/workbench/services/keybinding/common/keybindingEditing.ts
浏览文件 @
47372d50
...
...
@@ -211,7 +211,7 @@ export class KeybindingsEditingService extends Disposable implements IKeybinding
return
this
.
fileService
.
exists
(
this
.
resource
)
.
then
(
exists
=>
{
const
EOL
=
this
.
configurationService
.
getValue
(
'
files
'
,
{
overrideIdentifier
:
'
json
'
})[
'
eol
'
];
const
result
:
Promise
<
any
>
=
exists
?
Promise
.
resolve
(
null
)
:
this
.
textFileService
.
upda
te
(
this
.
resource
,
this
.
getEmptyContent
(
EOL
));
const
result
:
Promise
<
any
>
=
exists
?
Promise
.
resolve
(
null
)
:
this
.
textFileService
.
wri
te
(
this
.
resource
,
this
.
getEmptyContent
(
EOL
));
return
result
.
then
(()
=>
this
.
textModelResolverService
.
createModelReference
(
this
.
resource
));
});
}
...
...
src/vs/workbench/services/preferences/browser/preferencesService.ts
浏览文件 @
47372d50
...
...
@@ -557,7 +557,7 @@ export class PreferencesService extends Disposable implements IPreferencesServic
private
createIfNotExists
(
resource
:
URI
,
contents
:
string
):
Promise
<
any
>
{
return
this
.
fileService
.
resolveContent
(
resource
,
{
acceptTextOnly
:
true
}).
then
(
undefined
,
error
=>
{
if
((
<
FileOperationError
>
error
).
fileOperationResult
===
FileOperationResult
.
FILE_NOT_FOUND
)
{
return
this
.
textFileService
.
upda
te
(
resource
,
contents
).
then
(
undefined
,
error
=>
{
return
this
.
textFileService
.
wri
te
(
resource
,
contents
).
then
(
undefined
,
error
=>
{
return
Promise
.
reject
(
new
Error
(
nls
.
localize
(
'
fail.createSettings
'
,
"
Unable to create '{0}' ({1}).
"
,
this
.
labelService
.
getUriLabel
(
resource
,
{
relative
:
true
}),
error
)));
});
}
...
...
src/vs/workbench/services/textfile/common/textFileEditorModel.ts
浏览文件 @
47372d50
...
...
@@ -703,12 +703,12 @@ export class TextFileEditorModel extends BaseTextEditorModel implements ITextFil
// Save to Disk
// mark the save operation as currently pending with the versionId (it might have changed from a save participant triggering)
this
.
logService
.
trace
(
`doSave(
${
versionId
}
) - before
updateContent
()`
,
this
.
resource
);
this
.
logService
.
trace
(
`doSave(
${
versionId
}
) - before
write
()`
,
this
.
resource
);
const
snapshot
=
this
.
createSnapshot
();
if
(
!
snapshot
)
{
throw
new
Error
(
'
Invalid snapshot
'
);
}
return
this
.
saveSequentializer
.
setPending
(
newVersionId
,
this
.
textFileService
.
upda
te
(
this
.
lastResolvedDiskStat
.
resource
,
snapshot
,
{
return
this
.
saveSequentializer
.
setPending
(
newVersionId
,
this
.
textFileService
.
wri
te
(
this
.
lastResolvedDiskStat
.
resource
,
snapshot
,
{
overwriteReadonly
:
options
.
overwriteReadonly
,
overwriteEncoding
:
options
.
overwriteEncoding
,
mtime
:
this
.
lastResolvedDiskStat
.
mtime
,
...
...
@@ -716,7 +716,7 @@ export class TextFileEditorModel extends BaseTextEditorModel implements ITextFil
etag
:
this
.
lastResolvedDiskStat
.
etag
,
writeElevated
:
options
.
writeElevated
}).
then
(
stat
=>
{
this
.
logService
.
trace
(
`doSave(
${
versionId
}
) - after
updateContent
()`
,
this
.
resource
);
this
.
logService
.
trace
(
`doSave(
${
versionId
}
) - after
write
()`
,
this
.
resource
);
// Update dirty state unless model has changed meanwhile
if
(
versionId
===
this
.
versionId
)
{
...
...
@@ -849,7 +849,7 @@ export class TextFileEditorModel extends BaseTextEditorModel implements ITextFil
throw
new
Error
(
'
invalid snapshot
'
);
}
return
this
.
saveSequentializer
.
setPending
(
versionId
,
this
.
textFileService
.
upda
te
(
this
.
lastResolvedDiskStat
.
resource
,
snapshot
,
{
return
this
.
saveSequentializer
.
setPending
(
versionId
,
this
.
textFileService
.
wri
te
(
this
.
lastResolvedDiskStat
.
resource
,
snapshot
,
{
mtime
:
this
.
lastResolvedDiskStat
.
mtime
,
encoding
:
this
.
getEncoding
(),
etag
:
this
.
lastResolvedDiskStat
.
etag
...
...
src/vs/workbench/services/textfile/common/textFileService.ts
浏览文件 @
47372d50
...
...
@@ -399,8 +399,10 @@ export class TextFileService extends Disposable implements ITextFileService {
return
stat
;
}
update
(
resource
:
URI
,
value
:
string
|
ITextSnapshot
,
options
?:
IUpdateContentOptions
):
Promise
<
IFileStatWithMetadata
>
{
return
this
.
fileService
.
updateContent
(
resource
,
value
,
options
);
async
write
(
resource
:
URI
,
value
:
string
|
ITextSnapshot
,
options
?:
IUpdateContentOptions
):
Promise
<
IFileStatWithMetadata
>
{
const
stat
=
await
this
.
fileService
.
updateContent
(
resource
,
value
,
options
);
return
stat
;
}
async
delete
(
resource
:
URI
,
options
?:
{
useTrash
?:
boolean
,
recursive
?:
boolean
}):
Promise
<
void
>
{
...
...
@@ -802,7 +804,7 @@ export class TextFileService extends Disposable implements ITextFileService {
// create target model adhoc if file does not exist yet
if
(
!
targetExists
)
{
await
this
.
upd
ate
(
target
,
''
);
await
this
.
cre
ate
(
target
,
''
);
}
targetModel
=
await
this
.
models
.
loadOrCreate
(
target
);
...
...
src/vs/workbench/services/textfile/common/textfiles.ts
浏览文件 @
47372d50
...
...
@@ -355,7 +355,7 @@ export interface ITextFileService extends IDisposable {
/**
* Update a file with given contents.
*/
upda
te
(
resource
:
URI
,
value
:
string
|
ITextSnapshot
,
options
?:
IUpdateContentOptions
):
Promise
<
IFileStatWithMetadata
>
;
wri
te
(
resource
:
URI
,
value
:
string
|
ITextSnapshot
,
options
?:
IUpdateContentOptions
):
Promise
<
IFileStatWithMetadata
>
;
/**
* Delete a file. If the file is dirty, it will get reverted and then deleted from disk.
...
...
src/vs/workbench/services/workspace/electron-browser/workspaceEditingService.ts
浏览文件 @
47372d50
...
...
@@ -31,7 +31,7 @@ import { mnemonicButtonLabel } from 'vs/base/common/labels';
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
registerSingleton
}
from
'
vs/platform/instantiation/common/extensions
'
;
import
{
ILabelService
}
from
'
vs/platform/label/common/label
'
;
import
{
VSBuffer
}
from
'
vs/base/common/buffer
'
;
import
{
ITextFileService
}
from
'
vs/workbench/services/textfile/common/textfiles
'
;
export
class
WorkspaceEditingService
implements
IWorkspaceEditingService
{
...
...
@@ -47,7 +47,8 @@ export class WorkspaceEditingService implements IWorkspaceEditingService {
@
IBackupFileService
private
readonly
backupFileService
:
IBackupFileService
,
@
INotificationService
private
readonly
notificationService
:
INotificationService
,
@
ICommandService
private
readonly
commandService
:
ICommandService
,
@
IFileService
private
readonly
fileSystemService
:
IFileService
,
@
IFileService
private
readonly
fileService
:
IFileService
,
@
ITextFileService
private
readonly
textFileService
:
ITextFileService
,
@
IWindowsService
private
readonly
windowsService
:
IWindowsService
,
@
IWorkspacesService
private
readonly
workspaceService
:
IWorkspacesService
,
@
IWorkbenchEnvironmentService
private
readonly
environmentService
:
IWorkbenchEnvironmentService
,
...
...
@@ -297,9 +298,9 @@ export class WorkspaceEditingService implements IWorkspaceEditingService {
}
// Read the contents of the workspace file, update it to new location and save it.
const
raw
=
await
this
.
fileS
ystemS
ervice
.
resolveContent
(
configPathURI
);
const
raw
=
await
this
.
fileService
.
resolveContent
(
configPathURI
);
const
newRawWorkspaceContents
=
rewriteWorkspaceFileForNewLocation
(
raw
.
value
,
configPathURI
,
targetConfigPathURI
);
await
this
.
fileSystemService
.
createFile2
(
targetConfigPathURI
,
VSBuffer
.
fromString
(
newRawWorkspaceContents
)
,
{
overwrite
:
true
});
await
this
.
textFileService
.
create
(
targetConfigPathURI
,
newRawWorkspaceContents
,
{
overwrite
:
true
});
}
private
handleWorkspaceConfigurationEditingError
(
error
:
JSONEditingError
):
Promise
<
void
>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录