Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
eaf18ad3
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,体验更适合开发者的 AI 搜索 >>
提交
eaf18ad3
编写于
5月 24, 2017
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Adopt accessibilitySupportEnabled in the editor (#26730)
上级
2b7051ef
变更
15
隐藏空白更改
内联
并排
Showing
15 changed file
with
175 addition
and
56 deletion
+175
-56
src/vs/base/browser/browser.ts
src/vs/base/browser/browser.ts
+5
-16
src/vs/base/common/platform.ts
src/vs/base/common/platform.ts
+11
-0
src/vs/editor/browser/config/configuration.ts
src/vs/editor/browser/config/configuration.ts
+3
-1
src/vs/editor/browser/controller/textAreaHandler.ts
src/vs/editor/browser/controller/textAreaHandler.ts
+22
-6
src/vs/editor/browser/view/viewImpl.ts
src/vs/editor/browser/view/viewImpl.ts
+1
-6
src/vs/editor/browser/viewParts/lines/viewLines.ts
src/vs/editor/browser/viewParts/lines/viewLines.ts
+3
-6
src/vs/editor/common/config/commonEditorConfig.ts
src/vs/editor/common/config/commonEditorConfig.ts
+3
-1
src/vs/editor/common/config/editorOptions.ts
src/vs/editor/common/config/editorOptions.ts
+113
-13
src/vs/editor/common/view/viewEvents.ts
src/vs/editor/common/view/viewEvents.ts
+2
-0
src/vs/editor/test/common/config/commonEditorConfig.test.ts
src/vs/editor/test/common/config/commonEditorConfig.test.ts
+3
-1
src/vs/editor/test/common/mocks/testConfiguration.ts
src/vs/editor/test/common/mocks/testConfiguration.ts
+3
-1
src/vs/monaco.d.ts
src/vs/monaco.d.ts
+1
-0
src/vs/workbench/browser/parts/editor/editorStatus.ts
src/vs/workbench/browser/parts/editor/editorStatus.ts
+3
-3
src/vs/workbench/electron-browser/main.ts
src/vs/workbench/electron-browser/main.ts
+1
-1
src/vs/workbench/electron-browser/window.ts
src/vs/workbench/electron-browser/window.ts
+1
-1
未找到文件。
src/vs/base/browser/browser.ts
浏览文件 @
eaf18ad3
...
...
@@ -8,17 +8,6 @@ import * as Platform from 'vs/base/common/platform';
import
Event
,
{
Emitter
}
from
'
vs/base/common/event
'
;
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
export
const
enum
AccessibilitySupport
{
/**
* This should be the browser case where it is not known if a screen reader is attached or no.
*/
Unknown
=
0
,
Disabled
=
1
,
Enabled
=
2
}
class
WindowManager
{
public
static
INSTANCE
=
new
WindowManager
();
...
...
@@ -88,11 +77,11 @@ class WindowManager {
}
// --- Accessibility
private
_accessibilitySupport
=
AccessibilitySupport
.
Unknown
;
private
_accessibilitySupport
=
Platform
.
AccessibilitySupport
.
Unknown
;
private
_onDidChangeAccessibilitySupport
:
Emitter
<
void
>
=
new
Emitter
<
void
>
();
public
onDidChangeAccessibilitySupport
:
Event
<
void
>
=
this
.
_onDidChangeAccessibilitySupport
.
event
;
public
setAccessibilitySupport
(
accessibilitySupport
:
AccessibilitySupport
):
void
{
public
setAccessibilitySupport
(
accessibilitySupport
:
Platform
.
AccessibilitySupport
):
void
{
if
(
this
.
_accessibilitySupport
===
accessibilitySupport
)
{
return
;
}
...
...
@@ -100,7 +89,7 @@ class WindowManager {
this
.
_accessibilitySupport
=
accessibilitySupport
;
this
.
_onDidChangeAccessibilitySupport
.
fire
();
}
public
getAccessibilitySupport
():
AccessibilitySupport
{
public
getAccessibilitySupport
():
Platform
.
AccessibilitySupport
{
return
this
.
_accessibilitySupport
;
}
...
...
@@ -144,10 +133,10 @@ export function onDidChangeFullscreen(callback: () => void): IDisposable {
return
WindowManager
.
INSTANCE
.
onDidChangeFullscreen
(
callback
);
}
export
function
setAccessibilitySupport
(
accessibilitySupport
:
AccessibilitySupport
):
void
{
export
function
setAccessibilitySupport
(
accessibilitySupport
:
Platform
.
AccessibilitySupport
):
void
{
WindowManager
.
INSTANCE
.
setAccessibilitySupport
(
accessibilitySupport
);
}
export
function
getAccessibilitySupport
():
AccessibilitySupport
{
export
function
getAccessibilitySupport
():
Platform
.
AccessibilitySupport
{
return
WindowManager
.
INSTANCE
.
getAccessibilitySupport
();
}
export
function
onDidChangeAccessibilitySupport
(
callback
:
()
=>
void
):
IDisposable
{
...
...
src/vs/base/common/platform.ts
浏览文件 @
eaf18ad3
...
...
@@ -142,3 +142,14 @@ export const enum OperatingSystem {
Linux
=
3
}
export
const
OS
=
(
_isMacintosh
?
OperatingSystem
.
Macintosh
:
(
_isWindows
?
OperatingSystem
.
Windows
:
OperatingSystem
.
Linux
));
export
const
enum
AccessibilitySupport
{
/**
* This should be the browser case where it is not known if a screen reader is attached or no.
*/
Unknown
=
0
,
Disabled
=
1
,
Enabled
=
2
}
src/vs/editor/browser/config/configuration.ts
浏览文件 @
eaf18ad3
...
...
@@ -310,6 +310,7 @@ export class Configuration extends CommonEditorConfiguration {
}
this
.
_register
(
browser
.
onDidChangeZoomLevel
(
_
=>
this
.
_recomputeOptions
()));
this
.
_register
(
browser
.
onDidChangeAccessibilitySupport
(()
=>
this
.
_recomputeOptions
()));
this
.
_recomputeOptions
();
}
...
...
@@ -353,7 +354,8 @@ export class Configuration extends CommonEditorConfiguration {
canUseTranslate3d
:
browser
.
canUseTranslate3d
(),
emptySelectionClipboard
:
browser
.
isWebKit
,
pixelRatio
:
browser
.
getPixelRatio
(),
zoomLevel
:
browser
.
getZoomLevel
()
zoomLevel
:
browser
.
getZoomLevel
(),
accessibilitySupport
:
browser
.
getAccessibilitySupport
()
};
}
...
...
src/vs/editor/browser/controller/textAreaHandler.ts
浏览文件 @
eaf18ad3
...
...
@@ -5,6 +5,7 @@
'
use strict
'
;
import
'
vs/css!./textAreaHandler
'
;
import
*
as
platform
from
'
vs/base/common/platform
'
;
import
*
as
browser
from
'
vs/base/browser/browser
'
;
import
{
TextAreaInput
,
ITextAreaInputHost
,
IPasteData
,
ICompositionData
}
from
'
vs/editor/browser/controller/textAreaInput
'
;
import
{
ISimpleModel
,
ITypeData
,
TextAreaState
,
IENarratorStrategy
,
NVDAPagedStrategy
}
from
'
vs/editor/browser/controller/textAreaState
'
;
...
...
@@ -54,6 +55,7 @@ export class TextAreaHandler extends ViewPart {
private
readonly
_viewHelper
:
ITextAreaHandlerHelper
;
private
_pixelRatio
:
number
;
private
_accessibilitySupport
:
platform
.
AccessibilitySupport
;
private
_contentLeft
:
number
;
private
_contentWidth
:
number
;
private
_contentHeight
:
number
;
...
...
@@ -85,6 +87,7 @@ export class TextAreaHandler extends ViewPart {
const
conf
=
this
.
_context
.
configuration
.
editor
;
this
.
_pixelRatio
=
conf
.
pixelRatio
;
this
.
_accessibilitySupport
=
conf
.
accessibilitySupport
;
this
.
_contentLeft
=
conf
.
layoutInfo
.
contentLeft
;
this
.
_contentWidth
=
conf
.
layoutInfo
.
contentWidth
;
this
.
_contentHeight
=
conf
.
layoutInfo
.
contentHeight
;
...
...
@@ -160,6 +163,11 @@ export class TextAreaHandler extends ViewPart {
return
TextAreaState
.
EMPTY
;
}
if
(
this
.
_accessibilitySupport
===
platform
.
AccessibilitySupport
.
Disabled
)
{
// We know for a fact that a screen reader is not attached
return
TextAreaState
.
EMPTY
;
}
const
selection
=
this
.
_selections
[
0
];
if
(
this
.
_experimentalScreenReader
)
{
...
...
@@ -286,6 +294,10 @@ export class TextAreaHandler extends ViewPart {
if
(
e
.
pixelRatio
)
{
this
.
_pixelRatio
=
conf
.
pixelRatio
;
}
if
(
e
.
accessibilitySupport
)
{
this
.
_accessibilitySupport
=
conf
.
accessibilitySupport
;
this
.
_textAreaInput
.
writeScreenReaderContent
(
'
strategy changed
'
);
}
if
(
e
.
emptySelectionClipboard
)
{
this
.
_emptySelectionClipboard
=
conf
.
emptySelectionClipboard
;
}
...
...
@@ -294,6 +306,7 @@ export class TextAreaHandler extends ViewPart {
}
public
onCursorStateChanged
(
e
:
viewEvents
.
ViewCursorStateChangedEvent
):
boolean
{
this
.
_selections
=
e
.
selections
.
slice
(
0
);
this
.
_textAreaInput
.
writeScreenReaderContent
(
'
selection changed
'
);
return
true
;
}
public
onDecorationsChanged
(
e
:
viewEvents
.
ViewDecorationsChangedEvent
):
boolean
{
...
...
@@ -333,10 +346,6 @@ export class TextAreaHandler extends ViewPart {
this
.
_textAreaInput
.
focusTextArea
();
}
public
writeToTextArea
():
void
{
this
.
_textAreaInput
.
writeScreenReaderContent
(
'
selection changed
'
);
}
public
setAriaActiveDescendant
(
id
:
string
):
void
{
if
(
id
)
{
this
.
textArea
.
setAttribute
(
'
role
'
,
'
combobox
'
);
...
...
@@ -356,11 +365,18 @@ export class TextAreaHandler extends ViewPart {
private
_primaryCursorVisibleRange
:
HorizontalRange
=
null
;
public
prepareRender
(
ctx
:
RenderingContext
):
void
{
const
primaryCursorPosition
=
new
Position
(
this
.
_selections
[
0
].
positionLineNumber
,
this
.
_selections
[
0
].
positionColumn
);
this
.
_primaryCursorVisibleRange
=
ctx
.
visibleRangeForPosition
(
primaryCursorPosition
);
if
(
this
.
_accessibilitySupport
===
platform
.
AccessibilitySupport
.
Enabled
)
{
// Do not move the textarea with the cursor, as this generates accessibility events that might confuse screen readers
// See https://github.com/Microsoft/vscode/issues/26730
this
.
_primaryCursorVisibleRange
=
null
;
}
else
{
const
primaryCursorPosition
=
new
Position
(
this
.
_selections
[
0
].
positionLineNumber
,
this
.
_selections
[
0
].
positionColumn
);
this
.
_primaryCursorVisibleRange
=
ctx
.
visibleRangeForPosition
(
primaryCursorPosition
);
}
}
public
render
(
ctx
:
RestrictedRenderingContext
):
void
{
this
.
_textAreaInput
.
writeScreenReaderContent
(
'
render
'
);
this
.
_render
();
}
...
...
src/vs/editor/browser/view/viewImpl.ts
浏览文件 @
eaf18ad3
...
...
@@ -403,7 +403,6 @@ export class View extends ViewEventHandler {
if
(
!
this
.
viewLines
.
shouldRender
()
&&
viewPartsToRender
.
length
===
0
)
{
// Nothing to render
this
.
_textAreaHandler
.
writeToTextArea
();
return
;
}
...
...
@@ -413,15 +412,11 @@ export class View extends ViewEventHandler {
let
viewportData
=
new
ViewportData
(
partialViewportData
,
this
.
_context
.
model
);
if
(
this
.
viewLines
.
shouldRender
())
{
this
.
viewLines
.
renderText
(
viewportData
,
()
=>
{
this
.
_textAreaHandler
.
writeToTextArea
();
});
this
.
viewLines
.
renderText
(
viewportData
);
this
.
viewLines
.
onDidRender
();
// Rendering of viewLines might cause scroll events to occur, so collect view parts to render again
viewPartsToRender
=
this
.
_getViewPartsToRender
();
}
else
{
this
.
_textAreaHandler
.
writeToTextArea
();
}
let
renderingContext
=
new
RenderingContext
(
this
.
_context
.
viewLayout
,
viewportData
,
this
.
viewLines
);
...
...
src/vs/editor/browser/viewParts/lines/viewLines.ts
浏览文件 @
eaf18ad3
...
...
@@ -405,17 +405,14 @@ export class ViewLines extends ViewPart implements IVisibleLinesHost<ViewLine>,
throw
new
Error
(
'
Not supported
'
);
}
public
renderText
(
viewportData
:
ViewportData
,
onAfterLinesRendered
:
()
=>
void
):
void
{
public
renderText
(
viewportData
:
ViewportData
):
void
{
// (1) render lines - ensures lines are in the DOM
this
.
_visibleLines
.
renderLines
(
viewportData
);
this
.
_lastRenderedData
.
setCurrentVisibleRange
(
viewportData
.
visibleRange
);
this
.
domNode
.
setWidth
(
this
.
_context
.
viewLayout
.
getScrollWidth
());
this
.
domNode
.
setHeight
(
Math
.
min
(
this
.
_context
.
viewLayout
.
getScrollHeight
(),
1000000
));
// (2) execute DOM writing that forces sync layout (e.g. textArea manipulation)
onAfterLinesRendered
();
// (3) compute horizontal scroll position:
// (2) compute horizontal scroll position:
// - this must happen after the lines are in the DOM since it might need a line that rendered just now
// - it might change `scrollWidth` and `scrollLeft`
if
(
this
.
_lastCursorRevealRangeHorizontallyEvent
)
{
...
...
@@ -440,7 +437,7 @@ export class ViewLines extends ViewPart implements IVisibleLinesHost<ViewLine>,
});
}
// (
4
) handle scrolling
// (
3
) handle scrolling
const
adjustedScrollTop
=
this
.
_context
.
viewLayout
.
getScrollTop
()
-
viewportData
.
bigNumbersDelta
;
if
(
this
.
_canUseTranslate3d
)
{
let
transform
=
'
translate3d(
'
+
-
this
.
_context
.
viewLayout
.
getScrollLeft
()
+
'
px,
'
+
-
adjustedScrollTop
+
'
px, 0px)
'
;
...
...
src/vs/editor/common/config/commonEditorConfig.ts
浏览文件 @
eaf18ad3
...
...
@@ -59,6 +59,7 @@ export interface IEnvConfiguration {
emptySelectionClipboard
:
boolean
;
pixelRatio
:
number
;
zoomLevel
:
number
;
accessibilitySupport
:
platform
.
AccessibilitySupport
;
}
export
abstract
class
CommonEditorConfiguration
extends
Disposable
implements
editorCommon
.
IConfiguration
{
...
...
@@ -122,7 +123,8 @@ export abstract class CommonEditorConfiguration extends Disposable implements ed
canUseTranslate3d
:
partialEnv
.
canUseTranslate3d
,
emptySelectionClipboard
:
partialEnv
.
emptySelectionClipboard
,
pixelRatio
:
partialEnv
.
pixelRatio
,
tabFocusMode
:
TabFocus
.
getTabFocusMode
()
tabFocusMode
:
TabFocus
.
getTabFocusMode
(),
accessibilitySupport
:
partialEnv
.
accessibilitySupport
};
return
editorOptions
.
InternalEditorOptionsFactory
.
createInternalEditorOptions
(
env
,
opts
);
}
...
...
src/vs/editor/common/config/editorOptions.ts
浏览文件 @
eaf18ad3
...
...
@@ -789,7 +789,6 @@ export interface IValidatedEditorOptions {
readonly
dragAndDrop
:
boolean
;
readonly
emptySelectionClipboard
:
boolean
;
readonly
useTabStops
:
boolean
;
readonly
performanceCritical
:
boolean
;
readonly
viewInfo
:
InternalEditorViewOptions
;
readonly
contribInfo
:
EditorContribOptions
;
...
...
@@ -806,6 +805,10 @@ export class InternalEditorOptions {
readonly
editorClassName
:
string
;
readonly
lineHeight
:
number
;
readonly
readOnly
:
boolean
;
/**
* @internal
*/
readonly
accessibilitySupport
:
platform
.
AccessibilitySupport
;
// ---- cursor options
readonly
wordSeparators
:
string
;
...
...
@@ -831,6 +834,7 @@ export class InternalEditorOptions {
editorClassName
:
string
;
lineHeight
:
number
;
readOnly
:
boolean
;
accessibilitySupport
:
platform
.
AccessibilitySupport
;
wordSeparators
:
string
;
autoClosingBrackets
:
boolean
;
useTabStops
:
boolean
;
...
...
@@ -848,6 +852,7 @@ export class InternalEditorOptions {
this
.
editorClassName
=
source
.
editorClassName
;
this
.
lineHeight
=
source
.
lineHeight
|
0
;
this
.
readOnly
=
source
.
readOnly
;
this
.
accessibilitySupport
=
source
.
accessibilitySupport
;
this
.
wordSeparators
=
source
.
wordSeparators
;
this
.
autoClosingBrackets
=
source
.
autoClosingBrackets
;
this
.
useTabStops
=
source
.
useTabStops
;
...
...
@@ -871,6 +876,7 @@ export class InternalEditorOptions {
&&
this
.
editorClassName
===
other
.
editorClassName
&&
this
.
lineHeight
===
other
.
lineHeight
&&
this
.
readOnly
===
other
.
readOnly
&&
this
.
accessibilitySupport
===
other
.
accessibilitySupport
&&
this
.
wordSeparators
===
other
.
wordSeparators
&&
this
.
autoClosingBrackets
===
other
.
autoClosingBrackets
&&
this
.
useTabStops
===
other
.
useTabStops
...
...
@@ -895,6 +901,7 @@ export class InternalEditorOptions {
editorClassName
:
(
this
.
editorClassName
!==
newOpts
.
editorClassName
),
lineHeight
:
(
this
.
lineHeight
!==
newOpts
.
lineHeight
),
readOnly
:
(
this
.
readOnly
!==
newOpts
.
readOnly
),
accessibilitySupport
:
(
this
.
accessibilitySupport
!==
newOpts
.
accessibilitySupport
),
wordSeparators
:
(
this
.
wordSeparators
!==
newOpts
.
wordSeparators
),
autoClosingBrackets
:
(
this
.
autoClosingBrackets
!==
newOpts
.
autoClosingBrackets
),
useTabStops
:
(
this
.
useTabStops
!==
newOpts
.
useTabStops
),
...
...
@@ -1232,6 +1239,7 @@ export interface IConfigurationChangedEvent {
readonly
editorClassName
:
boolean
;
readonly
lineHeight
:
boolean
;
readonly
readOnly
:
boolean
;
readonly
accessibilitySupport
:
boolean
;
readonly
wordSeparators
:
boolean
;
readonly
autoClosingBrackets
:
boolean
;
readonly
useTabStops
:
boolean
;
...
...
@@ -1259,6 +1267,7 @@ export interface IEnvironmentalOptions {
readonly
emptySelectionClipboard
:
boolean
;
readonly
pixelRatio
:
number
;
readonly
tabFocusMode
:
boolean
;
readonly
accessibilitySupport
:
platform
.
AccessibilitySupport
;
}
function
_boolean
<
T
>
(
value
:
any
,
defaultValue
:
T
):
boolean
|
T
{
...
...
@@ -1381,9 +1390,8 @@ export class EditorOptionsValidator {
wordWrap
=
_stringSet
<
'
off
'
|
'
on
'
|
'
wordWrapColumn
'
|
'
bounded
'
>
(
wordWrap
,
defaults
.
wordWrap
,
[
'
off
'
,
'
on
'
,
'
wordWrapColumn
'
,
'
bounded
'
]);
}
const
performanceCritical
=
false
;
const
viewInfo
=
this
.
_sanitizeViewInfo
(
opts
,
defaults
.
viewInfo
);
const
contribInfo
=
this
.
_sanitizeContribInfo
(
opts
,
defaults
.
contribInfo
,
performanceCritical
);
const
contribInfo
=
this
.
_sanitizeContribInfo
(
opts
,
defaults
.
contribInfo
);
return
{
inDiffEditor
:
_boolean
(
opts
.
inDiffEditor
,
defaults
.
inDiffEditor
),
...
...
@@ -1405,7 +1413,6 @@ export class EditorOptionsValidator {
dragAndDrop
:
_boolean
(
opts
.
dragAndDrop
,
defaults
.
dragAndDrop
),
emptySelectionClipboard
:
_boolean
(
opts
.
emptySelectionClipboard
,
defaults
.
emptySelectionClipboard
),
useTabStops
:
_boolean
(
opts
.
useTabStops
,
defaults
.
useTabStops
),
performanceCritical
:
performanceCritical
,
viewInfo
:
viewInfo
,
contribInfo
:
contribInfo
,
};
...
...
@@ -1564,7 +1571,7 @@ export class EditorOptionsValidator {
};
}
private
static
_sanitizeContribInfo
(
opts
:
IEditorOptions
,
defaults
:
EditorContribOptions
,
performanceCritical
:
boolean
):
EditorContribOptions
{
private
static
_sanitizeContribInfo
(
opts
:
IEditorOptions
,
defaults
:
EditorContribOptions
):
EditorContribOptions
{
let
quickSuggestions
:
boolean
|
{
other
:
boolean
,
comments
:
boolean
,
strings
:
boolean
};
if
(
typeof
opts
.
quickSuggestions
===
'
object
'
)
{
quickSuggestions
=
{
other
:
true
,
...
opts
.
quickSuggestions
};
...
...
@@ -1589,12 +1596,12 @@ export class EditorOptionsValidator {
wordBasedSuggestions
:
_boolean
(
opts
.
wordBasedSuggestions
,
defaults
.
wordBasedSuggestions
),
suggestFontSize
:
_clampedInt
(
opts
.
suggestFontSize
,
defaults
.
suggestFontSize
,
0
,
1000
),
suggestLineHeight
:
_clampedInt
(
opts
.
suggestLineHeight
,
defaults
.
suggestLineHeight
,
0
,
1000
),
selectionHighlight
:
!
performanceCritical
&&
_boolean
(
opts
.
selectionHighlight
,
defaults
.
selectionHighlight
),
occurrencesHighlight
:
!
performanceCritical
&&
_boolean
(
opts
.
occurrencesHighlight
,
defaults
.
occurrencesHighlight
),
codeLens
:
!
performanceCritical
&&
_boolean
(
opts
.
codeLens
,
defaults
.
codeLens
)
&&
_boolean
(
opts
.
referenceInfos
,
true
),
folding
:
!
performanceCritical
&&
_boolean
(
opts
.
folding
,
defaults
.
folding
),
selectionHighlight
:
_boolean
(
opts
.
selectionHighlight
,
defaults
.
selectionHighlight
),
occurrencesHighlight
:
_boolean
(
opts
.
occurrencesHighlight
,
defaults
.
occurrencesHighlight
),
codeLens
:
_boolean
(
opts
.
codeLens
,
defaults
.
codeLens
)
&&
_boolean
(
opts
.
referenceInfos
,
true
),
folding
:
_boolean
(
opts
.
folding
,
defaults
.
folding
),
showFoldingControls
:
_stringSet
<
'
always
'
|
'
mouseover
'
>
(
opts
.
showFoldingControls
,
defaults
.
showFoldingControls
,
[
'
always
'
,
'
mouseover
'
]),
matchBrackets
:
!
performanceCritical
&&
_boolean
(
opts
.
matchBrackets
,
defaults
.
matchBrackets
),
matchBrackets
:
_boolean
(
opts
.
matchBrackets
,
defaults
.
matchBrackets
),
find
:
find
};
}
...
...
@@ -1605,7 +1612,100 @@ export class EditorOptionsValidator {
*/
export
class
InternalEditorOptionsFactory
{
public
static
createInternalEditorOptions
(
env
:
IEnvironmentalOptions
,
opts
:
IValidatedEditorOptions
)
{
private
static
_handlePerformanceCritical
(
opts
:
IValidatedEditorOptions
,
performanceCritical
:
boolean
):
IValidatedEditorOptions
{
if
(
!
performanceCritical
)
{
return
opts
;
}
return
{
inDiffEditor
:
opts
.
inDiffEditor
,
wordSeparators
:
opts
.
wordSeparators
,
lineNumbersMinChars
:
opts
.
lineNumbersMinChars
,
lineDecorationsWidth
:
opts
.
lineDecorationsWidth
,
readOnly
:
opts
.
readOnly
,
mouseStyle
:
opts
.
mouseStyle
,
disableTranslate3d
:
opts
.
disableTranslate3d
,
automaticLayout
:
opts
.
automaticLayout
,
wordWrap
:
opts
.
wordWrap
,
wordWrapColumn
:
opts
.
wordWrapColumn
,
wordWrapMinified
:
opts
.
wordWrapMinified
,
wrappingIndent
:
opts
.
wrappingIndent
,
wordWrapBreakBeforeCharacters
:
opts
.
wordWrapBreakBeforeCharacters
,
wordWrapBreakAfterCharacters
:
opts
.
wordWrapBreakAfterCharacters
,
wordWrapBreakObtrusiveCharacters
:
opts
.
wordWrapBreakObtrusiveCharacters
,
autoClosingBrackets
:
opts
.
autoClosingBrackets
,
dragAndDrop
:
opts
.
dragAndDrop
,
emptySelectionClipboard
:
opts
.
emptySelectionClipboard
,
useTabStops
:
opts
.
useTabStops
,
viewInfo
:
{
extraEditorClassName
:
opts
.
viewInfo
.
extraEditorClassName
,
disableMonospaceOptimizations
:
opts
.
viewInfo
.
disableMonospaceOptimizations
,
experimentalScreenReader
:
opts
.
viewInfo
.
experimentalScreenReader
,
rulers
:
opts
.
viewInfo
.
rulers
,
ariaLabel
:
opts
.
viewInfo
.
ariaLabel
,
renderLineNumbers
:
opts
.
viewInfo
.
renderLineNumbers
,
renderCustomLineNumbers
:
opts
.
viewInfo
.
renderCustomLineNumbers
,
renderRelativeLineNumbers
:
opts
.
viewInfo
.
renderRelativeLineNumbers
,
selectOnLineNumbers
:
opts
.
viewInfo
.
selectOnLineNumbers
,
glyphMargin
:
opts
.
viewInfo
.
glyphMargin
,
revealHorizontalRightPadding
:
opts
.
viewInfo
.
revealHorizontalRightPadding
,
roundedSelection
:
false
,
// DISABLED
overviewRulerLanes
:
opts
.
viewInfo
.
overviewRulerLanes
,
overviewRulerBorder
:
opts
.
viewInfo
.
overviewRulerBorder
,
cursorBlinking
:
opts
.
viewInfo
.
cursorBlinking
,
mouseWheelZoom
:
opts
.
viewInfo
.
mouseWheelZoom
,
cursorStyle
:
opts
.
viewInfo
.
cursorStyle
,
hideCursorInOverviewRuler
:
opts
.
viewInfo
.
hideCursorInOverviewRuler
,
scrollBeyondLastLine
:
opts
.
viewInfo
.
scrollBeyondLastLine
,
stopRenderingLineAfter
:
opts
.
viewInfo
.
stopRenderingLineAfter
,
renderWhitespace
:
'
none
'
,
// DISABLED
renderControlCharacters
:
false
,
// DISABLED
fontLigatures
:
false
,
// DISABLED
renderIndentGuides
:
false
,
// DISABLED
renderLineHighlight
:
'
none
'
,
// DISABLED
scrollbar
:
opts
.
viewInfo
.
scrollbar
,
minimap
:
{
enabled
:
false
,
// DISABLED
renderCharacters
:
opts
.
viewInfo
.
minimap
.
renderCharacters
,
maxColumn
:
opts
.
viewInfo
.
minimap
.
maxColumn
},
fixedOverflowWidgets
:
opts
.
viewInfo
.
fixedOverflowWidgets
},
contribInfo
:
{
selectionClipboard
:
opts
.
contribInfo
.
selectionClipboard
,
hover
:
opts
.
contribInfo
.
hover
,
contextmenu
:
opts
.
contribInfo
.
contextmenu
,
quickSuggestions
:
opts
.
contribInfo
.
quickSuggestions
,
quickSuggestionsDelay
:
opts
.
contribInfo
.
quickSuggestionsDelay
,
parameterHints
:
opts
.
contribInfo
.
parameterHints
,
iconsInSuggestions
:
opts
.
contribInfo
.
iconsInSuggestions
,
formatOnType
:
opts
.
contribInfo
.
formatOnType
,
formatOnPaste
:
opts
.
contribInfo
.
formatOnPaste
,
suggestOnTriggerCharacters
:
opts
.
contribInfo
.
suggestOnTriggerCharacters
,
acceptSuggestionOnEnter
:
opts
.
contribInfo
.
acceptSuggestionOnEnter
,
acceptSuggestionOnCommitCharacter
:
opts
.
contribInfo
.
acceptSuggestionOnCommitCharacter
,
snippetSuggestions
:
opts
.
contribInfo
.
snippetSuggestions
,
wordBasedSuggestions
:
opts
.
contribInfo
.
wordBasedSuggestions
,
suggestFontSize
:
opts
.
contribInfo
.
suggestFontSize
,
suggestLineHeight
:
opts
.
contribInfo
.
suggestLineHeight
,
selectionHighlight
:
false
,
// DISABLED
occurrencesHighlight
:
false
,
// DISABLED
codeLens
:
false
,
// DISABLED
folding
:
false
,
// DISABLED
showFoldingControls
:
opts
.
contribInfo
.
showFoldingControls
,
matchBrackets
:
false
,
// DISABLED
find
:
opts
.
contribInfo
.
find
}
};
}
public
static
createInternalEditorOptions
(
env
:
IEnvironmentalOptions
,
_opts
:
IValidatedEditorOptions
)
{
// Disable some non critical features to get as best performance as possible
// See https://github.com/Microsoft/vscode/issues/26730
const
opts
=
this
.
_handlePerformanceCritical
(
_opts
,
(
env
.
accessibilitySupport
===
platform
.
AccessibilitySupport
.
Enabled
));
let
lineDecorationsWidth
:
number
;
if
(
typeof
opts
.
lineDecorationsWidth
===
'
string
'
&&
/^
\d
+
(\.\d
+
)?
ch$/
.
test
(
opts
.
lineDecorationsWidth
))
{
...
...
@@ -1713,6 +1813,7 @@ export class InternalEditorOptionsFactory {
editorClassName
:
className
,
lineHeight
:
env
.
fontInfo
.
lineHeight
,
readOnly
:
opts
.
readOnly
,
accessibilitySupport
:
env
.
accessibilitySupport
,
wordSeparators
:
opts
.
wordSeparators
,
autoClosingBrackets
:
opts
.
autoClosingBrackets
,
useTabStops
:
opts
.
useTabStops
,
...
...
@@ -1723,7 +1824,7 @@ export class InternalEditorOptionsFactory {
fontInfo
:
env
.
fontInfo
,
viewInfo
:
opts
.
viewInfo
,
wrappingInfo
:
wrappingInfo
,
contribInfo
:
opts
.
contribInfo
,
contribInfo
:
opts
.
contribInfo
});
}
}
...
...
@@ -1931,7 +2032,6 @@ export const EDITOR_DEFAULTS: IValidatedEditorOptions = {
dragAndDrop
:
false
,
emptySelectionClipboard
:
true
,
useTabStops
:
true
,
performanceCritical
:
false
,
viewInfo
:
{
extraEditorClassName
:
''
,
...
...
src/vs/editor/common/view/viewEvents.ts
浏览文件 @
eaf18ad3
...
...
@@ -38,6 +38,7 @@ export class ViewConfigurationChangedEvent {
public
readonly
editorClassName
:
boolean
;
public
readonly
lineHeight
:
boolean
;
public
readonly
readOnly
:
boolean
;
public
readonly
accessibilitySupport
:
boolean
;
public
readonly
emptySelectionClipboard
:
boolean
;
public
readonly
layoutInfo
:
boolean
;
public
readonly
fontInfo
:
boolean
;
...
...
@@ -50,6 +51,7 @@ export class ViewConfigurationChangedEvent {
this
.
editorClassName
=
source
.
editorClassName
;
this
.
lineHeight
=
source
.
lineHeight
;
this
.
readOnly
=
source
.
readOnly
;
this
.
accessibilitySupport
=
source
.
accessibilitySupport
;
this
.
emptySelectionClipboard
=
source
.
emptySelectionClipboard
;
this
.
layoutInfo
=
source
.
layoutInfo
;
this
.
fontInfo
=
source
.
fontInfo
;
...
...
src/vs/editor/test/common/config/commonEditorConfig.test.ts
浏览文件 @
eaf18ad3
...
...
@@ -8,6 +8,7 @@ import * as assert from 'assert';
import
{
EditorZoom
}
from
'
vs/editor/common/config/editorZoom
'
;
import
{
TestConfiguration
}
from
'
vs/editor/test/common/mocks/testConfiguration
'
;
import
{
IEnvConfiguration
}
from
"
vs/editor/common/config/commonEditorConfig
"
;
import
{
AccessibilitySupport
}
from
"
vs/base/common/platform
"
;
suite
(
'
Common Editor Config
'
,
()
=>
{
test
(
'
Zoom Level
'
,
()
=>
{
...
...
@@ -61,7 +62,8 @@ suite('Common Editor Config', () => {
canUseTranslate3d
:
true
,
emptySelectionClipboard
:
true
,
pixelRatio
:
1
,
zoomLevel
:
0
zoomLevel
:
0
,
accessibilitySupport
:
AccessibilitySupport
.
Unknown
};
}
}
...
...
src/vs/editor/test/common/mocks/testConfiguration.ts
浏览文件 @
eaf18ad3
...
...
@@ -7,6 +7,7 @@
import
{
CommonEditorConfiguration
,
IEnvConfiguration
}
from
'
vs/editor/common/config/commonEditorConfig
'
;
import
{
IEditorOptions
}
from
'
vs/editor/common/config/editorOptions
'
;
import
{
FontInfo
,
BareFontInfo
}
from
'
vs/editor/common/config/fontInfo
'
;
import
{
AccessibilitySupport
}
from
"
vs/base/common/platform
"
;
export
class
TestConfiguration
extends
CommonEditorConfiguration
{
...
...
@@ -23,7 +24,8 @@ export class TestConfiguration extends CommonEditorConfiguration {
canUseTranslate3d
:
true
,
emptySelectionClipboard
:
true
,
pixelRatio
:
1
,
zoomLevel
:
0
zoomLevel
:
0
,
accessibilitySupport
:
AccessibilitySupport
.
Unknown
};
}
...
...
src/vs/monaco.d.ts
浏览文件 @
eaf18ad3
...
...
@@ -3389,6 +3389,7 @@ declare module monaco.editor {
readonly
editorClassName
:
boolean
;
readonly
lineHeight
:
boolean
;
readonly
readOnly
:
boolean
;
readonly
accessibilitySupport
:
boolean
;
readonly
wordSeparators
:
boolean
;
readonly
autoClosingBrackets
:
boolean
;
readonly
useTabStops
:
boolean
;
...
...
src/vs/workbench/browser/parts/editor/editorStatus.ts
浏览文件 @
eaf18ad3
...
...
@@ -17,7 +17,7 @@ import errors = require('vs/base/common/errors');
import
*
as
browser
from
'
vs/base/browser/browser
'
;
import
{
IStatusbarItem
}
from
'
vs/workbench/browser/parts/statusbar/statusbar
'
;
import
{
Action
}
from
'
vs/base/common/actions
'
;
import
{
language
,
LANGUAGE_DEFAULT
}
from
'
vs/base/common/platform
'
;
import
{
language
,
LANGUAGE_DEFAULT
,
AccessibilitySupport
}
from
'
vs/base/common/platform
'
;
import
{
IMode
}
from
'
vs/editor/common/modes
'
;
import
{
UntitledEditorInput
}
from
'
vs/workbench/common/editor/untitledEditorInput
'
;
import
{
IFileEditorInput
,
EncodingMode
,
IEncodingSupport
,
toResource
,
SideBySideEditorInput
}
from
'
vs/workbench/common/editor
'
;
...
...
@@ -383,7 +383,7 @@ export class EditorStatus implements IStatusbarItem {
}
if
(
changed
.
selectionStatus
)
{
if
(
this
.
state
.
selectionStatus
)
{
if
(
this
.
state
.
selectionStatus
&&
!
this
.
state
.
screenReaderMode
)
{
this
.
selectionElement
.
textContent
=
this
.
state
.
selectionStatus
;
show
(
this
.
selectionElement
);
}
else
{
...
...
@@ -686,7 +686,7 @@ export class EditorStatus implements IStatusbarItem {
}
private
onScreenReaderModeChange
():
void
{
const
info
:
StateDelta
=
{
screenReaderMode
:
browser
.
getAccessibilitySupport
()
===
browser
.
AccessibilitySupport
.
Enabled
};
const
info
:
StateDelta
=
{
screenReaderMode
:
browser
.
getAccessibilitySupport
()
===
AccessibilitySupport
.
Enabled
};
this
.
updateState
(
info
);
}
...
...
src/vs/workbench/electron-browser/main.ts
浏览文件 @
eaf18ad3
...
...
@@ -70,7 +70,7 @@ export function startup(configuration: IWindowConfiguration): TPromise<void> {
KeyboardMapperFactory
.
INSTANCE
.
_onKeyboardLayoutChanged
(
configuration
.
isISOKeyboard
);
browser
.
setAccessibilitySupport
(
configuration
.
accessibilitySupportEnabled
?
browser
.
AccessibilitySupport
.
Enabled
:
browser
.
AccessibilitySupport
.
Disabled
);
browser
.
setAccessibilitySupport
(
configuration
.
accessibilitySupportEnabled
?
platform
.
AccessibilitySupport
.
Enabled
:
platform
.
AccessibilitySupport
.
Disabled
);
// Setup Intl
comparer
.
setFileNameComparer
(
new
Intl
.
Collator
(
undefined
,
{
numeric
:
true
,
sensitivity
:
'
base
'
}));
...
...
src/vs/workbench/electron-browser/window.ts
浏览文件 @
eaf18ad3
...
...
@@ -298,7 +298,7 @@ export class ElectronWindow extends Themable {
// keyboard layout changed event
ipc
.
on
(
'
vscode:accessibilitySupportChanged
'
,
(
event
,
accessibilitySupportEnabled
:
boolean
)
=>
{
browser
.
setAccessibilitySupport
(
accessibilitySupportEnabled
?
browser
.
AccessibilitySupport
.
Enabled
:
browser
.
AccessibilitySupport
.
Disabled
);
browser
.
setAccessibilitySupport
(
accessibilitySupportEnabled
?
platform
.
AccessibilitySupport
.
Enabled
:
platform
.
AccessibilitySupport
.
Disabled
);
});
// Configuration changes
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录