Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
afaad416
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,发现更多精彩内容 >>
提交
afaad416
编写于
5月 20, 2016
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove IMode.linkSupport and convert to provider
上级
68ea5b4c
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
93 addition
and
54 deletion
+93
-54
src/vs/editor/common/modes.ts
src/vs/editor/common/modes.ts
+5
-18
src/vs/editor/contrib/hover/browser/modesContentHover.ts
src/vs/editor/contrib/hover/browser/modesContentHover.ts
+2
-2
src/vs/editor/contrib/hover/common/hover.ts
src/vs/editor/contrib/hover/common/hover.ts
+2
-2
src/vs/editor/contrib/links/browser/links.ts
src/vs/editor/contrib/links/browser/links.ts
+4
-9
src/vs/editor/contrib/links/common/links.ts
src/vs/editor/contrib/links/common/links.ts
+37
-0
src/vs/languages/handlebars/common/handlebars.ts
src/vs/languages/handlebars/common/handlebars.ts
+6
-0
src/vs/languages/html/common/html.ts
src/vs/languages/html/common/html.ts
+9
-5
src/vs/languages/html/common/htmlWorker.ts
src/vs/languages/html/common/htmlWorker.ts
+3
-3
src/vs/languages/razor/common/razor.ts
src/vs/languages/razor/common/razor.ts
+6
-0
src/vs/workbench/parts/output/common/outputMode.ts
src/vs/workbench/parts/output/common/outputMode.ts
+13
-9
src/vs/workbench/parts/output/common/outputWorker.ts
src/vs/workbench/parts/output/common/outputWorker.ts
+1
-1
src/vs/workbench/test/node/api/extHostLanguageFeatures.test.ts
...s/workbench/test/node/api/extHostLanguageFeatures.test.ts
+5
-5
未找到文件。
src/vs/editor/common/modes.ts
浏览文件 @
afaad416
...
@@ -211,11 +211,6 @@ export interface IMode {
...
@@ -211,11 +211,6 @@ export interface IMode {
*/
*/
emitOutputSupport
?:
IEmitOutputSupport
;
emitOutputSupport
?:
IEmitOutputSupport
;
/**
* Optional adapter to support detecting links.
*/
linkSupport
?:
ILinkSupport
;
/**
/**
* Optional adapter to support configuring this mode.
* Optional adapter to support configuring this mode.
*/
*/
...
@@ -584,26 +579,16 @@ export interface IEmitOutput {
...
@@ -584,26 +579,16 @@ export interface IEmitOutput {
content
:
string
;
content
:
string
;
}
}
/**
* Interface used to detect links.
*/
export
interface
ILink
{
export
interface
ILink
{
range
:
editorCommon
.
IRange
;
range
:
editorCommon
.
IRange
;
/**
* The url of the link.
* The url should be absolute and will not get any special treatment.
*/
url
:
string
;
url
:
string
;
extraInlineClassName
?:
string
;
}
}
export
interface
ILinkSupport
{
export
interface
ILinkSupport
{
computeLinks
(
resource
:
URI
):
TPromis
e
<
ILink
[]
>
;
provideLinks
(
model
:
editorCommon
.
IReadOnlyModel
,
token
:
CancellationToken
):
ILink
[]
|
Thenabl
e
<
ILink
[]
>
;
}
}
/**
/**
* Interface used to define a configurable editor mode.
* Interface used to define a configurable editor mode.
*/
*/
...
@@ -781,3 +766,5 @@ export const DocumentFormattingEditProviderRegistry = new LanguageFeatureRegistr
...
@@ -781,3 +766,5 @@ export const DocumentFormattingEditProviderRegistry = new LanguageFeatureRegistr
export
const
DocumentRangeFormattingEditProviderRegistry
=
new
LanguageFeatureRegistry
<
DocumentRangeFormattingEditProvider
>
();
export
const
DocumentRangeFormattingEditProviderRegistry
=
new
LanguageFeatureRegistry
<
DocumentRangeFormattingEditProvider
>
();
export
const
OnTypeFormattingEditProviderRegistry
=
new
LanguageFeatureRegistry
<
OnTypeFormattingEditProvider
>
();
export
const
OnTypeFormattingEditProviderRegistry
=
new
LanguageFeatureRegistry
<
OnTypeFormattingEditProvider
>
();
export
const
LinksProviderRegistry
=
new
LanguageFeatureRegistry
<
ILinkSupport
>
();
src/vs/editor/contrib/hover/browser/modesContentHover.ts
浏览文件 @
afaad416
...
@@ -16,7 +16,7 @@ import {IEditorRange, IRange} from 'vs/editor/common/editorCommon';
...
@@ -16,7 +16,7 @@ import {IEditorRange, IRange} from 'vs/editor/common/editorCommon';
import
{
HoverProviderRegistry
,
Hover
,
IMode
}
from
'
vs/editor/common/modes
'
;
import
{
HoverProviderRegistry
,
Hover
,
IMode
}
from
'
vs/editor/common/modes
'
;
import
{
tokenizeToString
}
from
'
vs/editor/common/modes/textToHtmlTokenizer
'
;
import
{
tokenizeToString
}
from
'
vs/editor/common/modes/textToHtmlTokenizer
'
;
import
{
ICodeEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
ICodeEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
provide
Hover
}
from
'
../common/hover
'
;
import
{
get
Hover
}
from
'
../common/hover
'
;
import
{
HoverOperation
,
IHoverComputer
}
from
'
./hoverOperation
'
;
import
{
HoverOperation
,
IHoverComputer
}
from
'
./hoverOperation
'
;
import
{
ContentHoverWidget
}
from
'
./hoverWidgets
'
;
import
{
ContentHoverWidget
}
from
'
./hoverWidgets
'
;
...
@@ -47,7 +47,7 @@ class ModesContentComputer implements IHoverComputer<Hover[]> {
...
@@ -47,7 +47,7 @@ class ModesContentComputer implements IHoverComputer<Hover[]> {
return
TPromise
.
as
(
null
);
return
TPromise
.
as
(
null
);
}
}
return
provide
Hover
(
model
,
new
Position
(
return
get
Hover
(
model
,
new
Position
(
this
.
_range
.
startLineNumber
,
this
.
_range
.
startLineNumber
,
this
.
_range
.
startColumn
this
.
_range
.
startColumn
));
));
...
...
src/vs/editor/contrib/hover/common/hover.ts
浏览文件 @
afaad416
...
@@ -13,7 +13,7 @@ import {CommonEditorRegistry} from 'vs/editor/common/editorCommonExtensions';
...
@@ -13,7 +13,7 @@ import {CommonEditorRegistry} from 'vs/editor/common/editorCommonExtensions';
import
{
Hover
,
HoverProviderRegistry
}
from
'
vs/editor/common/modes
'
;
import
{
Hover
,
HoverProviderRegistry
}
from
'
vs/editor/common/modes
'
;
import
{
asWinJsPromise
}
from
'
vs/base/common/async
'
;
import
{
asWinJsPromise
}
from
'
vs/base/common/async
'
;
export
function
provide
Hover
(
model
:
IReadOnlyModel
,
position
:
IEditorPosition
):
TPromise
<
Hover
[]
>
{
export
function
get
Hover
(
model
:
IReadOnlyModel
,
position
:
IEditorPosition
):
TPromise
<
Hover
[]
>
{
const
supports
=
HoverProviderRegistry
.
ordered
(
model
);
const
supports
=
HoverProviderRegistry
.
ordered
(
model
);
const
values
:
Hover
[]
=
[];
const
values
:
Hover
[]
=
[];
...
@@ -37,4 +37,4 @@ export function provideHover(model: IReadOnlyModel, position: IEditorPosition):
...
@@ -37,4 +37,4 @@ export function provideHover(model: IReadOnlyModel, position: IEditorPosition):
return
TPromise
.
join
(
promises
).
then
(()
=>
coalesce
(
values
));
return
TPromise
.
join
(
promises
).
then
(()
=>
coalesce
(
values
));
}
}
CommonEditorRegistry
.
registerDefaultLanguageCommand
(
'
_executeHoverProvider
'
,
provideHover
);
CommonEditorRegistry
.
registerDefaultLanguageCommand
(
'
_executeHoverProvider
'
,
getHover
);
\ No newline at end of file
\ No newline at end of file
src/vs/editor/contrib/links/browser/links.ts
浏览文件 @
afaad416
...
@@ -22,9 +22,10 @@ import {EditorAction} from 'vs/editor/common/editorAction';
...
@@ -22,9 +22,10 @@ import {EditorAction} from 'vs/editor/common/editorAction';
import
{
Behaviour
}
from
'
vs/editor/common/editorActionEnablement
'
;
import
{
Behaviour
}
from
'
vs/editor/common/editorActionEnablement
'
;
import
*
as
editorCommon
from
'
vs/editor/common/editorCommon
'
;
import
*
as
editorCommon
from
'
vs/editor/common/editorCommon
'
;
import
{
CommonEditorRegistry
,
EditorActionDescriptor
}
from
'
vs/editor/common/editorCommonExtensions
'
;
import
{
CommonEditorRegistry
,
EditorActionDescriptor
}
from
'
vs/editor/common/editorCommonExtensions
'
;
import
{
ILink
}
from
'
vs/editor/common/modes
'
;
import
{
ILink
,
LinksProviderRegistry
}
from
'
vs/editor/common/modes
'
;
import
{
IEditorWorkerService
}
from
'
vs/editor/common/services/editorWorkerService
'
;
import
{
IEditorWorkerService
}
from
'
vs/editor/common/services/editorWorkerService
'
;
import
{
IEditorMouseEvent
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
IEditorMouseEvent
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
getLinks
}
from
'
vs/editor/contrib/links/common/links
'
;
class
LinkOccurence
{
class
LinkOccurence
{
...
@@ -42,9 +43,6 @@ class LinkOccurence {
...
@@ -42,9 +43,6 @@ class LinkOccurence {
private
static
_getOptions
(
link
:
ILink
,
isActive
:
boolean
):
editorCommon
.
IModelDecorationOptions
{
private
static
_getOptions
(
link
:
ILink
,
isActive
:
boolean
):
editorCommon
.
IModelDecorationOptions
{
var
result
=
''
;
var
result
=
''
;
if
(
link
.
extraInlineClassName
)
{
result
=
link
.
extraInlineClassName
+
'
'
;
}
if
(
isActive
)
{
if
(
isActive
)
{
result
+=
LinkDetector
.
CLASS_NAME_ACTIVE
;
result
+=
LinkDetector
.
CLASS_NAME_ACTIVE
;
...
@@ -79,12 +77,10 @@ class LinkOccurence {
...
@@ -79,12 +77,10 @@ class LinkOccurence {
class
Link
{
class
Link
{
range
:
editorCommon
.
IEditorRange
;
range
:
editorCommon
.
IEditorRange
;
url
:
string
;
url
:
string
;
extraInlineClassName
:
string
;
constructor
(
source
:
ILink
)
{
constructor
(
source
:
ILink
)
{
this
.
range
=
new
Range
(
source
.
range
.
startLineNumber
,
source
.
range
.
startColumn
,
source
.
range
.
endLineNumber
,
source
.
range
.
endColumn
);
this
.
range
=
new
Range
(
source
.
range
.
startLineNumber
,
source
.
range
.
startColumn
,
source
.
range
.
endLineNumber
,
source
.
range
.
endColumn
);
this
.
url
=
source
.
url
;
this
.
url
=
source
.
url
;
this
.
extraInlineClassName
=
source
.
extraInlineClassName
||
null
;
}
}
}
}
...
@@ -165,9 +161,8 @@ class LinkDetector {
...
@@ -165,9 +161,8 @@ class LinkDetector {
}
}
let
modePromise
:
TPromise
<
ILink
[]
>
=
TPromise
.
as
(
null
);
let
modePromise
:
TPromise
<
ILink
[]
>
=
TPromise
.
as
(
null
);
let
mode
=
this
.
editor
.
getModel
().
getMode
();
if
(
LinksProviderRegistry
.
has
(
this
.
editor
.
getModel
()))
{
if
(
mode
.
linkSupport
)
{
modePromise
=
getLinks
(
this
.
editor
.
getModel
());
modePromise
=
mode
.
linkSupport
.
computeLinks
(
this
.
editor
.
getModel
().
getAssociatedResource
());
}
}
let
standardPromise
:
TPromise
<
ILink
[]
>
=
this
.
editorWorkerService
.
computeLinks
(
this
.
editor
.
getModel
().
getAssociatedResource
());
let
standardPromise
:
TPromise
<
ILink
[]
>
=
this
.
editorWorkerService
.
computeLinks
(
this
.
editor
.
getModel
().
getAssociatedResource
());
...
...
src/vs/editor/contrib/links/common/links.ts
0 → 100644
浏览文件 @
afaad416
/*---------------------------------------------------------------------------------------------
* 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
{
onUnexpectedError
}
from
'
vs/base/common/errors
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
IReadOnlyModel
}
from
'
vs/editor/common/editorCommon
'
;
import
{
ILink
,
LinksProviderRegistry
}
from
'
vs/editor/common/modes
'
;
import
{
asWinJsPromise
}
from
'
vs/base/common/async
'
;
export
function
getLinks
(
model
:
IReadOnlyModel
):
TPromise
<
ILink
[]
>
{
const
promises
=
LinksProviderRegistry
.
ordered
(
model
).
map
((
support
)
=>
{
return
asWinJsPromise
((
token
)
=>
{
return
support
.
provideLinks
(
model
,
token
);
}).
then
((
result
)
=>
{
if
(
Array
.
isArray
(
result
))
{
return
<
ILink
[]
>
result
;
}
},
err
=>
{
onUnexpectedError
(
err
);
});
});
return
TPromise
.
join
(
promises
).
then
(
manyLinks
=>
{
let
result
:
ILink
[]
=
[];
for
(
let
links
of
manyLinks
)
{
if
(
links
)
{
result
=
result
.
concat
(
links
);
}
}
return
result
;
});
}
src/vs/languages/handlebars/common/handlebars.ts
浏览文件 @
afaad416
...
@@ -142,6 +142,12 @@ export class HandlebarsMode extends htmlMode.HTMLMode<htmlWorker.HTMLWorker> {
...
@@ -142,6 +142,12 @@ export class HandlebarsMode extends htmlMode.HTMLMode<htmlWorker.HTMLWorker> {
return
wireCancellationToken
(
token
,
this
.
_provideDocumentHighlights
(
model
.
getAssociatedResource
(),
position
));
return
wireCancellationToken
(
token
,
this
.
_provideDocumentHighlights
(
model
.
getAssociatedResource
(),
position
));
}
}
});
});
modes
.
LinksProviderRegistry
.
register
(
this
.
getId
(),
{
provideLinks
:
(
model
,
token
):
Thenable
<
modes
.
ILink
[]
>
=>
{
return
wireCancellationToken
(
token
,
this
.
_provideLinks
(
model
.
getAssociatedResource
()));
}
});
}
}
protected
_createRichEditSupport
():
modes
.
IRichEditSupport
{
protected
_createRichEditSupport
():
modes
.
IRichEditSupport
{
...
...
src/vs/languages/html/common/html.ts
浏览文件 @
afaad416
...
@@ -287,7 +287,6 @@ export class HTMLMode<W extends htmlWorker.HTMLWorker> extends AbstractMode impl
...
@@ -287,7 +287,6 @@ export class HTMLMode<W extends htmlWorker.HTMLWorker> extends AbstractMode impl
public
tokenizationSupport
:
modes
.
ITokenizationSupport
;
public
tokenizationSupport
:
modes
.
ITokenizationSupport
;
public
richEditSupport
:
modes
.
IRichEditSupport
;
public
richEditSupport
:
modes
.
IRichEditSupport
;
public
linkSupport
:
modes
.
ILinkSupport
;
public
configSupport
:
modes
.
IConfigurationSupport
;
public
configSupport
:
modes
.
IConfigurationSupport
;
private
modeService
:
IModeService
;
private
modeService
:
IModeService
;
...
@@ -307,7 +306,6 @@ export class HTMLMode<W extends htmlWorker.HTMLWorker> extends AbstractMode impl
...
@@ -307,7 +306,6 @@ export class HTMLMode<W extends htmlWorker.HTMLWorker> extends AbstractMode impl
this
.
threadService
=
threadService
;
this
.
threadService
=
threadService
;
this
.
tokenizationSupport
=
new
TokenizationSupport
(
this
,
this
,
true
,
true
);
this
.
tokenizationSupport
=
new
TokenizationSupport
(
this
,
this
,
true
,
true
);
this
.
linkSupport
=
this
;
this
.
configSupport
=
this
;
this
.
configSupport
=
this
;
this
.
richEditSupport
=
this
.
_createRichEditSupport
();
this
.
richEditSupport
=
this
.
_createRichEditSupport
();
...
@@ -358,6 +356,12 @@ export class HTMLMode<W extends htmlWorker.HTMLWorker> extends AbstractMode impl
...
@@ -358,6 +356,12 @@ export class HTMLMode<W extends htmlWorker.HTMLWorker> extends AbstractMode impl
return
wireCancellationToken
(
token
,
this
.
_provideDocumentRangeFormattingEdits
(
model
.
getAssociatedResource
(),
range
,
options
));
return
wireCancellationToken
(
token
,
this
.
_provideDocumentRangeFormattingEdits
(
model
.
getAssociatedResource
(),
range
,
options
));
}
}
});
});
modes
.
LinksProviderRegistry
.
register
(
this
.
getId
(),
{
provideLinks
:
(
model
,
token
):
Thenable
<
modes
.
ILink
[]
>
=>
{
return
wireCancellationToken
(
token
,
this
.
_provideLinks
(
model
.
getAssociatedResource
()));
}
});
}
}
protected
_createModeWorkerManager
(
descriptor
:
modes
.
IModeDescriptor
,
instantiationService
:
IInstantiationService
):
ModeWorkerManager
<
W
>
{
protected
_createModeWorkerManager
(
descriptor
:
modes
.
IModeDescriptor
,
instantiationService
:
IInstantiationService
):
ModeWorkerManager
<
W
>
{
...
@@ -484,9 +488,9 @@ export class HTMLMode<W extends htmlWorker.HTMLWorker> extends AbstractMode impl
...
@@ -484,9 +488,9 @@ export class HTMLMode<W extends htmlWorker.HTMLWorker> extends AbstractMode impl
return
this
.
_worker
((
w
)
=>
w
.
_doConfigure
(
options
));
return
this
.
_worker
((
w
)
=>
w
.
_doConfigure
(
options
));
}
}
static
$
computeLinks
=
OneWorkerAttr
(
HTMLMode
,
HTMLMode
.
prototype
.
comput
eLinks
);
static
$
_provideLinks
=
OneWorkerAttr
(
HTMLMode
,
HTMLMode
.
prototype
.
_provid
eLinks
);
p
ublic
comput
eLinks
(
resource
:
URI
):
winjs
.
TPromise
<
modes
.
ILink
[]
>
{
p
rotected
_provid
eLinks
(
resource
:
URI
):
winjs
.
TPromise
<
modes
.
ILink
[]
>
{
return
this
.
_worker
((
w
)
=>
w
.
comput
eLinks
(
resource
));
return
this
.
_worker
((
w
)
=>
w
.
provid
eLinks
(
resource
));
}
}
static
$_provideDocumentRangeFormattingEdits
=
OneWorkerAttr
(
HTMLMode
,
HTMLMode
.
prototype
.
_provideDocumentRangeFormattingEdits
);
static
$_provideDocumentRangeFormattingEdits
=
OneWorkerAttr
(
HTMLMode
,
HTMLMode
.
prototype
.
_provideDocumentRangeFormattingEdits
);
...
...
src/vs/languages/html/common/htmlWorker.ts
浏览文件 @
afaad416
...
@@ -21,7 +21,7 @@ import {isTag, DELIM_END, DELIM_START, DELIM_ASSIGN, ATTRIB_NAME, ATTRIB_VALUE}
...
@@ -21,7 +21,7 @@ import {isTag, DELIM_END, DELIM_START, DELIM_ASSIGN, ATTRIB_NAME, ATTRIB_VALUE}
import
{
isEmptyElement
}
from
'
vs/languages/html/common/htmlEmptyTagsShared
'
;
import
{
isEmptyElement
}
from
'
vs/languages/html/common/htmlEmptyTagsShared
'
;
import
{
filterSuggestions
}
from
'
vs/editor/common/modes/supports/suggestSupport
'
;
import
{
filterSuggestions
}
from
'
vs/editor/common/modes/supports/suggestSupport
'
;
import
paths
=
require
(
'
vs/base/common/paths
'
);
import
paths
=
require
(
'
vs/base/common/paths
'
);
import
{
provide
Hover
}
from
'
vs/editor/contrib/hover/common/hover
'
;
import
{
get
Hover
}
from
'
vs/editor/contrib/hover/common/hover
'
;
import
{
provideReferences
}
from
'
vs/editor/contrib/referenceSearch/common/referenceSearch
'
;
import
{
provideReferences
}
from
'
vs/editor/contrib/referenceSearch/common/referenceSearch
'
;
import
{
provideCompletionItems
}
from
'
vs/editor/contrib/suggest/common/suggest
'
;
import
{
provideCompletionItems
}
from
'
vs/editor/contrib/suggest/common/suggest
'
;
...
@@ -150,7 +150,7 @@ export class HTMLWorker {
...
@@ -150,7 +150,7 @@ export class HTMLWorker {
public
provideHover
(
resource
:
URI
,
position
:
editorCommon
.
IPosition
):
winjs
.
TPromise
<
modes
.
Hover
>
{
public
provideHover
(
resource
:
URI
,
position
:
editorCommon
.
IPosition
):
winjs
.
TPromise
<
modes
.
Hover
>
{
return
this
.
_delegateToModeAtPosition
(
resource
,
position
,
(
isEmbeddedMode
,
model
)
=>
{
return
this
.
_delegateToModeAtPosition
(
resource
,
position
,
(
isEmbeddedMode
,
model
)
=>
{
if
(
isEmbeddedMode
)
{
if
(
isEmbeddedMode
)
{
return
provide
Hover
(
model
,
Position
.
lift
(
position
)).
then
((
r
)
=>
{
return
get
Hover
(
model
,
Position
.
lift
(
position
)).
then
((
r
)
=>
{
return
(
r
.
length
>
0
?
r
[
0
]
:
null
);
return
(
r
.
length
>
0
?
r
[
0
]
:
null
);
});
});
}
}
...
@@ -659,7 +659,7 @@ export class HTMLWorker {
...
@@ -659,7 +659,7 @@ export class HTMLWorker {
return
newLinks
;
return
newLinks
;
}
}
public
comput
eLinks
(
resource
:
URI
):
winjs
.
TPromise
<
modes
.
ILink
[]
>
{
public
provid
eLinks
(
resource
:
URI
):
winjs
.
TPromise
<
modes
.
ILink
[]
>
{
let
model
=
this
.
resourceService
.
get
(
resource
);
let
model
=
this
.
resourceService
.
get
(
resource
);
return
winjs
.
TPromise
.
as
(
this
.
_computeHTMLLinks
(
model
));
return
winjs
.
TPromise
.
as
(
this
.
_computeHTMLLinks
(
model
));
}
}
...
...
src/vs/languages/razor/common/razor.ts
浏览文件 @
afaad416
...
@@ -91,6 +91,12 @@ export class RAZORMode extends htmlMode.HTMLMode<RAZORWorker> {
...
@@ -91,6 +91,12 @@ export class RAZORMode extends htmlMode.HTMLMode<RAZORWorker> {
return
wireCancellationToken
(
token
,
this
.
_provideDocumentHighlights
(
model
.
getAssociatedResource
(),
position
));
return
wireCancellationToken
(
token
,
this
.
_provideDocumentHighlights
(
model
.
getAssociatedResource
(),
position
));
}
}
});
});
modes
.
LinksProviderRegistry
.
register
(
this
.
getId
(),
{
provideLinks
:
(
model
,
token
):
Thenable
<
modes
.
ILink
[]
>
=>
{
return
wireCancellationToken
(
token
,
this
.
_provideLinks
(
model
.
getAssociatedResource
()));
}
});
}
}
protected
_createModeWorkerManager
(
descriptor
:
modes
.
IModeDescriptor
,
instantiationService
:
IInstantiationService
):
ModeWorkerManager
<
RAZORWorker
>
{
protected
_createModeWorkerManager
(
descriptor
:
modes
.
IModeDescriptor
,
instantiationService
:
IInstantiationService
):
ModeWorkerManager
<
RAZORWorker
>
{
...
...
src/vs/workbench/parts/output/common/outputMode.ts
浏览文件 @
afaad416
...
@@ -14,12 +14,13 @@ import {OutputWorker} from 'vs/workbench/parts/output/common/outputWorker';
...
@@ -14,12 +14,13 @@ import {OutputWorker} from 'vs/workbench/parts/output/common/outputWorker';
import
winjs
=
require
(
'
vs/base/common/winjs.base
'
);
import
winjs
=
require
(
'
vs/base/common/winjs.base
'
);
import
{
OneWorkerAttr
}
from
'
vs/platform/thread/common/threadService
'
;
import
{
OneWorkerAttr
}
from
'
vs/platform/thread/common/threadService
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
Modes
=
require
(
'
vs/editor/common/modes
'
)
;
import
*
as
modes
from
'
vs/editor/common/modes
'
;
import
{
IEditorWorkerService
}
from
'
vs/editor/common/services/editorWorkerService
'
;
import
{
IEditorWorkerService
}
from
'
vs/editor/common/services/editorWorkerService
'
;
import
{
AbstractMode
,
ModeWorkerManager
}
from
'
vs/editor/common/modes/abstractMode
'
;
import
{
AbstractMode
,
ModeWorkerManager
}
from
'
vs/editor/common/modes/abstractMode
'
;
import
{
createRichEditSupport
}
from
'
vs/editor/common/modes/monarch/monarchDefinition
'
;
import
{
createRichEditSupport
}
from
'
vs/editor/common/modes/monarch/monarchDefinition
'
;
import
{
createTokenizationSupport
}
from
'
vs/editor/common/modes/monarch/monarchLexer
'
;
import
{
createTokenizationSupport
}
from
'
vs/editor/common/modes/monarch/monarchLexer
'
;
import
{
RichEditSupport
}
from
'
vs/editor/common/modes/supports/richEditSupport
'
;
import
{
RichEditSupport
}
from
'
vs/editor/common/modes/supports/richEditSupport
'
;
import
{
wireCancellationToken
}
from
'
vs/base/common/async
'
;
export
const
language
:
types
.
ILanguage
=
{
export
const
language
:
types
.
ILanguage
=
{
displayName
:
'
Log
'
,
displayName
:
'
Log
'
,
...
@@ -47,9 +48,8 @@ export const language: types.ILanguage = {
...
@@ -47,9 +48,8 @@ export const language: types.ILanguage = {
export
class
OutputMode
extends
AbstractMode
{
export
class
OutputMode
extends
AbstractMode
{
public
linkSupport
:
Modes
.
ILinkSupport
;
public
tokenizationSupport
:
modes
.
ITokenizationSupport
;
public
tokenizationSupport
:
Modes
.
ITokenizationSupport
;
public
richEditSupport
:
modes
.
IRichEditSupport
;
public
richEditSupport
:
Modes
.
IRichEditSupport
;
private
_modeWorkerManager
:
ModeWorkerManager
<
OutputWorker
>
;
private
_modeWorkerManager
:
ModeWorkerManager
<
OutputWorker
>
;
...
@@ -64,19 +64,23 @@ export class OutputMode extends AbstractMode {
...
@@ -64,19 +64,23 @@ export class OutputMode extends AbstractMode {
let
lexer
=
compile
(
language
);
let
lexer
=
compile
(
language
);
this
.
_modeWorkerManager
=
new
ModeWorkerManager
<
OutputWorker
>
(
descriptor
,
'
vs/workbench/parts/output/common/outputWorker
'
,
'
OutputWorker
'
,
null
,
instantiationService
);
this
.
_modeWorkerManager
=
new
ModeWorkerManager
<
OutputWorker
>
(
descriptor
,
'
vs/workbench/parts/output/common/outputWorker
'
,
'
OutputWorker
'
,
null
,
instantiationService
);
this
.
linkSupport
=
this
;
this
.
tokenizationSupport
=
createTokenizationSupport
(
modeService
,
this
,
lexer
);
this
.
tokenizationSupport
=
createTokenizationSupport
(
modeService
,
this
,
lexer
);
this
.
richEditSupport
=
new
RichEditSupport
(
this
.
getId
(),
null
,
createRichEditSupport
(
lexer
));
this
.
richEditSupport
=
new
RichEditSupport
(
this
.
getId
(),
null
,
createRichEditSupport
(
lexer
));
modes
.
LinksProviderRegistry
.
register
(
this
.
getId
(),
{
provideLinks
:
(
model
,
token
):
Thenable
<
modes
.
ILink
[]
>
=>
{
return
wireCancellationToken
(
token
,
this
.
_provideLinks
(
model
.
getAssociatedResource
()));
}
});
}
}
private
_worker
<
T
>
(
runner
:(
worker
:
OutputWorker
)
=>
winjs
.
TPromise
<
T
>
):
winjs
.
TPromise
<
T
>
{
private
_worker
<
T
>
(
runner
:(
worker
:
OutputWorker
)
=>
winjs
.
TPromise
<
T
>
):
winjs
.
TPromise
<
T
>
{
return
this
.
_modeWorkerManager
.
worker
(
runner
);
return
this
.
_modeWorkerManager
.
worker
(
runner
);
}
}
static
$
computeLinks
=
OneWorkerAttr
(
OutputMode
,
OutputMode
.
prototype
.
comput
eLinks
);
static
$
_provideLinks
=
OneWorkerAttr
(
OutputMode
,
OutputMode
.
prototype
.
_provid
eLinks
);
p
ublic
computeLinks
(
resource
:
URI
):
winjs
.
TPromise
<
M
odes
.
ILink
[]
>
{
p
rivate
_provideLinks
(
resource
:
URI
):
winjs
.
TPromise
<
m
odes
.
ILink
[]
>
{
return
this
.
_worker
((
w
)
=>
w
.
comput
eLinks
(
resource
));
return
this
.
_worker
((
w
)
=>
w
.
provid
eLinks
(
resource
));
}
}
}
}
src/vs/workbench/parts/output/common/outputWorker.ts
浏览文件 @
afaad416
...
@@ -44,7 +44,7 @@ export class OutputWorker {
...
@@ -44,7 +44,7 @@ export class OutputWorker {
return
this
.
_contextService
;
return
this
.
_contextService
;
}
}
public
comput
eLinks
(
resource
:
URI
):
TPromise
<
ILink
[]
>
{
public
provid
eLinks
(
resource
:
URI
):
TPromise
<
ILink
[]
>
{
let
links
:
ILink
[]
=
[];
let
links
:
ILink
[]
=
[];
if
(
!
this
.
patterns
.
length
)
{
if
(
!
this
.
patterns
.
length
)
{
return
TPromise
.
as
(
links
);
return
TPromise
.
as
(
links
);
...
...
src/vs/workbench/test/node/api/extHostLanguageFeatures.test.ts
浏览文件 @
afaad416
...
@@ -26,7 +26,7 @@ import {getDocumentSymbols} from 'vs/editor/contrib/quickOpen/common/quickOpen';
...
@@ -26,7 +26,7 @@ import {getDocumentSymbols} from 'vs/editor/contrib/quickOpen/common/quickOpen';
import
{
DocumentSymbolProviderRegistry
,
DocumentHighlightKind
}
from
'
vs/editor/common/modes
'
;
import
{
DocumentSymbolProviderRegistry
,
DocumentHighlightKind
}
from
'
vs/editor/common/modes
'
;
import
{
getCodeLensData
}
from
'
vs/editor/contrib/codelens/common/codelens
'
;
import
{
getCodeLensData
}
from
'
vs/editor/contrib/codelens/common/codelens
'
;
import
{
getDeclarationsAtPosition
}
from
'
vs/editor/contrib/goToDeclaration/common/goToDeclaration
'
;
import
{
getDeclarationsAtPosition
}
from
'
vs/editor/contrib/goToDeclaration/common/goToDeclaration
'
;
import
{
provide
Hover
}
from
'
vs/editor/contrib/hover/common/hover
'
;
import
{
get
Hover
}
from
'
vs/editor/contrib/hover/common/hover
'
;
import
{
getOccurrencesAtPosition
}
from
'
vs/editor/contrib/wordHighlighter/common/wordHighlighter
'
;
import
{
getOccurrencesAtPosition
}
from
'
vs/editor/contrib/wordHighlighter/common/wordHighlighter
'
;
import
{
provideReferences
}
from
'
vs/editor/contrib/referenceSearch/common/referenceSearch
'
;
import
{
provideReferences
}
from
'
vs/editor/contrib/referenceSearch/common/referenceSearch
'
;
import
{
getCodeActions
}
from
'
vs/editor/contrib/quickFix/common/quickFix
'
;
import
{
getCodeActions
}
from
'
vs/editor/contrib/quickFix/common/quickFix
'
;
...
@@ -337,7 +337,7 @@ suite('ExtHostLanguageFeatures', function() {
...
@@ -337,7 +337,7 @@ suite('ExtHostLanguageFeatures', function() {
}));
}));
return
threadService
.
sync
().
then
(()
=>
{
return
threadService
.
sync
().
then
(()
=>
{
provide
Hover
(
model
,
new
EditorPosition
(
1
,
1
)).
then
(
value
=>
{
get
Hover
(
model
,
new
EditorPosition
(
1
,
1
)).
then
(
value
=>
{
assert
.
equal
(
value
.
length
,
1
);
assert
.
equal
(
value
.
length
,
1
);
let
[
entry
]
=
value
;
let
[
entry
]
=
value
;
assert
.
deepEqual
(
entry
.
range
,
{
startLineNumber
:
1
,
startColumn
:
1
,
endLineNumber
:
1
,
endColumn
:
5
});
assert
.
deepEqual
(
entry
.
range
,
{
startLineNumber
:
1
,
startColumn
:
1
,
endLineNumber
:
1
,
endColumn
:
5
});
...
@@ -356,7 +356,7 @@ suite('ExtHostLanguageFeatures', function() {
...
@@ -356,7 +356,7 @@ suite('ExtHostLanguageFeatures', function() {
return
threadService
.
sync
().
then
(()
=>
{
return
threadService
.
sync
().
then
(()
=>
{
provide
Hover
(
model
,
new
EditorPosition
(
1
,
1
)).
then
(
value
=>
{
get
Hover
(
model
,
new
EditorPosition
(
1
,
1
)).
then
(
value
=>
{
assert
.
equal
(
value
.
length
,
1
);
assert
.
equal
(
value
.
length
,
1
);
let
[
entry
]
=
value
;
let
[
entry
]
=
value
;
assert
.
deepEqual
(
entry
.
range
,
{
startLineNumber
:
4
,
startColumn
:
1
,
endLineNumber
:
9
,
endColumn
:
8
});
assert
.
deepEqual
(
entry
.
range
,
{
startLineNumber
:
4
,
startColumn
:
1
,
endLineNumber
:
9
,
endColumn
:
8
});
...
@@ -380,7 +380,7 @@ suite('ExtHostLanguageFeatures', function() {
...
@@ -380,7 +380,7 @@ suite('ExtHostLanguageFeatures', function() {
}));
}));
return
threadService
.
sync
().
then
(()
=>
{
return
threadService
.
sync
().
then
(()
=>
{
return
provide
Hover
(
model
,
new
EditorPosition
(
1
,
1
)).
then
(
value
=>
{
return
get
Hover
(
model
,
new
EditorPosition
(
1
,
1
)).
then
(
value
=>
{
assert
.
equal
(
value
.
length
,
2
);
assert
.
equal
(
value
.
length
,
2
);
let
[
first
,
second
]
=
value
;
let
[
first
,
second
]
=
value
;
assert
.
equal
(
first
.
htmlContent
[
0
].
markdown
,
'
registered second
'
);
assert
.
equal
(
first
.
htmlContent
[
0
].
markdown
,
'
registered second
'
);
...
@@ -405,7 +405,7 @@ suite('ExtHostLanguageFeatures', function() {
...
@@ -405,7 +405,7 @@ suite('ExtHostLanguageFeatures', function() {
return
threadService
.
sync
().
then
(()
=>
{
return
threadService
.
sync
().
then
(()
=>
{
provide
Hover
(
model
,
new
EditorPosition
(
1
,
1
)).
then
(
value
=>
{
get
Hover
(
model
,
new
EditorPosition
(
1
,
1
)).
then
(
value
=>
{
assert
.
equal
(
value
.
length
,
1
);
assert
.
equal
(
value
.
length
,
1
);
});
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录