Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
dotNET Platform
fsharp
提交
5392322d
F
fsharp
项目概览
dotNET Platform
/
fsharp
11 个月 前同步成功
通知
0
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
fsharp
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
5392322d
编写于
5月 04, 2022
作者:
T
Tomáš Matoušek
提交者:
GitHub
5月 04, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Avoid obsolete navigation APIs (#12721)
上级
d09343ad
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
19 addition
and
20 deletion
+19
-20
vsintegration/src/FSharp.Editor/CodeLens/FSharpCodeLensService.fs
...ation/src/FSharp.Editor/CodeLens/FSharpCodeLensService.fs
+1
-1
vsintegration/src/FSharp.Editor/Navigation/GoToDefinition.fs
vsintegration/src/FSharp.Editor/Navigation/GoToDefinition.fs
+15
-17
vsintegration/src/FSharp.Editor/Navigation/NavigableSymbolsService.fs
...n/src/FSharp.Editor/Navigation/NavigableSymbolsService.fs
+1
-1
vsintegration/src/FSharp.Editor/QuickInfo/Views.fs
vsintegration/src/FSharp.Editor/QuickInfo/Views.fs
+2
-1
未找到文件。
vsintegration/src/FSharp.Editor/CodeLens/FSharpCodeLensService.fs
浏览文件 @
5392322d
...
...
@@ -132,7 +132,7 @@ type internal FSharpCodeLensService
|
:?
NavigableTaggedText
as
nav
when
navigation
.
IsTargetValid
nav
.
Range
->
let
h
=
Documents
.
Hyperlink
(
run
,
ToolTip
=
nav
.
Range
.
FileName
)
h
.
Click
.
Add
(
fun
_
->
navigation
.
NavigateTo
nav
.
Range
)
navigation
.
NavigateTo
(
nav
.
Range
,
CancellationToken
.
None
)
)
h
:>
Documents
.
Inline
|
_
->
run
:>
_
FSharpDependencyObjectExtensions
.
SetTextProperties
(
inl
,
actualProperties
)
...
...
vsintegration/src/FSharp.Editor/Navigation/GoToDefinition.fs
浏览文件 @
5392322d
...
...
@@ -349,17 +349,16 @@ type internal GoToDefinition(metadataAsSource: FSharpMetadataAsSourceService) =
/// Navigate to the positon of the textSpan in the provided document
/// used by quickinfo link navigation when the tooltip contains the correct destination range.
member
_.
TryNavigateToTextSpan
(
document
:
Document
,
textSpan
:
Microsoft
.
CodeAnalysis
.
Text
.
TextSpan
,
statusBar
:
StatusBar
)
=
member
_.
TryNavigateToTextSpan
(
document
:
Document
,
textSpan
:
Microsoft
.
CodeAnalysis
.
Text
.
TextSpan
,
statusBar
:
StatusBar
,
cancellationToken
:
CancellationToken
)
=
let
navigableItem
=
FSharpGoToDefinitionNavigableItem
(
document
,
textSpan
)
let
workspace
=
document
.
Project
.
Solution
.
Workspace
let
navigationService
=
workspace
.
Services
.
GetService
<
IFSharpDocumentNavigationService
>()
let
options
=
workspace
.
Options
.
WithChangedOption
(
FSharpNavigationOptions
.
PreferProvisionalTab
,
true
)
let
navigationSucceeded
=
navigationService
.
TryNavigateToSpan
(
workspace
,
navigableItem
.
Document
.
Id
,
navigableItem
.
SourceSpan
,
options
)
let
navigationSucceeded
=
navigationService
.
TryNavigateToSpan
(
workspace
,
navigableItem
.
Document
.
Id
,
navigableItem
.
SourceSpan
,
cancellationToken
)
if
not
navigationSucceeded
then
statusBar
.
TempMessage
(
SR
.
CannotNavigateUnknown
()
)
member
_.
NavigateToItem
(
navigableItem
:
FSharpNavigableItem
,
statusBar
:
StatusBar
)
=
member
_.
NavigateToItem
(
navigableItem
:
FSharpNavigableItem
,
statusBar
:
StatusBar
,
cancellationToken
:
CancellationToken
)
=
use
__
=
statusBar
.
Animate
()
statusBar
.
Message
(
SR
.
NavigatingTo
()
)
...
...
@@ -368,8 +367,7 @@ type internal GoToDefinition(metadataAsSource: FSharpMetadataAsSourceService) =
let
navigationService
=
workspace
.
Services
.
GetService
<
IFSharpDocumentNavigationService
>()
// Prefer open documents in the preview tab.
let
options
=
workspace
.
Options
.
WithChangedOption
(
FSharpNavigationOptions
.
PreferProvisionalTab
,
true
)
let
result
=
navigationService
.
TryNavigateToSpan
(
workspace
,
navigableItem
.
Document
.
Id
,
navigableItem
.
SourceSpan
,
options
)
let
result
=
navigationService
.
TryNavigateToSpan
(
workspace
,
navigableItem
.
Document
.
Id
,
navigableItem
.
SourceSpan
,
cancellationToken
)
if
result
then
statusBar
.
Clear
()
...
...
@@ -377,17 +375,17 @@ type internal GoToDefinition(metadataAsSource: FSharpMetadataAsSourceService) =
statusBar
.
TempMessage
(
SR
.
CannotNavigateUnknown
()
)
/// Find the declaration location (signature file/.fsi) of the target symbol if possible, fall back to definition
member
this
.
NavigateToSymbolDeclarationAsync
(
targetDocument
:
Document
,
targetSourceText
:
SourceText
,
symbolRange
:
range
,
statusBar
:
StatusBar
)
=
member
this
.
NavigateToSymbolDeclarationAsync
(
targetDocument
:
Document
,
targetSourceText
:
SourceText
,
symbolRange
:
range
,
statusBar
:
StatusBar
,
cancellationToken
:
CancellationToken
)
=
asyncMaybe
{
let
!
item
=
this
.
FindDeclarationOfSymbolAtRange
(
targetDocument
,
symbolRange
,
targetSourceText
)
return
this
.
NavigateToItem
(
item
,
statusBar
)
return
this
.
NavigateToItem
(
item
,
statusBar
,
cancellationToken
)
}
/// Find the definition location (implementation file/.fs) of the target symbol
member
this
.
NavigateToSymbolDefinitionAsync
(
targetDocument
:
Document
,
targetSourceText
:
SourceText
,
symbolRange
:
range
,
statusBar
:
StatusBar
)
=
member
this
.
NavigateToSymbolDefinitionAsync
(
targetDocument
:
Document
,
targetSourceText
:
SourceText
,
symbolRange
:
range
,
statusBar
:
StatusBar
,
cancellationToken
:
CancellationToken
)
=
asyncMaybe
{
let
!
item
=
this
.
FindDefinitionOfSymbolAtRange
(
targetDocument
,
symbolRange
,
targetSourceText
)
return
this
.
NavigateToItem
(
item
,
statusBar
)
return
this
.
NavigateToItem
(
item
,
statusBar
,
cancellationToken
)
}
member
this
.
NavigateToExternalDeclaration
(
targetSymbolUse
:
FSharpSymbolUse
,
metadataReferences
:
seq
<
MetadataReference
>,
cancellationToken
:
CancellationToken
,
statusBar
:
StatusBar
)
=
...
...
@@ -481,7 +479,7 @@ type internal GoToDefinition(metadataAsSource: FSharpMetadataAsSourceService) =
|
_
->
TextSpan
()
let
navItem
=
FSharpGoToDefinitionNavigableItem
(
tmpShownDoc
,
span
)
this
.
NavigateToItem
(
navItem
,
statusBar
)
this
.
NavigateToItem
(
navItem
,
statusBar
,
cancellationToken
)
true
|
_
->
false
...
...
@@ -654,11 +652,11 @@ type internal FSharpNavigation
Uri
(
sfp
).
MakeRelativeUri
(
targetUri
).
ToString
()
relativePathEscaped
|>
Uri
.
UnescapeDataString
member
_.
NavigateTo
(
range
:
range
)
=
member
_.
NavigateTo
(
range
:
range
,
cancellationToken
:
CancellationToken
)
=
asyncMaybe
{
let
targetPath
=
range
.
FileName
let
!
targetDoc
=
solution
.
TryGetDocumentFromFSharpRange
(
range
,
initialDoc
.
Project
.
Id
)
let
!
targetSource
=
targetDoc
.
GetTextAsync
()
let
!
targetSource
=
targetDoc
.
GetTextAsync
(
cancellationToken
)
let
!
targetTextSpan
=
RoslynHelpers
.
TryFSharpRangeToTextSpan
(
targetSource
,
range
)
let
gtd
=
GoToDefinition
(
metadataAsSource
)
...
...
@@ -672,15 +670,15 @@ type internal FSharpNavigation
match
initialDoc
.
FilePath
,
targetPath
with
|
Signature
,
Signature
|
Implementation
,
Implementation
->
return
gtd
.
TryNavigateToTextSpan
(
targetDoc
,
targetTextSpan
,
statusBar
)
return
gtd
.
TryNavigateToTextSpan
(
targetDoc
,
targetTextSpan
,
statusBar
,
cancellationToken
)
// Adjust the target from signature to implementation.
|
Implementation
,
Signature
->
return
!
gtd
.
NavigateToSymbolDefinitionAsync
(
targetDoc
,
targetSource
,
range
,
statusBar
)
return
!
gtd
.
NavigateToSymbolDefinitionAsync
(
targetDoc
,
targetSource
,
range
,
statusBar
,
cancellationToken
)
// Adjust the target from implmentation to signature.
|
Signature
,
Implementation
->
return
!
gtd
.
NavigateToSymbolDeclarationAsync
(
targetDoc
,
targetSource
,
range
,
statusBar
)
return
!
gtd
.
NavigateToSymbolDeclarationAsync
(
targetDoc
,
targetSource
,
range
,
statusBar
,
cancellationToken
)
}
|>
Async
.
Ignore
|>
Async
.
StartImmediate
...
...
@@ -709,7 +707,7 @@ type internal FSharpNavigation
if
gtdTask
.
Status
=
TaskStatus
.
RanToCompletion
&&
gtdTask
.
Result
.
IsSome
then
match
gtdTask
.
Result
.
Value
with
|
FSharpGoToDefinitionResult
.
NavigableItem
(
navItem
),
_
->
gtd
.
NavigateToItem
(
navItem
,
statusBar
)
gtd
.
NavigateToItem
(
navItem
,
statusBar
,
cancellationToken
)
// 'true' means do it, like Sheev Palpatine would want us to.
true
|
FSharpGoToDefinitionResult
.
ExternalAssembly
(
targetSymbolUse
,
metadataReferences
),
_
->
...
...
vsintegration/src/FSharp.Editor/Navigation/NavigableSymbolsService.fs
浏览文件 @
5392322d
...
...
@@ -22,7 +22,7 @@ open Microsoft.VisualStudio.Shell
type
internal
FSharpNavigableSymbol
(
item
:
FSharpNavigableItem
,
span
:
SnapshotSpan
,
gtd
:
GoToDefinition
,
statusBar
:
StatusBar
)
=
interface
INavigableSymbol
with
member
_.
Navigate
(_:
INavigableRelationship
)
=
gtd
.
NavigateToItem
(
item
,
statusBar
)
gtd
.
NavigateToItem
(
item
,
statusBar
,
CancellationToken
.
None
)
member
_.
Relationships
=
seq
{
yield
PredefinedNavigableRelationships
.
Definition
}
...
...
vsintegration/src/FSharp.Editor/QuickInfo/Views.fs
浏览文件 @
5392322d
...
...
@@ -3,6 +3,7 @@
namespace
Microsoft
.
VisualStudio
.
FSharp
.
Editor
open
System
.
Collections
.
Generic
open
System
.
Threading
open
FSharp
.
Compiler
.
Text
open
Microsoft
.
CodeAnalysis
.
Classification
open
Microsoft
.
VisualStudio
.
Core
.
Imaging
...
...
@@ -75,7 +76,7 @@ module internal QuickInfoViewProvider =
match
item
with
|
:?
NavigableTaggedText
as
nav
when
navigation
.
IsTargetValid
nav
.
Range
->
flushRuns
()
let
navigableTextRun
=
NavigableTextRun
(
classificationTag
,
item
.
Text
,
fun
()
->
navigation
.
NavigateTo
nav
.
Range
)
let
navigableTextRun
=
NavigableTextRun
(
classificationTag
,
item
.
Text
,
fun
()
->
navigation
.
NavigateTo
(
nav
.
Range
,
CancellationToken
.
None
)
)
currentContainerItems
.
Add
(
navigableTextRun
:>
obj
)
|
_
when
item
.
Tag
=
TextTag
.
LineBreak
->
flushRuns
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录