Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
14ce5183
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,发现更多精彩内容 >>
提交
14ce5183
编写于
1月 11, 2019
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
renames, #58649
上级
ae5078f4
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
98 addition
and
78 deletion
+98
-78
src/vs/editor/common/modes.ts
src/vs/editor/common/modes.ts
+25
-13
src/vs/editor/contrib/goToDefinition/goToDefinition.ts
src/vs/editor/contrib/goToDefinition/goToDefinition.ts
+8
-8
src/vs/editor/contrib/goToDefinition/goToDefinitionCommands.ts
...s/editor/contrib/goToDefinition/goToDefinitionCommands.ts
+6
-6
src/vs/editor/contrib/goToDefinition/goToDefinitionMouse.ts
src/vs/editor/contrib/goToDefinition/goToDefinitionMouse.ts
+5
-5
src/vs/monaco.d.ts
src/vs/monaco.d.ts
+22
-14
src/vs/workbench/api/electron-browser/mainThreadLanguageFeatures.ts
...kbench/api/electron-browser/mainThreadLanguageFeatures.ts
+14
-14
src/vs/workbench/api/node/extHost.protocol.ts
src/vs/workbench/api/node/extHost.protocol.ts
+2
-2
src/vs/workbench/api/node/extHostLanguageFeatures.ts
src/vs/workbench/api/node/extHostLanguageFeatures.ts
+13
-13
src/vs/workbench/api/node/extHostTypeConverters.ts
src/vs/workbench/api/node/extHostTypeConverters.ts
+3
-3
未找到文件。
src/vs/editor/common/modes.ts
浏览文件 @
14ce5183
...
...
@@ -715,20 +715,32 @@ export interface Location {
*/
range
:
IRange
;
}
/**
* The definition of a symbol represented as one or many [locations](#Location).
* For most programming languages there is only one location at which a symbol is
* defined.
*/
export
type
Definition
=
Location
|
Location
[];
export
interface
DefinitionLink
{
origin
?:
IRange
;
export
interface
LocationLink
{
/**
* A range to select where this link originates from.
*/
originSelectionRange
?:
IRange
;
/**
* The target uri this link points to.
*/
uri
:
URI
;
/**
* The full range this link points to.
*/
range
:
IRange
;
selectionRange
?:
IRange
;
/**
* A range to select this link points to. Must be contained
* in `LocationLink.range`.
*/
targetSelectionRange
?:
IRange
;
}
export
type
Definition
=
Location
|
Location
[]
|
LocationLink
[];
/**
* The definition provider interface defines the contract between extensions and
* the [go to definition](https://code.visualstudio.com/docs/editor/editingevolved#_go-to-definition)
...
...
@@ -738,7 +750,7 @@ export interface DefinitionProvider {
/**
* Provide the definition of the symbol at the given position and document.
*/
provideDefinition
(
model
:
model
.
ITextModel
,
position
:
Position
,
token
:
CancellationToken
):
ProviderResult
<
Definition
|
Defini
tionLink
[]
>
;
provideDefinition
(
model
:
model
.
ITextModel
,
position
:
Position
,
token
:
CancellationToken
):
ProviderResult
<
Definition
|
Loca
tionLink
[]
>
;
}
/**
...
...
@@ -750,7 +762,7 @@ export interface DeclarationProvider {
/**
* Provide the declaration of the symbol at the given position and document.
*/
provideDeclaration
(
model
:
model
.
ITextModel
,
position
:
Position
,
token
:
CancellationToken
):
ProviderResult
<
Definition
|
Defini
tionLink
[]
>
;
provideDeclaration
(
model
:
model
.
ITextModel
,
position
:
Position
,
token
:
CancellationToken
):
ProviderResult
<
Definition
|
Loca
tionLink
[]
>
;
}
/**
...
...
@@ -761,7 +773,7 @@ export interface ImplementationProvider {
/**
* Provide the implementation of the symbol at the given position and document.
*/
provideImplementation
(
model
:
model
.
ITextModel
,
position
:
Position
,
token
:
CancellationToken
):
ProviderResult
<
Definition
|
Defini
tionLink
[]
>
;
provideImplementation
(
model
:
model
.
ITextModel
,
position
:
Position
,
token
:
CancellationToken
):
ProviderResult
<
Definition
|
Loca
tionLink
[]
>
;
}
/**
...
...
@@ -772,7 +784,7 @@ export interface TypeDefinitionProvider {
/**
* Provide the type definition of the symbol at the given position and document.
*/
provideTypeDefinition
(
model
:
model
.
ITextModel
,
position
:
Position
,
token
:
CancellationToken
):
ProviderResult
<
Definition
|
Defini
tionLink
[]
>
;
provideTypeDefinition
(
model
:
model
.
ITextModel
,
position
:
Position
,
token
:
CancellationToken
):
ProviderResult
<
Definition
|
Loca
tionLink
[]
>
;
}
/**
...
...
src/vs/editor/contrib/goToDefinition/goToDefinition.ts
浏览文件 @
14ce5183
...
...
@@ -9,7 +9,7 @@ import { onUnexpectedExternalError } from 'vs/base/common/errors';
import
{
registerDefaultLanguageCommand
}
from
'
vs/editor/browser/editorExtensions
'
;
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
import
{
ITextModel
}
from
'
vs/editor/common/model
'
;
import
{
Defini
tionLink
,
DefinitionProviderRegistry
,
ImplementationProviderRegistry
,
TypeDefinitionProviderRegistry
,
DeclarationProviderRegistry
,
ProviderResult
}
from
'
vs/editor/common/modes
'
;
import
{
Loca
tionLink
,
DefinitionProviderRegistry
,
ImplementationProviderRegistry
,
TypeDefinitionProviderRegistry
,
DeclarationProviderRegistry
,
ProviderResult
}
from
'
vs/editor/common/modes
'
;
import
{
LanguageFeatureRegistry
}
from
'
vs/editor/common/modes/languageFeatureRegistry
'
;
...
...
@@ -17,12 +17,12 @@ function getDefinitions<T>(
model
:
ITextModel
,
position
:
Position
,
registry
:
LanguageFeatureRegistry
<
T
>
,
provide
:
(
provider
:
T
,
model
:
ITextModel
,
position
:
Position
)
=>
ProviderResult
<
DefinitionLink
|
Defini
tionLink
[]
>
):
Promise
<
Defini
tionLink
[]
>
{
provide
:
(
provider
:
T
,
model
:
ITextModel
,
position
:
Position
)
=>
ProviderResult
<
LocationLink
|
Loca
tionLink
[]
>
):
Promise
<
Loca
tionLink
[]
>
{
const
provider
=
registry
.
ordered
(
model
);
// get results
const
promises
=
provider
.
map
((
provider
):
Promise
<
DefinitionLink
|
Defini
tionLink
[]
|
null
|
undefined
>
=>
{
const
promises
=
provider
.
map
((
provider
):
Promise
<
LocationLink
|
Loca
tionLink
[]
|
null
|
undefined
>
=>
{
return
Promise
.
resolve
(
provide
(
provider
,
model
,
position
)).
then
(
undefined
,
err
=>
{
onUnexpectedExternalError
(
err
);
return
null
;
...
...
@@ -34,25 +34,25 @@ function getDefinitions<T>(
}
export
function
getDefinitionsAtPosition
(
model
:
ITextModel
,
position
:
Position
,
token
:
CancellationToken
):
Promise
<
Defini
tionLink
[]
>
{
export
function
getDefinitionsAtPosition
(
model
:
ITextModel
,
position
:
Position
,
token
:
CancellationToken
):
Promise
<
Loca
tionLink
[]
>
{
return
getDefinitions
(
model
,
position
,
DefinitionProviderRegistry
,
(
provider
,
model
,
position
)
=>
{
return
provider
.
provideDefinition
(
model
,
position
,
token
);
});
}
export
function
getDeclarationsAtPosition
(
model
:
ITextModel
,
position
:
Position
,
token
:
CancellationToken
):
Promise
<
Defini
tionLink
[]
>
{
export
function
getDeclarationsAtPosition
(
model
:
ITextModel
,
position
:
Position
,
token
:
CancellationToken
):
Promise
<
Loca
tionLink
[]
>
{
return
getDefinitions
(
model
,
position
,
DeclarationProviderRegistry
,
(
provider
,
model
,
position
)
=>
{
return
provider
.
provideDeclaration
(
model
,
position
,
token
);
});
}
export
function
getImplementationsAtPosition
(
model
:
ITextModel
,
position
:
Position
,
token
:
CancellationToken
):
Promise
<
Defini
tionLink
[]
>
{
export
function
getImplementationsAtPosition
(
model
:
ITextModel
,
position
:
Position
,
token
:
CancellationToken
):
Promise
<
Loca
tionLink
[]
>
{
return
getDefinitions
(
model
,
position
,
ImplementationProviderRegistry
,
(
provider
,
model
,
position
)
=>
{
return
provider
.
provideImplementation
(
model
,
position
,
token
);
});
}
export
function
getTypeDefinitionsAtPosition
(
model
:
ITextModel
,
position
:
Position
,
token
:
CancellationToken
):
Promise
<
Defini
tionLink
[]
>
{
export
function
getTypeDefinitionsAtPosition
(
model
:
ITextModel
,
position
:
Position
,
token
:
CancellationToken
):
Promise
<
Loca
tionLink
[]
>
{
return
getDefinitions
(
model
,
position
,
TypeDefinitionProviderRegistry
,
(
provider
,
model
,
position
)
=>
{
return
provider
.
provideTypeDefinition
(
model
,
position
,
token
);
});
...
...
src/vs/editor/contrib/goToDefinition/goToDefinitionCommands.ts
浏览文件 @
14ce5183
...
...
@@ -15,7 +15,7 @@ import * as corePosition from 'vs/editor/common/core/position';
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
import
{
EditorContextKeys
}
from
'
vs/editor/common/editorContextKeys
'
;
import
{
ITextModel
,
IWordAtPosition
}
from
'
vs/editor/common/model
'
;
import
{
Defini
tionLink
,
Location
}
from
'
vs/editor/common/modes
'
;
import
{
Loca
tionLink
,
Location
}
from
'
vs/editor/common/modes
'
;
import
{
MessageController
}
from
'
vs/editor/contrib/message/messageController
'
;
import
{
PeekContext
}
from
'
vs/editor/contrib/referenceSearch/peekViewWidget
'
;
import
{
ReferencesController
}
from
'
vs/editor/contrib/referenceSearch/referencesController
'
;
...
...
@@ -69,7 +69,7 @@ export class DefinitionAction extends EditorAction {
// * remove falsy references
// * find reference at the current pos
let
idxOfCurrent
=
-
1
;
const
result
:
Defini
tionLink
[]
=
[];
const
result
:
Loca
tionLink
[]
=
[];
for
(
const
reference
of
references
)
{
if
(
!
reference
||
!
reference
.
range
)
{
continue
;
...
...
@@ -113,7 +113,7 @@ export class DefinitionAction extends EditorAction {
return
definitionPromise
;
}
protected
_getTargetLocationForPosition
(
model
:
ITextModel
,
position
:
corePosition
.
Position
,
token
:
CancellationToken
):
Promise
<
Defini
tionLink
[]
>
{
protected
_getTargetLocationForPosition
(
model
:
ITextModel
,
position
:
corePosition
.
Position
,
token
:
CancellationToken
):
Promise
<
Loca
tionLink
[]
>
{
return
getDefinitionsAtPosition
(
model
,
position
,
token
);
}
...
...
@@ -256,7 +256,7 @@ export class PeekDefinitionAction extends DefinitionAction {
export
class
DeclarationAction
extends
DefinitionAction
{
protected
_getTargetLocationForPosition
(
model
:
ITextModel
,
position
:
corePosition
.
Position
,
token
:
CancellationToken
):
Promise
<
Defini
tionLink
[]
>
{
protected
_getTargetLocationForPosition
(
model
:
ITextModel
,
position
:
corePosition
.
Position
,
token
:
CancellationToken
):
Promise
<
Loca
tionLink
[]
>
{
return
getDeclarationsAtPosition
(
model
,
position
,
token
);
}
...
...
@@ -320,7 +320,7 @@ export class PeekDeclarationAction extends DeclarationAction {
}
export
class
ImplementationAction
extends
DefinitionAction
{
protected
_getTargetLocationForPosition
(
model
:
ITextModel
,
position
:
corePosition
.
Position
,
token
:
CancellationToken
):
Promise
<
Defini
tionLink
[]
>
{
protected
_getTargetLocationForPosition
(
model
:
ITextModel
,
position
:
corePosition
.
Position
,
token
:
CancellationToken
):
Promise
<
Loca
tionLink
[]
>
{
return
getImplementationsAtPosition
(
model
,
position
,
token
);
}
...
...
@@ -378,7 +378,7 @@ export class PeekImplementationAction extends ImplementationAction {
}
export
class
TypeDefinitionAction
extends
DefinitionAction
{
protected
_getTargetLocationForPosition
(
model
:
ITextModel
,
position
:
corePosition
.
Position
,
token
:
CancellationToken
):
Promise
<
Defini
tionLink
[]
>
{
protected
_getTargetLocationForPosition
(
model
:
ITextModel
,
position
:
corePosition
.
Position
,
token
:
CancellationToken
):
Promise
<
Loca
tionLink
[]
>
{
return
getTypeDefinitionsAtPosition
(
model
,
position
,
token
);
}
...
...
src/vs/editor/contrib/goToDefinition/goToDefinitionMouse.ts
浏览文件 @
14ce5183
...
...
@@ -12,7 +12,7 @@ import { MarkdownString } from 'vs/base/common/htmlContent';
import
{
IModeService
}
from
'
vs/editor/common/services/modeService
'
;
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
import
*
as
editorCommon
from
'
vs/editor/common/editorCommon
'
;
import
{
DefinitionProviderRegistry
,
Defini
tionLink
}
from
'
vs/editor/common/modes
'
;
import
{
DefinitionProviderRegistry
,
Loca
tionLink
}
from
'
vs/editor/common/modes
'
;
import
{
ICodeEditor
,
IMouseTarget
,
MouseTargetType
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
registerEditorContribution
}
from
'
vs/editor/browser/editorExtensions
'
;
import
{
getDefinitionsAtPosition
}
from
'
./goToDefinition
'
;
...
...
@@ -35,7 +35,7 @@ class GotoDefinitionWithMouseEditorContribution implements editorCommon.IEditorC
private
toUnhook
:
IDisposable
[];
private
decorations
:
string
[];
private
currentWordUnderMouse
:
IWordAtPosition
;
private
previousPromise
:
CancelablePromise
<
Defini
tionLink
[]
>
;
private
previousPromise
:
CancelablePromise
<
Loca
tionLink
[]
>
;
constructor
(
editor
:
ICodeEditor
,
...
...
@@ -152,8 +152,8 @@ class GotoDefinitionWithMouseEditorContribution implements editorCommon.IEditorC
const
previewValue
=
this
.
getPreviewValue
(
textEditorModel
,
startLineNumber
);
let
wordRange
:
Range
;
if
(
result
.
origin
)
{
wordRange
=
Range
.
lift
(
result
.
origin
);
if
(
result
.
origin
SelectionRange
)
{
wordRange
=
Range
.
lift
(
result
.
origin
SelectionRange
);
}
else
{
wordRange
=
new
Range
(
position
.
lineNumber
,
word
.
startColumn
,
position
.
lineNumber
,
word
.
endColumn
);
}
...
...
@@ -281,7 +281,7 @@ class GotoDefinitionWithMouseEditorContribution implements editorCommon.IEditorC
DefinitionProviderRegistry
.
has
(
this
.
editor
.
getModel
());
}
private
findDefinition
(
target
:
IMouseTarget
,
token
:
CancellationToken
):
Promise
<
Defini
tionLink
[]
|
null
>
{
private
findDefinition
(
target
:
IMouseTarget
,
token
:
CancellationToken
):
Promise
<
Loca
tionLink
[]
|
null
>
{
const
model
=
this
.
editor
.
getModel
();
if
(
!
model
)
{
return
Promise
.
resolve
(
null
);
...
...
src/vs/monaco.d.ts
浏览文件 @
14ce5183
...
...
@@ -5018,20 +5018,28 @@ declare namespace monaco.languages {
range
:
IRange
;
}
/**
* The definition of a symbol represented as one or many [locations](#Location).
* For most programming languages there is only one location at which a symbol is
* defined.
*/
export
type
Definition
=
Location
|
Location
[];
export
interface
DefinitionLink
{
origin
?:
IRange
;
export
interface
LocationLink
{
/**
* A range to select where this link originates from.
*/
originSelectionRange
?:
IRange
;
/**
* The target uri this link points to.
*/
uri
:
Uri
;
/**
* The full range this link points to.
*/
range
:
IRange
;
selectionRange
?:
IRange
;
/**
* A range to select this link points to. Must be contained
* in `LocationLink.range`.
*/
targetSelectionRange
?:
IRange
;
}
export
type
Definition
=
Location
|
Location
[]
|
LocationLink
[];
/**
* The definition provider interface defines the contract between extensions and
* the [go to definition](https://code.visualstudio.com/docs/editor/editingevolved#_go-to-definition)
...
...
@@ -5041,7 +5049,7 @@ declare namespace monaco.languages {
/**
* Provide the definition of the symbol at the given position and document.
*/
provideDefinition
(
model
:
editor
.
ITextModel
,
position
:
Position
,
token
:
CancellationToken
):
ProviderResult
<
Definition
|
Defini
tionLink
[]
>
;
provideDefinition
(
model
:
editor
.
ITextModel
,
position
:
Position
,
token
:
CancellationToken
):
ProviderResult
<
Definition
|
Loca
tionLink
[]
>
;
}
/**
...
...
@@ -5053,7 +5061,7 @@ declare namespace monaco.languages {
/**
* Provide the declaration of the symbol at the given position and document.
*/
provideDeclaration
(
model
:
editor
.
ITextModel
,
position
:
Position
,
token
:
CancellationToken
):
ProviderResult
<
Definition
|
Defini
tionLink
[]
>
;
provideDeclaration
(
model
:
editor
.
ITextModel
,
position
:
Position
,
token
:
CancellationToken
):
ProviderResult
<
Definition
|
Loca
tionLink
[]
>
;
}
/**
...
...
@@ -5064,7 +5072,7 @@ declare namespace monaco.languages {
/**
* Provide the implementation of the symbol at the given position and document.
*/
provideImplementation
(
model
:
editor
.
ITextModel
,
position
:
Position
,
token
:
CancellationToken
):
ProviderResult
<
Definition
|
Defini
tionLink
[]
>
;
provideImplementation
(
model
:
editor
.
ITextModel
,
position
:
Position
,
token
:
CancellationToken
):
ProviderResult
<
Definition
|
Loca
tionLink
[]
>
;
}
/**
...
...
@@ -5075,7 +5083,7 @@ declare namespace monaco.languages {
/**
* Provide the type definition of the symbol at the given position and document.
*/
provideTypeDefinition
(
model
:
editor
.
ITextModel
,
position
:
Position
,
token
:
CancellationToken
):
ProviderResult
<
Definition
|
Defini
tionLink
[]
>
;
provideTypeDefinition
(
model
:
editor
.
ITextModel
,
position
:
Position
,
token
:
CancellationToken
):
ProviderResult
<
Definition
|
Loca
tionLink
[]
>
;
}
/**
...
...
src/vs/workbench/api/electron-browser/mainThreadLanguageFeatures.ts
浏览文件 @
14ce5183
...
...
@@ -69,17 +69,17 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
}
}
private
static
_revive
DefinitionLinkDto
(
data
:
DefinitionLinkDto
):
modes
.
Defini
tionLink
;
private
static
_revive
DefinitionLinkDto
(
data
:
DefinitionLinkDto
[]):
modes
.
Defini
tionLink
[];
private
static
_revive
DefinitionLinkDto
(
data
:
DefinitionLinkDto
|
DefinitionLinkDto
[]):
modes
.
DefinitionLink
|
modes
.
Defini
tionLink
[]
{
private
static
_revive
LocationLinkDto
(
data
:
DefinitionLinkDto
):
modes
.
Loca
tionLink
;
private
static
_revive
LocationLinkDto
(
data
:
DefinitionLinkDto
[]):
modes
.
Loca
tionLink
[];
private
static
_revive
LocationLinkDto
(
data
:
DefinitionLinkDto
|
DefinitionLinkDto
[]):
modes
.
LocationLink
|
modes
.
Loca
tionLink
[]
{
if
(
!
data
)
{
return
<
modes
.
Defini
tionLink
>
data
;
return
<
modes
.
Loca
tionLink
>
data
;
}
else
if
(
Array
.
isArray
(
data
))
{
data
.
forEach
(
l
=>
MainThreadLanguageFeatures
.
_revive
Defini
tionLinkDto
(
l
));
return
<
modes
.
Defini
tionLink
[]
>
data
;
data
.
forEach
(
l
=>
MainThreadLanguageFeatures
.
_revive
Loca
tionLinkDto
(
l
));
return
<
modes
.
Loca
tionLink
[]
>
data
;
}
else
{
data
.
uri
=
URI
.
revive
(
data
.
uri
);
return
<
modes
.
Defini
tionLink
>
data
;
return
<
modes
.
Loca
tionLink
>
data
;
}
}
...
...
@@ -150,8 +150,8 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
$registerDefinitionSupport
(
handle
:
number
,
selector
:
ISerializedDocumentFilter
[]):
void
{
this
.
_registrations
[
handle
]
=
modes
.
DefinitionProviderRegistry
.
register
(
typeConverters
.
LanguageSelector
.
from
(
selector
),
<
modes
.
DefinitionProvider
>
{
provideDefinition
:
(
model
,
position
,
token
):
Promise
<
modes
.
Defini
tionLink
[]
>
=>
{
return
this
.
_proxy
.
$provideDefinition
(
handle
,
model
.
uri
,
position
,
token
).
then
(
MainThreadLanguageFeatures
.
_revive
Defini
tionLinkDto
);
provideDefinition
:
(
model
,
position
,
token
):
Promise
<
modes
.
Loca
tionLink
[]
>
=>
{
return
this
.
_proxy
.
$provideDefinition
(
handle
,
model
.
uri
,
position
,
token
).
then
(
MainThreadLanguageFeatures
.
_revive
Loca
tionLinkDto
);
}
});
}
...
...
@@ -159,23 +159,23 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
$registerDeclarationSupport
(
handle
:
number
,
selector
:
ISerializedDocumentFilter
[]):
void
{
this
.
_registrations
[
handle
]
=
modes
.
DeclarationProviderRegistry
.
register
(
typeConverters
.
LanguageSelector
.
from
(
selector
),
<
modes
.
DeclarationProvider
>
{
provideDeclaration
:
(
model
,
position
,
token
)
=>
{
return
this
.
_proxy
.
$provideDeclaration
(
handle
,
model
.
uri
,
position
,
token
).
then
(
MainThreadLanguageFeatures
.
_revive
Defini
tionLinkDto
);
return
this
.
_proxy
.
$provideDeclaration
(
handle
,
model
.
uri
,
position
,
token
).
then
(
MainThreadLanguageFeatures
.
_revive
Loca
tionLinkDto
);
}
});
}
$registerImplementationSupport
(
handle
:
number
,
selector
:
ISerializedDocumentFilter
[]):
void
{
this
.
_registrations
[
handle
]
=
modes
.
ImplementationProviderRegistry
.
register
(
typeConverters
.
LanguageSelector
.
from
(
selector
),
<
modes
.
ImplementationProvider
>
{
provideImplementation
:
(
model
,
position
,
token
):
Promise
<
modes
.
Definition
>
=>
{
return
this
.
_proxy
.
$provideImplementation
(
handle
,
model
.
uri
,
position
,
token
).
then
(
MainThreadLanguageFeatures
.
_revive
Defini
tionLinkDto
);
provideImplementation
:
(
model
,
position
,
token
):
Promise
<
modes
.
LocationLink
[]
>
=>
{
return
this
.
_proxy
.
$provideImplementation
(
handle
,
model
.
uri
,
position
,
token
).
then
(
MainThreadLanguageFeatures
.
_revive
Loca
tionLinkDto
);
}
});
}
$registerTypeDefinitionSupport
(
handle
:
number
,
selector
:
ISerializedDocumentFilter
[]):
void
{
this
.
_registrations
[
handle
]
=
modes
.
TypeDefinitionProviderRegistry
.
register
(
typeConverters
.
LanguageSelector
.
from
(
selector
),
<
modes
.
TypeDefinitionProvider
>
{
provideTypeDefinition
:
(
model
,
position
,
token
):
Promise
<
modes
.
Definition
>
=>
{
return
this
.
_proxy
.
$provideTypeDefinition
(
handle
,
model
.
uri
,
position
,
token
).
then
(
MainThreadLanguageFeatures
.
_revive
Defini
tionLinkDto
);
provideTypeDefinition
:
(
model
,
position
,
token
):
Promise
<
modes
.
LocationLink
[]
>
=>
{
return
this
.
_proxy
.
$provideTypeDefinition
(
handle
,
model
.
uri
,
position
,
token
).
then
(
MainThreadLanguageFeatures
.
_revive
Loca
tionLinkDto
);
}
});
}
...
...
src/vs/workbench/api/node/extHost.protocol.ts
浏览文件 @
14ce5183
...
...
@@ -804,10 +804,10 @@ export interface LocationDto {
}
export
interface
DefinitionLinkDto
{
origin
?:
IRange
;
origin
SelectionRange
?:
IRange
;
uri
:
UriComponents
;
range
:
IRange
;
s
electionRange
?:
IRange
;
targetS
electionRange
?:
IRange
;
}
export
interface
WorkspaceSymbolDto
extends
IdObject
{
...
...
src/vs/workbench/api/node/extHostLanguageFeatures.ts
浏览文件 @
14ce5183
...
...
@@ -143,7 +143,7 @@ class CodeLensAdapter {
}
}
function
convertTo
DefinitionLinks
(
value
:
vscode
.
Definition
):
modes
.
Defini
tionLink
[]
{
function
convertTo
LocationLinks
(
value
:
vscode
.
Definition
):
modes
.
Loca
tionLink
[]
{
if
(
Array
.
isArray
(
value
))
{
return
(
value
as
(
vscode
.
DefinitionLink
|
vscode
.
Location
)[]).
map
(
typeConvert
.
DefinitionLink
.
from
);
}
else
if
(
value
)
{
...
...
@@ -159,10 +159,10 @@ class DefinitionAdapter {
private
readonly
_provider
:
vscode
.
DefinitionProvider
)
{
}
provideDefinition
(
resource
:
URI
,
position
:
IPosition
,
token
:
CancellationToken
):
Promise
<
modes
.
Defini
tionLink
[]
>
{
provideDefinition
(
resource
:
URI
,
position
:
IPosition
,
token
:
CancellationToken
):
Promise
<
modes
.
Loca
tionLink
[]
>
{
let
doc
=
this
.
_documents
.
getDocumentData
(
resource
).
document
;
let
pos
=
typeConvert
.
Position
.
to
(
position
);
return
asPromise
(()
=>
this
.
_provider
.
provideDefinition
(
doc
,
pos
,
token
)).
then
(
convertTo
Defini
tionLinks
);
return
asPromise
(()
=>
this
.
_provider
.
provideDefinition
(
doc
,
pos
,
token
)).
then
(
convertTo
Loca
tionLinks
);
}
}
...
...
@@ -173,10 +173,10 @@ class DeclarationAdapter {
private
readonly
_provider
:
vscode
.
DeclarationProvider
)
{
}
provideDeclaration
(
resource
:
URI
,
position
:
IPosition
,
token
:
CancellationToken
):
Promise
<
modes
.
Defini
tionLink
[]
>
{
provideDeclaration
(
resource
:
URI
,
position
:
IPosition
,
token
:
CancellationToken
):
Promise
<
modes
.
Loca
tionLink
[]
>
{
let
doc
=
this
.
_documents
.
getDocumentData
(
resource
).
document
;
let
pos
=
typeConvert
.
Position
.
to
(
position
);
return
asPromise
(()
=>
this
.
_provider
.
provideDeclaration
(
doc
,
pos
,
token
)).
then
(
convertTo
Defini
tionLinks
);
return
asPromise
(()
=>
this
.
_provider
.
provideDeclaration
(
doc
,
pos
,
token
)).
then
(
convertTo
Loca
tionLinks
);
}
}
...
...
@@ -187,10 +187,10 @@ class ImplementationAdapter {
private
readonly
_provider
:
vscode
.
ImplementationProvider
)
{
}
provideImplementation
(
resource
:
URI
,
position
:
IPosition
,
token
:
CancellationToken
):
Promise
<
modes
.
Defini
tionLink
[]
>
{
provideImplementation
(
resource
:
URI
,
position
:
IPosition
,
token
:
CancellationToken
):
Promise
<
modes
.
Loca
tionLink
[]
>
{
let
doc
=
this
.
_documents
.
getDocumentData
(
resource
).
document
;
let
pos
=
typeConvert
.
Position
.
to
(
position
);
return
asPromise
(()
=>
this
.
_provider
.
provideImplementation
(
doc
,
pos
,
token
)).
then
(
convertTo
Defini
tionLinks
);
return
asPromise
(()
=>
this
.
_provider
.
provideImplementation
(
doc
,
pos
,
token
)).
then
(
convertTo
Loca
tionLinks
);
}
}
...
...
@@ -201,10 +201,10 @@ class TypeDefinitionAdapter {
private
readonly
_provider
:
vscode
.
TypeDefinitionProvider
)
{
}
provideTypeDefinition
(
resource
:
URI
,
position
:
IPosition
,
token
:
CancellationToken
):
Promise
<
modes
.
Defini
tionLink
[]
>
{
provideTypeDefinition
(
resource
:
URI
,
position
:
IPosition
,
token
:
CancellationToken
):
Promise
<
modes
.
Loca
tionLink
[]
>
{
const
doc
=
this
.
_documents
.
getDocumentData
(
resource
).
document
;
const
pos
=
typeConvert
.
Position
.
to
(
position
);
return
asPromise
(()
=>
this
.
_provider
.
provideTypeDefinition
(
doc
,
pos
,
token
)).
then
(
convertTo
Defini
tionLinks
);
return
asPromise
(()
=>
this
.
_provider
.
provideTypeDefinition
(
doc
,
pos
,
token
)).
then
(
convertTo
Loca
tionLinks
);
}
}
...
...
@@ -1060,7 +1060,7 @@ export class ExtHostLanguageFeatures implements ExtHostLanguageFeaturesShape {
return
this
.
_createDisposable
(
handle
);
}
$provideDefinition
(
handle
:
number
,
resource
:
UriComponents
,
position
:
IPosition
,
token
:
CancellationToken
):
Promise
<
modes
.
Defini
tionLink
[]
>
{
$provideDefinition
(
handle
:
number
,
resource
:
UriComponents
,
position
:
IPosition
,
token
:
CancellationToken
):
Promise
<
modes
.
Loca
tionLink
[]
>
{
return
this
.
_withAdapter
(
handle
,
DefinitionAdapter
,
adapter
=>
adapter
.
provideDefinition
(
URI
.
revive
(
resource
),
position
,
token
));
}
...
...
@@ -1070,7 +1070,7 @@ export class ExtHostLanguageFeatures implements ExtHostLanguageFeaturesShape {
return
this
.
_createDisposable
(
handle
);
}
$provideDeclaration
(
handle
:
number
,
resource
:
UriComponents
,
position
:
IPosition
,
token
:
CancellationToken
):
Promise
<
modes
.
Defini
tionLink
[]
>
{
$provideDeclaration
(
handle
:
number
,
resource
:
UriComponents
,
position
:
IPosition
,
token
:
CancellationToken
):
Promise
<
modes
.
Loca
tionLink
[]
>
{
return
this
.
_withAdapter
(
handle
,
DeclarationAdapter
,
adapter
=>
adapter
.
provideDeclaration
(
URI
.
revive
(
resource
),
position
,
token
));
}
...
...
@@ -1080,7 +1080,7 @@ export class ExtHostLanguageFeatures implements ExtHostLanguageFeaturesShape {
return
this
.
_createDisposable
(
handle
);
}
$provideImplementation
(
handle
:
number
,
resource
:
UriComponents
,
position
:
IPosition
,
token
:
CancellationToken
):
Promise
<
modes
.
Defini
tionLink
[]
>
{
$provideImplementation
(
handle
:
number
,
resource
:
UriComponents
,
position
:
IPosition
,
token
:
CancellationToken
):
Promise
<
modes
.
Loca
tionLink
[]
>
{
return
this
.
_withAdapter
(
handle
,
ImplementationAdapter
,
adapter
=>
adapter
.
provideImplementation
(
URI
.
revive
(
resource
),
position
,
token
));
}
...
...
@@ -1090,7 +1090,7 @@ export class ExtHostLanguageFeatures implements ExtHostLanguageFeaturesShape {
return
this
.
_createDisposable
(
handle
);
}
$provideTypeDefinition
(
handle
:
number
,
resource
:
UriComponents
,
position
:
IPosition
,
token
:
CancellationToken
):
Promise
<
modes
.
Defini
tionLink
[]
>
{
$provideTypeDefinition
(
handle
:
number
,
resource
:
UriComponents
,
position
:
IPosition
,
token
:
CancellationToken
):
Promise
<
modes
.
Loca
tionLink
[]
>
{
return
this
.
_withAdapter
(
handle
,
TypeDefinitionAdapter
,
adapter
=>
adapter
.
provideTypeDefinition
(
URI
.
revive
(
resource
),
position
,
token
));
}
...
...
src/vs/workbench/api/node/extHostTypeConverters.ts
浏览文件 @
14ce5183
...
...
@@ -583,16 +583,16 @@ export namespace location {
}
export
namespace
DefinitionLink
{
export
function
from
(
value
:
vscode
.
Location
|
vscode
.
DefinitionLink
):
modes
.
Defini
tionLink
{
export
function
from
(
value
:
vscode
.
Location
|
vscode
.
DefinitionLink
):
modes
.
Loca
tionLink
{
const
definitionLink
=
<
vscode
.
DefinitionLink
>
value
;
const
location
=
<
vscode
.
Location
>
value
;
return
{
origin
:
definitionLink
.
originSelectionRange
origin
SelectionRange
:
definitionLink
.
originSelectionRange
?
Range
.
from
(
definitionLink
.
originSelectionRange
)
:
undefined
,
uri
:
definitionLink
.
targetUri
?
definitionLink
.
targetUri
:
location
.
uri
,
range
:
Range
.
from
(
definitionLink
.
targetRange
?
definitionLink
.
targetRange
:
location
.
range
),
s
electionRange
:
definitionLink
.
targetSelectionRange
targetS
electionRange
:
definitionLink
.
targetSelectionRange
?
Range
.
from
(
definitionLink
.
targetSelectionRange
)
:
undefined
,
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录