Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
e7725c7d
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,发现更多精彩内容 >>
提交
e7725c7d
编写于
11月 09, 2017
作者:
D
David Weber
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make lineNumberInterval setting a single type instead of a union type
上级
ee32647e
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
22 addition
and
51 deletion
+22
-51
src/vs/editor/browser/viewParts/lineNumbers/lineNumbers.ts
src/vs/editor/browser/viewParts/lineNumbers/lineNumbers.ts
+3
-10
src/vs/editor/common/config/commonEditorConfig.ts
src/vs/editor/common/config/commonEditorConfig.ts
+10
-18
src/vs/editor/common/config/editorOptions.ts
src/vs/editor/common/config/editorOptions.ts
+7
-21
src/vs/monaco.d.ts
src/vs/monaco.d.ts
+2
-2
未找到文件。
src/vs/editor/browser/viewParts/lineNumbers/lineNumbers.ts
浏览文件 @
e7725c7d
...
...
@@ -27,7 +27,7 @@ export class LineNumbersOverlay extends DynamicViewOverlay {
private
_renderRelativeLineNumbers
:
boolean
;
private
_lineNumbersLeft
:
number
;
private
_lineNumbersWidth
:
number
;
private
_lineNumberInterval
:
number
|
{
interval
:
number
,
showCurrentLineNumber
:
boolean
};
private
_lineNumberInterval
:
{
interval
:
number
,
showCurrentLineNumber
:
boolean
};
private
_lastCursorModelPosition
:
Position
;
private
_renderResult
:
string
[];
...
...
@@ -146,15 +146,8 @@ export class LineNumbersOverlay extends DynamicViewOverlay {
}
private
_inInterval
(
lineNumber
:
number
):
boolean
{
let
inInterval
=
false
;
if
(
typeof
this
.
_lineNumberInterval
===
'
object
'
)
{
inInterval
=
lineNumber
%
this
.
_lineNumberInterval
.
interval
===
0
||
(
this
.
_lineNumberInterval
.
showCurrentLineNumber
&&
this
.
_lastCursorModelPosition
.
lineNumber
===
lineNumber
);
}
else
if
(
typeof
this
.
_lineNumberInterval
===
'
number
'
)
{
inInterval
=
lineNumber
%
this
.
_lineNumberInterval
===
0
;
}
return
inInterval
;
return
lineNumber
%
this
.
_lineNumberInterval
.
interval
===
0
||
(
this
.
_lineNumberInterval
.
showCurrentLineNumber
&&
this
.
_lastCursorModelPosition
.
lineNumber
===
lineNumber
);
}
public
render
(
startLineNumber
:
number
,
lineNumber
:
number
):
string
{
...
...
src/vs/editor/common/config/commonEditorConfig.ts
浏览文件 @
e7725c7d
...
...
@@ -208,28 +208,20 @@ const editorConfiguration: IConfigurationNode = {
'
description
'
:
nls
.
localize
(
'
lineNumbers
'
,
"
Controls the display of line numbers. Possible values are 'on', 'off', and 'relative'. 'relative' shows the line count from the current cursor position.
"
)
},
'
editor.lineNumberInterval
'
:
{
'
anyOf
'
:
[
{
'
type
'
:
'
object
'
,
properties
:
{
interval
:
{
type
:
'
number
'
,
'
minimum
'
:
1
,
default
:
EDITOR_DEFAULTS
.
viewInfo
.
lineNumberInterval
,
description
:
nls
.
localize
(
'
lineNumberInterval.interval
'
,
"
Controls the interval at which line numbers are shown.
"
)
},
{
type
:
'
object
'
,
properties
:
{
interval
:
{
type
:
'
number
'
,
'
minimum
'
:
1
,
default
:
EDITOR_DEFAULTS
.
viewInfo
.
lineNumberInterval
,
description
:
nls
.
localize
(
'
lineNumberInterval.interval
'
,
"
Controls the interval at which line numbers are shown.
"
)
},
showCurrentLineNumber
:
{
type
:
'
boolean
'
,
default
:
false
,
description
:
nls
.
localize
(
'
lineNumberInterval.showCurrentLineNumber
'
,
"
Display the line number for the current cursor position.
"
)
}
}
showCurrentLineNumber
:
{
type
:
'
boolean
'
,
default
:
false
,
description
:
nls
.
localize
(
'
lineNumberInterval.showCurrentLineNumber
'
,
"
Display the line number for the current cursor position.
"
)
}
]
,
}
,
'
default
'
:
EDITOR_DEFAULTS
.
viewInfo
.
lineNumberInterval
,
'
description
'
:
nls
.
localize
(
'
lineNumberInterval
'
,
"
Controls the interval at which line numbers are shown..
"
)
},
...
...
src/vs/editor/common/config/editorOptions.ts
浏览文件 @
e7725c7d
...
...
@@ -165,7 +165,7 @@ export interface IEditorOptions {
* Controls the interval at which line numbers are rendered.
* Defaults to 1.
*/
lineNumberInterval
?:
number
|
{
interval
:
number
,
showCurrentLineNumber
:
boolean
};
lineNumberInterval
?:
{
interval
:
number
,
showCurrentLineNumber
:
boolean
};
/**
* Should the corresponding line be selected when clicking on the line number?
* Defaults to true.
...
...
@@ -767,7 +767,7 @@ export interface InternalEditorViewOptions {
readonly
renderCustomLineNumbers
:
(
lineNumber
:
number
)
=>
string
;
readonly
renderRelativeLineNumbers
:
boolean
;
readonly
selectOnLineNumbers
:
boolean
;
readonly
lineNumberInterval
:
number
|
{
interval
:
number
,
showCurrentLineNumber
:
boolean
};
readonly
lineNumberInterval
:
{
interval
:
number
,
showCurrentLineNumber
:
boolean
};
readonly
glyphMargin
:
boolean
;
readonly
revealHorizontalRightPadding
:
number
;
readonly
roundedSelection
:
boolean
;
...
...
@@ -1184,16 +1184,7 @@ export class InternalEditorOptions {
);
}
private
static
_equalsLineNumberInterval
(
a
:
number
|
{
interval
:
number
,
showCurrentLineNumber
:
boolean
},
b
:
number
|
{
interval
:
number
,
showCurrentLineNumber
:
boolean
}):
boolean
{
if
(
typeof
a
===
'
number
'
)
{
if
(
typeof
b
!==
'
number
'
)
{
return
false
;
}
return
a
===
b
;
}
if
(
typeof
b
===
'
number
'
)
{
return
false
;
}
private
static
_equalsLineNumberInterval
(
a
:
{
interval
:
number
,
showCurrentLineNumber
:
boolean
},
b
:
{
interval
:
number
,
showCurrentLineNumber
:
boolean
}):
boolean
{
return
(
a
.
interval
===
b
.
interval
&&
a
.
showCurrentLineNumber
===
b
.
showCurrentLineNumber
...
...
@@ -1639,15 +1630,10 @@ export class EditorOptionsValidator {
renderLineHighlight
=
_stringSet
<
'
none
'
|
'
gutter
'
|
'
line
'
|
'
all
'
>
(
opts
.
renderLineHighlight
,
defaults
.
renderLineHighlight
,
[
'
none
'
,
'
gutter
'
,
'
line
'
,
'
all
'
]);
}
let
lineNumberInterval
:
number
|
{
interval
:
number
,
showCurrentLineNumber
:
boolean
};
if
(
typeof
opts
.
lineNumberInterval
===
'
object
'
)
{
lineNumberInterval
=
{
interval
:
_clampedInt
(
opts
.
lineNumberInterval
,
1
,
1
,
Constants
.
MAX_UINT_32
),
...
opts
.
lineNumberInterval
};
}
else
{
lineNumberInterval
=
_clampedInt
(
opts
.
lineNumberInterval
,
1
,
1
,
Constants
.
MAX_UINT_32
)
}
let
lineNumberInterval
=
{
interval
:
_clampedInt
(
opts
.
lineNumberInterval
,
1
,
1
,
Constants
.
MAX_UINT_32
),
...
opts
.
lineNumberInterval
};
const
mouseWheelScrollSensitivity
=
_float
(
opts
.
mouseWheelScrollSensitivity
,
defaults
.
scrollbar
.
mouseWheelScrollSensitivity
);
const
scrollbar
=
this
.
_sanitizeScrollbarOpts
(
opts
.
scrollbar
,
defaults
.
scrollbar
,
mouseWheelScrollSensitivity
);
...
...
src/vs/monaco.d.ts
浏览文件 @
e7725c7d
...
...
@@ -2750,7 +2750,7 @@ declare module monaco.editor {
* Controls the interval at which line numbers are rendered.
* Defaults to 1.
*/
lineNumberInterval
?:
number
|
{
lineNumberInterval
?:
{
interval
:
number
;
showCurrentLineNumber
:
boolean
;
};
...
...
@@ -3288,7 +3288,7 @@ declare module monaco.editor {
readonly
renderCustomLineNumbers
:
(
lineNumber
:
number
)
=>
string
;
readonly
renderRelativeLineNumbers
:
boolean
;
readonly
selectOnLineNumbers
:
boolean
;
readonly
lineNumberInterval
:
number
|
{
readonly
lineNumberInterval
:
{
interval
:
number
;
showCurrentLineNumber
:
boolean
;
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录