Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
ace47418
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,发现更多精彩内容 >>
提交
ace47418
编写于
2月 12, 2016
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add screen reader support and keyboard support for gotoError
上级
9e8834fc
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
126 addition
and
44 deletion
+126
-44
src/vs/editor/contrib/gotoError/browser/gotoError.ts
src/vs/editor/contrib/gotoError/browser/gotoError.ts
+121
-42
src/vs/editor/contrib/zoneWidget/browser/zoneWidget.ts
src/vs/editor/contrib/zoneWidget/browser/zoneWidget.ts
+5
-2
未找到文件。
src/vs/editor/contrib/gotoError/browser/gotoError.ts
浏览文件 @
ace47418
...
@@ -15,7 +15,6 @@ import severity from 'vs/base/common/severity';
...
@@ -15,7 +15,6 @@ import severity from 'vs/base/common/severity';
import
DOM
=
require
(
'
vs/base/browser/dom
'
);
import
DOM
=
require
(
'
vs/base/browser/dom
'
);
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
ZoneWidget
=
require
(
'
vs/editor/contrib/zoneWidget/browser/zoneWidget
'
);
import
ZoneWidget
=
require
(
'
vs/editor/contrib/zoneWidget/browser/zoneWidget
'
);
import
Builder
=
require
(
'
vs/base/browser/builder
'
);
import
{
EditorBrowserRegistry
}
from
'
vs/editor/browser/editorBrowserExtensions
'
;
import
{
EditorBrowserRegistry
}
from
'
vs/editor/browser/editorBrowserExtensions
'
;
import
{
CommonEditorRegistry
,
ContextKey
,
EditorActionDescriptor
}
from
'
vs/editor/common/editorCommonExtensions
'
;
import
{
CommonEditorRegistry
,
ContextKey
,
EditorActionDescriptor
}
from
'
vs/editor/common/editorCommonExtensions
'
;
import
{
EditorAction
,
Behaviour
}
from
'
vs/editor/common/editorAction
'
;
import
{
EditorAction
,
Behaviour
}
from
'
vs/editor/common/editorAction
'
;
...
@@ -31,9 +30,7 @@ import {IKeybindingService, IKeybindingContextKey} from 'vs/platform/keybinding/
...
@@ -31,9 +30,7 @@ import {IKeybindingService, IKeybindingContextKey} from 'vs/platform/keybinding/
import
{
IEventService
}
from
'
vs/platform/event/common/event
'
;
import
{
IEventService
}
from
'
vs/platform/event/common/event
'
;
import
{
IEditorService
}
from
'
vs/platform/editor/common/editor
'
;
import
{
IEditorService
}
from
'
vs/platform/editor/common/editor
'
;
import
{
bulkEdit
}
from
'
vs/editor/common/services/bulkEdit
'
;
import
{
bulkEdit
}
from
'
vs/editor/common/services/bulkEdit
'
;
import
{
KeyMod
,
KeyCode
}
from
'
vs/base/common/keyCodes
'
;
import
{
KeyMod
,
KeyCode
,
CommonKeybindings
}
from
'
vs/base/common/keyCodes
'
;
var
$
=
Builder
.
$
;
class
MarkerModel
{
class
MarkerModel
{
...
@@ -193,16 +190,20 @@ class MarkerModel {
...
@@ -193,16 +190,20 @@ class MarkerModel {
var
zoneOptions
:
ZoneWidget
.
IOptions
=
{
var
zoneOptions
:
ZoneWidget
.
IOptions
=
{
showFrame
:
true
,
showFrame
:
true
,
showArrow
:
true
showArrow
:
true
,
isAccessible
:
true
};
};
class
MarkerNavigationWidget
extends
ZoneWidget
.
ZoneWidget
{
class
MarkerNavigationWidget
extends
ZoneWidget
.
ZoneWidget
{
private
_eventService
:
IEventService
;
private
_eventService
:
IEventService
;
private
_editorService
:
IEditorService
;
private
_editorService
:
IEditorService
;
private
_element
:
Builder
.
Builder
;
private
_container
:
HTMLElement
;
private
_quickFixSection
:
Builder
.
Builder
;
private
_element
:
HTMLElement
;
private
_quickFixSection
:
HTMLElement
;
private
_callOnDispose
:
lifecycle
.
IDisposable
[]
=
[];
private
_callOnDispose
:
lifecycle
.
IDisposable
[]
=
[];
private
_localCleanup
:
lifecycle
.
IDisposable
[]
=
[];
private
_quickFixEntries
:
HTMLElement
[];
constructor
(
eventService
:
IEventService
,
editorService
:
IEditorService
,
editor
:
EditorBrowser
.
ICodeEditor
,
private
_model
:
MarkerModel
)
{
constructor
(
eventService
:
IEventService
,
editorService
:
IEditorService
,
editor
:
EditorBrowser
.
ICodeEditor
,
private
_model
:
MarkerModel
)
{
super
(
editor
,
zoneOptions
);
super
(
editor
,
zoneOptions
);
...
@@ -213,18 +214,64 @@ class MarkerNavigationWidget extends ZoneWidget.ZoneWidget {
...
@@ -213,18 +214,64 @@ class MarkerNavigationWidget extends ZoneWidget.ZoneWidget {
}
}
public
fillContainer
(
container
:
HTMLElement
):
void
{
public
fillContainer
(
container
:
HTMLElement
):
void
{
this
.
_container
=
container
;
DOM
.
addClass
(
this
.
_container
,
'
marker-widget
'
);
this
.
_container
.
tabIndex
=
0
;
this
.
_container
.
setAttribute
(
'
role
'
,
'
tooltip
'
);
this
.
_element
=
document
.
createElement
(
'
div
'
);
this
.
_element
.
className
=
'
descriptioncontainer
'
;
this
.
_element
.
setAttribute
(
'
aria-live
'
,
'
assertive
'
);
this
.
_element
.
setAttribute
(
'
role
'
,
'
alert
'
);
this
.
_container
.
appendChild
(
this
.
_element
);
this
.
_quickFixSection
=
document
.
createElement
(
'
div
'
);
this
.
_container
.
appendChild
(
this
.
_quickFixSection
);
this
.
_callOnDispose
.
push
(
DOM
.
addStandardDisposableListener
(
this
.
_container
,
'
keydown
'
,
(
e
)
=>
{
switch
(
e
.
asKeybinding
())
{
case
CommonKeybindings
.
LEFT_ARROW
:
this
.
_goLeft
();
e
.
preventDefault
();
e
.
stopPropagation
();
break
;
case
CommonKeybindings
.
RIGHT_ARROW
:
this
.
_goRight
();
e
.
preventDefault
();
e
.
stopPropagation
();
break
;
var
$container
=
$
(
container
).
addClass
(
'
marker-widget
'
);
}
}));
}
$container
.
div
({
class
:
'
descriptioncontainer
'
},
(
div
:
Builder
.
Builder
)
=>
{
private
_goLeft
():
void
{
this
.
_element
=
div
;
if
(
!
this
.
_quickFixEntries
)
{
});
return
;
$container
.
div
((
div
:
Builder
.
Builder
)
=>
{
}
this
.
_quickFixSection
=
div
;
let
idx
=
this
.
_quickFixEntries
.
indexOf
(
<
HTMLElement
>
document
.
activeElement
);
});
if
(
idx
===
-
1
)
{
$container
.
on
(
DOM
.
EventType
.
CLICK
,
()
=>
{
idx
=
1
;
this
.
editor
.
focus
();
}
});
idx
=
(
idx
+
this
.
_quickFixEntries
.
length
-
1
)
%
this
.
_quickFixEntries
.
length
;
this
.
_quickFixEntries
[
idx
].
focus
();
}
private
_goRight
():
void
{
if
(
!
this
.
_quickFixEntries
)
{
return
;
}
let
idx
=
this
.
_quickFixEntries
.
indexOf
(
<
HTMLElement
>
document
.
activeElement
);
idx
=
(
idx
+
1
)
%
this
.
_quickFixEntries
.
length
;
this
.
_quickFixEntries
[
idx
].
focus
();
}
public
show
(
where
:
EditorCommon
.
IRange
,
heightInLines
:
number
):
void
;
public
show
(
where
:
EditorCommon
.
IPosition
,
heightInLines
:
number
):
void
;
public
show
(
where
:
any
,
heightInLines
:
number
):
void
{
super
.
show
(
where
,
heightInLines
);
this
.
_container
.
focus
();
}
}
private
_wireModelAndView
():
void
{
private
_wireModelAndView
():
void
{
...
@@ -248,45 +295,76 @@ class MarkerNavigationWidget extends ZoneWidget.ZoneWidget {
...
@@ -248,45 +295,76 @@ class MarkerNavigationWidget extends ZoneWidget.ZoneWidget {
break
;
break
;
}
}
this
.
_localCleanup
=
lifecycle
.
disposeAll
(
this
.
_localCleanup
);
// update label and show
// update label and show
let
text
=
strings
.
format
(
'
({0}/{1})
'
,
this
.
_model
.
indexOf
(
marker
)
+
1
,
this
.
_model
.
length
());
let
text
=
strings
.
format
(
'
({0}/{1})
'
,
this
.
_model
.
indexOf
(
marker
)
+
1
,
this
.
_model
.
length
());
if
(
marker
.
source
)
{
if
(
marker
.
source
)
{
text
=
`
${
text
}
[
${
marker
.
source
}
] `
;
text
=
`
${
text
}
[
${
marker
.
source
}
] `
;
}
}
this
.
_element
.
text
(
tex
t
);
DOM
.
clearNode
(
this
.
_elemen
t
);
var
htmlElem
=
this
.
_element
.
getHTMLElement
(
);
this
.
_element
.
appendChild
(
document
.
createTextNode
(
text
)
);
htmlElem
.
appendChild
(
HtmlContentRenderer
.
renderHtml
(
marker
.
message
));
this
.
_element
.
appendChild
(
HtmlContentRenderer
.
renderHtml
(
marker
.
message
));
var
mode
=
this
.
editor
.
getModel
().
getMode
();
var
mode
=
this
.
editor
.
getModel
().
getMode
();
this
.
_quickFixSection
.
hide
()
;
this
.
_quickFixSection
.
style
.
display
=
'
none
'
;
if
(
mode
.
quickFixSupport
)
{
if
(
mode
.
quickFixSupport
)
{
var
promise
=
mode
.
quickFixSupport
.
getQuickFixes
(
this
.
editor
.
getModel
().
getAssociatedResource
(),
marker
);
var
promise
=
mode
.
quickFixSupport
.
getQuickFixes
(
this
.
editor
.
getModel
().
getAssociatedResource
(),
marker
);
promise
.
then
((
result
:
Modes
.
IQuickFix
[])
=>
{
promise
.
then
((
result
:
Modes
.
IQuickFix
[])
=>
{
this
.
_quickFixSection
.
clearChildren
(
);
DOM
.
clearNode
(
this
.
_quickFixSection
);
if
(
result
.
length
>
0
)
{
if
(
result
.
length
>
0
)
{
var
container
=
$
(
this
.
_quickFixSection
);
container
.
span
({
this
.
_localCleanup
.
push
({
class
:
'
quickfixhead
'
,
dispose
:()
=>
{
text
:
result
.
length
>
1
?
nls
.
localize
(
'
quickfix.multiple.label
'
,
'
Suggested fixes:
'
)
:
nls
.
localize
(
'
quickfix.single.label
'
,
'
Suggested fix:
'
)
this
.
_quickFixEntries
=
[];
}).
span
({
class
:
'
quickfixcontainer
'
},(
quickFixContainer
:
Builder
.
Builder
)
=>
{
}
result
.
forEach
((
fix
,
idx
,
arr
)
=>
{
});
var
container
=
$
(
quickFixContainer
);
if
(
idx
>
0
)
{
let
quickfixhead
=
document
.
createElement
(
'
span
'
);
container
=
container
.
span
({
text
:
'
,
'
});
quickfixhead
.
className
=
'
quickfixhead
'
;
}
quickfixhead
.
appendChild
(
document
.
createTextNode
(
result
.
length
>
1
?
nls
.
localize
(
'
quickfix.multiple.label
'
,
'
Suggested fixes:
'
)
:
nls
.
localize
(
'
quickfix.single.label
'
,
'
Suggested fix:
'
)));
container
.
span
({
this
.
_quickFixSection
.
appendChild
(
quickfixhead
);
class
:
'
quickfixentry
'
,
text
:
fix
.
command
.
title
this
.
_quickFixEntries
=
[];
}).
on
(
DOM
.
EventType
.
CLICK
,()
=>
{
let
quickfixcontainer
=
document
.
createElement
(
'
span
'
);
mode
.
quickFixSupport
.
runQuickFixAction
(
this
.
editor
.
getModel
().
getAssociatedResource
(),
marker
,
fix
).
then
(
result
=>
{
quickfixcontainer
.
className
=
'
quickfixcontainer
'
;
return
bulkEdit
(
this
.
_eventService
,
this
.
_editorService
,
this
.
editor
,
result
.
edits
);
result
.
forEach
((
fix
,
idx
,
arr
)
=>
{
});
var
container
=
quickfixcontainer
;
return
true
;
if
(
idx
>
0
)
{
let
separator
=
document
.
createElement
(
'
span
'
);
separator
.
appendChild
(
document
.
createTextNode
(
'
,
'
));
container
.
appendChild
(
separator
);
}
let
entry
=
document
.
createElement
(
'
a
'
);
entry
.
tabIndex
=
0
;
entry
.
className
=
'
quickfixentry
'
;
entry
.
appendChild
(
document
.
createTextNode
(
fix
.
command
.
title
));
this
.
_localCleanup
.
push
(
DOM
.
addDisposableListener
(
entry
,
DOM
.
EventType
.
CLICK
,
()
=>
{
mode
.
quickFixSupport
.
runQuickFixAction
(
this
.
editor
.
getModel
().
getAssociatedResource
(),
marker
,
fix
).
then
(
result
=>
{
return
bulkEdit
(
this
.
_eventService
,
this
.
_editorService
,
this
.
editor
,
result
.
edits
);
});
});
});
return
true
;
}));
this
.
_localCleanup
.
push
(
DOM
.
addStandardDisposableListener
(
entry
,
'
keydown
'
,
(
e
)
=>
{
switch
(
e
.
asKeybinding
())
{
case
CommonKeybindings
.
ENTER
:
case
CommonKeybindings
.
SPACE
:
mode
.
quickFixSupport
.
runQuickFixAction
(
this
.
editor
.
getModel
().
getAssociatedResource
(),
marker
,
fix
).
then
(
result
=>
{
return
bulkEdit
(
this
.
_eventService
,
this
.
_editorService
,
this
.
editor
,
result
.
edits
);
});
e
.
preventDefault
();
e
.
stopPropagation
();
}
}));
container
.
appendChild
(
entry
);
this
.
_quickFixEntries
.
push
(
entry
);
});
});
this
.
_quickFixSection
.
show
();
this
.
_quickFixSection
.
appendChild
(
quickfixcontainer
);
this
.
_quickFixSection
.
style
.
display
=
''
;
this
.
show
(
new
Position
(
marker
.
startLineNumber
,
marker
.
startColumn
),
4
);
this
.
show
(
new
Position
(
marker
.
startLineNumber
,
marker
.
startColumn
),
4
);
}
}
},(
error
)
=>
{
},(
error
)
=>
{
...
@@ -398,6 +476,7 @@ class MarkerController implements EditorCommon.IEditorContribution {
...
@@ -398,6 +476,7 @@ class MarkerController implements EditorCommon.IEditorContribution {
public
closeMarkersNavigation
():
void
{
public
closeMarkersNavigation
():
void
{
this
.
_cleanUp
();
this
.
_cleanUp
();
this
.
editor
.
focus
();
}
}
private
_onMarkerChanged
(
changedResources
:
URI
[]):
void
{
private
_onMarkerChanged
(
changedResources
:
URI
[]):
void
{
...
...
src/vs/editor/contrib/zoneWidget/browser/zoneWidget.ts
浏览文件 @
ace47418
...
@@ -17,6 +17,7 @@ export interface IOptions {
...
@@ -17,6 +17,7 @@ export interface IOptions {
showArrow
?:
boolean
;
showArrow
?:
boolean
;
frameColor
?:
string
;
frameColor
?:
string
;
className
?:
string
;
className
?:
string
;
isAccessible
?:
boolean
;
}
}
var
defaultOptions
:
IOptions
=
{
var
defaultOptions
:
IOptions
=
{
...
@@ -104,8 +105,10 @@ export class ZoneWidget extends Events.EventEmitter {
...
@@ -104,8 +105,10 @@ export class ZoneWidget extends Events.EventEmitter {
this
.
overlayWidget
=
null
;
this
.
overlayWidget
=
null
;
this
.
lastView
=
null
;
this
.
lastView
=
null
;
this
.
domNode
=
document
.
createElement
(
'
div
'
);
this
.
domNode
=
document
.
createElement
(
'
div
'
);
this
.
domNode
.
setAttribute
(
'
aria-hidden
'
,
'
true
'
);
if
(
!
this
.
options
.
isAccessible
)
{
this
.
domNode
.
setAttribute
(
'
role
'
,
'
presentation
'
);
this
.
domNode
.
setAttribute
(
'
aria-hidden
'
,
'
true
'
);
this
.
domNode
.
setAttribute
(
'
role
'
,
'
presentation
'
);
}
this
.
container
=
null
;
this
.
container
=
null
;
this
.
listenersToRemove
=
[];
this
.
listenersToRemove
=
[];
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录