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

Commitd92b43a

Browse files
committed
merge disposable colorization
2 parents1ef21cb +a177ef9 commitd92b43a

File tree

7 files changed

+26
-1
lines changed

7 files changed

+26
-1
lines changed

‎src/fsharp/TcGlobals.fs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -942,6 +942,7 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d
942942
member valtcref_System_IComparable= findSysTyconRef sys"IComparable"
943943
member valtcref_System_IStructuralComparable= findSysTyconRef sysCollections"IStructuralComparable"
944944
member valtcref_System_IStructuralEquatable= findSysTyconRef sysCollections"IStructuralEquatable"
945+
member valtcref_System_IDisposable= findSysTyconRef sys"IDisposable"
945946

946947
member valtcref_LanguagePrimitives= mk_MFCore_tcref fslibCcu"LanguagePrimitives"
947948

‎src/fsharp/vs/Symbols.fs‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,11 @@ and FSharpEntity(cenv:cenv, entity:EntityRef) =
403403
letty= generalizedTyconRef entity
404404
Infos.ExistsHeadTypeInEntireHierarchy cenv.g cenv.amap range0 ty cenv.g.tcref_System_Attribute
405405

406+
memberx.IsDisposableType=
407+
if isUnresolved()thenfalseelse
408+
letty= generalizedTyconRef entity
409+
Infos.ExistsHeadTypeInEntireHierarchy cenv.g cenv.amap range0 ty cenv.g.tcref_System_IDisposable
410+
406411
memberx.BaseType=
407412
checkIsResolved()
408413
GetSuperTypeOfType cenv.g cenv.amap range0(generalizedTyconRef entity)

‎src/fsharp/vs/service.fs‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,7 @@ type SemanticClassificationType =
503503
| Interface
504504
| TypeArgument
505505
| Operator
506+
| Disposable
506507

507508
// A scope represents everything we get back from the typecheck of a file.
508509
// It acts like an in-memory database about the file.
@@ -1140,6 +1141,7 @@ type TypeCheckInfo
11401141
else
11411142
items
11421143

1144+
11431145
memberx.IsRelativeNameResolvable(cursorPos:pos,plid:string list,item:Item):bool=
11441146
/// Determines if a long ident is resolvable at a specific point.
11451147
ErrorScope.Protect
@@ -1459,6 +1461,9 @@ type TypeCheckInfo
14591461
| None->
14601462
sResolutions.CapturedNameResolutions:> seq<_>
14611463

