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

Commit1bb7445

Browse files
committed
Provided type quickinfo shouldn't show hidden and obsolete members from base class
Fixesdotnet#321
1 parent34f300d commit1bb7445

File tree

3 files changed

+53
-4
lines changed

3 files changed

+53
-4
lines changed

‎src/fsharp/NicePrint.fs‎

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1399,19 +1399,35 @@ module private TastDefinitionPrinting =
13991399
v.DisplayName,// sort by name
14001400
List.sum v.NumArgs,// sort by #curried
14011401
v.NumArgs.Length)// sort by arity
1402-
letctors= GetIntrinsicConstructorInfosOfType infoReader m ty
1403-
letmeths= GetImmediateIntrinsicMethInfosOfType(None,ad) g amap m ty
1402+
1403+
letshouldShow(valRef:ValRef option)=
1404+
match valRefwith
1405+
| None->true
1406+
| Some(vr)->
1407+
(denv.showObsoleteMembers||not(Infos.AttributeChecking.CheckFSharpAttributesForObsolete denv.g vr.Attribs))&&
1408+
(denv.showHiddenMembers||not(Infos.AttributeChecking.CheckFSharpAttributesForHidden denv.g vr.Attribs))
1409+
1410+
letctors=
1411+
GetIntrinsicConstructorInfosOfType infoReader m ty
1412+
|> List.filter(fun v-> shouldShow v.ArbitraryValRef)
1413+
1414+
letmeths=
1415+
GetImmediateIntrinsicMethInfosOfType(None,ad) g amap m ty
1416+
|> List.filter(fun v-> shouldShow v.ArbitraryValRef)
1417+
14041418
letiimplsLs=
14051419
if suppressInheritanceAndInterfacesForTyInSimplifiedDisplays g amap m tythen
14061420
[]
14071421
else
14081422
GetImmediateInterfacesOfType g amap m ty|> List.map(fun ity-> wordL(if isInterfaceTy g tythen"inherit"else"interface")--- layoutType denv ity)
14091423

14101424
letprops=
1411-
GetIntrinsicPropInfosOfType infoReader(None,ad,AllowMultiIntfInstantiations.Yes) PreferOverrides m ty
1425+
GetIntrinsicPropInfosOfType infoReader(None,ad,AllowMultiIntfInstantiations.Yes) PreferOverrides m ty
1426+
|> List.filter(fun v-> shouldShow v.ArbitraryValRef)
14121427

14131428
letevents=
1414-
infoReader.GetEventInfosOfType(None,ad,m,ty)
1429+
infoReader.GetEventInfosOfType(None,ad,m,ty)
1430+
|> List.filter(fun v-> shouldShow v.ArbitraryValRef)
14151431

14161432
letimpliedNames=
14171433
try

‎vsintegration/src/unittests/Resources.MockTypeProviders/DummyProviderForLanguageServiceTesting/DummyProviderForLanguageServiceTesting.fs‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,29 @@ module TypeProviderThatThrowsErrorsModule =
209209
typeTypeProviderThatThrowsErrors()=
210210
inherit TypeProviderForNamespaces(TypeProviderThatThrowsErrorsModule.rootNamespace, TypeProviderThatThrowsErrorsModule.types)
211211

212+
openSystem.ComponentModel
213+
typeTPBaseTy()=
214+
[<EditorBrowsableAttribute(EditorBrowsableState.Never)>]
215+
[<CompilerMessageAttribute("This method is intended for use in generated code only.",10001, IsHidden=true, IsError=false)>]
216+
memberthis.DoNotShowHidden=()
217+
218+
[<System.ObsoleteAttribute("TP base type obsolete member")>]
219+
memberthis.DoNotShowObsolete=()
220+
221+
memberthis.ShowThisProp=()
222+
223+
[<TypeProvider>]
224+
typeHiddenMembersInBaseClassProvider()as this=
225+
inherit TypeProviderForNamespaces()
226+
letnamespaceName="HiddenMembersInBaseClass"
227+
letthisAssembly= System.Reflection.Assembly.GetExecutingAssembly()
228+
229+
lettypeT= ProvidedTypeDefinition(thisAssembly, namespaceName,"HiddenBaseMembersTP", Some typeof<TPBaseTy>)
230+
lettypes=[ typeT]
231+
232+
do
233+
this.AddNamespace(namespaceName,types)
234+
212235
moduleTypeProviderForTestingTuplesErasureModule=
213236
typeprivateMarker=interfaceend
214237
letassembly= typeof<Marker>.Assembly

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,16 @@ type QuickInfoTests() =
204204
atStart=true,
205205
f=(fun((text,_),_)-> printfn"actual%s" text; Assert.IsFalse(text.Contains"member Print1"))
206206
)
207+
208+
[<Test>]
209+
memberpublicthis.``QuickInfo.HideBaseClassMembersTP``()=
210+
letfileContents="type foo = HiddenMembersInBaseClass.HiddenBaseMembersTP(*Marker*)"
211+
212+
this.AssertQuickInfoContainsAtStartOfMarker(
213+
fileContents,
214+
marker="MembersTP(*Marker*)",
215+
expected="type HiddenBaseMembersTP =\n inherit TPBaseTy\n member ShowThisProp : unit",
216+
addtlRefAssy=[System.IO.Path.Combine(System.Environment.CurrentDirectory,@"UnitTestsResources\MockTypeProviders\DummyProviderForLanguageServiceTesting.dll")])
207217

208218
[<Test>]
209219
memberpublicthis.``QuickInfo.OverriddenMethods``()=

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp