Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
f1b7315a
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,发现更多精彩内容 >>
提交
f1b7315a
编写于
12月 02, 2016
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix #16372
上级
036c2b0e
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
34 addition
and
16 deletion
+34
-16
src/vs/workbench/parts/preferences/browser/preferencesEditor.ts
.../workbench/parts/preferences/browser/preferencesEditor.ts
+14
-8
src/vs/workbench/parts/preferences/common/preferencesModels.ts
...s/workbench/parts/preferences/common/preferencesModels.ts
+20
-8
未找到文件。
src/vs/workbench/parts/preferences/browser/preferencesEditor.ts
浏览文件 @
f1b7315a
...
...
@@ -351,6 +351,7 @@ export class PreferencesEditorContribution extends Disposable implements editorC
export
class
SettingsRenderer
extends
Disposable
implements
IPreferencesRenderer
{
private
copySettingActionRenderer
:
CopySettingActionRenderer
;
private
modelChangeDelayer
:
Delayer
<
void
>
=
new
Delayer
<
void
>
(
200
);
constructor
(
protected
editor
:
ICodeEditor
,
protected
settingsEditorModel
:
SettingsEditorModel
,
@
IPreferencesService
protected
preferencesService
:
IPreferencesService
,
...
...
@@ -358,14 +359,18 @@ export class SettingsRenderer extends Disposable implements IPreferencesRenderer
)
{
super
();
this
.
copySettingActionRenderer
=
this
.
_register
(
instantiationService
.
createInstance
(
CopySettingActionRenderer
,
editor
,
false
));
this
.
_register
(
editor
.
getModel
().
onDidChangeContent
(()
=>
this
.
onModelChanged
(
)));
this
.
_register
(
editor
.
getModel
().
onDidChangeContent
(()
=>
this
.
modelChangeDelayer
.
trigger
(()
=>
this
.
onModelChanged
()
)));
}
public
render
()
{
public
render
()
:
void
{
this
.
copySettingActionRenderer
.
render
(
this
.
settingsEditorModel
.
settingsGroups
);
}
private
onModelChanged
()
{
private
onModelChanged
():
void
{
if
(
!
this
.
editor
.
getModel
())
{
// model could have been disposed during the delay
return
;
}
this
.
render
();
}
}
...
...
@@ -721,12 +726,13 @@ export class CopySettingActionRenderer extends Disposable {
if
(
jsonSchema
)
{
const
canChooseValue
=
jsonSchema
.
enum
||
jsonSchema
.
type
===
'
boolean
'
;
if
(
this
.
isDefaultSettings
||
canChooseValue
)
{
const
lineNumber
=
setting
.
keyRange
.
startLineNumber
;
return
{
range
:
{
startLineNumber
:
setting
.
valueRange
.
startL
ineNumber
,
startColumn
:
model
.
getLineMaxColumn
(
setting
.
valueRange
.
startL
ineNumber
),
endLineNumber
:
setting
.
valueRange
.
startL
ineNumber
,
endColumn
:
model
.
getLineMaxColumn
(
setting
.
valueRange
.
startL
ineNumber
),
startLineNumber
:
l
ineNumber
,
startColumn
:
model
.
getLineMaxColumn
(
l
ineNumber
),
endLineNumber
:
l
ineNumber
,
endColumn
:
model
.
getLineMaxColumn
(
l
ineNumber
),
},
options
:
{
afterContentClassName
:
'
copySetting
'
,
...
...
@@ -787,7 +793,7 @@ export class CopySettingActionRenderer extends Disposable {
if
(
lineNumber
>=
group
.
range
.
startLineNumber
&&
lineNumber
<=
group
.
range
.
endLineNumber
)
{
for
(
const
section
of
group
.
sections
)
{
for
(
const
setting
of
section
.
settings
)
{
if
(
lineNumber
>=
setting
.
valueRange
.
startLineNumber
&&
lineNumber
<=
setting
.
value
Range
.
endLineNumber
)
{
if
(
lineNumber
>=
setting
.
keyRange
.
startLineNumber
&&
lineNumber
<=
setting
.
key
Range
.
endLineNumber
)
{
return
setting
;
}
}
...
...
src/vs/workbench/parts/preferences/common/preferencesModels.ts
浏览文件 @
f1b7315a
...
...
@@ -136,6 +136,12 @@ export class SettingsEditorModel extends AbstractSettingsModel implements ISetti
let
currentProperty
:
string
=
null
;
let
currentParent
:
any
=
[];
let
previousParents
:
any
[]
=
[];
let
range
=
{
startLineNumber
:
0
,
startColumn
:
0
,
endLineNumber
:
0
,
endColumn
:
0
};
function
onValue
(
value
:
any
,
offset
:
number
,
length
:
number
)
{
if
(
Array
.
isArray
(
currentParent
))
{
...
...
@@ -163,6 +169,9 @@ export class SettingsEditorModel extends AbstractSettingsModel implements ISetti
onObjectBegin
:
(
offset
:
number
,
length
:
number
)
=>
{
if
(
!
parsingSettings
)
{
parsingSettings
=
true
;
let
position
=
model
.
getPositionAt
(
offset
);
range
.
startLineNumber
=
position
.
lineNumber
;
range
.
startColumn
=
position
.
column
;
}
else
{
parsingSettingValue
=
true
;
}
...
...
@@ -177,8 +186,14 @@ export class SettingsEditorModel extends AbstractSettingsModel implements ISetti
if
(
parsingSettings
&&
!
parsingSettingValue
)
{
let
settingStartPosition
=
model
.
getPositionAt
(
offset
);
settings
.
push
({
key
:
name
,
description
:
''
,
key
:
name
,
keyRange
:
{
startLineNumber
:
settingStartPosition
.
lineNumber
,
startColumn
:
settingStartPosition
.
column
,
endLineNumber
:
settingStartPosition
.
lineNumber
,
endColumn
:
settingStartPosition
.
column
+
length
},
range
:
{
startLineNumber
:
settingStartPosition
.
lineNumber
,
startColumn
:
settingStartPosition
.
column
,
...
...
@@ -186,7 +201,6 @@ export class SettingsEditorModel extends AbstractSettingsModel implements ISetti
endColumn
:
0
},
value
:
null
,
keyRange
:
null
,
valueRange
:
null
,
descriptionRange
:
null
,
});
...
...
@@ -208,6 +222,9 @@ export class SettingsEditorModel extends AbstractSettingsModel implements ISetti
if
(
parsingSettingValue
)
{
parsingSettingValue
=
false
;
}
else
if
(
parsingSettings
)
{
let
position
=
model
.
getPositionAt
(
offset
);
range
.
endLineNumber
=
position
.
lineNumber
;
range
.
endColumn
=
position
.
column
;
parsingSettings
=
false
;
}
},
...
...
@@ -245,12 +262,7 @@ export class SettingsEditorModel extends AbstractSettingsModel implements ISetti
],
title
:
null
,
titleRange
:
null
,
range
:
{
startLineNumber
:
settings
[
0
].
range
.
startLineNumber
,
startColumn
:
settings
[
0
].
range
.
startColumn
,
endLineNumber
:
settings
[
settings
.
length
-
1
].
range
.
endLineNumber
,
endColumn
:
settings
[
settings
.
length
-
1
].
range
.
endColumn
,
}
range
}]
:
[];
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录