Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
dotNET Platform
fsharp
提交
2a99ffe0
F
fsharp
项目概览
dotNET Platform
/
fsharp
12 个月 前同步成功
通知
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,发现更多精彩内容 >>
提交
2a99ffe0
编写于
4月 03, 2017
作者:
J
Jared Hester
提交者:
Kevin Ransom (msft)
4月 03, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
show dialog box on failure (#2791)
上级
81f25e5d
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
17 addition
and
8 deletion
+17
-8
vsintegration/src/FSharp.Editor/Navigation/GoToDefinitionService.fs
...ion/src/FSharp.Editor/Navigation/GoToDefinitionService.fs
+17
-8
未找到文件。
vsintegration/src/FSharp.Editor/Navigation/GoToDefinitionService.fs
浏览文件 @
2a99ffe0
...
...
@@ -84,14 +84,14 @@ module internal FSharpGoToDefinition =
let
defines
=
CompilerEnvironment
.
GetCompilationDefinesForEditing
(
originDocument
.
FilePath
,
projectOptions
.
OtherOptions
|>
Seq
.
toList
)
let
originTextSpan
=
RoslynHelpers
.
FSharpRangeToTextSpan
(
sourceText
,
originRange
)
let
position
=
originTextSpan
.
Start
let
!
lexerSymbol
=
Tokenizer
.
getSymbolAtPosition
(
originDocument
.
Id
,
sourceText
,
position
,
originDocument
.
FilePath
,
defines
,
SymbolLookupKind
.
Greedy
)
let
!
lexerSymbol
=
Tokenizer
.
getSymbolAtPosition
(
originDocument
.
Id
,
sourceText
,
position
,
originDocument
.
FilePath
,
defines
,
SymbolLookupKind
.
Greedy
)
let
textLinePos
=
sourceText
.
Lines
.
GetLinePosition
position
let
fcsTextLineNumber
=
Line
.
fromZ
textLinePos
.
Line
let
lineText
=
(
sourceText
.
Lines
.
GetLineFromPosition
position
).
ToString
()
let
!
_,
_,
checkFileResults
=
checker
.
ParseAndCheckDocument
(
originDocument
,
projectOptions
,
allowStaleResults
=
true
,
sourceText
=
sourceText
)
let
idRange
=
lexerSymbol
.
Ident
.
idRange
let
!
fsSymbolUse
=
checkFileResults
.
GetSymbolUseAtLocation
(
fcsTextLineNumber
,
idRange
.
EndColumn
,
lineText
,
lexerSymbol
.
FullIsland
)
let
symbol
=
fsSymbolUse
.
Symbol
...
...
@@ -119,11 +119,13 @@ module internal FSharpGoToDefinition =
(
targetDocument
:
Document
,
symbolRange
:
range
,
targetSource
:
SourceText
,
checker
:
FSharpChecker
,
projectInfoManager
:
ProjectInfoManager
)
=
findSymbolHelper
(
targetDocument
,
symbolRange
,
targetSource
,
true
,
checker
,
projectInfoManager
)
/// find the definition location (implementation file/.fs) of the target symbol
let
findDefinitionOfSymbolAtRange
(
targetDocument
:
Document
,
symbolRange
:
range
,
targetSourceText
:
SourceText
,
checker
:
FSharpChecker
,
projectInfoManager
:
ProjectInfoManager
)
=
findSymbolHelper
(
targetDocument
,
symbolRange
,
targetSourceText
,
false
,
checker
,
projectInfoManager
)
/// use the targetSymbol to find the first instance of its presence in the provided source file
let
findSymbolDeclarationInFile
(
targetSymbolUse
:
FSharpSymbolUse
,
filePath
:
string
,
source
:
string
,
checker
:
FSharpChecker
,
projectOptions
:
FSharpProjectOptions
,
fileVersion
:
int
)
=
...
...
@@ -138,6 +140,7 @@ module internal FSharpGoToDefinition =
return
implSymbol
.
RangeAlternate
}
open
FSharpGoToDefinition
[<
Shared
>]
...
...
@@ -202,6 +205,7 @@ type internal FSharpGoToDefinitionService [<ImportingConstructor>]
clearStatusBarAfter
4000
true
/// 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
this
.
TryNavigateToTextSpan
(
document
:
Document
,
textSpan
:
TextSpan
)
=
...
...
@@ -215,6 +219,7 @@ type internal FSharpGoToDefinitionService [<ImportingConstructor>]
clearStatusBarAfter
4000
false
/// 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
)
=
async
{
...
...
@@ -224,6 +229,7 @@ type internal FSharpGoToDefinitionService [<ImportingConstructor>]
return
tryNavigateToItem
navresult
}
/// find the definition location (implementation file/.fs) of the target symbol
member
this
.
NavigateToSymbolDefinitionAsync
(
targetDocument
:
Document
,
targetSourceText
:
SourceText
,
symbolRange
:
range
)=
async
{
let
!
navresult
=
...
...
@@ -232,6 +238,7 @@ type internal FSharpGoToDefinitionService [<ImportingConstructor>]
return
tryNavigateToItem
navresult
}
static
member
FindDefinition
(
checker
:
FSharpChecker
,
documentKey
:
DocumentId
,
sourceText
:
SourceText
,
filePath
:
string
,
position
:
int
,
defines
:
string
list
,
options
:
FSharpProjectOptions
,
textVersionHash
:
int
)
:
Option
<
range
>
=
maybe
{
...
...
@@ -252,6 +259,7 @@ type internal FSharpGoToDefinitionService [<ImportingConstructor>]
|
_
->
return
!
None
}
/// Construct a task that will return a navigation target for the implementation definition of the symbol
/// at the provided position in the document
member
this
.
FindDefinitionsTask
(
originDocument
:
Document
,
position
:
int
,
cancellationToken
:
CancellationToken
)
=
...
...
@@ -270,9 +278,7 @@ type internal FSharpGoToDefinitionService [<ImportingConstructor>]
let
!
_,
_,
checkFileResults
=
checkerProvider
.
Checker
.
ParseAndCheckDocument
(
originDocument
,
projectOptions
,
allowStaleResults
=
true
,
sourceText
=
sourceText
)
let
!
lexerSymbol
=
Tokenizer
.
getSymbolAtPosition
(
originDocument
.
Id
,
sourceText
,
position
,
originDocument
.
FilePath
,
defines
,
SymbolLookupKind
.
Greedy
)
let
!
lexerSymbol
=
Tokenizer
.
getSymbolAtPosition
(
originDocument
.
Id
,
sourceText
,
position
,
originDocument
.
FilePath
,
defines
,
SymbolLookupKind
.
Greedy
)
let
idRange
=
lexerSymbol
.
Ident
.
idRange
let
!
declarations
=
...
...
@@ -346,11 +352,14 @@ type internal FSharpGoToDefinitionService [<ImportingConstructor>]
}
|>
Async
.
map
(
Option
.
defaultValue
Seq
.
empty
)
|>
RoslynHelpers
.
StartAsyncAsTask
cancellationToken
interface
IGoToDefinitionService
with
// used for 'definition peek'
member
this
.
FindDefinitionsAsync
(
document
:
Document
,
position
:
int
,
cancellationToken
:
CancellationToken
)
=
this
.
FindDefinitionsTask
(
document
,
position
,
cancellationToken
)
// used for 'goto definition' proper
/// Try to navigate to the definiton of the symbol at the symbolRange in the originDocument
member
this
.
TryGoToDefinition
(
document
:
Document
,
position
:
int
,
cancellationToken
:
CancellationToken
)
=
...
...
@@ -374,11 +383,11 @@ type internal FSharpGoToDefinitionService [<ImportingConstructor>]
stopSearchAnimation
()
if
result
then
clearStatusBar
()
true
// we always return true to prevent the dialog box from appearing
result
else
statusBarMessage
"Could Not Navigate to Definition of Symbol Under Caret"
clearStatusBarAfter
4000
true
// we always return true to prevent the dialog box from appearing
result
// FSROSLYNTODO: potentially display multiple results here
// If GotoDef returns one result then it should try to jump to a discovered location. If it returns multiple results then it should use
...
...
@@ -394,4 +403,4 @@ type internal FSharpGoToDefinitionService [<ImportingConstructor>]
stopSearchAnimation
()
statusBarMessage
"Could Not Navigate to Definition of Symbol Under Caret"
clearStatusBarAfter
4000
true
// we always return true to prevent the dialog box from appearing
\ No newline at end of file
false
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录