Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
5c4923b2
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,发现更多精彩内容 >>
提交
5c4923b2
编写于
2月 20, 2017
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
git: telemetry events
上级
9ae2575f
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
24 addition
and
8 deletion
+24
-8
extensions/git/package.json
extensions/git/package.json
+3
-1
extensions/git/src/commands.ts
extensions/git/src/commands.ts
+7
-3
extensions/git/src/main.ts
extensions/git/src/main.ts
+8
-4
extensions/git/src/typings/vscode-extension-telemetry.d.ts
extensions/git/src/typings/vscode-extension-telemetry.d.ts
+6
-0
未找到文件。
extensions/git/package.json
浏览文件 @
5c4923b2
...
...
@@ -7,6 +7,7 @@
"engines"
:
{
"vscode"
:
"^1.5.0"
},
"aiKey"
:
"AIF-d9b70cd4-b9f9-4d70-929b-a071c400b217"
,
"enableProposedApi"
:
true
,
"categories"
:
[
"Other"
...
...
@@ -588,9 +589,10 @@
}
},
"dependencies"
:
{
"vscode-extension-telemetry"
:
"0.0.5"
,
"vscode-nls"
:
"^2.0.1"
},
"devDependencies"
:
{
"@types/node"
:
"^7.0.4"
}
}
\ No newline at end of file
}
extensions/git/src/commands.ts
浏览文件 @
5c4923b2
...
...
@@ -11,6 +11,7 @@ import { Model, Resource, Status, CommitOptions } from './model';
import
*
as
staging
from
'
./staging
'
;
import
*
as
path
from
'
path
'
;
import
*
as
os
from
'
os
'
;
import
TelemetryReporter
from
'
vscode-extension-telemetry
'
;
import
*
as
nls
from
'
vscode-nls
'
;
const
localize
=
nls
.
loadMessageBundle
();
...
...
@@ -95,14 +96,15 @@ export class CommandCenter {
constructor
(
model
:
Model
|
undefined
,
private
outputChannel
:
OutputChannel
private
outputChannel
:
OutputChannel
,
private
telemetryReporter
:
TelemetryReporter
)
{
if
(
model
)
{
this
.
model
=
model
;
}
this
.
disposables
=
Commands
.
map
(({
commandId
,
method
})
=>
commands
.
registerCommand
(
commandId
,
this
.
createCommand
(
method
)));
.
map
(({
commandId
,
method
})
=>
commands
.
registerCommand
(
commandId
,
this
.
createCommand
(
commandId
,
method
)));
}
@
command
(
'
git.refresh
'
)
...
...
@@ -693,13 +695,15 @@ export class CommandCenter {
this
.
outputChannel
.
show
();
}
private
createCommand
(
method
:
Function
):
(...
args
:
any
[])
=>
any
{
private
createCommand
(
id
:
string
,
method
:
Function
):
(...
args
:
any
[])
=>
any
{
return
(...
args
)
=>
{
if
(
!
this
.
model
)
{
window
.
showInformationMessage
(
localize
(
'
disabled
'
,
"
Git is either disabled or not supported in this workspace
"
));
return
;
}
this
.
telemetryReporter
.
sendTelemetryEvent
(
'
git.command
'
,
{
command
:
id
});
const
result
=
Promise
.
resolve
(
method
.
apply
(
this
,
args
));
return
result
.
catch
(
async
err
=>
{
...
...
extensions/git/src/main.ts
浏览文件 @
5c4923b2
...
...
@@ -15,11 +15,15 @@ import { GitContentProvider } from './contentProvider';
import
{
AutoFetcher
}
from
'
./autofetch
'
;
import
{
MergeDecorator
}
from
'
./merge
'
;
import
{
Askpass
}
from
'
./askpass
'
;
import
TelemetryReporter
from
'
vscode-extension-telemetry
'
;
import
*
as
nls
from
'
vscode-nls
'
;
const
localize
=
nls
.
config
()();
async
function
init
(
disposables
:
Disposable
[]):
Promise
<
void
>
{
async
function
init
(
context
:
ExtensionContext
,
disposables
:
Disposable
[]):
Promise
<
void
>
{
const
{
name
,
version
,
aiKey
}
=
require
(
context
.
asAbsolutePath
(
'
./package.json
'
))
as
{
name
:
string
,
version
:
string
,
aiKey
:
string
};
const
telemetryReporter
:
TelemetryReporter
=
new
TelemetryReporter
(
name
,
version
,
aiKey
);
const
outputChannel
=
window
.
createOutputChannel
(
'
Git
'
);
disposables
.
push
(
outputChannel
);
...
...
@@ -28,7 +32,7 @@ async function init(disposables: Disposable[]): Promise<void> {
const
rootPath
=
workspace
.
rootPath
;
if
(
!
rootPath
||
!
enabled
)
{
const
commandCenter
=
new
CommandCenter
(
undefined
,
outputChannel
);
const
commandCenter
=
new
CommandCenter
(
undefined
,
outputChannel
,
telemetryReporter
);
disposables
.
push
(
commandCenter
);
return
;
}
...
...
@@ -42,7 +46,7 @@ async function init(disposables: Disposable[]): Promise<void> {
outputChannel
.
appendLine
(
localize
(
'
using git
'
,
"
Using git {0} from {1}
"
,
info
.
version
,
info
.
path
));
git
.
onOutput
(
str
=>
outputChannel
.
append
(
str
),
null
,
disposables
);
const
commandCenter
=
new
CommandCenter
(
model
,
outputChannel
);
const
commandCenter
=
new
CommandCenter
(
model
,
outputChannel
,
telemetryReporter
);
const
provider
=
new
GitSCMProvider
(
model
,
commandCenter
);
const
contentProvider
=
new
GitContentProvider
(
model
);
const
checkoutStatusBar
=
new
CheckoutStatusBar
(
model
);
...
...
@@ -81,6 +85,6 @@ export function activate(context: ExtensionContext): any {
const
disposables
:
Disposable
[]
=
[];
context
.
subscriptions
.
push
(
new
Disposable
(()
=>
Disposable
.
from
(...
disposables
).
dispose
()));
init
(
disposables
)
init
(
context
,
disposables
)
.
catch
(
err
=>
console
.
error
(
err
));
}
\ No newline at end of file
extensions/git/src/typings/vscode-extension-telemetry.d.ts
0 → 100644
浏览文件 @
5c4923b2
declare
module
'
vscode-extension-telemetry
'
{
export
default
class
TelemetryReporter
{
constructor
(
extensionId
:
string
,
extensionVersion
:
string
,
key
:
string
);
sendTelemetryEvent
(
eventName
:
string
,
properties
?:
{
[
key
:
string
]:
string
},
measures
?:
{
[
key
:
string
]:
number
}):
void
;
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录