Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
c7f07d24
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,发现更多精彩内容 >>
提交
c7f07d24
编写于
11月 10, 2016
作者:
C
Christof Marti
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add telemetry events for opening/closing editors (#15321)
上级
5931743a
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
67 addition
and
1 deletion
+67
-1
src/vs/platform/telemetry/common/telemetry.ts
src/vs/platform/telemetry/common/telemetry.ts
+8
-0
src/vs/workbench/common/editor.ts
src/vs/workbench/common/editor.ts
+22
-0
src/vs/workbench/common/editor/editorStacksModel.ts
src/vs/workbench/common/editor/editorStacksModel.ts
+23
-1
src/vs/workbench/common/editor/resourceEditorInput.ts
src/vs/workbench/common/editor/resourceEditorInput.ts
+7
-0
src/vs/workbench/parts/files/common/files.ts
src/vs/workbench/parts/files/common/files.ts
+7
-0
未找到文件。
src/vs/platform/telemetry/common/telemetry.ts
浏览文件 @
c7f07d24
...
...
@@ -5,6 +5,9 @@
'
use strict
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
guessMimeTypes
}
from
'
vs/base/common/mime
'
;
import
paths
=
require
(
'
vs/base/common/paths
'
);
import
URI
from
'
vs/base/common/uri
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
createDecorator
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IStorageService
}
from
'
vs/platform/storage/common/storage
'
;
...
...
@@ -146,4 +149,9 @@ export function anonymize(input: string): string {
r
+=
ch
;
}
return
r
;
}
export
function
telemetryURIDescriptor
(
uri
:
URI
):
any
{
const
fsPath
=
uri
&&
uri
.
fsPath
;
return
fsPath
?
{
mimeType
:
guessMimeTypes
(
fsPath
).
join
(
'
,
'
),
ext
:
paths
.
extname
(
fsPath
),
path
:
anonymize
(
fsPath
)
}
:
{};
}
\ No newline at end of file
src/vs/workbench/common/editor.ts
浏览文件 @
c7f07d24
...
...
@@ -6,6 +6,7 @@
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
Event
,
{
Emitter
}
from
'
vs/base/common/event
'
;
import
*
as
objects
from
'
vs/base/common/objects
'
;
import
types
=
require
(
'
vs/base/common/types
'
);
import
URI
from
'
vs/base/common/uri
'
;
import
{
IEditor
,
ICommonCodeEditor
,
IEditorViewState
,
IEditorOptions
as
ICodeEditorOptions
}
from
'
vs/editor/common/editorCommon
'
;
...
...
@@ -15,6 +16,7 @@ import { IEditorGroupService } from 'vs/workbench/services/group/common/groupSer
import
{
SyncDescriptor
,
AsyncDescriptor
}
from
'
vs/platform/instantiation/common/descriptors
'
;
import
{
IInstantiationService
,
IConstructorSignature0
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IModel
}
from
'
vs/editor/common/editorCommon
'
;
import
{
telemetryURIDescriptor
}
from
'
vs/platform/telemetry/common/telemetry
'
;
export
enum
ConfirmResult
{
SAVE
,
...
...
@@ -199,6 +201,15 @@ export abstract class EditorInput implements IEditorInput {
return
null
;
}
/**
* Returns a descriptor suitable for telemetry events or null if none is available.
*
* Subclasses should extend if they can contribute.
*/
public
getTelemetryDescriptor
():
any
{
return
{
typeId
:
this
.
getTypeId
()
};
}
/**
* Returns a type of EditorModel that represents the resolved input. Subclasses should
* override to provide a meaningful model. The optional second argument allows to specify
...
...
@@ -339,6 +350,12 @@ export abstract class UntitledEditorInput extends EditorInput implements IEncodi
abstract
getEncoding
():
string
;
abstract
setEncoding
(
encoding
:
string
,
mode
:
EncodingMode
):
void
;
public
getTelemetryDescriptor
():
any
{
const
descriptor
=
super
.
getTelemetryDescriptor
();
descriptor
.
resource
=
telemetryURIDescriptor
(
this
.
getResource
());
return
descriptor
;
}
}
/**
...
...
@@ -378,6 +395,11 @@ export abstract class BaseDiffEditorInput extends EditorInput {
public
revert
():
TPromise
<
boolean
>
{
return
this
.
_modifiedInput
.
revert
();
}
public
getTelemetryDescriptor
():
any
{
const
descriptor
=
this
.
_modifiedInput
.
getTelemetryDescriptor
();
return
objects
.
assign
(
descriptor
,
super
.
getTelemetryDescriptor
());
}
}
export
interface
ITextEditorModel
extends
IEditorModel
{
...
...
src/vs/workbench/common/editor/editorStacksModel.ts
浏览文件 @
c7f07d24
...
...
@@ -15,6 +15,7 @@ import { ILifecycleService } from 'vs/platform/lifecycle/common/lifecycle';
import
{
dispose
,
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
Registry
}
from
'
vs/platform/platform
'
;
import
{
Position
,
Direction
}
from
'
vs/platform/editor/common/editor
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
DiffEditorInput
}
from
'
vs/workbench/common/editor/diffEditorInput
'
;
export
interface
GroupEvent
extends
IGroupEvent
{
...
...
@@ -693,6 +694,7 @@ export class EditorStacksModel implements IEditorStacksModel {
private
_onEditorDisposed
:
Emitter
<
EditorIdentifier
>
;
private
_onEditorDirty
:
Emitter
<
EditorIdentifier
>
;
private
_onEditorLabelChange
:
Emitter
<
EditorIdentifier
>
;
private
_onEditorOpened
:
Emitter
<
EditorIdentifier
>
;
private
_onEditorClosed
:
Emitter
<
GroupEvent
>
;
private
_onModelChanged
:
Emitter
<
IStacksModelChangeEvent
>
;
...
...
@@ -700,7 +702,8 @@ export class EditorStacksModel implements IEditorStacksModel {
private
restoreFromStorage
:
boolean
,
@
IStorageService
private
storageService
:
IStorageService
,
@
ILifecycleService
private
lifecycleService
:
ILifecycleService
,
@
IInstantiationService
private
instantiationService
:
IInstantiationService
@
IInstantiationService
private
instantiationService
:
IInstantiationService
,
@
ITelemetryService
private
telemetryService
:
ITelemetryService
)
{
this
.
toDispose
=
[];
...
...
@@ -717,6 +720,7 @@ export class EditorStacksModel implements IEditorStacksModel {
this
.
_onEditorDisposed
=
new
Emitter
<
EditorIdentifier
>
();
this
.
_onEditorDirty
=
new
Emitter
<
EditorIdentifier
>
();
this
.
_onEditorLabelChange
=
new
Emitter
<
EditorIdentifier
>
();
this
.
_onEditorOpened
=
new
Emitter
<
EditorIdentifier
>
();
this
.
_onEditorClosed
=
new
Emitter
<
GroupEvent
>
();
this
.
toDispose
.
push
(
this
.
_onGroupOpened
,
this
.
_onGroupClosed
,
this
.
_onGroupActivated
,
this
.
_onGroupDeactivated
,
this
.
_onGroupMoved
,
this
.
_onGroupRenamed
,
this
.
_onModelChanged
,
this
.
_onEditorDisposed
,
this
.
_onEditorDirty
,
this
.
_onEditorLabelChange
,
this
.
_onEditorClosed
);
...
...
@@ -768,6 +772,10 @@ export class EditorStacksModel implements IEditorStacksModel {
return
this
.
_onEditorLabelChange
.
event
;
}
public
get
onEditorOpened
():
Event
<
EditorIdentifier
>
{
return
this
.
_onEditorOpened
.
event
;
}
public
get
onEditorClosed
():
Event
<
GroupEvent
>
{
return
this
.
_onEditorClosed
.
event
;
}
...
...
@@ -1093,6 +1101,10 @@ export class EditorStacksModel implements IEditorStacksModel {
const
unbind
:
IDisposable
[]
=
[];
unbind
.
push
(
group
.
onEditorsStructureChanged
(
editor
=>
this
.
_onModelChanged
.
fire
({
group
,
editor
,
structural
:
true
})));
unbind
.
push
(
group
.
onEditorStateChanged
(
editor
=>
this
.
_onModelChanged
.
fire
({
group
,
editor
})));
unbind
.
push
(
group
.
onEditorOpened
(
editor
=>
{
this
.
handleOnEditorOpened
(
editor
);
this
.
_onEditorOpened
.
fire
({
editor
,
group
});
}));
unbind
.
push
(
group
.
onEditorClosed
(
event
=>
{
this
.
handleOnEditorClosed
(
event
);
this
.
_onEditorClosed
.
fire
(
event
);
...
...
@@ -1109,6 +1121,12 @@ export class EditorStacksModel implements IEditorStacksModel {
return
group
;
}
private
handleOnEditorOpened
(
editor
:
EditorInput
):
void
{
if
(
this
.
telemetryService
)
{
this
.
telemetryService
.
publicLog
(
'
editorOpened
'
,
editor
.
getTelemetryDescriptor
());
}
}
private
handleOnEditorClosed
(
event
:
GroupEvent
):
void
{
const
editor
=
event
.
editor
;
...
...
@@ -1125,6 +1143,10 @@ export class EditorStacksModel implements IEditorStacksModel {
});
}
}
if
(
this
.
telemetryService
)
{
this
.
telemetryService
.
publicLog
(
'
editorClosed
'
,
editor
.
getTelemetryDescriptor
());
}
}
public
isOpen
(
resource
:
URI
):
boolean
;
...
...
src/vs/workbench/common/editor/resourceEditorInput.ts
浏览文件 @
c7f07d24
...
...
@@ -7,6 +7,7 @@
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
EditorInput
,
ITextEditorModel
}
from
'
vs/workbench/common/editor
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
{
telemetryURIDescriptor
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
ITextModelResolverService
}
from
'
vs/platform/textmodelResolver/common/resolver
'
;
import
{
ResourceEditorModel
}
from
'
vs/workbench/common/editor/resourceEditorModel
'
;
...
...
@@ -63,6 +64,12 @@ export class ResourceEditorInput extends EditorInput {
}
}
public
getTelemetryDescriptor
():
any
{
const
descriptor
=
super
.
getTelemetryDescriptor
();
descriptor
.
resource
=
telemetryURIDescriptor
(
this
.
resource
);
return
descriptor
;
}
public
resolve
(
refresh
?:
boolean
):
TPromise
<
ITextEditorModel
>
{
// Use Cached Model
...
...
src/vs/workbench/parts/files/common/files.ts
浏览文件 @
c7f07d24
...
...
@@ -10,6 +10,7 @@ import { EncodingMode, EditorInput, IFileEditorInput, IWorkbenchEditorConfigurat
import
{
IFilesConfiguration
}
from
'
vs/platform/files/common/files
'
;
import
{
FileStat
}
from
'
vs/workbench/parts/files/common/explorerViewModel
'
;
import
{
RawContextKey
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
telemetryURIDescriptor
}
from
'
vs/platform/telemetry/common/telemetry
'
;
/**
* Explorer viewlet id.
...
...
@@ -49,6 +50,12 @@ export abstract class FileEditorInput extends EditorInput implements IFileEditor
public
abstract
setEncoding
(
encoding
:
string
,
mode
:
EncodingMode
):
void
;
public
abstract
getEncoding
():
string
;
public
getTelemetryDescriptor
():
any
{
const
descriptor
=
super
.
getTelemetryDescriptor
();
descriptor
.
resource
=
telemetryURIDescriptor
(
this
.
getResource
());
return
descriptor
;
}
}
export
interface
IFilesConfiguration
extends
IFilesConfiguration
,
IWorkbenchEditorConfiguration
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录