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

Commitac55622

Browse files
forkilatkin
authored andcommitted
Members hidden from IntelliSense are now also omitted in QuickInfo -fixesdotnet#50
closesdotnet#73commite127dfaAuthor: Steffen Forkmann <steffen.forkmann@msu-solutions.de>Date: Wed Jan 21 10:52:10 2015 +0100 fix typos in XmlDocumentation.fs and ast.fscommit6f99029Author: Steffen Forkmann <steffen.forkmann@msu-solutions.de>Date: Wed Jan 21 12:17:58 2015 +0100 Obsolete members are now also omitted in QuickInfo - referencesdotnet#50commitae54746Author: Steffen Forkmann <steffen.forkmann@msu-solutions.de>Date: Wed Jan 21 12:17:16 2015 +0100 Capturing broken QuickTip for obsolete methods in test - referencesdotnet#50commit1e38a8aAuthor: Steffen Forkmann <steffen.forkmann@msu-solutions.de>Date: Wed Jan 21 10:51:23 2015 +0100 Members hidden from IntelliSense are now also omitted in QuickInfo -fixesdotnet#50commit5f27136Author: Steffen Forkmann <steffen.forkmann@msu-solutions.de>Date: Sun Jan 18 10:49:41 2015 +0100 Capturing broken QuickTips for hidden methods in test - referencesdotnet#50
1 parenta932a13 commitac55622

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
@@ -1500,7 +1500,8 @@ module private TastDefinitionPrinting =
15001500
// Don't print individual methods forming interface implementations - these are currently never exported
15011501
not(isInterfaceTy denv.g oty)
15021502
|[]->true)
1503-
|> List.filter(fun v-> denv.showObsoleteMembers||not(HasFSharpAttribute denv.g denv.g.attrib_SystemObsolete v.Attribs))
1503+
|> List.filter(fun v-> denv.showObsoleteMembers||not(Infos.AttributeChecking.CheckFSharpAttributesForObsolete denv.g v.Attribs))
1504+
|> List.filter(fun v-> denv.showHiddenMembers||not(Infos.AttributeChecking.CheckFSharpAttributesForHidden denv.g v.Attribs))
15041505
// sort
15051506
letsortKey(v:ValRef)=(not v.IsConstructor,// constructors before others
15061507
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
@@ -2660,22 +2660,29 @@ module AttributeChecking =
26602660
let(AttribInfo(tref,_))= g.attrib_SystemObsolete
26612661
isSome(TryDecodeILAttribute g tref(Some(tref.Scope)) cattrs)
26622662

2663+
/// Checks the attributes for CompilerMessageAttribute, which has an IsHidden argument that allows
2664+
/// items to be suppressed from intellisense.
2665+
letCheckFSharpAttributesForHidden g attribs=
2666+
nonNil attribs&&
2667+
(match TryFindFSharpAttribute g g.attrib_CompilerMessageAttribute attribswith
2668+
| Some(Attrib(_,_,[AttribStringArg_; AttribInt32Arg messageNumber],
2669+
ExtractAttribNamedArg"IsHidden"(AttribBoolArg v),_,_,_))->
2670+
// Message number 62 is for "ML Compatibility". Items labelled with this are visible in intellisense
2671+
// when mlCompatibility is set.
2672+
v&&not(messageNumber=62&& g.mlCompatibility)
2673+
|_->false)
2674+
2675+
/// Indicate if a list of F# attributes contains 'ObsoleteAttribute'. Used to suppress the item in intellisense.
2676+
letCheckFSharpAttributesForObsolete g attribs=
2677+
nonNil attribs&&(HasFSharpAttribute g g.attrib_SystemObsolete attribs)
2678+
26632679
/// Indicate if a list of F# attributes contains 'ObsoleteAttribute'. Used to suppress the item in intellisense.
26642680
/// Also check the attributes for CompilerMessageAttribute, which has an IsHidden argument that allows
26652681
/// items to be suppressed from intellisense.
26662682
letCheckFSharpAttributesForUnseen g attribs _m=
2667-
nonNil attribs&&
2668-
(letisObsolete= isSome(TryFindFSharpAttribute g g.attrib_SystemObsolete attribs)
2669-
letisHidden=
2670-
(match TryFindFSharpAttribute g g.attrib_CompilerMessageAttribute attribswith
2671-
| Some(Attrib(_,_,[AttribStringArg_; AttribInt32Arg messageNumber],
2672-
ExtractAttribNamedArg"IsHidden"(AttribBoolArg v),_,_,_))->
2673-
// Message number 62 is for "ML Compatibility". Items labelled with this are visible in intellisense
2674-
// when mlCompatibility is set.
2675-
v&&not(messageNumber=62&& g.mlCompatibility)
2676-
|_->false)
2677-
isObsolete|| isHidden
2678-
)
2683+
nonNil attribs&&
2684+
(CheckFSharpAttributesForObsolete g attribs||
2685+
CheckFSharpAttributesForHidden g attribs)
26792686

26802687
#if EXTENSIONTYPING
26812688
/// 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
@@ -2344,6 +2344,7 @@ type DisplayEnv =
23442344
suppressNestedTypes:bool;
23452345
maxMembers:int option;
23462346
showObsoleteMembers:bool;
2347+
showHiddenMembers:bool;
23472348
showTyparBinding:bool;
23482349
showImperativeTyparAnnotations:bool;
23492350
suppressInlineKeyword:bool;
@@ -2374,7 +2375,8 @@ type DisplayEnv =
23742375
shortTypeNames=false;
23752376
suppressNestedTypes=false;
23762377
maxMembers=None;
2377-
showObsoleteMembers=true;
2378+
showObsoleteMembers=false;
2379+
showHiddenMembers=false;
23782380
showTyparBinding=false;
23792381
showImperativeTyparAnnotations=false;
23802382
suppressInlineKeyword=false;

‎src/fsharp/tastops.fsi‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -587,6 +587,7 @@ type DisplayEnv =
587587
suppressNestedTypes:bool;
588588
maxMembers:int option;
589589
showObsoleteMembers:bool;
590+
showHiddenMembers:bool;
590591
showTyparBinding:bool;
591592
showImperativeTyparAnnotations:bool;
592593
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