1464+
letisDisposableTy(ty:TType)=
1465+
Infos.ExistsHeadTypeInEntireHierarchy g amap range0 ty g.tcref_System_IDisposable
1466+
14621467
resolutions
14631468
|> Seq.choose(fun cnr->
14641469
match cnrwith
@@ -1490,6 +1495,8 @@ type TypeCheckInfo
14901495
Some(m, SemanticClassificationType.Interface)
14911496
| CNR(_, Item.Types(_, types), LegitTypeOccurence,_,_,_, m)when types|> List.exists(isStructTy g)->
14921497
Some(m, SemanticClassificationType.ValueType)
1498+
| CNR(_, Item.Types(_, types), LegitTypeOccurence,_,_,_, m)when types|> List.exists isDisposableTy->
1499+
Some(m, SemanticClassificationType.Disposable)
14931500
| CNR(_, Item.Types_, LegitTypeOccurence,_,_,_, m)->
14941501
Some(m, SemanticClassificationType.ReferenceType)
14951502
| CNR(_,(Item.TypeVar_), LegitTypeOccurence,_,_,_, m)->

‎src/fsharp/vs/service.fsi‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ type internal SemanticClassificationType =
164164
| Interface
165165
| TypeArgument
166166
| Operator
167+
| Disposable
167168

168169
/// A handle to the results of CheckFileInProject.
169170
[<Sealed>]

‎vsintegration/src/FSharp.Editor/Classification/ClassificationDefinitions.fs‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ module internal FSharpClassificationTypes =
3333
let [<Literal>]Interface= ClassificationTypeNames.InterfaceName
3434
let [<Literal>]TypeArgument= ClassificationTypeNames.TypeParameterName
3535
let [<Literal>]Operator= ClassificationTypeNames.Operator
36+
let [<Literal>]Disposable="FSharp.Disposable"
3637

3738
letgetClassificationTypeName=function
3839
| SemanticClassificationType.ReferenceType-> ReferenceType
@@ -49,6 +50,7 @@ module internal FSharpClassificationTypes =
4950
| SemanticClassificationType.Interface-> Interface
5051
| SemanticClassificationType.TypeArgument-> TypeArgument
5152
| SemanticClassificationType.Operator-> Operator
53+
| SemanticClassificationType.Disposable-> Disposable
5254

5355
moduleinternalClassificationDefinitions=
5456

@@ -74,7 +76,9 @@ module internal ClassificationDefinitions =
7476
[ FSharpClassificationTypes.Function,(Colors.Black, Color.FromRgb(220uy,220uy,220uy))
7577
FSharpClassificationTypes.MutableVar,(Color.FromRgb(160uy,128uy,0uy), Color.FromRgb(255uy,210uy,28uy))
7678
FSharpClassificationTypes.Printf,(Color.FromRgb(43uy,145uy,175uy), Color.FromRgb(78uy,220uy,176uy))
77-
FSharpClassificationTypes.Property,(Colors.Black, Color.FromRgb(220uy,220uy,220uy))]
79+
FSharpClassificationTypes.Property,(Colors.Black, Color.FromRgb(220uy,220uy,220uy))
80+
FSharpClassificationTypes.Disposable,(Color.FromRgb(43uy,145uy,175uy), Color.FromRgb(78uy,220uy,176uy))]
81+
7882

7983
letsetColors _=
8084
letfontAndColorStorage= serviceProvider.GetService(typeof<SVsFontAndColorStorage>):?> IVsFontAndColorStorage
@@ -121,6 +125,9 @@ module internal ClassificationDefinitions =
121125
[<Export; Name(FSharpClassificationTypes.Property); BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)>]
122126
letFSharpPropertyClassificationType:ClassificationTypeDefinition=null
123127

128+
[<Export; Name(FSharpClassificationTypes.Disposable); BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)>]
129+
letFSharpDisposableClassificationType:ClassificationTypeDefinition=null
130+
124131
[<Export(typeof<EditorFormatDefinition>)>]
125132
[<ClassificationType(ClassificationTypeNames= FSharpClassificationTypes.Function)>]
126133
[<Name(FSharpClassificationTypes.Function)>]

‎vsintegration/src/FSharp.Editor/FSharp.Editor.resx‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,9 @@
150150
<dataname="FSharpPropertiesClassificationType"xml:space="preserve">
151151
<value>F# Properties</value>
152152
</data>
153+
<dataname="FSharpDisposablesClassificationType"xml:space="preserve">
154+
<value>F# Disposable Types</value>
155+
</data>
153156
<dataname="RemoveUnusedOpens"xml:space="preserve">
154157
<value>Remove unused open declaration</value>
155158
</data>

‎vsintegration/src/FSharp.Editor/srFSharp.Editor.fs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,6 @@ module SR =
2424
letFSharpMutableVarsClassificationType=lazy(GetString"FSharpMutableVarsClassificationType")
2525
letFSharpPrintfFormatClassificationType=lazy(GetString"FSharpPrintfFormatClassificationType")
2626
letFSharpPropertiesClassificationType=lazy(GetString"FSharpPropertiesClassificationType")
27+
letFSharpDisposablesClassificationType=lazy(GetString"FSharpDisposablesClassificationType")
2728
letRemoveUnusedOpens=lazy(GetString"RemoveUnusedOpens")
2829
letUnusedOpens=lazy(GetString"UnusedOpens")

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp