Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
3ce087b9
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,发现更多精彩内容 >>
提交
3ce087b9
编写于
5月 14, 2017
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#16580 Provide option to not to notify error by default. This is needed for extension API
上级
5f5df7cb
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
39 addition
and
13 deletion
+39
-13
src/vs/workbench/api/electron-browser/mainThreadConfiguration.ts
...workbench/api/electron-browser/mainThreadConfiguration.ts
+2
-2
src/vs/workbench/parts/preferences/browser/preferencesRenderers.ts
...rkbench/parts/preferences/browser/preferencesRenderers.ts
+14
-3
src/vs/workbench/parts/preferences/browser/preferencesService.ts
...workbench/parts/preferences/browser/preferencesService.ts
+1
-1
src/vs/workbench/services/configuration/common/configurationEditing.ts
...nch/services/configuration/common/configurationEditing.ts
+12
-1
src/vs/workbench/services/configuration/node/configurationEditingService.ts
...ervices/configuration/node/configurationEditingService.ts
+10
-6
未找到文件。
src/vs/workbench/api/electron-browser/mainThreadConfiguration.ts
浏览文件 @
3ce087b9
...
...
@@ -35,10 +35,10 @@ export class MainThreadConfiguration extends MainThreadConfigurationShape {
}
$updateConfigurationOption
(
target
:
ConfigurationTarget
,
key
:
string
,
value
:
any
):
TPromise
<
void
>
{
return
this
.
_configurationEditingService
.
writeConfiguration
(
target
,
{
key
,
value
});
return
this
.
_configurationEditingService
.
writeConfiguration
(
target
,
{
key
,
value
}
,
{
donotNotifyError
:
true
}
);
}
$removeConfigurationOption
(
target
:
ConfigurationTarget
,
key
:
string
):
TPromise
<
void
>
{
return
this
.
_configurationEditingService
.
writeConfiguration
(
target
,
{
key
,
value
:
undefined
});
return
this
.
_configurationEditingService
.
writeConfiguration
(
target
,
{
key
,
value
:
undefined
}
,
{
donotNotifyError
:
true
}
);
}
}
src/vs/workbench/parts/preferences/browser/preferencesRenderers.ts
浏览文件 @
3ce087b9
...
...
@@ -24,7 +24,7 @@ import { IContextMenuService, ContextSubMenu } from 'vs/platform/contextview/bro
import
{
SettingsGroupTitleWidget
,
EditPreferenceWidget
}
from
'
vs/workbench/parts/preferences/browser/preferencesWidgets
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
RangeHighlightDecorations
}
from
'
vs/workbench/common/editor/rangeDecorations
'
;
import
{
IConfigurationEditingService
}
from
'
vs/workbench/services/configuration/common/configurationEditing
'
;
import
{
IConfigurationEditingService
,
IConfigurationEditingError
,
ConfigurationEditingErrorCode
,
ConfigurationTarget
}
from
'
vs/workbench/services/configuration/common/configurationEditing
'
;
import
{
ITextFileService
}
from
'
vs/workbench/services/textfile/common/textfiles
'
;
import
{
overrideIdentifierFromKey
}
from
'
vs/platform/configuration/common/model
'
;
import
{
IMarkerService
,
IMarkerData
}
from
'
vs/platform/markers/common/markers
'
;
...
...
@@ -100,8 +100,19 @@ export class UserSettingsRenderer extends Disposable implements IPreferencesRend
public
updatePreference
(
key
:
string
,
value
:
any
,
source
:
ISetting
):
void
{
this
.
telemetryService
.
publicLog
(
'
defaultSettingsActions.copySetting
'
,
{
userConfigurationKeys
:
[
key
]
});
const
overrideIdentifier
=
source
.
overrideOf
?
overrideIdentifierFromKey
(
source
.
overrideOf
.
key
)
:
null
;
this
.
configurationEditingService
.
writeConfiguration
(
this
.
preferencesModel
.
configurationTarget
,
{
key
,
value
,
overrideIdentifier
},
!
this
.
textFileService
.
isDirty
(
this
.
preferencesModel
.
uri
))
.
then
(()
=>
this
.
onSettingUpdated
(
source
));
this
.
configurationEditingService
.
writeConfiguration
(
this
.
preferencesModel
.
configurationTarget
,
{
key
,
value
,
overrideIdentifier
},
{
donotSave
:
this
.
textFileService
.
isDirty
(
this
.
preferencesModel
.
uri
),
donotNotifyError
:
true
})
.
then
(()
=>
this
.
onSettingUpdated
(
source
),
error
=>
{
this
.
messageService
.
show
(
Severity
.
Error
,
this
.
toErrorMessage
(
error
,
this
.
preferencesModel
.
configurationTarget
));
});
}
private
toErrorMessage
(
error
:
IConfigurationEditingError
,
target
:
ConfigurationTarget
):
string
{
switch
(
error
.
code
)
{
case
ConfigurationEditingErrorCode
.
ERROR_INVALID_CONFIGURATION
:
{
return
nls
.
localize
(
'
errorInvalidConfiguration
'
,
"
Unable to write into settings. Correct errors/warnings in the file and try again.
"
);
};
}
return
error
.
message
;
}
private
onModelChanged
():
void
{
...
...
src/vs/workbench/parts/preferences/browser/preferencesService.ts
浏览文件 @
3ce087b9
...
...
@@ -325,7 +325,7 @@ export class PreferencesService extends Disposable implements IPreferencesServic
}
return
{
lineNumber
:
setting
.
valueRange
.
startLineNumber
,
column
:
setting
.
valueRange
.
startColumn
+
1
};
}
return
this
.
configurationEditingService
.
writeConfiguration
(
ConfigurationTarget
.
USER
,
{
key
:
languageKey
,
value
:
{}
},
false
)
return
this
.
configurationEditingService
.
writeConfiguration
(
ConfigurationTarget
.
USER
,
{
key
:
languageKey
,
value
:
{}
},
{
donotSave
:
true
}
)
.
then
(()
=>
{
setting
=
settingsModel
.
getPreference
(
languageKey
);
let
content
=
eol
+
this
.
spaces
(
2
,
configuration
)
+
eol
+
this
.
spaces
(
1
,
configuration
);
...
...
src/vs/workbench/services/configuration/common/configurationEditing.ts
浏览文件 @
3ce087b9
...
...
@@ -61,6 +61,17 @@ export interface IConfigurationValue {
overrideIdentifier
?:
string
;
}
export
interface
IConfigurationEditingOptions
{
/**
* If `true`, do not saves the configuration. Default is `false`.
*/
donotSave
?:
boolean
;
/**
* If `true`, do not notifies the error to user by showing the message box. Default is `false`.
*/
donotNotifyError
?:
boolean
;
}
export
interface
IConfigurationEditingService
{
_serviceBrand
:
ServiceIdentifier
<
any
>
;
...
...
@@ -69,5 +80,5 @@ export interface IConfigurationEditingService {
* Allows to write the configuration value to either the user or workspace configuration file and save it if asked to save.
* The returned promise will be in error state in any of the error cases from [ConfigurationEditingErrorCode](#ConfigurationEditingErrorCode)
*/
writeConfiguration
(
target
:
ConfigurationTarget
,
value
:
IConfigurationValue
,
save
?:
boolean
):
TPromise
<
void
>
;
writeConfiguration
(
target
:
ConfigurationTarget
,
value
:
IConfigurationValue
,
options
?:
IConfigurationEditingOptions
):
TPromise
<
void
>
;
}
\ No newline at end of file
src/vs/workbench/services/configuration/node/configurationEditingService.ts
浏览文件 @
3ce087b9
...
...
@@ -26,7 +26,7 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
import
{
keyFromOverrideIdentifier
}
from
'
vs/platform/configuration/common/model
'
;
import
{
WORKSPACE_CONFIG_DEFAULT_PATH
,
WORKSPACE_STANDALONE_CONFIGURATIONS
}
from
'
vs/workbench/services/configuration/common/configuration
'
;
import
{
IFileService
}
from
'
vs/platform/files/common/files
'
;
import
{
IConfigurationEditingService
,
ConfigurationEditingErrorCode
,
IConfigurationEditingError
,
ConfigurationTarget
,
IConfigurationValue
}
from
'
vs/workbench/services/configuration/common/configurationEditing
'
;
import
{
IConfigurationEditingService
,
ConfigurationEditingErrorCode
,
IConfigurationEditingError
,
ConfigurationTarget
,
IConfigurationValue
,
IConfigurationEditingOptions
}
from
'
vs/workbench/services/configuration/common/configurationEditing
'
;
import
{
ITextModelResolverService
,
ITextEditorModel
}
from
'
vs/editor/common/services/resolverService
'
;
import
{
OVERRIDE_PROPERTY_PATTERN
}
from
'
vs/platform/configuration/common/configurationRegistry
'
;
import
{
IChoiceService
,
IMessageService
,
Severity
}
from
'
vs/platform/message/common/message
'
;
...
...
@@ -62,15 +62,19 @@ export class ConfigurationEditingService implements IConfigurationEditingService
this
.
queue
=
new
Queue
<
void
>
();
}
writeConfiguration
(
target
:
ConfigurationTarget
,
value
:
IConfigurationValue
,
save
:
boolean
=
true
):
TPromise
<
void
>
{
return
this
.
queue
.
queue
(()
=>
this
.
doWriteConfiguration
(
target
,
value
,
save
).
then
(()
=>
null
,
error
=>
this
.
onError
(
error
,
target
)));
// queue up writes to prevent race conditions
writeConfiguration
(
target
:
ConfigurationTarget
,
value
:
IConfigurationValue
,
options
:
IConfigurationEditingOptions
=
{}):
TPromise
<
void
>
{
return
this
.
queue
.
queue
(()
=>
this
.
doWriteConfiguration
(
target
,
value
,
options
)
// queue up writes to prevent race conditions
.
then
(()
=>
null
,
error
=>
{
return
options
.
donotNotifyError
?
TPromise
.
wrapError
(
error
)
:
this
.
onError
(
error
,
target
);
}));
}
private
doWriteConfiguration
(
target
:
ConfigurationTarget
,
value
:
IConfigurationValue
,
save
:
boolean
):
TPromise
<
void
>
{
private
doWriteConfiguration
(
target
:
ConfigurationTarget
,
value
:
IConfigurationValue
,
options
:
IConfigurationEditingOptions
):
TPromise
<
void
>
{
const
operation
=
this
.
getConfigurationEditOperation
(
target
,
value
);
return
this
.
resolveAndValidate
(
target
,
operation
,
s
ave
)
.
then
(
reference
=>
this
.
writeToBuffer
(
reference
.
object
.
textEditorModel
,
operation
,
s
ave
)
return
this
.
resolveAndValidate
(
target
,
operation
,
!
options
.
donotS
ave
)
.
then
(
reference
=>
this
.
writeToBuffer
(
reference
.
object
.
textEditorModel
,
operation
,
!
options
.
donotS
ave
)
.
then
(()
=>
reference
.
dispose
()));
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录