Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
dotNET Platform
fsharp
提交
2c43ded9
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,发现更多精彩内容 >>
未验证
提交
2c43ded9
编写于
4月 25, 2022
作者:
K
kerams
提交者:
GitHub
4月 25, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Reuse some default values in FCS (#13035)
上级
bdee5ba9
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
26 addition
and
17 deletion
+26
-17
src/fsharp/service/FSharpCheckerResults.fs
src/fsharp/service/FSharpCheckerResults.fs
+10
-11
src/fsharp/service/ServiceDeclarationLists.fs
src/fsharp/service/ServiceDeclarationLists.fs
+11
-5
src/fsharp/service/ServiceDeclarationLists.fsi
src/fsharp/service/ServiceDeclarationLists.fsi
+5
-1
未找到文件。
src/fsharp/service/FSharpCheckerResults.fs
浏览文件 @
2c43ded9
...
...
@@ -1246,7 +1246,7 @@ type internal TypeCheckInfo
loadClosure
.
PackageReferences
|>
Array
.
tryFind
(
fun
(
m
,
_)
->
rangeContainsPos
m
pos
)
match
matches
with
|
None
->
ToolTipText
.
ToolTipText
[]
|
None
->
emptyToolTip
|
Some
(_,
lines
)
->
let
lines
=
lines
|>
List
.
filter
(
fun
line
->
not
(
line
.
StartsWith
(
"//"
))
&&
not
(
String
.
IsNullOrEmpty
line
))
ToolTipText
.
ToolTipText
...
...
@@ -1283,7 +1283,7 @@ type internal TypeCheckInfo
ResolveOverloads
.
Yes
,
None
,
(
fun
()
->
[]
))
match
declItemsOpt
with
|
None
->
ToolTipText
[]
|
None
->
emptyToolTip
|
Some
(
items
,
denv
,
_,
m
)
->
ToolTipText
(
items
|>
List
.
map
(
fun
x
->
FormatStructuredDescriptionOfItem
false
infoReader
tcAccessRights
m
denv
x
.
ItemWithInst
)))
...
...
@@ -1976,6 +1976,8 @@ type FSharpCheckFileResults
|
None
->
dflt
()
|
Some
(
scope
,
_
builderOpt
)
->
f
scope
static
let
emptyFindDeclResult
=
FindDeclResult
.
DeclNotFound
(
FindDeclFailureReason
.
Unknown
""
)
member
_.
Diagnostics
=
errors
member
_.
HasFullTypeCheckInfo
=
details
.
IsSome
...
...
@@ -1998,19 +2000,18 @@ type FSharpCheckFileResults
/// Resolve the names at the given location to give a data tip
member
_.
GetToolTip
(
line
,
colAtEndOfNames
,
lineText
,
names
,
tokenTag
)
=
let
dflt
=
ToolTipText
[]
match
tokenTagToTokenId
tokenTag
with
|
TOKEN_IDENT
->
threadSafeOp
(
fun
()
->
dflt
)
(
fun
scope
->
threadSafeOp
(
fun
()
->
emptyToolTip
)
(
fun
scope
->
scope
.
GetStructuredToolTipText
(
line
,
lineText
,
colAtEndOfNames
,
names
))
|
TOKEN_STRING
|
TOKEN_STRING_TEXT
->
threadSafeOp
(
fun
()
->
dflt
)
(
fun
scope
->
threadSafeOp
(
fun
()
->
emptyToolTip
)
(
fun
scope
->
scope
.
GetReferenceResolutionStructuredToolTipText
(
line
,
colAtEndOfNames
)
)
|
_
->
dflt
emptyToolTip
member
_.
GetDescription
(
symbol
:
FSharpSymbol
,
inst
:
(
FSharpGenericParameter
*
FSharpType
)
list
,
displayFullName
,
range
:
range
)
=
threadSafeOp
(
fun
()
->
ToolTipText
[]
)
(
fun
scope
->
threadSafeOp
(
fun
()
->
emptyToolTip
)
(
fun
scope
->
scope
.
GetDescription
(
symbol
,
inst
,
displayFullName
,
range
))
member
_.
GetF1Keyword
(
line
,
colAtEndOfNames
,
lineText
,
names
)
=
...
...
@@ -2019,13 +2020,11 @@ type FSharpCheckFileResults
// Resolve the names at the given location to a set of methods
member
_.
GetMethods
(
line
,
colAtEndOfNames
,
lineText
,
names
)
=
let
dflt
=
MethodGroup
(
""
,[|
|])
threadSafeOp
(
fun
()
->
dflt
)
(
fun
scope
->
threadSafeOp
(
fun
()
->
MethodGroup
.
Empty
)
(
fun
scope
->
scope
.
GetMethods
(
line
,
lineText
,
colAtEndOfNames
,
names
))
member
_.
GetDeclarationLocation
(
line
,
colAtEndOfNames
,
lineText
,
names
,
?
preferFlag
)
=
let
dflt
=
FindDeclResult
.
DeclNotFound
(
FindDeclFailureReason
.
Unknown
""
)
threadSafeOp
(
fun
()
->
dflt
)
(
fun
scope
->
threadSafeOp
(
fun
()
->
emptyFindDeclResult
)
(
fun
scope
->
scope
.
GetDeclarationLocation
(
line
,
lineText
,
colAtEndOfNames
,
names
,
preferFlag
))
member
_.
GetSymbolUseAtLocation
(
line
,
colAtEndOfNames
,
lineText
,
names
)
=
...
...
src/fsharp/service/ServiceDeclarationLists.fs
浏览文件 @
2c43ded9
...
...
@@ -59,7 +59,7 @@ type ToolTipElement =
/// Information for building a data tip box.
type
ToolTipText
=
/// A list of data tip elements to display.
|
ToolTipText
of
ToolTipElement
list
|
ToolTipText
of
ToolTipElement
list
[<
RequireQualifiedAccess
>]
type
CompletionItemKind
=
...
...
@@ -87,7 +87,9 @@ type CompletionItem =
[<
AutoOpen
>]
module
DeclarationListHelpers
=
let
mutable
ToolTipFault
=
None
let
mutable
ToolTipFault
=
None
let
emptyToolTip
=
ToolTipText
[]
/// Generate the structured tooltip for a method info
let
FormatOverloadsToList
(
infoReader
:
InfoReader
)
m
denv
(
item
:
ItemWithInst
)
minfos
:
ToolTipElement
=
...
...
@@ -942,6 +944,8 @@ type DeclarationListItem(textInDeclList: string, textInCode: string, fullName: s
type
DeclarationListInfo
(
declarations
:
DeclarationListItem
[]
,
isForType
:
bool
,
isError
:
bool
)
=
static
let
fsharpNamespace
=
[|
"Microsoft"
;
"FSharp"
|]
static
let
empty
=
DeclarationListInfo
([|
|],
false
,
false
)
// Check whether this item looks like an operator.
static
let
isOperatorItem
name
(
items
:
CompletionItem
list
)
=
match
items
with
...
...
@@ -1088,7 +1092,7 @@ type DeclarationListInfo(declarations: DeclarationListItem[], isForType: bool, i
[|
DeclarationListItem
(
"<Note>"
,
"<Note>"
,
"<Note>"
,
FSharpGlyph
.
Error
,
Choice2Of2
(
ToolTipText
[
ToolTipElement
.
CompositionError
message
]),
FSharpAccessibility
(
taccessPublic
),
CompletionItemKind
.
Other
,
false
,
0
,
false
,
None
)
|],
false
,
true
)
static
member
Empty
=
DeclarationListInfo
([|
|],
false
,
false
)
static
member
Empty
=
empty
...
...
@@ -1134,6 +1138,8 @@ type MethodGroup( name: string, unsortedMethods: MethodGroupItem[] ) =
static
let
methodOverloadsCache
=
System
.
Runtime
.
CompilerServices
.
ConditionalWeakTable
<
ItemWithInst
,
MethodGroupItem
[]
>()
#
endif
static
let
empty
=
MethodGroup
(
""
,
[|
|])
let
methods
=
unsortedMethods
// Methods with zero arguments show up here as taking a single argument of type 'unit'. Patch them now to appear as having zero arguments.
...
...
@@ -1154,7 +1160,7 @@ type MethodGroup( name: string, unsortedMethods: MethodGroupItem[] ) =
static
member
Create
(
infoReader
:
InfoReader
,
ad
,
m
,
denv
,
items
:
ItemWithInst
list
)
=
let
g
=
infoReader
.
g
if
isNil
items
then
MethodGroup
(
""
,
[|
|])
else
if
isNil
items
then
empty
else
let
name
=
items
.
Head
.
Item
.
DisplayName
let
methods
=
...
...
@@ -1210,5 +1216,5 @@ type MethodGroup( name: string, unsortedMethods: MethodGroupItem[] ) =
MethodGroup
(
name
,
methods
)
static
member
internal
Empty
=
empty
src/fsharp/service/ServiceDeclarationLists.fsi
浏览文件 @
2c43ded9
...
...
@@ -51,7 +51,7 @@ type public ToolTipElement =
type
public
ToolTipText
=
/// A list of data tip elements to display.
|
ToolTipText
of
ToolTipElement
list
|
ToolTipText
of
ToolTipElement
list
[<
RequireQualifiedAccess
>]
type
public
CompletionItemKind
=
...
...
@@ -209,6 +209,8 @@ type public MethodGroup =
static
member
internal
Create
:
InfoReader
*
AccessorDomain
*
range
*
DisplayEnv
*
ItemWithInst
list
->
MethodGroup
static
member
internal
Empty
:
MethodGroup
module
internal
DeclarationListHelpers
=
val
FormatStructuredDescriptionOfItem
:
isDecl
:
bool
->
InfoReader
->
AccessorDomain
->
range
->
DisplayEnv
->
ItemWithInst
->
ToolTipElement
...
...
@@ -218,3 +220,5 @@ module internal DeclarationListHelpers =
val
mutable
ToolTipFault
:
string
option
val
emptyToolTip
:
ToolTipText
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录