Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
8dd07034
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,发现更多精彩内容 >>
提交
8dd07034
编写于
5月 18, 2017
作者:
M
Matt Bierner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Split reporter out into own file
上级
f084c2a1
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
80 addition
and
36 deletion
+80
-36
extensions/typescript/src/typescriptServiceClient.ts
extensions/typescript/src/typescriptServiceClient.ts
+4
-36
extensions/typescript/src/utils/telemetry.ts
extensions/typescript/src/utils/telemetry.ts
+76
-0
未找到文件。
extensions/typescript/src/typescriptServiceClient.ts
浏览文件 @
8dd07034
...
...
@@ -22,9 +22,8 @@ import Logger from './utils/logger';
import
*
as
VersionStatus
from
'
./utils/versionStatus
'
;
import
*
as
is
from
'
./utils/is
'
;
import
TelemetryReporter
from
'
vscode-extension-telemetry
'
;
import
*
as
nls
from
'
vscode-nls
'
;
import
TelemetryReporter
from
"
./utils/telemetry
"
;
const
localize
=
nls
.
loadMessageBundle
();
interface
CallbackItem
{
...
...
@@ -43,12 +42,6 @@ interface RequestItem {
callbacks
:
CallbackItem
|
null
;
}
interface
IPackageInfo
{
name
:
string
;
version
:
string
;
aiKey
:
string
;
}
enum
Trace
{
Off
,
Messages
,
...
...
@@ -162,7 +155,6 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient
private
_onDidEndInstallTypings
=
new
EventEmitter
<
Proto
.
EndInstallTypesEventBody
>
();
private
_onTypesInstallerInitializationFailed
=
new
EventEmitter
<
Proto
.
TypesInstallerInitializationFailedEventBody
>
();
private
_packageInfo
:
IPackageInfo
|
null
;
private
_apiVersion
:
API
;
private
telemetryReporter
:
TelemetryReporter
;
private
checkJs
:
boolean
;
...
...
@@ -230,10 +222,8 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient
this
.
restartTsServer
();
}
}));
if
(
this
.
packageInfo
&&
this
.
packageInfo
.
aiKey
)
{
this
.
telemetryReporter
=
new
TelemetryReporter
(
this
.
packageInfo
.
name
,
this
.
packageInfo
.
version
,
this
.
packageInfo
.
aiKey
);
disposables
.
push
(
this
.
telemetryReporter
);
}
this
.
telemetryReporter
=
new
TelemetryReporter
();
disposables
.
push
(
this
.
telemetryReporter
);
this
.
startService
();
}
...
...
@@ -341,30 +331,8 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient
this
.
logger
.
logLevel
(
'
Trace
'
,
message
,
data
);
}
private
get
packageInfo
():
IPackageInfo
|
null
{
if
(
this
.
_packageInfo
!==
undefined
)
{
return
this
.
_packageInfo
;
}
let
packagePath
=
path
.
join
(
__dirname
,
'
./../package.json
'
);
let
extensionPackage
=
require
(
packagePath
);
if
(
extensionPackage
)
{
this
.
_packageInfo
=
{
name
:
extensionPackage
.
name
,
version
:
extensionPackage
.
version
,
aiKey
:
extensionPackage
.
aiKey
};
}
else
{
this
.
_packageInfo
=
null
;
}
return
this
.
_packageInfo
;
}
public
logTelemetry
(
eventName
:
string
,
properties
?:
{
[
prop
:
string
]:
string
})
{
if
(
this
.
telemetryReporter
)
{
this
.
telemetryReporter
.
sendTelemetryEvent
(
eventName
,
properties
);
}
this
.
telemetryReporter
.
logTelemetry
(
eventName
,
properties
);
}
private
service
():
Thenable
<
cp
.
ChildProcess
>
{
...
...
extensions/typescript/src/utils/telemetry.ts
0 → 100644
浏览文件 @
8dd07034
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'
use strict
'
;
import
*
as
path
from
'
path
'
;
import
VsCodeTelemetryReporter
from
'
vscode-extension-telemetry
'
;
import
{
Disposable
}
from
"
vscode
"
;
interface
IPackageInfo
{
name
:
string
;
version
:
string
;
aiKey
:
string
;
}
export
default
class
TelemetryReporter
extends
Disposable
{
private
_packageInfo
:
IPackageInfo
|
null
;
private
_reporter
:
VsCodeTelemetryReporter
|
null
;
constructor
()
{
super
(()
=>
this
.
dispose
());
}
dispose
()
{
if
(
this
.
_reporter
)
{
this
.
_reporter
.
dispose
();
this
.
_reporter
=
null
;
}
}
public
logTelemetry
(
eventName
:
string
,
properties
?:
{
[
prop
:
string
]:
string
})
{
if
(
this
.
_reporter
)
{
this
.
_reporter
.
sendTelemetryEvent
(
eventName
,
properties
);
}
}
private
get
reporter
():
VsCodeTelemetryReporter
|
null
{
if
(
typeof
this
.
_reporter
!==
'
undefined
'
)
{
return
this
.
_reporter
;
}
if
(
this
.
packageInfo
&&
this
.
packageInfo
.
aiKey
)
{
this
.
_reporter
=
new
VsCodeTelemetryReporter
(
this
.
packageInfo
.
name
,
this
.
packageInfo
.
version
,
this
.
packageInfo
.
aiKey
);
}
else
{
this
.
_reporter
=
null
;
}
return
this
.
_reporter
;
}
private
get
packageInfo
():
IPackageInfo
|
null
{
if
(
this
.
_packageInfo
!==
undefined
)
{
return
this
.
_packageInfo
;
}
let
packagePath
=
path
.
join
(
__dirname
,
'
./../package.json
'
);
let
extensionPackage
=
require
(
packagePath
);
if
(
extensionPackage
)
{
this
.
_packageInfo
=
{
name
:
extensionPackage
.
name
,
version
:
extensionPackage
.
version
,
aiKey
:
extensionPackage
.
aiKey
};
}
else
{
this
.
_packageInfo
=
null
;
}
return
this
.
_packageInfo
;
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录