Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
c0766762
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
c0766762
编写于
12月 11, 2018
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix #63897
上级
55cbf197
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
24 addition
and
24 deletion
+24
-24
src/vs/platform/workspaces/electron-main/workspacesMainService.ts
...latform/workspaces/electron-main/workspacesMainService.ts
+1
-1
src/vs/workbench/browser/parts/editor/editorControl.ts
src/vs/workbench/browser/parts/editor/editorControl.ts
+1
-1
src/vs/workbench/services/configuration/node/configurationEditingService.ts
...ervices/configuration/node/configurationEditingService.ts
+10
-10
src/vs/workbench/services/configuration/node/jsonEditingService.ts
...rkbench/services/configuration/node/jsonEditingService.ts
+3
-3
src/vs/workbench/services/textfile/common/textFileEditorModel.ts
...workbench/services/textfile/common/textFileEditorModel.ts
+3
-3
src/vs/workbench/services/textfile/common/textFileEditorModelManager.ts
...ch/services/textfile/common/textFileEditorModelManager.ts
+1
-1
src/vs/workbench/services/textfile/common/textFileService.ts
src/vs/workbench/services/textfile/common/textFileService.ts
+3
-3
src/vs/workbench/services/textfile/test/textFileEditorModel.test.ts
...kbench/services/textfile/test/textFileEditorModel.test.ts
+1
-1
src/vs/workbench/test/workbenchTestServices.ts
src/vs/workbench/test/workbenchTestServices.ts
+1
-1
未找到文件。
src/vs/platform/workspaces/electron-main/workspacesMainService.ts
浏览文件 @
c0766762
...
...
@@ -201,7 +201,7 @@ export class WorkspacesMainService extends Disposable implements IWorkspacesMain
try
{
storedWorkspace
=
this
.
doParseStoredWorkspace
(
workspace
.
configPath
,
rawWorkspaceContents
);
}
catch
(
error
)
{
return
TPromise
.
wrapError
(
error
);
return
Promise
.
reject
(
error
);
}
const
sourceConfigFolder
=
dirname
(
workspace
.
configPath
);
...
...
src/vs/workbench/browser/parts/editor/editorControl.ts
浏览文件 @
c0766762
...
...
@@ -191,7 +191,7 @@ export class EditorControl extends Disposable {
// Operation done
operation
.
stop
();
return
TPromise
.
wrapError
(
e
);
return
Promise
.
reject
(
e
);
});
}
...
...
src/vs/workbench/services/configuration/node/configurationEditingService.ts
浏览文件 @
c0766762
...
...
@@ -264,7 +264,7 @@ export class ConfigurationEditingService {
this
.
editorService
.
openEditor
({
resource
});
}
private
wrapError
<
T
=
never
>
(
code
:
ConfigurationEditingErrorCode
,
target
:
ConfigurationTarget
,
operation
:
IConfigurationEditOperation
):
Promise
<
T
>
{
private
reject
<
T
=
never
>
(
code
:
ConfigurationEditingErrorCode
,
target
:
ConfigurationTarget
,
operation
:
IConfigurationEditOperation
):
Promise
<
T
>
{
const
message
=
this
.
toErrorMessage
(
code
,
target
,
operation
);
return
Promise
.
reject
(
new
ConfigurationEditingError
(
message
,
code
));
...
...
@@ -377,45 +377,45 @@ export class ConfigurationEditingService {
if
(
!
operation
.
workspaceStandAloneConfigurationKey
)
{
const
validKeys
=
this
.
configurationService
.
keys
().
default
;
if
(
validKeys
.
indexOf
(
operation
.
key
)
<
0
&&
!
OVERRIDE_PROPERTY_PATTERN
.
test
(
operation
.
key
))
{
return
this
.
wrapError
(
ConfigurationEditingErrorCode
.
ERROR_UNKNOWN_KEY
,
target
,
operation
);
return
this
.
reject
(
ConfigurationEditingErrorCode
.
ERROR_UNKNOWN_KEY
,
target
,
operation
);
}
}
if
(
operation
.
workspaceStandAloneConfigurationKey
)
{
// Global tasks and launches are not supported
if
(
target
===
ConfigurationTarget
.
USER
)
{
return
this
.
wrapError
(
ConfigurationEditingErrorCode
.
ERROR_INVALID_USER_TARGET
,
target
,
operation
);
return
this
.
reject
(
ConfigurationEditingErrorCode
.
ERROR_INVALID_USER_TARGET
,
target
,
operation
);
}
// Workspace tasks are not supported
if
(
operation
.
workspaceStandAloneConfigurationKey
===
TASKS_CONFIGURATION_KEY
&&
this
.
contextService
.
getWorkbenchState
()
===
WorkbenchState
.
WORKSPACE
&&
operation
.
target
===
ConfigurationTarget
.
WORKSPACE
)
{
return
this
.
wrapError
(
ConfigurationEditingErrorCode
.
ERROR_INVALID_WORKSPACE_TARGET
,
target
,
operation
);
return
this
.
reject
(
ConfigurationEditingErrorCode
.
ERROR_INVALID_WORKSPACE_TARGET
,
target
,
operation
);
}
}
// Target cannot be workspace or folder if no workspace opened
if
((
target
===
ConfigurationTarget
.
WORKSPACE
||
target
===
ConfigurationTarget
.
WORKSPACE_FOLDER
)
&&
this
.
contextService
.
getWorkbenchState
()
===
WorkbenchState
.
EMPTY
)
{
return
this
.
wrapError
(
ConfigurationEditingErrorCode
.
ERROR_NO_WORKSPACE_OPENED
,
target
,
operation
);
return
this
.
reject
(
ConfigurationEditingErrorCode
.
ERROR_NO_WORKSPACE_OPENED
,
target
,
operation
);
}
if
(
target
===
ConfigurationTarget
.
WORKSPACE
)
{
if
(
!
operation
.
workspaceStandAloneConfigurationKey
)
{
const
configurationProperties
=
Registry
.
as
<
IConfigurationRegistry
>
(
ConfigurationExtensions
.
Configuration
).
getConfigurationProperties
();
if
(
configurationProperties
[
operation
.
key
].
scope
===
ConfigurationScope
.
APPLICATION
)
{
return
this
.
wrapError
(
ConfigurationEditingErrorCode
.
ERROR_INVALID_WORKSPACE_CONFIGURATION_APPLICATION
,
target
,
operation
);
return
this
.
reject
(
ConfigurationEditingErrorCode
.
ERROR_INVALID_WORKSPACE_CONFIGURATION_APPLICATION
,
target
,
operation
);
}
}
}
if
(
target
===
ConfigurationTarget
.
WORKSPACE_FOLDER
)
{
if
(
!
operation
.
resource
)
{
return
this
.
wrapError
(
ConfigurationEditingErrorCode
.
ERROR_INVALID_FOLDER_TARGET
,
target
,
operation
);
return
this
.
reject
(
ConfigurationEditingErrorCode
.
ERROR_INVALID_FOLDER_TARGET
,
target
,
operation
);
}
if
(
!
operation
.
workspaceStandAloneConfigurationKey
)
{
const
configurationProperties
=
Registry
.
as
<
IConfigurationRegistry
>
(
ConfigurationExtensions
.
Configuration
).
getConfigurationProperties
();
if
(
configurationProperties
[
operation
.
key
].
scope
!==
ConfigurationScope
.
RESOURCE
)
{
return
this
.
wrapError
(
ConfigurationEditingErrorCode
.
ERROR_INVALID_FOLDER_CONFIGURATION
,
target
,
operation
);
return
this
.
reject
(
ConfigurationEditingErrorCode
.
ERROR_INVALID_FOLDER_CONFIGURATION
,
target
,
operation
);
}
}
}
...
...
@@ -425,12 +425,12 @@ export class ConfigurationEditingService {
const
model
=
reference
.
object
.
textEditorModel
;
if
(
this
.
hasParseErrors
(
model
,
operation
))
{
return
this
.
wrapError
<
typeof
reference
>
(
ConfigurationEditingErrorCode
.
ERROR_INVALID_CONFIGURATION
,
target
,
operation
);
return
this
.
reject
<
typeof
reference
>
(
ConfigurationEditingErrorCode
.
ERROR_INVALID_CONFIGURATION
,
target
,
operation
);
}
// Target cannot be dirty if not writing into buffer
if
(
checkDirty
&&
this
.
textFileService
.
isDirty
(
operation
.
resource
))
{
return
this
.
wrapError
<
typeof
reference
>
(
ConfigurationEditingErrorCode
.
ERROR_CONFIGURATION_FILE_DIRTY
,
target
,
operation
);
return
this
.
reject
<
typeof
reference
>
(
ConfigurationEditingErrorCode
.
ERROR_CONFIGURATION_FILE_DIRTY
,
target
,
operation
);
}
return
reference
;
});
...
...
src/vs/workbench/services/configuration/node/jsonEditingService.ts
浏览文件 @
c0766762
...
...
@@ -103,18 +103,18 @@ export class JSONEditingService implements IJSONEditingService {
const
model
=
reference
.
object
.
textEditorModel
;
if
(
this
.
hasParseErrors
(
model
))
{
return
this
.
wrapError
<
IReference
<
ITextEditorModel
>>
(
JSONEditingErrorCode
.
ERROR_INVALID_FILE
);
return
this
.
reject
<
IReference
<
ITextEditorModel
>>
(
JSONEditingErrorCode
.
ERROR_INVALID_FILE
);
}
// Target cannot be dirty if not writing into buffer
if
(
checkDirty
&&
this
.
textFileService
.
isDirty
(
resource
))
{
return
this
.
wrapError
<
IReference
<
ITextEditorModel
>>
(
JSONEditingErrorCode
.
ERROR_FILE_DIRTY
);
return
this
.
reject
<
IReference
<
ITextEditorModel
>>
(
JSONEditingErrorCode
.
ERROR_FILE_DIRTY
);
}
return
reference
;
});
}
private
wrapError
<
T
>
(
code
:
JSONEditingErrorCode
):
Promise
<
T
>
{
private
reject
<
T
>
(
code
:
JSONEditingErrorCode
):
Promise
<
T
>
{
const
message
=
this
.
toErrorMessage
(
code
);
return
Promise
.
reject
(
new
JSONEditingError
(
message
,
code
));
}
...
...
src/vs/workbench/services/textfile/common/textFileEditorModel.ts
浏览文件 @
c0766762
...
...
@@ -232,7 +232,7 @@ export class TextFileEditorModel extends BaseTextEditorModel implements ITextFil
// Set flags back to previous values, we are still dirty if revert failed
undo
();
return
TPromise
.
wrapError
(
error
);
return
Promise
.
reject
(
error
);
});
}
...
...
@@ -344,7 +344,7 @@ export class TextFileEditorModel extends BaseTextEditorModel implements ITextFil
}
// Otherwise bubble up the error
return
TPromise
.
wrapError
<
TextFileEditorModel
>
(
error
);
return
Promise
.
reject
<
TextFileEditorModel
>
(
error
);
});
}
...
...
@@ -467,7 +467,7 @@ export class TextFileEditorModel extends BaseTextEditorModel implements ITextFil
},
error
=>
{
this
.
createTextEditorModelPromise
=
null
;
return
TPromise
.
wrapError
<
TextFileEditorModel
>
(
error
);
return
Promise
.
reject
<
TextFileEditorModel
>
(
error
);
});
});
...
...
src/vs/workbench/services/textfile/common/textFileEditorModelManager.ts
浏览文件 @
c0766762
...
...
@@ -214,7 +214,7 @@ export class TextFileEditorModelManager extends Disposable implements ITextFileE
// Remove from pending loads
this
.
mapResourceToPendingModelLoaders
.
delete
(
resource
);
return
TPromise
.
wrapError
<
ITextFileEditorModel
>
(
error
);
return
Promise
.
reject
<
ITextFileEditorModel
>
(
error
);
});
}
...
...
src/vs/workbench/services/textfile/common/textFileService.ts
浏览文件 @
c0766762
...
...
@@ -623,7 +623,7 @@ export abstract class TextFileService extends Disposable implements ITextFileSer
return
this
.
fileService
.
del
(
target
).
then
(()
=>
this
.
doSaveTextFileAs
(
sourceModel
,
resource
,
target
,
options
));
}
return
TPromise
.
wrapError
(
error
);
return
Promise
.
reject
(
error
);
});
}
...
...
@@ -687,7 +687,7 @@ export abstract class TextFileService extends Disposable implements ITextFileSer
// Otherwise bubble up the error
else
{
return
TPromise
.
wrapError
(
error
);
return
Promise
.
reject
(
error
);
}
return
void
0
;
...
...
@@ -791,7 +791,7 @@ export abstract class TextFileService extends Disposable implements ITextFileSer
// In case of an error, discard any dirty target backups that were made
return
TPromise
.
join
(
dirtyTargetModels
.
map
(
dirtyTargetModel
=>
this
.
backupFileService
.
discardResourceBackup
(
dirtyTargetModel
)))
.
then
(()
=>
TPromise
.
wrapError
(
error
));
.
then
(()
=>
Promise
.
reject
(
error
));
});
});
});
...
...
src/vs/workbench/services/textfile/test/textFileEditorModel.test.ts
浏览文件 @
c0766762
...
...
@@ -320,7 +320,7 @@ suite('Files - TextFileEditorModel', () => {
TextFileEditorModel
.
setSaveParticipant
({
participate
:
(
model
)
=>
{
return
TPromise
.
wrapError
(
new
Error
(
'
boom
'
));
return
Promise
.
reject
(
new
Error
(
'
boom
'
));
}
});
...
...
src/vs/workbench/test/workbenchTestServices.ts
浏览文件 @
c0766762
...
...
@@ -210,7 +210,7 @@ export class TestTextFileService extends TextFileService {
const
error
=
this
.
resolveTextContentError
;
this
.
resolveTextContentError
=
null
;
return
TPromise
.
wrapError
<
IRawTextContent
>
(
error
);
return
Promise
.
reject
(
error
);
}
return
this
.
fileService
.
resolveContent
(
resource
,
options
).
then
((
content
):
IRawTextContent
=>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录