Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
c7cc30ca
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,发现更多精彩内容 >>
未验证
提交
c7cc30ca
编写于
1月 24, 2020
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add editor.renderValidationDecorations (#89057)
上级
a9a5fd05
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
112 addition
and
78 deletion
+112
-78
src/vs/editor/browser/widget/codeEditorWidget.ts
src/vs/editor/browser/widget/codeEditorWidget.ts
+2
-2
src/vs/editor/common/config/editorOptions.ts
src/vs/editor/common/config/editorOptions.ts
+26
-0
src/vs/editor/common/standalone/standaloneEnums.ts
src/vs/editor/common/standalone/standaloneEnums.ts
+37
-36
src/vs/editor/common/viewModel/viewModelDecorations.ts
src/vs/editor/common/viewModel/viewModelDecorations.ts
+2
-2
src/vs/editor/common/viewModel/viewModelImpl.ts
src/vs/editor/common/viewModel/viewModelImpl.ts
+2
-2
src/vs/monaco.d.ts
src/vs/monaco.d.ts
+43
-36
未找到文件。
src/vs/editor/browser/widget/codeEditorWidget.ts
浏览文件 @
c7cc30ca
...
...
@@ -22,7 +22,7 @@ import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService
import
{
ICommandDelegate
}
from
'
vs/editor/browser/view/viewController
'
;
import
{
IContentWidgetData
,
IOverlayWidgetData
,
View
}
from
'
vs/editor/browser/view/viewImpl
'
;
import
{
ViewOutgoingEvents
}
from
'
vs/editor/browser/view/viewOutgoingEvents
'
;
import
{
ConfigurationChangedEvent
,
EditorLayoutInfo
,
IEditorOptions
,
EditorOption
,
IComputedEditorOptions
,
FindComputedEditorOptionValueById
,
IEditorConstructionOptions
}
from
'
vs/editor/common/config/editorOptions
'
;
import
{
ConfigurationChangedEvent
,
EditorLayoutInfo
,
IEditorOptions
,
EditorOption
,
IComputedEditorOptions
,
FindComputedEditorOptionValueById
,
IEditorConstructionOptions
,
shouldRenderValidationDecorations
}
from
'
vs/editor/common/config/editorOptions
'
;
import
{
Cursor
,
CursorStateChangedEvent
}
from
'
vs/editor/common/controller/cursor
'
;
import
{
CursorColumns
,
ICursors
}
from
'
vs/editor/common/controller/cursorCommon
'
;
import
{
ICursorPositionChangedEvent
,
ICursorSelectionChangedEvent
}
from
'
vs/editor/common/controller/cursorEvents
'
;
...
...
@@ -1064,7 +1064,7 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
if
(
!
this
.
_modelData
)
{
return
null
;
}
return
this
.
_modelData
.
model
.
getLineDecorations
(
lineNumber
,
this
.
_id
,
this
.
_configuration
.
options
.
get
(
EditorOption
.
readOnly
));
return
this
.
_modelData
.
model
.
getLineDecorations
(
lineNumber
,
this
.
_id
,
shouldRenderValidationDecorations
(
this
.
_configuration
.
options
));
}
public
deltaDecorations
(
oldDecorations
:
string
[],
newDecorations
:
IModelDeltaDecoration
[]):
string
[]
{
...
...
src/vs/editor/common/config/editorOptions.ts
浏览文件 @
c7cc30ca
...
...
@@ -135,6 +135,11 @@ export interface IEditorOptions {
* Defaults to false.
*/
readOnly
?:
boolean
;
/**
* Should the editor render validation decorations.
* Defaults to editable.
*/
renderValidationDecorations
?:
'
editable
'
|
'
on
'
|
'
off
'
;
/**
* Control the behavior and rendering of the scrollbars.
*/
...
...
@@ -2334,6 +2339,21 @@ class EditorRenderLineNumbersOption extends BaseEditorOption<EditorOption.lineNu
//#endregion
//#region renderValidationDecorations
/**
* @internal
*/
export
function
shouldRenderValidationDecorations
(
options
:
IComputedEditorOptions
):
boolean
{
const
renderValidationDecorations
=
options
.
get
(
EditorOption
.
renderValidationDecorations
);
if
(
renderValidationDecorations
===
'
editable
'
)
{
return
!
options
.
get
(
EditorOption
.
readOnly
);
}
return
renderValidationDecorations
===
'
on
'
?
true
:
false
;
}
//#endregion
//#region rulers
class
EditorRulers
extends
SimpleEditorOption
<
EditorOption
.
rulers
,
number
[]
>
{
...
...
@@ -3168,6 +3188,7 @@ export const enum EditorOption {
renderIndentGuides
,
renderFinalNewline
,
renderLineHighlight
,
renderValidationDecorations
,
renderWhitespace
,
revealHorizontalRightPadding
,
roundedSelection
,
...
...
@@ -3586,6 +3607,11 @@ export const EditorOptions = {
description
:
nls
.
localize
(
'
renderLineHighlight
'
,
"
Controls how the editor should render the current line highlight.
"
)
}
)),
renderValidationDecorations
:
register
(
new
EditorStringEnumOption
(
EditorOption
.
renderValidationDecorations
,
'
renderValidationDecorations
'
,
'
editable
'
as
'
editable
'
|
'
on
'
|
'
off
'
,
[
'
editable
'
,
'
on
'
,
'
off
'
]
as
const
)),
renderWhitespace
:
register
(
new
EditorStringEnumOption
(
EditorOption
.
renderWhitespace
,
'
renderWhitespace
'
,
'
none
'
as
'
none
'
|
'
boundary
'
|
'
selection
'
|
'
all
'
,
...
...
src/vs/editor/common/standalone/standaloneEnums.ts
浏览文件 @
c7cc30ca
...
...
@@ -238,42 +238,43 @@ export enum EditorOption {
renderIndentGuides
=
70
,
renderFinalNewline
=
71
,
renderLineHighlight
=
72
,
renderWhitespace
=
73
,
revealHorizontalRightPadding
=
74
,
roundedSelection
=
75
,
rulers
=
76
,
scrollbar
=
77
,
scrollBeyondLastColumn
=
78
,
scrollBeyondLastLine
=
79
,
selectionClipboard
=
80
,
selectionHighlight
=
81
,
selectOnLineNumbers
=
82
,
semanticHighlighting
=
83
,
showFoldingControls
=
84
,
showUnused
=
85
,
snippetSuggestions
=
86
,
smoothScrolling
=
87
,
stopRenderingLineAfter
=
88
,
suggest
=
89
,
suggestFontSize
=
90
,
suggestLineHeight
=
91
,
suggestOnTriggerCharacters
=
92
,
suggestSelection
=
93
,
tabCompletion
=
94
,
useTabStops
=
95
,
wordSeparators
=
96
,
wordWrap
=
97
,
wordWrapBreakAfterCharacters
=
98
,
wordWrapBreakBeforeCharacters
=
99
,
wordWrapColumn
=
100
,
wordWrapMinified
=
101
,
wrappingIndent
=
102
,
wrappingAlgorithm
=
103
,
editorClassName
=
104
,
pixelRatio
=
105
,
tabFocusMode
=
106
,
layoutInfo
=
107
,
wrappingInfo
=
108
renderValidationDecorations
=
73
,
renderWhitespace
=
74
,
revealHorizontalRightPadding
=
75
,
roundedSelection
=
76
,
rulers
=
77
,
scrollbar
=
78
,
scrollBeyondLastColumn
=
79
,
scrollBeyondLastLine
=
80
,
selectionClipboard
=
81
,
selectionHighlight
=
82
,
selectOnLineNumbers
=
83
,
semanticHighlighting
=
84
,
showFoldingControls
=
85
,
showUnused
=
86
,
snippetSuggestions
=
87
,
smoothScrolling
=
88
,
stopRenderingLineAfter
=
89
,
suggest
=
90
,
suggestFontSize
=
91
,
suggestLineHeight
=
92
,
suggestOnTriggerCharacters
=
93
,
suggestSelection
=
94
,
tabCompletion
=
95
,
useTabStops
=
96
,
wordSeparators
=
97
,
wordWrap
=
98
,
wordWrapBreakAfterCharacters
=
99
,
wordWrapBreakBeforeCharacters
=
100
,
wordWrapColumn
=
101
,
wordWrapMinified
=
102
,
wrappingIndent
=
103
,
wrappingAlgorithm
=
104
,
editorClassName
=
105
,
pixelRatio
=
106
,
tabFocusMode
=
107
,
layoutInfo
=
108
,
wrappingInfo
=
109
}
/**
...
...
src/vs/editor/common/viewModel/viewModelDecorations.ts
浏览文件 @
c7cc30ca
...
...
@@ -10,7 +10,7 @@ import * as editorCommon from 'vs/editor/common/editorCommon';
import
{
IModelDecoration
,
ITextModel
}
from
'
vs/editor/common/model
'
;
import
{
IViewModelLinesCollection
}
from
'
vs/editor/common/viewModel/splitLinesCollection
'
;
import
{
ICoordinatesConverter
,
InlineDecoration
,
InlineDecorationType
,
ViewModelDecoration
}
from
'
vs/editor/common/viewModel/viewModel
'
;
import
{
EditorOption
}
from
'
vs/editor/common/config/editorOptions
'
;
import
{
shouldRenderValidationDecorations
}
from
'
vs/editor/common/config/editorOptions
'
;
export
interface
IDecorationsViewportData
{
/**
...
...
@@ -104,7 +104,7 @@ export class ViewModelDecorations implements IDisposable {
}
private
_getDecorationsViewportData
(
viewportRange
:
Range
):
IDecorationsViewportData
{
const
modelDecorations
=
this
.
_linesCollection
.
getDecorationsInRange
(
viewportRange
,
this
.
editorId
,
this
.
configuration
.
options
.
get
(
EditorOption
.
readOnly
));
const
modelDecorations
=
this
.
_linesCollection
.
getDecorationsInRange
(
viewportRange
,
this
.
editorId
,
shouldRenderValidationDecorations
(
this
.
configuration
.
options
));
const
startLineNumber
=
viewportRange
.
startLineNumber
;
const
endLineNumber
=
viewportRange
.
endLineNumber
;
...
...
src/vs/editor/common/viewModel/viewModelImpl.ts
浏览文件 @
c7cc30ca
...
...
@@ -6,7 +6,7 @@
import
{
Color
}
from
'
vs/base/common/color
'
;
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
*
as
strings
from
'
vs/base/common/strings
'
;
import
{
ConfigurationChangedEvent
,
EDITOR_FONT_DEFAULTS
,
EditorOption
}
from
'
vs/editor/common/config/editorOptions
'
;
import
{
ConfigurationChangedEvent
,
EDITOR_FONT_DEFAULTS
,
EditorOption
,
shouldRenderValidationDecorations
}
from
'
vs/editor/common/config/editorOptions
'
;
import
{
IPosition
,
Position
}
from
'
vs/editor/common/core/position
'
;
import
{
IRange
,
Range
}
from
'
vs/editor/common/core/range
'
;
import
{
IConfiguration
,
IViewState
}
from
'
vs/editor/common/editorCommon
'
;
...
...
@@ -596,7 +596,7 @@ export class ViewModel extends viewEvents.ViewEventEmitter implements IViewModel
}
public
getAllOverviewRulerDecorations
(
theme
:
ITheme
):
IOverviewRulerDecorations
{
return
this
.
lines
.
getAllOverviewRulerDecorations
(
this
.
editorId
,
this
.
configuration
.
options
.
get
(
EditorOption
.
readOnly
),
theme
);
return
this
.
lines
.
getAllOverviewRulerDecorations
(
this
.
editorId
,
shouldRenderValidationDecorations
(
this
.
configuration
.
options
),
theme
);
}
public
invalidateOverviewRulerColorCache
():
void
{
...
...
src/vs/monaco.d.ts
浏览文件 @
c7cc30ca
...
...
@@ -2609,6 +2609,11 @@ declare namespace monaco.editor {
* Defaults to false.
*/
readOnly
?:
boolean
;
/**
* Should the editor render validation decorations.
* Defaults to editable.
*/
renderValidationDecorations
?:
'
editable
'
|
'
on
'
|
'
off
'
;
/**
* Control the behavior and rendering of the scrollbars.
*/
...
...
@@ -3753,42 +3758,43 @@ declare namespace monaco.editor {
renderIndentGuides
=
70
,
renderFinalNewline
=
71
,
renderLineHighlight
=
72
,
renderWhitespace
=
73
,
revealHorizontalRightPadding
=
74
,
roundedSelection
=
75
,
rulers
=
76
,
scrollbar
=
77
,
scrollBeyondLastColumn
=
78
,
scrollBeyondLastLine
=
79
,
selectionClipboard
=
80
,
selectionHighlight
=
81
,
selectOnLineNumbers
=
82
,
semanticHighlighting
=
83
,
showFoldingControls
=
84
,
showUnused
=
85
,
snippetSuggestions
=
86
,
smoothScrolling
=
87
,
stopRenderingLineAfter
=
88
,
suggest
=
89
,
suggestFontSize
=
90
,
suggestLineHeight
=
91
,
suggestOnTriggerCharacters
=
92
,
suggestSelection
=
93
,
tabCompletion
=
94
,
useTabStops
=
95
,
wordSeparators
=
96
,
wordWrap
=
97
,
wordWrapBreakAfterCharacters
=
98
,
wordWrapBreakBeforeCharacters
=
99
,
wordWrapColumn
=
100
,
wordWrapMinified
=
101
,
wrappingIndent
=
102
,
wrappingAlgorithm
=
103
,
editorClassName
=
104
,
pixelRatio
=
105
,
tabFocusMode
=
106
,
layoutInfo
=
107
,
wrappingInfo
=
108
renderValidationDecorations
=
73
,
renderWhitespace
=
74
,
revealHorizontalRightPadding
=
75
,
roundedSelection
=
76
,
rulers
=
77
,
scrollbar
=
78
,
scrollBeyondLastColumn
=
79
,
scrollBeyondLastLine
=
80
,
selectionClipboard
=
81
,
selectionHighlight
=
82
,
selectOnLineNumbers
=
83
,
semanticHighlighting
=
84
,
showFoldingControls
=
85
,
showUnused
=
86
,
snippetSuggestions
=
87
,
smoothScrolling
=
88
,
stopRenderingLineAfter
=
89
,
suggest
=
90
,
suggestFontSize
=
91
,
suggestLineHeight
=
92
,
suggestOnTriggerCharacters
=
93
,
suggestSelection
=
94
,
tabCompletion
=
95
,
useTabStops
=
96
,
wordSeparators
=
97
,
wordWrap
=
98
,
wordWrapBreakAfterCharacters
=
99
,
wordWrapBreakBeforeCharacters
=
100
,
wordWrapColumn
=
101
,
wordWrapMinified
=
102
,
wrappingIndent
=
103
,
wrappingAlgorithm
=
104
,
editorClassName
=
105
,
pixelRatio
=
106
,
tabFocusMode
=
107
,
layoutInfo
=
108
,
wrappingInfo
=
109
}
export
const
EditorOptions
:
{
acceptSuggestionOnCommitCharacter
:
IEditorOption
<
EditorOption
.
acceptSuggestionOnCommitCharacter
,
boolean
>
;
...
...
@@ -3864,6 +3870,7 @@ declare namespace monaco.editor {
renderIndentGuides
:
IEditorOption
<
EditorOption
.
renderIndentGuides
,
boolean
>
;
renderFinalNewline
:
IEditorOption
<
EditorOption
.
renderFinalNewline
,
boolean
>
;
renderLineHighlight
:
IEditorOption
<
EditorOption
.
renderLineHighlight
,
'
all
'
|
'
line
'
|
'
none
'
|
'
gutter
'
>
;
renderValidationDecorations
:
IEditorOption
<
EditorOption
.
renderValidationDecorations
,
'
on
'
|
'
off
'
|
'
editable
'
>
;
renderWhitespace
:
IEditorOption
<
EditorOption
.
renderWhitespace
,
'
all
'
|
'
none
'
|
'
boundary
'
|
'
selection
'
>
;
revealHorizontalRightPadding
:
IEditorOption
<
EditorOption
.
revealHorizontalRightPadding
,
number
>
;
roundedSelection
:
IEditorOption
<
EditorOption
.
roundedSelection
,
boolean
>
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录