Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
59cf7a96
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,发现更多精彩内容 >>
提交
59cf7a96
编写于
9月 21, 2016
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
let => const
上级
9f3efd44
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
44 addition
and
44 deletion
+44
-44
src/vs/base/parts/quickopen/browser/quickOpenModel.ts
src/vs/base/parts/quickopen/browser/quickOpenModel.ts
+20
-20
src/vs/base/parts/quickopen/browser/quickOpenWidget.ts
src/vs/base/parts/quickopen/browser/quickOpenWidget.ts
+24
-24
未找到文件。
src/vs/base/parts/quickopen/browser/quickOpenModel.ts
浏览文件 @
59cf7a96
...
...
@@ -181,8 +181,8 @@ export class QuickOpenEntry {
let
nameA
=
elementA
.
getLabel
();
let
nameB
=
elementB
.
getLabel
();
if
(
nameA
===
nameB
)
{
le
t
resourceA
=
elementA
.
getResource
();
le
t
resourceB
=
elementB
.
getResource
();
cons
t
resourceA
=
elementA
.
getResource
();
cons
t
resourceB
=
elementB
.
getResource
();
if
(
resourceA
&&
resourceB
)
{
nameA
=
resourceA
.
fsPath
;
...
...
@@ -202,7 +202,7 @@ export class QuickOpenEntry {
*/
public
static
highlight
(
entry
:
QuickOpenEntry
,
lookFor
:
string
,
fuzzyHighlight
=
false
):
{
labelHighlights
:
IHighlight
[],
descriptionHighlights
:
IHighlight
[]
}
{
let
labelHighlights
:
IHighlight
[]
=
[];
le
t
descriptionHighlights
:
IHighlight
[]
=
[];
cons
t
descriptionHighlights
:
IHighlight
[]
=
[];
const
normalizedLookFor
=
strings
.
stripWildcards
(
lookFor
);
const
label
=
entry
.
getLabel
();
...
...
@@ -219,7 +219,7 @@ export class QuickOpenEntry {
// Fuzzy/Full-Path: Highlight is special
else
if
(
fuzzyHighlight
||
lookFor
.
indexOf
(
paths
.
nativeSep
)
>=
0
)
{
le
t
candidateLabelHighlights
=
filters
.
matchesFuzzy
(
lookFor
,
label
,
fuzzyHighlight
);
cons
t
candidateLabelHighlights
=
filters
.
matchesFuzzy
(
lookFor
,
label
,
fuzzyHighlight
);
if
(
!
candidateLabelHighlights
)
{
const
pathPrefix
=
description
?
(
description
+
paths
.
nativeSep
)
:
''
;
const
pathPrefixLength
=
pathPrefix
.
length
;
...
...
@@ -488,41 +488,41 @@ class Renderer implements IRenderer<QuickOpenEntry> {
// Action Bar
DOM
.
addClass
(
container
,
'
actions
'
);
le
t
entryContainer
=
document
.
createElement
(
'
div
'
);
cons
t
entryContainer
=
document
.
createElement
(
'
div
'
);
DOM
.
addClass
(
entryContainer
,
'
sub-content
'
);
container
.
appendChild
(
entryContainer
);
le
t
actionBarContainer
=
document
.
createElement
(
'
div
'
);
cons
t
actionBarContainer
=
document
.
createElement
(
'
div
'
);
DOM
.
addClass
(
actionBarContainer
,
'
primary-action-bar
'
);
container
.
appendChild
(
actionBarContainer
);
le
t
actionBar
=
new
ActionBar
(
actionBarContainer
,
{
cons
t
actionBar
=
new
ActionBar
(
actionBarContainer
,
{
actionRunner
:
this
.
actionRunner
});
// Entry
le
t
entry
=
document
.
createElement
(
'
div
'
);
cons
t
entry
=
document
.
createElement
(
'
div
'
);
DOM
.
addClass
(
entry
,
'
quick-open-entry
'
);
entryContainer
.
appendChild
(
entry
);
// Icon
le
t
icon
=
document
.
createElement
(
'
span
'
);
cons
t
icon
=
document
.
createElement
(
'
span
'
);
entry
.
appendChild
(
icon
);
// Label
le
t
label
=
new
HighlightedLabel
(
entry
);
cons
t
label
=
new
HighlightedLabel
(
entry
);
// Description
le
t
descriptionContainer
=
document
.
createElement
(
'
span
'
);
cons
t
descriptionContainer
=
document
.
createElement
(
'
span
'
);
entry
.
appendChild
(
descriptionContainer
);
DOM
.
addClass
(
descriptionContainer
,
'
quick-open-entry-description
'
);
le
t
description
=
new
HighlightedLabel
(
descriptionContainer
);
cons
t
description
=
new
HighlightedLabel
(
descriptionContainer
);
// Detail
le
t
detailContainer
=
document
.
createElement
(
'
div
'
);
cons
t
detailContainer
=
document
.
createElement
(
'
div
'
);
entry
.
appendChild
(
detailContainer
);
DOM
.
addClass
(
detailContainer
,
'
quick-open-entry-meta
'
);
le
t
detail
=
new
HighlightedLabel
(
detailContainer
);
cons
t
detail
=
new
HighlightedLabel
(
detailContainer
);
return
{
container
,
...
...
@@ -544,7 +544,7 @@ class Renderer implements IRenderer<QuickOpenEntry> {
return
;
}
le
t
data
:
IQuickOpenEntryTemplateData
=
templateData
;
cons
t
data
:
IQuickOpenEntryTemplateData
=
templateData
;
// Action Bar
if
(
this
.
actionProvider
.
hasActions
(
null
,
entry
))
{
...
...
@@ -567,7 +567,7 @@ class Renderer implements IRenderer<QuickOpenEntry> {
// Entry group
if
(
entry
instanceof
QuickOpenEntryGroup
)
{
le
t
group
=
<
QuickOpenEntryGroup
>
entry
;
cons
t
group
=
<
QuickOpenEntryGroup
>
entry
;
// Border
if
(
group
.
showBorder
())
{
...
...
@@ -577,16 +577,16 @@ class Renderer implements IRenderer<QuickOpenEntry> {
}
// Group Label
le
t
groupLabel
=
group
.
getGroupLabel
()
||
''
;
cons
t
groupLabel
=
group
.
getGroupLabel
()
||
''
;
(
<
IQuickOpenEntryGroupTemplateData
>
templateData
).
group
.
textContent
=
groupLabel
;
}
// Normal Entry
if
(
entry
instanceof
QuickOpenEntry
)
{
le
t
[
labelHighlights
,
descriptionHighlights
,
detailHighlights
]
=
entry
.
getHighlights
();
cons
t
[
labelHighlights
,
descriptionHighlights
,
detailHighlights
]
=
entry
.
getHighlights
();
// Extra Class
le
t
extraClass
=
entry
.
getExtraClass
();
cons
t
extraClass
=
entry
.
getExtraClass
();
if
(
extraClass
)
{
DOM
.
addClass
(
data
.
entry
,
extraClass
);
}
else
{
...
...
@@ -594,7 +594,7 @@ class Renderer implements IRenderer<QuickOpenEntry> {
}
// Icon
le
t
iconClass
=
entry
.
getIcon
()
?
(
'
quick-open-entry-icon
'
+
entry
.
getIcon
())
:
''
;
cons
t
iconClass
=
entry
.
getIcon
()
?
(
'
quick-open-entry-icon
'
+
entry
.
getIcon
())
:
''
;
data
.
icon
.
className
=
iconClass
;
// Label
...
...
src/vs/base/parts/quickopen/browser/quickOpenWidget.ts
浏览文件 @
59cf7a96
...
...
@@ -121,7 +121,7 @@ export class QuickOpenWidget implements IModelProvider {
// Eventing
div
.
on
(
DOM
.
EventType
.
KEY_DOWN
,
(
e
:
KeyboardEvent
)
=>
{
le
t
keyboardEvent
:
StandardKeyboardEvent
=
new
StandardKeyboardEvent
(
e
);
cons
t
keyboardEvent
:
StandardKeyboardEvent
=
new
StandardKeyboardEvent
(
e
);
if
(
keyboardEvent
.
keyCode
===
KeyCode
.
Escape
)
{
DOM
.
EventHelper
.
stop
(
e
,
true
);
...
...
@@ -151,7 +151,7 @@ export class QuickOpenWidget implements IModelProvider {
this
.
inputElement
.
setAttribute
(
'
aria-autocomplete
'
,
'
list
'
);
DOM
.
addDisposableListener
(
this
.
inputBox
.
inputElement
,
DOM
.
EventType
.
KEY_DOWN
,
(
e
:
KeyboardEvent
)
=>
{
le
t
keyboardEvent
:
StandardKeyboardEvent
=
new
StandardKeyboardEvent
(
e
);
cons
t
keyboardEvent
:
StandardKeyboardEvent
=
new
StandardKeyboardEvent
(
e
);
// Do not handle Tab: It is used to navigate between elements without mouse
if
(
keyboardEvent
.
keyCode
===
KeyCode
.
Tab
)
{
...
...
@@ -169,7 +169,7 @@ export class QuickOpenWidget implements IModelProvider {
else
if
(
keyboardEvent
.
keyCode
===
KeyCode
.
Enter
)
{
DOM
.
EventHelper
.
stop
(
e
,
true
);
le
t
focus
=
this
.
tree
.
getFocus
();
cons
t
focus
=
this
.
tree
.
getFocus
();
if
(
focus
)
{
this
.
elementSelected
(
focus
,
e
);
}
...
...
@@ -218,7 +218,7 @@ export class QuickOpenWidget implements IModelProvider {
}));
}).
on
(
DOM
.
EventType
.
KEY_DOWN
,
(
e
:
KeyboardEvent
)
=>
{
le
t
keyboardEvent
:
StandardKeyboardEvent
=
new
StandardKeyboardEvent
(
e
);
cons
t
keyboardEvent
:
StandardKeyboardEvent
=
new
StandardKeyboardEvent
(
e
);
// Only handle when in quick navigation mode
if
(
!
this
.
quickNavigateConfiguration
)
{
...
...
@@ -233,8 +233,8 @@ export class QuickOpenWidget implements IModelProvider {
}
}).
on
(
DOM
.
EventType
.
KEY_UP
,
(
e
:
KeyboardEvent
)
=>
{
le
t
keyboardEvent
:
StandardKeyboardEvent
=
new
StandardKeyboardEvent
(
e
);
le
t
keyCode
=
keyboardEvent
.
keyCode
;
cons
t
keyboardEvent
:
StandardKeyboardEvent
=
new
StandardKeyboardEvent
(
e
);
cons
t
keyCode
=
keyboardEvent
.
keyCode
;
// Only handle when in quick navigation mode
if
(
!
this
.
quickNavigateConfiguration
)
{
...
...
@@ -242,8 +242,8 @@ export class QuickOpenWidget implements IModelProvider {
}
// Select element when keys are pressed that signal it
le
t
quickNavKeys
=
this
.
quickNavigateConfiguration
.
keybindings
;
le
t
wasTriggerKeyPressed
=
keyCode
===
KeyCode
.
Enter
||
quickNavKeys
.
some
((
k
)
=>
{
cons
t
quickNavKeys
=
this
.
quickNavigateConfiguration
.
keybindings
;
cons
t
wasTriggerKeyPressed
=
keyCode
===
KeyCode
.
Enter
||
quickNavKeys
.
some
((
k
)
=>
{
if
(
k
.
hasShift
()
&&
keyCode
===
KeyCode
.
Shift
)
{
if
(
keyboardEvent
.
ctrlKey
||
keyboardEvent
.
altKey
||
keyboardEvent
.
metaKey
)
{
return
false
;
// this is an optimistic check for the shift key being used to navigate back in quick open
...
...
@@ -282,7 +282,7 @@ export class QuickOpenWidget implements IModelProvider {
});
if
(
wasTriggerKeyPressed
)
{
le
t
focus
=
this
.
tree
.
getFocus
();
cons
t
focus
=
this
.
tree
.
getFocus
();
if
(
focus
)
{
this
.
elementSelected
(
focus
,
e
);
}
...
...
@@ -303,7 +303,7 @@ export class QuickOpenWidget implements IModelProvider {
}
private
onType
():
void
{
le
t
value
=
this
.
inputBox
.
value
;
cons
t
value
=
this
.
inputBox
.
value
;
// Adjust help text as needed if present
if
(
this
.
helpText
)
{
...
...
@@ -411,8 +411,8 @@ export class QuickOpenWidget implements IModelProvider {
// add telemetry when an item is accepted, logging the index of the item in the list and the length of the list
// to measure the rate of the success and the relevance of the order
if
(
this
.
usageLogger
)
{
le
t
indexOfAcceptedElement
=
this
.
model
.
entries
.
indexOf
(
value
);
le
t
entriesCount
=
this
.
model
.
entries
.
length
;
cons
t
indexOfAcceptedElement
=
this
.
model
.
entries
.
indexOf
(
value
);
cons
t
entriesCount
=
this
.
model
.
entries
.
length
;
this
.
usageLogger
.
publicLog
(
'
quickOpenWidgetItemAccepted
'
,
{
index
:
indexOfAcceptedElement
,
count
:
entriesCount
,
isQuickNavigate
:
this
.
quickNavigateConfiguration
?
true
:
false
});
}
...
...
@@ -516,10 +516,10 @@ export class QuickOpenWidget implements IModelProvider {
if
(
autoFocus
.
autoFocusPrefixMatch
)
{
let
caseSensitiveMatch
:
any
;
let
caseInsensitiveMatch
:
any
;
le
t
prefix
=
autoFocus
.
autoFocusPrefixMatch
;
le
t
lowerCasePrefix
=
prefix
.
toLowerCase
();
cons
t
prefix
=
autoFocus
.
autoFocusPrefixMatch
;
cons
t
lowerCasePrefix
=
prefix
.
toLowerCase
();
for
(
let
i
=
0
;
i
<
entries
.
length
;
i
++
)
{
le
t
entry
=
entries
[
i
];
cons
t
entry
=
entries
[
i
];
const
label
=
input
.
dataSource
.
getLabel
(
entry
);
if
(
!
caseSensitiveMatch
&&
label
.
indexOf
(
prefix
)
===
0
)
{
...
...
@@ -533,7 +533,7 @@ export class QuickOpenWidget implements IModelProvider {
}
}
le
t
entryToFocus
=
caseSensitiveMatch
||
caseInsensitiveMatch
;
cons
t
entryToFocus
=
caseSensitiveMatch
||
caseInsensitiveMatch
;
if
(
entryToFocus
)
{
this
.
tree
.
setFocus
(
entryToFocus
);
this
.
tree
.
reveal
(
entryToFocus
,
0
).
done
(
null
,
errors
.
onUnexpectedError
);
...
...
@@ -599,7 +599,7 @@ export class QuickOpenWidget implements IModelProvider {
const
renderer
=
input
.
renderer
;
if
(
!
input
)
{
le
t
itemHeight
=
renderer
.
getHeight
(
null
);
cons
t
itemHeight
=
renderer
.
getHeight
(
null
);
return
this
.
options
.
minItemsToShow
?
this
.
options
.
minItemsToShow
*
itemHeight
:
0
;
}
...
...
@@ -615,10 +615,10 @@ export class QuickOpenWidget implements IModelProvider {
preferredItemsHeight
=
QuickOpenWidget
.
MAX_ITEMS_HEIGHT
;
}
le
t
entries
=
input
.
entries
.
filter
(
e
=>
this
.
isElementVisible
(
input
,
e
));
le
t
maxEntries
=
this
.
options
.
maxItemsToShow
||
entries
.
length
;
cons
t
entries
=
input
.
entries
.
filter
(
e
=>
this
.
isElementVisible
(
input
,
e
));
cons
t
maxEntries
=
this
.
options
.
maxItemsToShow
||
entries
.
length
;
for
(
let
i
=
0
;
i
<
maxEntries
&&
i
<
entries
.
length
;
i
++
)
{
le
t
entryHeight
=
renderer
.
getHeight
(
entries
[
i
]);
cons
t
entryHeight
=
renderer
.
getHeight
(
entries
[
i
]);
if
(
height
+
entryHeight
<=
preferredItemsHeight
)
{
height
+=
entryHeight
;
}
else
{
...
...
@@ -641,7 +641,7 @@ export class QuickOpenWidget implements IModelProvider {
// report failure cases
if
(
reason
===
HideReason
.
CANCELED
)
{
if
(
this
.
model
)
{
le
t
entriesCount
=
this
.
model
.
entries
.
filter
(
e
=>
this
.
isElementVisible
(
this
.
model
,
e
)).
length
;
cons
t
entriesCount
=
this
.
model
.
entries
.
filter
(
e
=>
this
.
isElementVisible
(
this
.
model
,
e
)).
length
;
if
(
this
.
usageLogger
)
{
this
.
usageLogger
.
publicLog
(
'
quickOpenWidgetCancelled
'
,
{
count
:
entriesCount
,
isQuickNavigate
:
this
.
quickNavigateConfiguration
?
true
:
false
});
}
...
...
@@ -762,7 +762,7 @@ export class QuickOpenWidget implements IModelProvider {
public
accept
():
void
{
if
(
this
.
isVisible
())
{
le
t
focus
=
this
.
tree
.
getFocus
();
cons
t
focus
=
this
.
tree
.
getFocus
();
if
(
focus
)
{
this
.
elementSelected
(
focus
);
}
...
...
@@ -774,7 +774,7 @@ export class QuickOpenWidget implements IModelProvider {
}
public
setExtraClass
(
clazz
:
string
):
void
{
le
t
previousClass
=
this
.
builder
.
getProperty
(
'
extra-class
'
);
cons
t
previousClass
=
this
.
builder
.
getProperty
(
'
extra-class
'
);
if
(
previousClass
)
{
this
.
builder
.
removeClass
(
previousClass
);
}
...
...
@@ -795,7 +795,7 @@ export class QuickOpenWidget implements IModelProvider {
this
.
layoutDimensions
=
dimension
;
// Apply to quick open width (height is dynamic by number of items to show)
le
t
quickOpenWidth
=
Math
.
min
(
this
.
layoutDimensions
.
width
*
0.62
/* golden cut */
,
QuickOpenWidget
.
MAX_WIDTH
);
cons
t
quickOpenWidth
=
Math
.
min
(
this
.
layoutDimensions
.
width
*
0.62
/* golden cut */
,
QuickOpenWidget
.
MAX_WIDTH
);
if
(
this
.
builder
)
{
// quick open
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录