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

Commit6d0ac01

Browse files
committed
Merge branch 'master' into fsharp4
2 parentsc3e2584 +ac55622 commit6d0ac01

File tree

8 files changed

+71
-18
lines changed

8 files changed

+71
-18
lines changed

‎src/fsharp/NicePrint.fs‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1504,7 +1504,8 @@ module private TastDefinitionPrinting =
15041504
// Don't print individual methods forming interface implementations - these are currently never exported
15051505
not(isInterfaceTy denv.g oty)
15061506
|[]->true)
1507-
|> List.filter(fun v-> denv.showObsoleteMembers||not(HasFSharpAttribute denv.g denv.g.attrib_SystemObsolete v.Attribs))
1507+
|> List.filter(fun v-> denv.showObsoleteMembers||not(Infos.AttributeChecking.CheckFSharpAttributesForObsolete denv.g v.Attribs))
1508+
|> List.filter(fun v-> denv.showHiddenMembers||not(Infos.AttributeChecking.CheckFSharpAttributesForHidden denv.g v.Attribs))
15081509
// sort
15091510
letsortKey(v:ValRef)=(not v.IsConstructor,// constructors before others
15101511
v.Id.idText,// sort by name

‎src/fsharp/ast.fs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ type XmlDocCollector() =
5151
lazy(savedLines.ToArray()|> Array.sortWith(fun(_,p1)(_,p2)-> posCompare p1 p2))
5252

5353
letcheck()=
54-
assert(not savedLinesAsArray.IsValueCreated&&"can't add more XmlDoc elements toXmlDocCOllector after extracting first XmlDoc from the overall results"<>"")
54+
assert(not savedLinesAsArray.IsValueCreated&&"can't add more XmlDoc elements toXmlDocCollector after extracting first XmlDoc from the overall results"<>"")
5555

5656
memberx.AddGrabPoint(pos)=
5757
check()

‎src/fsharp/fsc.fs‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -548,11 +548,13 @@ let runFromCommandLineToImportingAssemblies(displayPSTypeProviderSecurityDialogB
548548
// Code from here on down is just used by fsc.exe
549549
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
550550

551-
letBuildInitialDisplayEnvForDocGeneration tcGlobals=
551+
letBuildInitialDisplayEnvForSigFileGeneration tcGlobals=
552552
letdenv= DisplayEnv.Empty tcGlobals
553553
letdenv=
554554
{ denvwith
555555
showImperativeTyparAnnotations=true;
556+
showHiddenMembers=true;
557+
showObsoleteMembers=true;
556558
showAttributes=true;}
557559
denv.SetOpenPaths
558560
[ FSharpLib.RootPath
@@ -577,7 +579,7 @@ module InterfaceFileWriter =
577579
fprintfn os""
578580

579581
for(TImplFile(_,_,mexpr,_,_))in declaredImplsdo
580-
letdenv=BuildInitialDisplayEnvForDocGeneration tcGlobals
582+
letdenv=BuildInitialDisplayEnvForSigFileGeneration tcGlobals
581583
writeViaBufferWithEnvironmentNewLines os(fun os s-> Printf.bprintf os"%s\n\n" s)
582584
(NicePrint.layoutInferredSigOfModuleExprtrue denv infoReader AccessibleFromSomewhere range0 mexpr|> Layout.squashTo80|> Layout.showL)
583585

‎src/fsharp/infos.fs‎

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2637,22 +2637,29 @@ module AttributeChecking =
26372637
let(AttribInfo(tref,_))= g.attrib_SystemObsolete
26382638
isSome(TryDecodeILAttribute g tref(Some(tref.Scope)) cattrs)
26392639

2640+
/// Checks the attributes for CompilerMessageAttribute, which has an IsHidden argument that allows
2641+
/// items to be suppressed from intellisense.
2642+
letCheckFSharpAttributesForHidden g attribs=
2643+
nonNil attribs&&
2644+
(match TryFindFSharpAttribute g g.attrib_CompilerMessageAttribute attribswith
2645+
| Some(Attrib(_,_,[AttribStringArg_; AttribInt32Arg messageNumber],
2646+
ExtractAttribNamedArg"IsHidden"(AttribBoolArg v),_,_,_))->
2647+
// Message number 62 is for "ML Compatibility". Items labelled with this are visible in intellisense
2648+
// when mlCompatibility is set.
2649+
v&&not(messageNumber=62&& g.mlCompatibility)
2650+
|_->false)
2651+
2652+
/// Indicate if a list of F# attributes contains 'ObsoleteAttribute'. Used to suppress the item in intellisense.
2653+
letCheckFSharpAttributesForObsolete g attribs=
2654+
nonNil attribs&&(HasFSharpAttribute g g.attrib_SystemObsolete attribs)
2655+
26402656
/// Indicate if a list of F# attributes contains 'ObsoleteAttribute'. Used to suppress the item in intellisense.
26412657
/// Also check the attributes for CompilerMessageAttribute, which has an IsHidden argument that allows
26422658
/// items to be suppressed from intellisense.
26432659
letCheckFSharpAttributesForUnseen g attribs _m=
2644-
nonNil attribs&&
2645-
(letisObsolete= isSome(TryFindFSharpAttribute g g.attrib_SystemObsolete attribs)
2646-
letisHidden=
2647-
(match TryFindFSharpAttribute g g.attrib_CompilerMessageAttribute attribswith
2648-
| Some(Attrib(_,_,[AttribStringArg_; AttribInt32Arg messageNumber],
2649-
ExtractAttribNamedArg"IsHidden"(AttribBoolArg v),_,_,_))->
2650-
// Message number 62 is for "ML Compatibility". Items labelled with this are visible in intellisense
2651-
// when mlCompatibility is set.
2652-
v&&not(messageNumber=62&& g.mlCompatibility)
2653-
|_->false)
2654-
isObsolete|| isHidden
2655-
)
2660+
nonNil attribs&&
2661+
(CheckFSharpAttributesForObsolete g attribs||
2662+
CheckFSharpAttributesForHidden g attribs)
26562663

26572664
#if EXTENSIONTYPING
26582665
/// Indicate if a list of provided attributes contains 'ObsoleteAttribute'. Used to suppress the item in intellisense.

‎src/fsharp/tastops.fs‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2354,6 +2354,7 @@ type DisplayEnv =
23542354
suppressNestedTypes:bool;
23552355
maxMembers:int option;
23562356
showObsoleteMembers:bool;
2357+
showHiddenMembers:bool;
23572358
showTyparBinding:bool;
23582359
showImperativeTyparAnnotations:bool;
23592360
suppressInlineKeyword:bool;
@@ -2384,7 +2385,8 @@ type DisplayEnv =
23842385
shortTypeNames=false;
23852386
suppressNestedTypes=false;
23862387
maxMembers=None;
2387-
showObsoleteMembers=true;
2388+
showObsoleteMembers=false;
2389+
showHiddenMembers=false;
23882390
showTyparBinding=false;
23892391
showImperativeTyparAnnotations=false;
23902392
suppressInlineKeyword=false;

‎src/fsharp/tastops.fsi‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -590,6 +590,7 @@ type DisplayEnv =
590590
suppressNestedTypes:bool;
591591
maxMembers:int option;
592592
showObsoleteMembers:bool;
593+
showHiddenMembers:bool;
593594
showTyparBinding:bool;
594595
showImperativeTyparAnnotations:bool;
595596
suppressInlineKeyword:bool;

‎vsintegration/src/unittests/Tests.LanguageService.QuickInfo.fs‎

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,46 @@ type QuickInfoTests() =
165165
f=(fun((text,_),_)-> printfn"actual%s" text; Assert.IsTrue(text.Contains"tooltip for operator"))
166166
)
167167

168+
[<Test>]
169+
memberpublicthis.``QuickInfo.HiddenMember``()=
170+
// Tooltips showed hidden members - #50
171+
letsource="""
172+
open System.ComponentModel
173+
174+
type TypeU = { Element : string }
175+
with
176+
[<EditorBrowsableAttribute(EditorBrowsableState.Never)>]
177+
[<CompilerMessageAttribute("This method is intended for use in generated code only.", 10001, IsHidden=true, IsError=false)>]
178+
member x._Print = x.Element.ToString()
179+
180+
let u = { Element = "abc" }
181+
"""
182+
this.CheckTooltip(
183+
code= source,
184+
marker="ypeU =",
185+
atStart=true,
186+
f=(fun((text,_),_)-> printfn"actual%s" text; Assert.IsFalse(text.Contains"member _Print"))
187+
)
188+
189+
[<Test>]
190+
memberpublicthis.``QuickInfo.ObsoleteMember``()=
191+
// Tooltips showed obsolete members - #50
192+
letsource="""
193+
type TypeU = { Element : string }
194+
with
195+
[<System.ObsoleteAttribute("This is replaced with Print2")>]
196+
member x.Print1 = x.Element.ToString()
197+
member x.Print2 = x.Element.ToString()
198+
199+
let u = { Element = "abc" }
200+
"""
201+
this.CheckTooltip(
202+
code= source,
203+
marker="ypeU =",
204+
atStart=true,
205+
f=(fun((text,_),_)-> printfn"actual%s" text; Assert.IsFalse(text.Contains"member Print1"))
206+
)
207+
168208
[<Test>]
169209
memberpublicthis.``QuickInfo.OverriddenMethods``()=
170210
letsource="""

‎vsintegration/src/vs/FsPkgs/FSharp.LanguageService/XmlDocumentation.fs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ module internal XmlDocumentation =
2626
"<root>"+ xml+"</root>"
2727
else xml
2828

29-
/// Provide XmlDocumentatation
29+
/// Provide XmlDocumentation
3030
typeProvider(xmlIndexService:IVsXMLMemberIndexService)=
3131
/// Index of assembly name to xml member index.
3232
let mutablexmlCache=new AgedLookup<string,IVsXMLMemberIndex>(10,areSame=(fun(x,y)-> x= y))

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp