Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
8f032f9e
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
8f032f9e
编写于
1月 18, 2016
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'wadeanderson-install-count'
上级
8ab1b046
d21757ae
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
66 addition
and
17 deletion
+66
-17
src/vs/workbench/parts/extensions/common/extensions.ts
src/vs/workbench/parts/extensions/common/extensions.ts
+1
-0
src/vs/workbench/parts/extensions/electron-browser/extensionsQuickOpen.ts
.../parts/extensions/electron-browser/extensionsQuickOpen.ts
+38
-9
src/vs/workbench/parts/extensions/electron-browser/media/extensions.css
...ch/parts/extensions/electron-browser/media/extensions.css
+9
-6
src/vs/workbench/parts/extensions/node/vsoGalleryService.ts
src/vs/workbench/parts/extensions/node/vsoGalleryService.ts
+18
-2
未找到文件。
src/vs/workbench/parts/extensions/common/extensions.ts
浏览文件 @
8f032f9e
...
...
@@ -23,6 +23,7 @@ export interface IGalleryInformation {
downloadUrl
:
string
;
publisherId
:
string
;
publisherDisplayName
:
string
;
installCount
:
number
;
date
:
string
;
}
...
...
src/vs/workbench/parts/extensions/electron-browser/extensionsQuickOpen.ts
浏览文件 @
8f032f9e
...
...
@@ -8,6 +8,7 @@ import 'vs/css!./media/extensions';
import
nls
=
require
(
'
vs/nls
'
);
import
{
IDisposable
,
disposeAll
}
from
'
vs/base/common/lifecycle
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
isNumber
}
from
'
vs/base/common/types
'
;
import
*
as
dom
from
'
vs/base/browser/dom
'
;
import
Severity
from
'
vs/base/common/severity
'
;
import
{
onUnexpectedError
}
from
'
vs/base/common/errors
'
;
...
...
@@ -56,7 +57,7 @@ interface ITemplateData {
root
:
HTMLElement
;
displayName
:
HighlightedLabel
;
version
:
HTMLElement
;
since
:
HTMLElement
;
installCount
:
HTMLElement
;
author
:
HTMLElement
;
actionbar
:
ActionBar
;
description
:
HighlightedLabel
;
...
...
@@ -80,9 +81,15 @@ function extensionEquals(one: IExtension, other: IExtension): boolean {
}
function
extensionEntryCompare
(
one
:
IExtensionEntry
,
other
:
IExtensionEntry
):
number
{
const
oneName
=
one
.
extension
.
displayName
||
one
.
extension
.
name
;
const
otherName
=
other
.
extension
.
displayName
||
other
.
extension
.
name
;
return
oneName
.
localeCompare
(
otherName
);
const
oneInstallCount
=
one
.
extension
.
galleryInformation
?
one
.
extension
.
galleryInformation
.
installCount
:
0
;
const
otherInstallCount
=
other
.
extension
.
galleryInformation
?
other
.
extension
.
galleryInformation
.
installCount
:
0
;
const
diff
=
otherInstallCount
-
oneInstallCount
;
if
(
diff
!==
0
)
{
return
diff
;
}
return
one
.
extension
.
displayName
.
localeCompare
(
other
.
extension
.
displayName
);
}
class
OpenInGalleryAction
extends
Action
{
...
...
@@ -171,19 +178,22 @@ class Renderer implements IRenderer<IExtensionEntry> {
}
renderTemplate
(
templateId
:
string
,
container
:
HTMLElement
):
ITemplateData
{
// Important to preserve order here.
const
root
=
dom
.
append
(
container
,
$
(
'
.extension
'
));
const
firstRow
=
dom
.
append
(
root
,
$
(
'
.row
'
));
const
secondRow
=
dom
.
append
(
root
,
$
(
'
.row
'
));
const
published
=
dom
.
append
(
firstRow
,
$
(
'
.published
'
));
const
since
=
dom
.
append
(
published
,
$
(
'
span.since
'
));
const
displayName
=
new
HighlightedLabel
(
dom
.
append
(
firstRow
,
$
(
'
span.name
'
)));
const
installCount
=
dom
.
append
(
firstRow
,
$
(
'
span.installCount
'
));
const
version
=
dom
.
append
(
published
,
$
(
'
span.version
'
));
const
author
=
dom
.
append
(
published
,
$
(
'
span.author
'
));
return
{
root
,
author
,
sinc
e
,
displayName
:
new
HighlightedLabel
(
dom
.
append
(
firstRow
,
$
(
'
span.name
'
)))
,
version
:
dom
.
append
(
firstRow
,
$
(
'
span.version
'
))
,
displayNam
e
,
version
,
installCount
,
actionbar
:
new
ActionBar
(
dom
.
append
(
secondRow
,
$
(
'
.actions
'
))),
description
:
new
HighlightedLabel
(
dom
.
append
(
secondRow
,
$
(
'
span.description
'
))),
disposables
:
[]
...
...
@@ -194,6 +204,7 @@ class Renderer implements IRenderer<IExtensionEntry> {
const
extension
=
entry
.
extension
;
const
date
=
extension
.
galleryInformation
?
extension
.
galleryInformation
.
date
:
null
;
const
publisher
=
extension
.
galleryInformation
?
extension
.
galleryInformation
.
publisherDisplayName
:
extension
.
publisher
;
const
installCount
=
extension
.
galleryInformation
?
extension
.
galleryInformation
.
installCount
:
null
;
const
actionOptions
=
{
icon
:
true
,
label
:
false
};
const
updateActions
=
()
=>
{
...
...
@@ -236,7 +247,25 @@ class Renderer implements IRenderer<IExtensionEntry> {
data
.
displayName
.
set
(
extension
.
displayName
,
entry
.
highlights
.
displayName
);
data
.
displayName
.
element
.
title
=
extension
.
name
;
data
.
version
.
textContent
=
extension
.
version
;
data
.
since
.
textContent
=
date
?
since
(
new
Date
(
date
))
:
''
;
if
(
isNumber
(
installCount
))
{
data
.
installCount
.
textContent
=
String
(
installCount
);
dom
.
addClass
(
data
.
installCount
,
'
octicon
'
);
dom
.
addClass
(
data
.
installCount
,
'
octicon-cloud-download
'
);
if
(
!
installCount
)
{
data
.
installCount
.
title
=
nls
.
localize
(
'
installCountZero
'
,
"
{0} wasn't downloaded yet.
"
,
extension
.
displayName
);
}
else
if
(
installCount
===
1
)
{
data
.
installCount
.
title
=
nls
.
localize
(
'
installCountOne
'
,
"
{0} was downloaded once.
"
,
extension
.
displayName
);
}
else
{
data
.
installCount
.
title
=
nls
.
localize
(
'
installCountMultiple
'
,
"
{0} was downloaded {1} times.
"
,
extension
.
displayName
,
installCount
);
}
}
else
{
data
.
installCount
.
textContent
=
''
;
dom
.
removeClass
(
data
.
installCount
,
'
octicon
'
);
dom
.
removeClass
(
data
.
installCount
,
'
octicon-cloud-download
'
);
}
data
.
author
.
textContent
=
publisher
;
data
.
description
.
set
(
extension
.
description
,
entry
.
highlights
.
description
);
data
.
description
.
element
.
title
=
extension
.
description
;
...
...
src/vs/workbench/parts/extensions/electron-browser/media/extensions.css
浏览文件 @
8f032f9e
...
...
@@ -28,14 +28,17 @@
opacity
:
0.6
;
}
.quick-open-widget
.extension
.version
{
font-family
:
Menlo
,
Monaco
,
Consolas
,
"Droid Sans Mono"
,
"Courier New"
,
monospace
,
"Droid Sans Fallback"
;
.quick-open-widget
.extension
.installCount
:not
(
:empty
)
{
margin-left
:
6px
;
padding
:
1px
3px
;
border-radius
:
3px
;
background-color
:
rgba
(
132
,
132
,
132
,
0.3
);
font-size
:
smaller
;
opacity
:
0.7
;
}
.quick-open-widget
.extension
.version
{
padding-left
:
6px
;
opacity
:
0.7
;
.quick-open-widget
.extension
.installCount
:not
(
:empty
)
:before
{
margin-right
:
2px
;
}
.quick-open-widget
.extension
.published
{
...
...
@@ -44,7 +47,7 @@
font-size
:
smaller
;
}
.quick-open-widget
.extension
.published
>
.
since
{
.quick-open-widget
.extension
.published
>
.
version
{
opacity
:
0.6
;
margin-right
:
0.5em
;
}
...
...
src/vs/workbench/parts/extensions/node/vsoGalleryService.ts
浏览文件 @
8f032f9e
...
...
@@ -33,6 +33,21 @@ export interface IGalleryExtension {
publisher
:
{
displayName
:
string
,
publisherId
:
string
,
publisherName
:
string
;
};
versions
:
IGalleryExtensionVersion
[];
galleryApiUrl
:
string
;
statistics
:
IGalleryExtensionStatistics
[];
}
export
interface
IGalleryExtensionStatistics
{
statisticName
:
string
;
value
:
number
;
}
function
getInstallCount
(
statistics
:
IGalleryExtensionStatistics
[]):
number
{
if
(
!
statistics
)
{
return
0
;
}
const
result
=
statistics
.
filter
(
s
=>
s
.
statisticName
===
'
install
'
)[
0
];
return
result
?
result
.
value
:
0
;
}
export
class
GalleryService
implements
IGalleryService
{
...
...
@@ -69,7 +84,7 @@ export class GalleryService implements IGalleryService {
value
:
'
vscode
'
}]
}],
flags
:
0x1
|
0x4
|
0x80
flags
:
0x1
|
0x4
|
0x80
|
0x100
});
const
request
=
{
...
...
@@ -98,7 +113,8 @@ export class GalleryService implements IGalleryService {
downloadUrl
:
`
${
extension
.
versions
[
0
].
assetUri
}
/Microsoft.VisualStudio.Services.VSIXPackage?install=true`
,
publisherId
:
extension
.
publisher
.
publisherId
,
publisherDisplayName
:
extension
.
publisher
.
displayName
,
date
:
extension
.
versions
[
0
].
lastUpdated
installCount
:
getInstallCount
(
extension
.
statistics
),
date
:
extension
.
versions
[
0
].
lastUpdated
,
}
}));
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录