Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
3d662dd0
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,发现更多精彩内容 >>
未验证
提交
3d662dd0
编写于
2月 18, 2019
作者:
A
Alexandru Dima
提交者:
GitHub
2月 18, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #64667 from MrZephyr17/eof-nl
Suppress display of end-of-file newline as blank line
上级
51ad0bb8
607528b7
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
32 addition
and
0 deletion
+32
-0
src/vs/editor/browser/viewParts/lineNumbers/lineNumbers.ts
src/vs/editor/browser/viewParts/lineNumbers/lineNumbers.ts
+11
-0
src/vs/editor/common/config/commonEditorConfig.ts
src/vs/editor/common/config/commonEditorConfig.ts
+5
-0
src/vs/editor/common/config/editorOptions.ts
src/vs/editor/common/config/editorOptions.ts
+10
-0
src/vs/monaco.d.ts
src/vs/monaco.d.ts
+6
-0
未找到文件。
src/vs/editor/browser/viewParts/lineNumbers/lineNumbers.ts
浏览文件 @
3d662dd0
...
...
@@ -23,6 +23,7 @@ export class LineNumbersOverlay extends DynamicViewOverlay {
private
_lineHeight
:
number
;
private
_renderLineNumbers
:
RenderLineNumbersType
;
private
_renderCustomLineNumbers
:
((
lineNumber
:
number
)
=>
string
)
|
null
;
private
_renderFinalNewline
:
boolean
;
private
_lineNumbersLeft
:
number
;
private
_lineNumbersWidth
:
number
;
private
_lastCursorModelPosition
:
Position
;
...
...
@@ -44,6 +45,7 @@ export class LineNumbersOverlay extends DynamicViewOverlay {
this
.
_lineHeight
=
config
.
lineHeight
;
this
.
_renderLineNumbers
=
config
.
viewInfo
.
renderLineNumbers
;
this
.
_renderCustomLineNumbers
=
config
.
viewInfo
.
renderCustomLineNumbers
;
this
.
_renderFinalNewline
=
config
.
viewInfo
.
renderFinalNewline
;
this
.
_lineNumbersLeft
=
config
.
layoutInfo
.
lineNumbersLeft
;
this
.
_lineNumbersWidth
=
config
.
layoutInfo
.
lineNumbersWidth
;
}
...
...
@@ -97,6 +99,15 @@ export class LineNumbersOverlay extends DynamicViewOverlay {
}
let
modelLineNumber
=
modelPosition
.
lineNumber
;
if
(
!
this
.
_renderFinalNewline
)
{
const
lineCount
=
this
.
_context
.
model
.
getLineCount
();
const
lineContent
=
this
.
_context
.
model
.
getLineContent
(
modelLineNumber
);
if
(
modelLineNumber
===
lineCount
&&
lineContent
===
''
)
{
return
''
;
}
}
if
(
this
.
_renderCustomLineNumbers
)
{
return
this
.
_renderCustomLineNumbers
(
modelLineNumber
);
}
...
...
src/vs/editor/common/config/commonEditorConfig.ts
浏览文件 @
3d662dd0
...
...
@@ -264,6 +264,11 @@ const editorConfiguration: IConfigurationNode = {
'
default
'
:
'
on
'
,
'
description
'
:
nls
.
localize
(
'
lineNumbers
'
,
"
Controls the display of line numbers.
"
)
},
'
editor.renderFinalNewline
'
:
{
'
type
'
:
'
boolean
'
,
'
default
'
:
EDITOR_DEFAULTS
.
viewInfo
.
renderFinalNewline
,
'
description
'
:
nls
.
localize
(
'
renderFinalNewline
'
,
"
Render last line number when the file ends with a newline.
"
)
},
'
editor.rulers
'
:
{
'
type
'
:
'
array
'
,
'
items
'
:
{
...
...
src/vs/editor/common/config/editorOptions.ts
浏览文件 @
3d662dd0
...
...
@@ -248,6 +248,11 @@ export interface IEditorOptions {
* Defaults to true.
*/
lineNumbers
?:
'
on
'
|
'
off
'
|
'
relative
'
|
'
interval
'
|
((
lineNumber
:
number
)
=>
string
);
/**
* Render last line number when the file ends with a newline.
* Defaults to true on Windows/Mac and to false on Linux.
*/
renderFinalNewline
?:
boolean
;
/**
* Should the corresponding line be selected when clicking on the line number?
* Defaults to true.
...
...
@@ -951,6 +956,7 @@ export interface InternalEditorViewOptions {
readonly
ariaLabel
:
string
;
readonly
renderLineNumbers
:
RenderLineNumbersType
;
readonly
renderCustomLineNumbers
:
((
lineNumber
:
number
)
=>
string
)
|
null
;
readonly
renderFinalNewline
:
boolean
;
readonly
selectOnLineNumbers
:
boolean
;
readonly
glyphMargin
:
boolean
;
readonly
revealHorizontalRightPadding
:
number
;
...
...
@@ -1258,6 +1264,7 @@ export class InternalEditorOptions {
&&
a
.
ariaLabel
===
b
.
ariaLabel
&&
a
.
renderLineNumbers
===
b
.
renderLineNumbers
&&
a
.
renderCustomLineNumbers
===
b
.
renderCustomLineNumbers
&&
a
.
renderFinalNewline
===
b
.
renderFinalNewline
&&
a
.
selectOnLineNumbers
===
b
.
selectOnLineNumbers
&&
a
.
glyphMargin
===
b
.
glyphMargin
&&
a
.
revealHorizontalRightPadding
===
b
.
revealHorizontalRightPadding
...
...
@@ -1995,6 +2002,7 @@ export class EditorOptionsValidator {
ariaLabel
:
_string
(
opts
.
ariaLabel
,
defaults
.
ariaLabel
),
renderLineNumbers
:
renderLineNumbers
,
renderCustomLineNumbers
:
renderCustomLineNumbers
,
renderFinalNewline
:
_boolean
(
opts
.
renderFinalNewline
,
defaults
.
renderFinalNewline
),
selectOnLineNumbers
:
_boolean
(
opts
.
selectOnLineNumbers
,
defaults
.
selectOnLineNumbers
),
glyphMargin
:
_boolean
(
opts
.
glyphMargin
,
defaults
.
glyphMargin
),
revealHorizontalRightPadding
:
_clampedInt
(
opts
.
revealHorizontalRightPadding
,
defaults
.
revealHorizontalRightPadding
,
0
,
1000
),
...
...
@@ -2115,6 +2123,7 @@ export class InternalEditorOptionsFactory {
ariaLabel
:
(
accessibilityIsOff
?
nls
.
localize
(
'
accessibilityOffAriaLabel
'
,
"
The editor is not accessible at this time. Press Alt+F1 for options.
"
)
:
opts
.
viewInfo
.
ariaLabel
),
renderLineNumbers
:
opts
.
viewInfo
.
renderLineNumbers
,
renderCustomLineNumbers
:
opts
.
viewInfo
.
renderCustomLineNumbers
,
renderFinalNewline
:
opts
.
viewInfo
.
renderFinalNewline
,
selectOnLineNumbers
:
opts
.
viewInfo
.
selectOnLineNumbers
,
glyphMargin
:
opts
.
viewInfo
.
glyphMargin
,
revealHorizontalRightPadding
:
opts
.
viewInfo
.
revealHorizontalRightPadding
,
...
...
@@ -2577,6 +2586,7 @@ export const EDITOR_DEFAULTS: IValidatedEditorOptions = {
ariaLabel
:
nls
.
localize
(
'
editorViewAccessibleLabel
'
,
"
Editor content
"
),
renderLineNumbers
:
RenderLineNumbersType
.
On
,
renderCustomLineNumbers
:
null
,
renderFinalNewline
:
(
platform
.
isLinux
?
false
:
true
),
selectOnLineNumbers
:
true
,
glyphMargin
:
true
,
revealHorizontalRightPadding
:
30
,
...
...
src/vs/monaco.d.ts
浏览文件 @
3d662dd0
...
...
@@ -2582,6 +2582,11 @@ declare namespace monaco.editor {
* Defaults to true.
*/
lineNumbers
?:
'
on
'
|
'
off
'
|
'
relative
'
|
'
interval
'
|
((
lineNumber
:
number
)
=>
string
);
/**
* Render last line number when the file ends with a newline.
* Defaults to true on Windows/Mac and to false on Linux.
*/
renderFinalNewline
?:
boolean
;
/**
* Should the corresponding line be selected when clicking on the line number?
* Defaults to true.
...
...
@@ -3219,6 +3224,7 @@ declare namespace monaco.editor {
readonly
ariaLabel
:
string
;
readonly
renderLineNumbers
:
RenderLineNumbersType
;
readonly
renderCustomLineNumbers
:
((
lineNumber
:
number
)
=>
string
)
|
null
;
readonly
renderFinalNewline
:
boolean
;
readonly
selectOnLineNumbers
:
boolean
;
readonly
glyphMargin
:
boolean
;
readonly
revealHorizontalRightPadding
:
number
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录