Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
6126d34c
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,发现更多精彩内容 >>
提交
6126d34c
编写于
11月 24, 2016
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use resource content providers for preferences
上级
9b135130
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
70 addition
and
83 deletion
+70
-83
src/vs/workbench/parts/contentprovider/common/contentprovider.contribution.ts
...ts/contentprovider/common/contentprovider.contribution.ts
+10
-1
src/vs/workbench/parts/preferences/browser/preferences.contribution.ts
...nch/parts/preferences/browser/preferences.contribution.ts
+3
-3
src/vs/workbench/parts/preferences/browser/preferencesEditor.ts
.../workbench/parts/preferences/browser/preferencesEditor.ts
+25
-29
src/vs/workbench/parts/preferences/browser/preferencesService.ts
...workbench/parts/preferences/browser/preferencesService.ts
+19
-40
src/vs/workbench/parts/preferences/common/preferences.ts
src/vs/workbench/parts/preferences/common/preferences.ts
+10
-7
src/vs/workbench/parts/preferences/common/preferencesModels.ts
...s/workbench/parts/preferences/common/preferencesModels.ts
+3
-3
未找到文件。
src/vs/workbench/parts/contentprovider/common/contentprovider.contribution.ts
浏览文件 @
6126d34c
...
...
@@ -13,6 +13,7 @@ import JSONContributionRegistry = require('vs/platform/jsonschemas/common/jsonCo
import
{
Registry
}
from
'
vs/platform/platform
'
;
import
{
IWorkbenchContribution
,
IWorkbenchContributionsRegistry
,
Extensions
as
WorkbenchExtensions
}
from
'
vs/workbench/common/contributions
'
;
import
{
ITextModelResolverService
}
from
'
vs/editor/common/services/resolverService
'
;
import
{
IPreferencesService
}
from
'
vs/workbench/parts/preferences/common/preferences
'
;
let
schemaRegistry
=
<
JSONContributionRegistry
.
IJSONContributionRegistry
>
Registry
.
as
(
JSONContributionRegistry
.
Extensions
.
JSONContribution
);
...
...
@@ -21,6 +22,7 @@ export class WorkbenchContentProvider implements IWorkbenchContribution {
constructor
(
@
IModelService
private
modelService
:
IModelService
,
@
ITextModelResolverService
private
textModelResolverService
:
ITextModelResolverService
,
@
IPreferencesService
private
preferencesService
:
IPreferencesService
,
@
IModeService
private
modeService
:
IModeService
)
{
this
.
start
();
...
...
@@ -45,7 +47,14 @@ export class WorkbenchContentProvider implements IWorkbenchContribution {
return
TPromise
.
as
(
this
.
modelService
.
createModel
(
modelContent
,
mode
,
uri
));
}
}
return
null
;
return
this
.
preferencesService
.
resolvePreferencesEditorModel
(
uri
)
.
then
(
preferencesModel
=>
{
if
(
preferencesModel
)
{
let
mode
=
this
.
modeService
.
getOrCreateMode
(
'
json
'
);
return
TPromise
.
as
(
this
.
modelService
.
createModel
(
preferencesModel
.
content
,
mode
,
uri
));
}
return
null
;
});
}
});
}
...
...
src/vs/workbench/parts/preferences/browser/preferences.contribution.ts
浏览文件 @
6126d34c
...
...
@@ -13,7 +13,7 @@ import { SyncActionDescriptor } from 'vs/platform/actions/common/actions';
import
{
registerSingleton
}
from
'
vs/platform/instantiation/common/extensions
'
;
import
{
KeyMod
,
KeyChord
,
KeyCode
}
from
'
vs/base/common/keyCodes
'
;
import
{
SyncDescriptor
}
from
'
vs/platform/instantiation/common/descriptors
'
;
import
{
Default
Setting
sEditor
,
DefaultSettingsInput
,
DefaultKeybindingsInput
}
from
'
vs/workbench/parts/preferences/browser/preferencesEditor
'
;
import
{
Default
Preference
sEditor
,
DefaultSettingsInput
,
DefaultKeybindingsInput
}
from
'
vs/workbench/parts/preferences/browser/preferencesEditor
'
;
import
{
OpenGlobalSettingsAction
,
OpenGlobalKeybindingsAction
,
OpenWorkspaceSettingsAction
}
from
'
vs/workbench/parts/preferences/browser/preferencesActions
'
;
import
{
IPreferencesService
}
from
'
vs/workbench/parts/preferences/common/preferences
'
;
import
{
PreferencesService
}
from
'
vs/workbench/parts/preferences/browser/preferencesService
'
;
...
...
@@ -22,10 +22,10 @@ registerSingleton(IPreferencesService, PreferencesService);
(
<
IEditorRegistry
>
Registry
.
as
(
EditorExtensions
.
Editors
)).
registerEditor
(
new
EditorDescriptor
(
Default
Setting
sEditor
.
ID
,
Default
Preference
sEditor
.
ID
,
nls
.
localize
(
'
defaultSettingsEditor
'
,
"
Default Settings Editor
"
),
'
vs/workbench/parts/preferences/browser/preferencesEditor
'
,
'
Default
Setting
sEditor
'
'
Default
Preference
sEditor
'
),
[
new
SyncDescriptor
(
DefaultSettingsInput
),
...
...
src/vs/workbench/parts/preferences/browser/preferencesEditor.ts
浏览文件 @
6126d34c
...
...
@@ -15,18 +15,19 @@ import Event, { Emitter } from 'vs/base/common/event';
import
{
LinkedMap
as
Map
}
from
'
vs/base/common/map
'
;
import
{
Registry
}
from
'
vs/platform/platform
'
;
import
{
EditorOptions
,
EditorInput
,
}
from
'
vs/workbench/common/editor
'
;
import
{
StringEditorInput
}
from
'
vs/workbench/common/editor/stringEditorInput
'
;
import
{
IConfigurationRegistry
,
Extensions
as
ConfigurationExtensions
}
from
'
vs/platform/configuration/common/configurationRegistry
'
;
import
*
as
editorCommon
from
'
vs/editor/common/editorCommon
'
;
import
{
StringEditor
}
from
'
vs/workbench/browser/parts/editor/stringEditor
'
;
import
{
ResourceEditorInput
}
from
'
vs/workbench/common/editor/resourceEditorInput
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IFoldingController
,
ID
as
FoldingContributionId
}
from
'
vs/editor/contrib/folding/common/folding
'
;
import
{
IPreferencesService
,
ISettingsGroup
,
ISetting
}
from
'
vs/workbench/parts/preferences/common/preferences
'
;
import
{
IPreferencesService
,
ISettingsGroup
,
ISetting
,
ISettingsEditorModel
,
IKeybindingsEditorModel
}
from
'
vs/workbench/parts/preferences/common/preferences
'
;
import
{
editorContribution
}
from
'
vs/editor/browser/editorBrowserExtensions
'
;
import
{
ICodeEditor
,
IEditorMouseEvent
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
IContextMenuService
}
from
'
vs/platform/contextview/browser/contextView
'
;
import
{
ITextModelResolverService
}
from
'
vs/editor/common/services/resolverService
'
;
export
class
AbstractSettingsInput
extends
String
EditorInput
{
export
class
DefaultPreferencesInput
extends
Resource
EditorInput
{
private
_willDispose
=
new
Emitter
<
void
>
();
public
willDispose
:
Event
<
void
>
=
this
.
_willDispose
.
event
;
...
...
@@ -34,17 +35,14 @@ export class AbstractSettingsInput extends StringEditorInput {
constructor
(
name
:
string
,
description
:
string
,
value
:
string
,
private
_resource
:
URI
,
modeId
:
string
,
singleton
:
boolean
,
@
IInstantiationService
instantiationService
:
IInstantiationService
resource
:
URI
,
@
ITextModelResolverService
textModelResolverService
:
ITextModelResolverService
)
{
super
(
name
,
description
,
value
,
modeId
,
singleton
,
instantiation
Service
);
super
(
name
,
description
,
resource
,
textModelResolver
Service
);
}
public
getResource
():
URI
{
return
this
.
_
resource
;
return
this
.
resource
;
}
public
dispose
()
{
...
...
@@ -54,41 +52,39 @@ export class AbstractSettingsInput extends StringEditorInput {
}
}
export
class
DefaultSettingsInput
extends
AbstractSetting
sInput
{
export
class
DefaultSettingsInput
extends
DefaultPreference
sInput
{
private
static
INSTANCE
:
DefaultSettingsInput
;
public
static
getInstance
(
instantiationService
:
IInstantiationService
,
preferencesService
:
IPreferencesService
):
DefaultSettingsInput
{
public
static
getInstance
(
instantiationService
:
IInstantiationService
,
defaultSettings
:
ISettingsEditorModel
):
DefaultSettingsInput
{
if
(
!
DefaultSettingsInput
.
INSTANCE
)
{
const
defaultSettings
=
preferencesService
.
defaultSettings
;
DefaultSettingsInput
.
INSTANCE
=
instantiationService
.
createInstance
(
DefaultSettingsInput
,
nls
.
localize
(
'
defaultName
'
,
"
Default Settings
"
),
null
,
defaultSettings
.
content
,
defaultSettings
.
uri
,
'
application/json
'
,
false
);
DefaultSettingsInput
.
INSTANCE
=
instantiationService
.
createInstance
(
DefaultSettingsInput
,
nls
.
localize
(
'
defaultName
'
,
"
Default Settings
"
),
null
,
defaultSettings
.
uri
);
}
return
DefaultSettingsInput
.
INSTANCE
;
}
}
export
class
DefaultKeybindingsInput
extends
AbstractSetting
sInput
{
export
class
DefaultKeybindingsInput
extends
DefaultPreference
sInput
{
private
static
INSTANCE
:
DefaultKeybindingsInput
;
public
static
getInstance
(
instantiationService
:
IInstantiationService
,
preferencesService
:
IPreferencesService
):
DefaultKeybindingsInput
{
public
static
getInstance
(
instantiationService
:
IInstantiationService
,
defaultKeybindings
:
IKeybindingsEditorModel
):
DefaultKeybindingsInput
{
if
(
!
DefaultKeybindingsInput
.
INSTANCE
)
{
const
defaultKeybindings
=
preferencesService
.
defaultKeybindings
;
DefaultKeybindingsInput
.
INSTANCE
=
instantiationService
.
createInstance
(
DefaultKeybindingsInput
,
nls
.
localize
(
'
defaultKeybindings
'
,
"
Default Keyboard Shortcuts
"
),
null
,
defaultKeybindings
.
content
,
defaultKeybindings
.
uri
,
'
application/json
'
,
false
);
DefaultKeybindingsInput
.
INSTANCE
=
instantiationService
.
createInstance
(
DefaultKeybindingsInput
,
nls
.
localize
(
'
defaultKeybindings
'
,
"
Default Keyboard Shortcuts
"
),
null
,
defaultKeybindings
.
uri
);
}
return
DefaultKeybindingsInput
.
INSTANCE
;
}
}
export
class
Default
Setting
sEditor
extends
StringEditor
{
export
class
Default
Preference
sEditor
extends
StringEditor
{
public
static
ID
=
'
workbench.editors.default
Setting
sEditor
'
;
public
static
ID
=
'
workbench.editors.default
Prefrence
sEditor
'
;
private
static
VIEW_STATE
:
Map
<
URI
,
editorCommon
.
IEditorViewState
>
=
new
Map
<
URI
,
editorCommon
.
IEditorViewState
>
();
private
inputDisposeListener
;
public
getId
():
string
{
return
Default
Setting
sEditor
.
ID
;
return
Default
Preference
sEditor
.
ID
;
}
public
setInput
(
input
:
EditorInput
,
options
:
EditorOptions
):
TPromise
<
void
>
{
...
...
@@ -97,7 +93,7 @@ export class DefaultSettingsEditor extends StringEditor {
}
public
clearInput
():
void
{
this
.
saveState
(
<
AbstractSetting
sInput
>
this
.
input
);
this
.
saveState
(
<
DefaultPreference
sInput
>
this
.
input
);
if
(
this
.
inputDisposeListener
)
{
this
.
inputDisposeListener
.
dispose
();
}
...
...
@@ -105,7 +101,7 @@ export class DefaultSettingsEditor extends StringEditor {
}
protected
restoreViewState
(
input
:
EditorInput
)
{
const
viewState
=
Default
SettingsEditor
.
VIEW_STATE
.
get
((
<
AbstractSetting
sInput
>
input
).
getResource
());
const
viewState
=
Default
PreferencesEditor
.
VIEW_STATE
.
get
((
<
DefaultPreference
sInput
>
input
).
getResource
());
if
(
viewState
)
{
this
.
getControl
().
restoreViewState
(
viewState
);
}
else
if
(
input
instanceof
DefaultSettingsInput
)
{
...
...
@@ -113,14 +109,14 @@ export class DefaultSettingsEditor extends StringEditor {
}
}
private
saveState
(
input
:
AbstractSetting
sInput
)
{
private
saveState
(
input
:
DefaultPreference
sInput
)
{
const
state
=
this
.
getControl
().
saveViewState
();
if
(
state
)
{
const
resource
=
input
.
getResource
();
if
(
Default
Setting
sEditor
.
VIEW_STATE
.
has
(
resource
))
{
Default
Setting
sEditor
.
VIEW_STATE
.
delete
(
resource
);
if
(
Default
Preference
sEditor
.
VIEW_STATE
.
has
(
resource
))
{
Default
Preference
sEditor
.
VIEW_STATE
.
delete
(
resource
);
}
Default
Setting
sEditor
.
VIEW_STATE
.
set
(
resource
,
state
);
Default
Preference
sEditor
.
VIEW_STATE
.
set
(
resource
,
state
);
}
}
...
...
@@ -133,8 +129,8 @@ export class DefaultSettingsEditor extends StringEditor {
if
(
this
.
inputDisposeListener
)
{
this
.
inputDisposeListener
.
dispose
();
}
if
(
input
instanceof
AbstractSetting
sInput
)
{
this
.
inputDisposeListener
=
(
<
AbstractSettingsInput
>
input
).
willDispose
(()
=>
this
.
saveState
(
<
AbstractSetting
sInput
>
input
));
if
(
input
instanceof
DefaultPreference
sInput
)
{
this
.
inputDisposeListener
=
(
<
DefaultPreferencesInput
>
input
).
willDispose
(()
=>
this
.
saveState
(
<
DefaultPreference
sInput
>
input
));
}
}
}
...
...
src/vs/workbench/parts/preferences/browser/preferencesService.ts
浏览文件 @
6126d34c
...
...
@@ -11,7 +11,6 @@ import { Delayer } from 'vs/base/common/async';
import
{
Disposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
parseTree
,
findNodeAtLocation
}
from
'
vs/base/common/json
'
;
import
{
asFileEditorInput
}
from
'
vs/workbench/common/editor
'
;
import
{
StringEditorInput
}
from
'
vs/workbench/common/editor/stringEditorInput
'
;
import
{
IWorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
IWorkspaceContextService
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
IWorkspaceConfigurationService
,
WORKSPACE_CONFIG_DEFAULT_PATH
}
from
'
vs/workbench/services/configuration/common/configuration
'
;
...
...
@@ -25,13 +24,10 @@ import { IEnvironmentService } from 'vs/platform/environment/common/environment'
import
{
ICodeEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
import
*
as
editorCommon
from
'
vs/editor/common/editorCommon
'
;
import
{
IConfigurationEditingService
,
ConfigurationTarget
,
IConfigurationValue
}
from
'
vs/workbench/services/configuration/common/configurationEditing
'
;
import
{
IPreferencesService
,
I
DefaultSettings
,
IDefaultKeybindings
}
from
'
vs/workbench/parts/preferences/common/preferences
'
;
import
{
IPreferencesService
,
I
PreferencesEditorModel
,
ISettingsEditorModel
,
IKeybindingsEditorModel
}
from
'
vs/workbench/parts/preferences/common/preferences
'
;
import
{
DefaultSettings
,
DefaultKeybindings
}
from
'
vs/workbench/parts/preferences/common/preferencesModels
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
ITextModelContentProvider
}
from
'
vs/editor/common/services/resolverService
'
;
import
{
IModelService
}
from
'
vs/editor/common/services/modelService
'
;
import
{
IModeService
}
from
'
vs/editor/common/services/modeService
'
;
import
{
DefaultSettingsInput
,
DefaultKeybindingsInput
}
from
'
vs/workbench/parts/preferences/browser/preferencesEditor
'
;
import
{
DefaultSettingsInput
,
DefaultKeybindingsInput
,
DefaultPreferencesInput
}
from
'
vs/workbench/parts/preferences/browser/preferencesEditor
'
;
const
SETTINGS_INFO_IGNORE_KEY
=
'
settings.workspace.info.ignore
'
;
...
...
@@ -50,8 +46,8 @@ export class PreferencesService extends Disposable implements IPreferencesServic
private
configurationTarget
:
ConfigurationTarget
=
null
;
private
_defaultSettings
:
I
DefaultSettings
;
private
_defaultKeybindings
:
I
DefaultKeybindings
;
private
_defaultSettings
:
I
SettingsEditorModel
;
private
_defaultKeybindings
:
I
KeybindingsEditorModel
;
constructor
(
@
IWorkbenchEditorService
private
editorService
:
IWorkbenchEditorService
,
...
...
@@ -82,20 +78,30 @@ export class PreferencesService extends Disposable implements IPreferencesServic
}));
}
public
get
defaultSettings
():
I
DefaultSettings
{
public
get
defaultSettings
():
I
SettingsEditorModel
{
if
(
!
this
.
_defaultSettings
)
{
this
.
_defaultSettings
=
this
.
instantiationService
.
createInstance
(
DefaultSettings
);
}
return
this
.
_defaultSettings
;
}
public
get
defaultKeybindings
():
I
DefaultKeybindings
{
public
get
defaultKeybindings
():
I
KeybindingsEditorModel
{
if
(
!
this
.
_defaultKeybindings
)
{
this
.
_defaultKeybindings
=
this
.
instantiationService
.
createInstance
(
DefaultKeybindings
);
}
return
this
.
_defaultKeybindings
;
}
resolvePreferencesEditorModel
(
uri
:
URI
):
TPromise
<
IPreferencesEditorModel
>
{
if
(
this
.
_defaultSettings
.
uri
.
fsPath
===
uri
.
fsPath
)
{
return
TPromise
.
wrap
(
this
.
_defaultSettings
);
}
if
(
this
.
_defaultKeybindings
.
uri
.
fsPath
===
uri
.
fsPath
)
{
return
TPromise
.
wrap
(
this
.
_defaultKeybindings
);
}
return
TPromise
.
wrap
(
null
);
}
openGlobalSettings
():
TPromise
<
void
>
{
if
(
this
.
configurationService
.
hasWorkspaceConfiguration
()
&&
!
this
.
storageService
.
getBoolean
(
SETTINGS_INFO_IGNORE_KEY
,
StorageScope
.
WORKSPACE
))
{
this
.
promptToOpenWorkspaceSettings
();
...
...
@@ -114,7 +120,7 @@ export class PreferencesService extends Disposable implements IPreferencesServic
openGlobalKeybindingSettings
():
TPromise
<
void
>
{
const
emptyContents
=
'
//
'
+
nls
.
localize
(
'
emptyKeybindingsHeader
'
,
"
Place your key bindings in this file to overwrite the defaults
"
)
+
'
\n
[
\n
]
'
;
return
this
.
openTwoEditors
(
DefaultKeybindingsInput
.
getInstance
(
this
.
instantiationService
,
this
),
URI
.
file
(
this
.
environmentService
.
appKeybindingsPath
),
emptyContents
).
then
(()
=>
null
);
return
this
.
openTwoEditors
(
DefaultKeybindingsInput
.
getInstance
(
this
.
instantiationService
,
this
.
defaultKeybindings
),
URI
.
file
(
this
.
environmentService
.
appKeybindingsPath
),
emptyContents
).
then
(()
=>
null
);
}
openEditableSettings
(
configurationTarget
:
ConfigurationTarget
,
showVisibleEditor
:
boolean
=
false
):
TPromise
<
IEditor
>
{
...
...
@@ -202,12 +208,12 @@ export class PreferencesService extends Disposable implements IPreferencesServic
if
(
openDefaultSettings
)
{
const
emptySettingsContents
=
this
.
getEmptyEditableSettingsContent
(
configurationTarget
);
const
settingsResource
=
this
.
getEditableSettingsURI
(
configurationTarget
);
return
this
.
openTwoEditors
(
DefaultSettingsInput
.
getInstance
(
this
.
instantiationService
,
this
),
settingsResource
,
emptySettingsContents
).
then
(()
=>
null
);
return
this
.
openTwoEditors
(
DefaultSettingsInput
.
getInstance
(
this
.
instantiationService
,
this
.
defaultSettings
),
settingsResource
,
emptySettingsContents
).
then
(()
=>
null
);
}
return
this
.
openEditableSettings
(
configurationTarget
).
then
(()
=>
null
);
}
private
openTwoEditors
(
leftHandDefaultInput
:
StringEditor
Input
,
editableResource
:
URI
,
defaultEditableContents
:
string
):
TPromise
<
IEditor
[]
>
{
private
openTwoEditors
(
leftHandDefaultInput
:
DefaultPreferences
Input
,
editableResource
:
URI
,
defaultEditableContents
:
string
):
TPromise
<
IEditor
[]
>
{
// Create as needed and open in editor
return
this
.
createIfNotExists
(
editableResource
,
defaultEditableContents
).
then
(()
=>
{
return
this
.
editorService
.
createInput
({
resource
:
editableResource
}).
then
(
typedRightHandEditableInput
=>
{
...
...
@@ -252,31 +258,4 @@ export class PreferencesService extends Disposable implements IPreferencesServic
endColumn
:
position
.
column
+
node
.
length
};
}
}
export
class
SettingsContentProvider
implements
ITextModelContentProvider
{
constructor
(
@
IPreferencesService
private
preferencesService
:
IPreferencesService
,
@
IModelService
private
modelService
:
IModelService
,
@
IModeService
private
modeService
:
IModeService
)
{
}
public
provideTextContent
(
uri
:
URI
):
TPromise
<
editorCommon
.
IModel
>
{
if
(
uri
.
scheme
!==
'
vscode
'
)
{
return
null
;
}
const
defaultSettings
=
this
.
preferencesService
.
defaultSettings
;
if
(
defaultSettings
.
uri
.
fsPath
===
uri
.
fsPath
)
{
let
mode
=
this
.
modeService
.
getOrCreateMode
(
'
application/json
'
);
return
TPromise
.
as
(
this
.
modelService
.
createModel
(
defaultSettings
.
content
,
mode
,
uri
));
}
const
defaultKeybindings
=
this
.
preferencesService
.
defaultKeybindings
;
if
(
defaultKeybindings
.
uri
.
fsPath
===
uri
.
fsPath
)
{
let
mode
=
this
.
modeService
.
getOrCreateMode
(
'
application/json
'
);
return
TPromise
.
as
(
this
.
modelService
.
createModel
(
defaultKeybindings
.
content
,
mode
,
uri
));
}
return
null
;
}
}
\ No newline at end of file
src/vs/workbench/parts/preferences/common/preferences.ts
浏览文件 @
6126d34c
...
...
@@ -29,15 +29,16 @@ export interface ISetting {
description
:
string
;
}
export
interface
I
DefaultSettings
{
export
interface
I
PreferencesEditorModel
{
uri
:
URI
;
content
:
string
;
}
export
interface
ISettingsEditorModel
extends
IPreferencesEditorModel
{
settingsGroups
:
ISettingsGroup
[];
}
export
interface
IDefaultKeybindings
{
uri
:
URI
;
content
:
string
;
export
interface
IKeybindingsEditorModel
extends
IPreferencesEditorModel
{
}
export
const
IPreferencesService
=
createDecorator
<
IPreferencesService
>
(
'
preferencesService
'
);
...
...
@@ -45,11 +46,13 @@ export const IPreferencesService = createDecorator<IPreferencesService>('prefere
export
interface
IPreferencesService
{
_serviceBrand
:
any
;
defaultSettings
:
IDefaultSettings
;
defaultKeybindings
:
IDefaultKeybindings
;
defaultSettings
:
ISettingsEditorModel
;
defaultKeybindings
:
IKeybindingsEditorModel
;
resolvePreferencesEditorModel
(
uri
:
URI
):
TPromise
<
IPreferencesEditorModel
>
;
openGlobalSettings
():
TPromise
<
void
>
;
openWorkspaceSettings
():
TPromise
<
void
>
;
openGlobalKeybindingSettings
():
TPromise
<
void
>
;
copyConfiguration
(
configurationValue
:
IConfigurationValue
):
void
;
}
}
\ No newline at end of file
src/vs/workbench/parts/preferences/common/preferencesModels.ts
浏览文件 @
6126d34c
...
...
@@ -9,11 +9,11 @@ import * as strings from 'vs/base/common/strings';
import
URI
from
'
vs/base/common/uri
'
;
import
{
Registry
}
from
'
vs/platform/platform
'
;
import
{
IConfigurationNode
,
IConfigurationRegistry
,
Extensions
}
from
'
vs/platform/configuration/common/configurationRegistry
'
;
import
{
I
DefaultSettings
,
IDefaultKeybindings
,
ISettingsGroup
,
ISetting
}
from
'
vs/workbench/parts/preferences/common/preferences
'
;
import
{
I
SettingsEditorModel
,
IKeybindingsEditorModel
,
ISettingsGroup
,
ISetting
}
from
'
vs/workbench/parts/preferences/common/preferences
'
;
import
{
IWorkspaceConfigurationService
}
from
'
vs/workbench/services/configuration/common/configuration
'
;
import
{
IKeybindingService
}
from
'
vs/platform/keybinding/common/keybinding
'
;
export
class
DefaultSettings
implements
I
DefaultSettings
{
export
class
DefaultSettings
implements
I
SettingsEditorModel
{
private
_uri
:
URI
=
URI
.
from
({
scheme
:
network
.
Schemas
.
vscode
,
authority
:
'
defaultsettings
'
,
path
:
'
/settings.json
'
});
private
indent
:
string
;
...
...
@@ -148,7 +148,7 @@ export class DefaultSettings implements IDefaultSettings {
}
}
export
class
DefaultKeybindings
implements
I
DefaultKeybindings
{
export
class
DefaultKeybindings
implements
I
KeybindingsEditorModel
{
private
_uri
:
URI
=
URI
.
from
({
scheme
:
network
.
Schemas
.
vscode
,
authority
:
'
defaultsettings
'
,
path
:
'
/keybindings.json
'
});
private
_content
:
string
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录