Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
229093ec
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,发现更多精彩内容 >>
提交
229093ec
编写于
10月 02, 2017
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
debt - remove unused 'usesCommandLink' telemetry
上级
8414d5c0
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
8 addition
and
115 deletion
+8
-115
src/vs/base/common/htmlContent.ts
src/vs/base/common/htmlContent.ts
+0
-14
src/vs/workbench/api/node/extHost.api.impl.ts
src/vs/workbench/api/node/extHost.api.impl.ts
+1
-1
src/vs/workbench/api/node/extHostDocumentsAndEditors.ts
src/vs/workbench/api/node/extHostDocumentsAndEditors.ts
+3
-7
src/vs/workbench/api/node/extHostLanguageFeatures.ts
src/vs/workbench/api/node/extHostLanguageFeatures.ts
+2
-16
src/vs/workbench/api/node/extHostTextEditor.ts
src/vs/workbench/api/node/extHostTextEditor.ts
+2
-77
未找到文件。
src/vs/base/common/htmlContent.ts
浏览文件 @
229093ec
...
...
@@ -6,7 +6,6 @@
'
use strict
'
;
import
{
equals
}
from
'
vs/base/common/arrays
'
;
import
{
marked
}
from
'
vs/base/common/marked/marked
'
;
export
interface
IMarkdownString
{
value
:
string
;
...
...
@@ -93,16 +92,3 @@ export function removeMarkdownEscapes(text: string): string {
}
return
text
.
replace
(
/
\\([\\
`*_{}[
\]
()#+
\-
.!
])
/g
,
'
$1
'
);
}
export
function
containsCommandLink
(
value
:
string
):
boolean
{
let
uses
=
false
;
const
renderer
=
new
marked
.
Renderer
();
renderer
.
link
=
(
href
,
title
,
text
):
string
=>
{
if
(
href
.
match
(
/^command:/i
))
{
uses
=
true
;
}
return
'
link
'
;
};
marked
(
value
,
{
renderer
});
return
uses
;
}
src/vs/workbench/api/node/extHost.api.impl.ts
浏览文件 @
229093ec
...
...
@@ -83,7 +83,7 @@ export function createApiFactory(
// Addressable instances
const
extHostHeapService
=
threadService
.
set
(
ExtHostContext
.
ExtHostHeapService
,
new
ExtHostHeapService
());
const
extHostDocumentsAndEditors
=
threadService
.
set
(
ExtHostContext
.
ExtHostDocumentsAndEditors
,
new
ExtHostDocumentsAndEditors
(
threadService
,
extensionService
));
const
extHostDocumentsAndEditors
=
threadService
.
set
(
ExtHostContext
.
ExtHostDocumentsAndEditors
,
new
ExtHostDocumentsAndEditors
(
threadService
));
const
extHostDocuments
=
threadService
.
set
(
ExtHostContext
.
ExtHostDocuments
,
new
ExtHostDocuments
(
threadService
,
extHostDocumentsAndEditors
));
const
extHostDocumentContentProviders
=
threadService
.
set
(
ExtHostContext
.
ExtHostDocumentContentProviders
,
new
ExtHostDocumentContentProvider
(
threadService
,
extHostDocumentsAndEditors
));
const
extHostDocumentSaveParticipant
=
threadService
.
set
(
ExtHostContext
.
ExtHostDocumentSaveParticipant
,
new
ExtHostDocumentSaveParticipant
(
extHostDocuments
,
threadService
.
get
(
MainContext
.
MainThreadEditors
)));
...
...
src/vs/workbench/api/node/extHostDocumentsAndEditors.ts
浏览文件 @
229093ec
...
...
@@ -8,10 +8,9 @@ import Event, { Emitter } from 'vs/base/common/event';
import
{
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
MainContext
,
ExtHostDocumentsAndEditorsShape
,
IDocumentsAndEditorsDelta
,
IMainContext
}
from
'
./extHost.protocol
'
;
import
{
ExtHostDocumentData
}
from
'
./extHostDocumentData
'
;
import
{
ExtHostTextEditor
,
ExtHostTextEditor2
}
from
'
./extHostTextEditor
'
;
import
{
ExtHostTextEditor
}
from
'
./extHostTextEditor
'
;
import
*
as
assert
from
'
assert
'
;
import
*
as
typeConverters
from
'
./extHostTypeConverters
'
;
import
{
ExtHostExtensionService
}
from
'
vs/workbench/api/node/extHostExtensionService
'
;
export
class
ExtHostDocumentsAndEditors
implements
ExtHostDocumentsAndEditorsShape
{
...
...
@@ -30,8 +29,7 @@ export class ExtHostDocumentsAndEditors implements ExtHostDocumentsAndEditorsSha
readonly
onDidChangeActiveTextEditor
:
Event
<
ExtHostTextEditor
>
=
this
.
_onDidChangeActiveTextEditor
.
event
;
constructor
(
private
readonly
_mainContext
:
IMainContext
,
private
readonly
_extHostExtensions
?:
ExtHostExtensionService
private
readonly
_mainContext
:
IMainContext
)
{
}
...
...
@@ -81,9 +79,7 @@ export class ExtHostDocumentsAndEditors implements ExtHostDocumentsAndEditorsSha
assert
.
ok
(
!
this
.
_editors
.
has
(
data
.
id
),
`editor '
${
data
.
id
}
' already exists!`
);
const
documentData
=
this
.
_documents
.
get
(
data
.
document
.
toString
());
const
editor
=
new
ExtHostTextEditor2
(
this
.
_extHostExtensions
,
this
.
_mainContext
.
get
(
MainContext
.
MainThreadTelemetry
),
const
editor
=
new
ExtHostTextEditor
(
this
.
_mainContext
.
get
(
MainContext
.
MainThreadEditors
),
data
.
id
,
documentData
,
...
...
src/vs/workbench/api/node/extHostLanguageFeatures.ts
浏览文件 @
229093ec
...
...
@@ -22,9 +22,7 @@ import { MainContext, MainThreadTelemetryShape, MainThreadLanguageFeaturesShape,
import
{
regExpLeadsToEndlessLoop
}
from
'
vs/base/common/strings
'
;
import
{
IPosition
}
from
'
vs/editor/common/core/position
'
;
import
{
IRange
}
from
'
vs/editor/common/core/range
'
;
import
{
containsCommandLink
}
from
'
vs/base/common/htmlContent
'
;
import
{
isFalsyOrEmpty
}
from
'
vs/base/common/arrays
'
;
import
{
once
}
from
'
vs/base/common/functional
'
;
// --- adapter
...
...
@@ -179,7 +177,6 @@ class HoverAdapter {
constructor
(
private
readonly
_documents
:
ExtHostDocuments
,
private
readonly
_provider
:
vscode
.
HoverProvider
,
private
readonly
_telemetryLog
:
(
name
:
string
,
data
:
object
)
=>
void
,
)
{
//
}
...
...
@@ -200,14 +197,7 @@ class HoverAdapter {
value
.
range
=
new
Range
(
pos
,
pos
);
}
const
result
=
TypeConverters
.
fromHover
(
value
);
// we wanna know which extension uses command links
// because that is a potential trick-attack on users
if
(
result
.
contents
.
some
(
h
=>
containsCommandLink
(
h
.
value
)))
{
this
.
_telemetryLog
(
'
usesCommandLink
'
,
{
from
:
'
hover
'
});
}
return
result
;
return
TypeConverters
.
fromHover
(
value
);
});
}
}
...
...
@@ -878,11 +868,7 @@ export class ExtHostLanguageFeatures implements ExtHostLanguageFeaturesShape {
registerHoverProvider
(
selector
:
vscode
.
DocumentSelector
,
provider
:
vscode
.
HoverProvider
,
extensionId
?:
string
):
vscode
.
Disposable
{
const
handle
=
this
.
_nextHandle
();
this
.
_adapter
.
set
(
handle
,
new
HoverAdapter
(
this
.
_documents
,
provider
,
once
((
name
:
string
,
data
:
any
)
=>
{
data
[
'
extension
'
]
=
extensionId
;
// __GDPR__TODO__ Dynamic event names and dynamic properties. Can not be registered statically.
this
.
_telemetry
.
$publicLog
(
name
,
data
);
})));
this
.
_adapter
.
set
(
handle
,
new
HoverAdapter
(
this
.
_documents
,
provider
));
this
.
_proxy
.
$registerHoverProvider
(
handle
,
selector
);
return
this
.
_createDisposable
(
handle
);
}
...
...
src/vs/workbench/api/node/extHostTextEditor.ts
浏览文件 @
229093ec
...
...
@@ -6,19 +6,17 @@
import
{
ok
}
from
'
vs/base/common/assert
'
;
import
{
readonly
,
illegalArgument
,
V8CallSite
}
from
'
vs/base/common/errors
'
;
import
{
readonly
,
illegalArgument
}
from
'
vs/base/common/errors
'
;
import
{
IdGenerator
}
from
'
vs/base/common/idGenerator
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
ExtHostDocumentData
}
from
'
vs/workbench/api/node/extHostDocumentData
'
;
import
{
Selection
,
Range
,
Position
,
EndOfLine
,
TextEditorRevealType
,
TextEditorLineNumbersStyle
,
SnippetString
}
from
'
./extHostTypes
'
;
import
{
ISingleEditOperation
}
from
'
vs/editor/common/editorCommon
'
;
import
*
as
TypeConverters
from
'
./extHostTypeConverters
'
;
import
{
MainThreadEditorsShape
,
MainThreadTelemetryShape
,
IResolvedTextEditorConfiguration
,
ITextEditorConfigurationUpdate
}
from
'
./extHost.protocol
'
;
import
{
MainThreadEditorsShape
,
IResolvedTextEditorConfiguration
,
ITextEditorConfigurationUpdate
}
from
'
./extHost.protocol
'
;
import
*
as
vscode
from
'
vscode
'
;
import
{
TextEditorCursorStyle
}
from
'
vs/editor/common/config/editorOptions
'
;
import
{
IRange
}
from
'
vs/editor/common/core/range
'
;
import
{
containsCommandLink
}
from
'
vs/base/common/htmlContent
'
;
import
{
ExtHostExtensionService
}
from
'
vs/workbench/api/node/extHostExtensionService
'
;
export
class
TextEditorDecorationType
implements
vscode
.
TextEditorDecorationType
{
...
...
@@ -552,79 +550,6 @@ export class ExtHostTextEditor implements vscode.TextEditor {
}
}
export
class
ExtHostTextEditor2
extends
ExtHostTextEditor
{
constructor
(
private
readonly
_extHostExtensions
:
ExtHostExtensionService
,
private
readonly
_mainThreadTelemetry
:
MainThreadTelemetryShape
,
proxy
:
MainThreadEditorsShape
,
id
:
string
,
document
:
ExtHostDocumentData
,
selections
:
Selection
[],
options
:
IResolvedTextEditorConfiguration
,
viewColumn
:
vscode
.
ViewColumn
)
{
super
(
proxy
,
id
,
document
,
selections
,
options
,
viewColumn
);
}
setDecorations
(
decorationType
:
vscode
.
TextEditorDecorationType
,
rangesOrOptions
:
Range
[]
|
vscode
.
DecorationOptions
[]):
void
{
// (1) find out if this decoration is important for us
let
usesCommandLink
=
false
;
outer
:
for
(
const
rangeOrOption
of
rangesOrOptions
)
{
if
(
Range
.
isRange
(
rangeOrOption
))
{
break
;
}
if
(
typeof
rangeOrOption
.
hoverMessage
===
'
string
'
&&
containsCommandLink
(
rangeOrOption
.
hoverMessage
))
{
usesCommandLink
=
true
;
break
;
}
else
if
(
Array
.
isArray
(
rangeOrOption
.
hoverMessage
))
{
for
(
const
message
of
rangeOrOption
.
hoverMessage
)
{
if
(
typeof
message
===
'
string
'
&&
containsCommandLink
(
message
))
{
usesCommandLink
=
true
;
break
outer
;
}
}
}
}
// (2) send event for important decorations
if
(
usesCommandLink
)
{
let
tag
=
new
Error
();
this
.
_extHostExtensions
.
getExtensionPathIndex
().
then
(
index
=>
{
const
oldHandler
=
(
<
any
>
Error
).
prepareStackTrace
;
(
<
any
>
Error
).
prepareStackTrace
=
(
error
:
Error
,
stackTrace
:
V8CallSite
[])
=>
{
for
(
const
call
of
stackTrace
)
{
const
extension
=
index
.
findSubstr
(
call
.
getFileName
());
if
(
extension
)
{
/* __GDPR__
"usesCommandLink" : {
"extension" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
"from": { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
"${include}": [
"${MainThreadData}"
]
}
*/
this
.
_mainThreadTelemetry
.
$publicLog
(
'
usesCommandLink
'
,
{
extension
:
extension
.
id
,
from
:
'
decoration
'
,
});
return
;
}
}
};
// it all happens here...
// tslint:disable-next-line:no-unused-expression
tag
.
stack
;
(
<
any
>
Error
).
prepareStackTrace
=
oldHandler
;
});
}
// (3) do it
super
.
setDecorations
(
decorationType
,
rangesOrOptions
);
}
}
function
warnOnError
(
promise
:
TPromise
<
any
>
):
void
{
promise
.
then
(
null
,
(
err
)
=>
{
console
.
warn
(
err
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录