Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3c7f59e

Browse files
vasily-kirichenkoKevinRansom
authored andcommitted
Custom operations are at the top of completion list & remove active pattern values from the list (#4831)
* custom operations are at the top of completion list* do not pick rhs NameResolutionEnvironment in completion if it corresponds to a computation expression* Revert "do not pick rhs NameResolutionEnvironment in completion if it corresponds to a computation expression"This reverts commit 4548ca2ea2fb730f9b896462bd00745621e3b245.* fix after merge* put active patterns (as functions) to the very end of completion list* filter out active patterns-as-value from completion list* Revert "put active patterns (as functions) to the very end of completion list"This reverts commit c26b24cc4a730bb0f741b73f39cc4601b7810127.
1 parent1af4f56 commit3c7f59e

File tree

6 files changed

+36
-10
lines changed

6 files changed

+36
-10
lines changed

‎src/fsharp/service/ServiceDeclarationLists.fs‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -615,15 +615,23 @@ type FSharpDeclarationListInfo(declarations: FSharpDeclarationListItem[], isForT
615615
| None-> item.Item.DisplayName
616616
name, items)
617617

618-
// Filter out operators (and list)
618+
// Filter out operators, active patterns (as values)andthe emptylist
619619
letitems=
620620
// Check whether this item looks like an operator.
621621
letisOperatorItem(name,items:CompletionItem list)=
622622
match items|> List.map(fun x-> x.Item)with
623623
|[Item.Value_| Item.MethodGroup_| Item.UnionCase_]-> IsOperatorName name
624624
|_->false
625-
letisFSharpList name=(name="[]")// list shows up as a Type and a UnionCase, only such entity with a symbolic name, but want to filter out of intellisense
626-
items|> List.filter(fun(displayName,items)->not(isOperatorItem(displayName, items))&&not(isFSharpList displayName))
625+
626+
letisActivePatternItem(items:CompletionItem list)=
627+
match items|> List.map(fun x-> x.Item)with
628+
|[Item.Value vref]-> IsActivePatternName vref.CompiledName
629+
|_->false
630+
631+
items|> List.filter(fun(displayName,items)->
632+
not(isOperatorItem(displayName, items))&&
633+
not(displayName="[]")&&// list shows up as a Type and a UnionCase, only such entity with a symbolic name, but want to filter out of intellisense
634+
not(isActivePatternItem items))
627635

628636
letdecls=
629637
items

‎src/fsharp/service/service.fs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,7 @@ type TypeCheckInfo
577577
| Item.Event_-> CompletionItemKind.Event
578578
| Item.ILField_
579579
| Item.Value_-> CompletionItemKind.Field
580+
| Item.CustomOperation_-> CompletionItemKind.CustomOperation
580581
|_-> CompletionItemKind.Other
581582

582583
{ ItemWithInst= item

‎src/fsharp/symbols/SymbolHelpers.fs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ type CompletionItemKind =
275275
| MethodofisExtension:bool
276276
| Event
277277
| Argument
278+
| CustomOperation
278279
| Other
279280

280281
typeUnresolvedSymbol=

‎src/fsharp/symbols/SymbolHelpers.fsi‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ type public CompletionItemKind =
113113
| MethodofisExtension:bool
114114
| Event
115115
| Argument
116+
| CustomOperation
116117
| Other
117118

118119
typeUnresolvedSymbol=

‎vsintegration/src/FSharp.Editor/Completion/CompletionUtils.fs‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,11 @@ module internal CompletionUtils =
102102

103103
let inlinegetKindPriority kind=
104104
match kindwith
105-
| CompletionItemKind.Property->0
106-
| CompletionItemKind.Field->1
107-
| CompletionItemKind.Method(isExtension=false)->2
108-
| CompletionItemKind.Event->3
109-
| CompletionItemKind.Argument->4
110-
| CompletionItemKind.Other->5
111-
| CompletionItemKind.Method(isExtension=true)->6
105+
| CompletionItemKind.CustomOperation->0
106+
| CompletionItemKind.Property->1
107+
| CompletionItemKind.Field->2
108+
| CompletionItemKind.Method(isExtension=false)->3
109+
| CompletionItemKind.Event->4
110+
| CompletionItemKind.Argument->5
111+
| CompletionItemKind.Other->6
112+
| CompletionItemKind.Method(isExtension=true)->7

‎vsintegration/tests/UnitTests/CompletionProviderTests.fs‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -603,6 +603,20 @@ module M2 =
603603
"""
604604
VerifyCompletionList(fileContents," Ext",["Extensions";"ExtraTopLevelOperators"],[])
605605

606+
[<Test>]
607+
let``Custom operations should be at the top of completion list inside computation expression``()=
608+
letfileContents="""
609+
let joinLocal = 1
610+
611+
let _ =
612+
query {
613+
for i in 1..10 do
614+
select i
615+
join
616+
}
617+
"""
618+
VerifyCompletionList(fileContents," join",["groupJoin";"join";"leftOuterJoin";"joinLocal"],[])
619+
606620
#if EXE
607621
ShouldDisplaySystemNamespace()
608622
#endif

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp