diff --git a/src/fsharp/service/SemanticClassification.fs b/src/fsharp/service/SemanticClassification.fs index 367d2290122..f715f26349f 100644 --- a/src/fsharp/service/SemanticClassification.fs +++ b/src/fsharp/service/SemanticClassification.fs @@ -10,7 +10,6 @@ open FSharp.Compiler open FSharp.Compiler.AbstractIL.Internal.Library open FSharp.Compiler.Infos open FSharp.Compiler.ErrorLogger -open FSharp.Compiler.Lib open FSharp.Compiler.NameResolution open FSharp.Compiler.PrettyNaming open FSharp.Compiler.Range @@ -24,10 +23,12 @@ type SemanticClassificationType = | ReferenceType | ValueType | UnionCase + | UnionCaseField | Function | Property | MutableVar | Module + | NameSpace | Printf | ComputationExpression | IntrinsicFunction @@ -35,19 +36,34 @@ type SemanticClassificationType = | Interface | TypeArgument | Operator - | Disposable + | DisposableType + | DisposableValue + | Method + | ExtensionMethod + | ConstructorForReferenceType + | ConstructorForValueType + | Literal + | RecordField + | MutableRecordField + | RecordFieldAsFunction + | Exception + | Field + | Event + | Delegate + | NamedArgument + | Value + | LocalValue + | Type + | TypeDef [] module TcResolutionsExtensions = - let (|CNR|) (cnr:CapturedNameResolution) = (cnr.Item, cnr.ItemOccurence, cnr.DisplayEnv, cnr.NameResolutionEnv, cnr.AccessorDomain, cnr.Range) type TcResolutions with - member sResolutions.GetSemanticClassification(g: TcGlobals, amap: Import.ImportMap, formatSpecifierLocations: (range * int) [], range: range option) : struct(range * SemanticClassificationType) [] = - ErrorScope.Protect Range.range0 - (fun () -> + ErrorScope.Protect Range.range0 (fun () -> let (|LegitTypeOccurence|_|) = function | ItemOccurence.UseInType | ItemOccurence.UseInAttribute @@ -56,18 +72,13 @@ module TcResolutionsExtensions = | ItemOccurence.Pattern _ -> Some() | _ -> None - let (|OptionalArgumentAttribute|_|) ttype = - match ttype with - | TType.TType_app(tref, _) when tref.Stamp = g.attrib_OptionalArgumentAttribute.TyconRef.Stamp -> Some() - | _ -> None - let (|KeywordIntrinsicValue|_|) (vref: ValRef) = if valRefEq g g.raise_vref vref || - valRefEq g g.reraise_vref vref || - valRefEq g g.typeof_vref vref || - valRefEq g g.typedefof_vref vref || - valRefEq g g.sizeof_vref vref || - valRefEq g g.nameof_vref vref then Some() + valRefEq g g.reraise_vref vref || + valRefEq g g.typeof_vref vref || + valRefEq g g.typedefof_vref vref || + valRefEq g g.sizeof_vref vref || + valRefEq g g.nameof_vref vref then Some() else None let (|EnumCaseFieldInfo|_|) (rfinfo : RecdFieldInfo) = @@ -87,7 +98,15 @@ module TcResolutionsExtensions = sResolutions.CapturedNameResolutions :> seq<_> let isDisposableTy (ty: TType) = + not (typeEquiv g ty g.system_IDisposable_ty) && protectAssemblyExplorationNoReraise false false (fun () -> Infos.ExistsHeadTypeInEntireHierarchy g amap range0 ty g.tcref_System_IDisposable) + + let isDiscard (str: string) = str.StartsWith("_") + + let isValRefDisposable (vref: ValRef) = + not (isDiscard vref.DisplayName) && + // For values, we actually do want to color things if they literally are IDisposables + protectAssemblyExplorationNoReraise false false (fun () -> Infos.ExistsHeadTypeInEntireHierarchy g amap range0 vref.Type g.tcref_System_IDisposable) let isStructTyconRef (tyconRef: TyconRef) = let ty = generalizedTyconRef tyconRef @@ -116,61 +135,206 @@ module TcResolutionsExtensions = // 'seq' in 'seq { ... }' gets colored as keywords | (Item.Value vref), ItemOccurence.Use, _, _, _, m when valRefEq g g.seq_vref vref -> add m SemanticClassificationType.ComputationExpression + | (Item.Value vref), _, _, _, _, m when isValRefMutable vref -> add m SemanticClassificationType.MutableVar + | Item.Value KeywordIntrinsicValue, ItemOccurence.Use, _, _, _, m -> add m SemanticClassificationType.IntrinsicFunction + | (Item.Value vref), _, _, _, _, m when isFunction g vref.Type -> if valRefEq g g.range_op_vref vref || valRefEq g g.range_step_op_vref vref then () elif vref.IsPropertyGetterMethod || vref.IsPropertySetterMethod then add m SemanticClassificationType.Property + elif vref.IsMember then + add m SemanticClassificationType.Method elif IsOperatorName vref.DisplayName then add m SemanticClassificationType.Operator else add m SemanticClassificationType.Function - | Item.RecdField rfinfo, _, _, _, _, m when isRecdFieldMutable rfinfo -> - add m SemanticClassificationType.MutableVar - | Item.RecdField rfinfo, _, _, _, _, m when isFunction g rfinfo.FieldType -> - add m SemanticClassificationType.Function - | Item.RecdField EnumCaseFieldInfo, _, _, _, _, m -> - add m SemanticClassificationType.Enumeration - | Item.MethodGroup _, _, _, _, _, m -> - add m SemanticClassificationType.Function - // custom builders, custom operations get colored as keywords + + | (Item.Value vref), _, _, _, _, m -> + if isValRefDisposable vref then + add m SemanticClassificationType.DisposableValue + elif Option.isSome vref.LiteralValue then + add m SemanticClassificationType.Literal + elif not vref.IsCompiledAsTopLevel && not(isDiscard vref.DisplayName) then + add m SemanticClassificationType.LocalValue + else + add m SemanticClassificationType.Value + + | Item.RecdField rfinfo, _, _, _, _, m -> + match rfinfo with + | EnumCaseFieldInfo -> + add m SemanticClassificationType.Enumeration + | _ -> + if isRecdFieldMutable rfinfo then + add m SemanticClassificationType.MutableRecordField + elif isFunTy g rfinfo.FieldType then + add m SemanticClassificationType.RecordFieldAsFunction + else + add m SemanticClassificationType.RecordField + + | Item.AnonRecdField(_, tys, idx, m), _, _, _, _, _ -> + let ty = tys.[idx] + + // It's not currently possible for anon record fields to be mutable, but they can be ref cells + if isRefCellTy g ty then + add m SemanticClassificationType.MutableRecordField + elif isFunTy g ty then + add m SemanticClassificationType.RecordFieldAsFunction + else + add m SemanticClassificationType.RecordField + + | Item.Property (_, pinfo :: _), _, _, _, _, m -> + if not pinfo.IsIndexer then + add m SemanticClassificationType.Property + + | Item.CtorGroup (_, minfos), _, _, _, _, m -> + if minfos |> List.forall (fun minfo -> isDisposableTy minfo.ApparentEnclosingType) then + add m SemanticClassificationType.DisposableType + elif minfos |> List.forall (fun minfo -> isStructTy g minfo.ApparentEnclosingType) then + add m SemanticClassificationType.ConstructorForValueType + else + add m SemanticClassificationType.ConstructorForReferenceType + + | (Item.DelegateCtor _ | Item.FakeInterfaceCtor _), _, _, _, _, m -> + add m SemanticClassificationType.ConstructorForReferenceType + + | Item.MethodGroup (_, minfos, _), _, _, _, _, m -> + if minfos |> List.forall (fun minfo -> minfo.IsExtensionMember || minfo.IsCSharpStyleExtensionMember) then + add m SemanticClassificationType.ExtensionMethod + else + add m SemanticClassificationType.Method + | (Item.CustomBuilder _ | Item.CustomOperation _), ItemOccurence.Use, _, _, _, m -> add m SemanticClassificationType.ComputationExpression - // types get colored as types when they occur in syntactic types or custom attributes - // type variables get colored as types when they occur in syntactic types custom builders, custom operations get colored as keywords - | Item.Types (_, [OptionalArgumentAttribute]), LegitTypeOccurence, _, _, _, _ -> () - | Item.CtorGroup(_, [MethInfo.FSMeth(_, OptionalArgumentAttribute, _, _)]), LegitTypeOccurence, _, _, _, _ -> () - | Item.Types(_, types), LegitTypeOccurence, _, _, _, m when types |> List.exists (isInterfaceTy g) -> - add m SemanticClassificationType.Interface - | Item.Types(_, types), LegitTypeOccurence, _, _, _, m when types |> List.exists (isStructTy g) -> - add m SemanticClassificationType.ValueType + + // Special case measures for struct types | Item.Types(_, TType_app(tyconRef, TType_measure _ :: _) :: _), LegitTypeOccurence, _, _, _, m when isStructTyconRef tyconRef -> add m SemanticClassificationType.ValueType - | Item.Types(_, types), LegitTypeOccurence, _, _, _, m when types |> List.exists isDisposableTy -> - add m SemanticClassificationType.Disposable - | Item.Types _, LegitTypeOccurence, _, _, _, m -> - add m SemanticClassificationType.ReferenceType + + | Item.Types (_, ty :: _), LegitTypeOccurence, _, _, _, m -> + let reprToClassificationType repr tcref = + match repr with + | TFSharpObjectRepr om -> + match om.fsobjmodel_kind with + | TTyconClass -> SemanticClassificationType.ReferenceType + | TTyconInterface -> SemanticClassificationType.Interface + | TTyconStruct -> SemanticClassificationType.ValueType + | TTyconDelegate _ -> SemanticClassificationType.Delegate + | TTyconEnum _ -> SemanticClassificationType.Enumeration + | TRecdRepr _ + | TUnionRepr _ -> + if isStructTyconRef tcref then + SemanticClassificationType.ValueType + else + SemanticClassificationType.Type + | TILObjectRepr (TILObjectReprData (_, _, td)) -> + if td.IsClass then + SemanticClassificationType.ReferenceType + elif td.IsStruct then + SemanticClassificationType.ValueType + elif td.IsInterface then + SemanticClassificationType.Interface + elif td.IsEnum then + SemanticClassificationType.Enumeration + else + SemanticClassificationType.Delegate + | TAsmRepr _ -> SemanticClassificationType.TypeDef + | TMeasureableRepr _-> SemanticClassificationType.TypeDef +#if !NO_EXTENSIONTYPING + | TProvidedTypeExtensionPoint _-> SemanticClassificationType.TypeDef + | TProvidedNamespaceExtensionPoint _-> SemanticClassificationType.TypeDef +#endif + | TNoRepr -> SemanticClassificationType.ReferenceType + + let ty = stripTyEqns g ty + if isDisposableTy ty then + add m SemanticClassificationType.DisposableType + else + match tryTcrefOfAppTy g ty with + | ValueSome tcref -> + add m (reprToClassificationType tcref.TypeReprInfo tcref) + | ValueNone -> + if isStructTupleTy g ty then + add m SemanticClassificationType.ValueType + elif isRefTupleTy g ty then + add m SemanticClassificationType.ReferenceType + elif isFunction g ty then + add m SemanticClassificationType.Function + elif isTyparTy g ty then + add m SemanticClassificationType.ValueType + else + add m SemanticClassificationType.TypeDef + | (Item.TypeVar _ ), LegitTypeOccurence, _, _, _, m -> add m SemanticClassificationType.TypeArgument - | Item.UnqualifiedType tyconRefs, LegitTypeOccurence, _, _, _, m -> - if tyconRefs |> List.exists (fun tyconRef -> tyconRef.Deref.IsStructOrEnumTycon) then - add m SemanticClassificationType.ValueType - else add m SemanticClassificationType.ReferenceType - | Item.CtorGroup(_, minfos), LegitTypeOccurence, _, _, _, m -> - if minfos |> List.exists (fun minfo -> isStructTy g minfo.ApparentEnclosingType) then - add m SemanticClassificationType.ValueType - else add m SemanticClassificationType.ReferenceType + | Item.ExnCase _, LegitTypeOccurence, _, _, _, m -> - add m SemanticClassificationType.ReferenceType - | Item.ModuleOrNamespaces refs, LegitTypeOccurence, _, _, _, m when refs |> List.exists (fun x -> x.IsModule) -> - add m SemanticClassificationType.Module + add m SemanticClassificationType.Exception + + | Item.ModuleOrNamespaces (modref :: _), LegitTypeOccurence, _, _, _, m -> + if modref.IsNamespace then + add m SemanticClassificationType.NameSpace + else + add m SemanticClassificationType.Module + | (Item.ActivePatternCase _ | Item.UnionCase _ | Item.ActivePatternResult _), _, _, _, _, m -> add m SemanticClassificationType.UnionCase - | _ -> ()) + + | Item.UnionCaseField _, _, _, _, _, m -> + add m SemanticClassificationType.UnionCaseField + + | Item.ILField _, _, _, _, _, m -> + add m SemanticClassificationType.Field + + | Item.Event _, _, _, _, _, m -> + add m SemanticClassificationType.Event + + | (Item.ArgName _ | Item.SetterArg _), _, _, _, _, m -> + add m SemanticClassificationType.NamedArgument + + | Item.SetterArg _, _, _, _, _, m -> + add m SemanticClassificationType.Property + + | Item.UnqualifiedType (tcref :: _), LegitTypeOccurence, _, _, _, m -> + if tcref.IsEnumTycon || tcref.IsILEnumTycon then + add m SemanticClassificationType.Enumeration + elif tcref.IsExceptionDecl then + add m SemanticClassificationType.Exception + elif tcref.IsFSharpDelegateTycon then + add m SemanticClassificationType.Delegate + elif tcref.IsFSharpInterfaceTycon then + add m SemanticClassificationType.Interface + elif tcref.IsFSharpStructOrEnumTycon then + add m SemanticClassificationType.ValueType + elif tcref.IsModule then + add m SemanticClassificationType.Module + elif tcref.IsNamespace then + add m SemanticClassificationType.NameSpace + elif tcref.IsUnionTycon || tcref.IsRecordTycon then + if isStructTyconRef tcref then + add m SemanticClassificationType.ValueType + else + add m SemanticClassificationType.UnionCase + elif tcref.IsILTycon then + let (TILObjectReprData (_, _, tydef)) = tcref.ILTyconInfo + + if tydef.IsInterface then + add m SemanticClassificationType.Interface + elif tydef.IsDelegate then + add m SemanticClassificationType.Delegate + elif tydef.IsEnum then + add m SemanticClassificationType.Enumeration + elif tydef.IsStruct then + add m SemanticClassificationType.ValueType + else + add m SemanticClassificationType.ReferenceType + + | _ -> + ()) results.AddRange(formatSpecifierLocations |> Array.map (fun (m, _) -> struct(m, SemanticClassificationType.Printf))) results.ToArray() ) diff --git a/src/fsharp/service/SemanticClassification.fsi b/src/fsharp/service/SemanticClassification.fsi index ff0e89a29f8..f2447219bd6 100644 --- a/src/fsharp/service/SemanticClassification.fsi +++ b/src/fsharp/service/SemanticClassification.fsi @@ -2,7 +2,6 @@ namespace FSharp.Compiler.SourceCodeServices -open FSharp.Compiler open FSharp.Compiler.AccessibilityLogic open FSharp.Compiler.Import open FSharp.Compiler.NameResolution @@ -16,10 +15,12 @@ type SemanticClassificationType = | ReferenceType | ValueType | UnionCase + | UnionCaseField | Function | Property | MutableVar | Module + | NameSpace | Printf | ComputationExpression | IntrinsicFunction @@ -27,14 +28,30 @@ type SemanticClassificationType = | Interface | TypeArgument | Operator - | Disposable + | DisposableType + | DisposableValue + | Method + | ExtensionMethod + | ConstructorForReferenceType + | ConstructorForValueType + | Literal + | RecordField + | MutableRecordField + | RecordFieldAsFunction + | Exception + | Field + | Event + | Delegate + | NamedArgument + | Value + | LocalValue + | Type + | TypeDef /// Extension methods for the TcResolutions type. [] module internal TcResolutionsExtensions = - val (|CNR|) : cnr: CapturedNameResolution -> (Item * ItemOccurence * DisplayEnv * NameResolutionEnv * AccessorDomain * range) type TcResolutions with - member GetSemanticClassification: g: TcGlobals * amap: ImportMap * formatSpecifierLocations: (range * int) [] * range: range option -> struct(range * SemanticClassificationType) [] \ No newline at end of file diff --git a/vsintegration/src/FSharp.Editor/Classification/ClassificationDefinitions.fs b/vsintegration/src/FSharp.Editor/Classification/ClassificationDefinitions.fs index 749c3ceed7a..1dea67f4f35 100644 --- a/vsintegration/src/FSharp.Editor/Classification/ClassificationDefinitions.fs +++ b/vsintegration/src/FSharp.Editor/Classification/ClassificationDefinitions.fs @@ -21,36 +21,45 @@ open FSharp.Compiler.SourceCodeServices [] module internal FSharpClassificationTypes = - let [] Function = "FSharp.Function" let [] MutableVar = "FSharp.MutableVar" - let [] Printf = "FSharp.Printf" - let [] ReferenceType = ClassificationTypeNames.ClassName - let [] Module = ClassificationTypeNames.ModuleName - let [] ValueType = ClassificationTypeNames.StructName - let [] Keyword = ClassificationTypeNames.Keyword - let [] Enum = ClassificationTypeNames.EnumName - let [] Property = "FSharp.Property" - let [] Interface = ClassificationTypeNames.InterfaceName - let [] TypeArgument = ClassificationTypeNames.TypeParameterName - let [] Operator = ClassificationTypeNames.Operator let [] Disposable = "FSharp.Disposable" let getClassificationTypeName = function - | SemanticClassificationType.ReferenceType -> ReferenceType - | SemanticClassificationType.Module -> Module - | SemanticClassificationType.ValueType -> ValueType - | SemanticClassificationType.Function -> Function + | SemanticClassificationType.MutableRecordField | SemanticClassificationType.MutableVar -> MutableVar - | SemanticClassificationType.Printf -> Printf + | SemanticClassificationType.DisposableValue + | SemanticClassificationType.DisposableType -> Disposable + | SemanticClassificationType.NameSpace -> ClassificationTypeNames.NamespaceName + | SemanticClassificationType.Exception + | SemanticClassificationType.Module + | SemanticClassificationType.Type + | SemanticClassificationType.TypeDef + | SemanticClassificationType.ConstructorForReferenceType + | SemanticClassificationType.Printf + | SemanticClassificationType.ReferenceType -> ClassificationTypeNames.ClassName + | SemanticClassificationType.ConstructorForValueType + | SemanticClassificationType.ValueType -> ClassificationTypeNames.StructName | SemanticClassificationType.ComputationExpression - | SemanticClassificationType.IntrinsicFunction -> Keyword + | SemanticClassificationType.IntrinsicFunction -> ClassificationTypeNames.Keyword | SemanticClassificationType.UnionCase - | SemanticClassificationType.Enumeration -> Enum - | SemanticClassificationType.Property -> Property - | SemanticClassificationType.Interface -> Interface - | SemanticClassificationType.TypeArgument -> TypeArgument - | SemanticClassificationType.Operator -> Operator - | SemanticClassificationType.Disposable -> Disposable + | SemanticClassificationType.Enumeration -> ClassificationTypeNames.EnumName + | SemanticClassificationType.Field + | SemanticClassificationType.UnionCaseField -> ClassificationTypeNames.FieldName + | SemanticClassificationType.Interface -> ClassificationTypeNames.InterfaceName + | SemanticClassificationType.TypeArgument -> ClassificationTypeNames.TypeParameterName + | SemanticClassificationType.Operator -> ClassificationTypeNames.Operator + | SemanticClassificationType.Function + | SemanticClassificationType.Method -> ClassificationTypeNames.MethodName + | SemanticClassificationType.ExtensionMethod -> ClassificationTypeNames.ExtensionMethodName + | SemanticClassificationType.Literal -> ClassificationTypeNames.ConstantName + | SemanticClassificationType.Property + | SemanticClassificationType.RecordFieldAsFunction + | SemanticClassificationType.RecordField -> ClassificationTypeNames.PropertyName // TODO - maybe pick something that isn't white by default like Property? + | SemanticClassificationType.NamedArgument -> ClassificationTypeNames.LabelName + | SemanticClassificationType.Event -> ClassificationTypeNames.EventName + | SemanticClassificationType.Delegate -> ClassificationTypeNames.DelegateName + | SemanticClassificationType.Value -> ClassificationTypeNames.Identifier + | SemanticClassificationType.LocalValue -> ClassificationTypeNames.LocalName module internal ClassificationDefinitions = @@ -73,13 +82,11 @@ module internal ClassificationDefinitions = let themeService = serviceProvider.GetService(typeof) :?> IVsColorThemeService themeService.CurrentTheme.ThemeId - let colorData = // name, (light, dark) - [ FSharpClassificationTypes.Function, (Colors.Black, Color.FromRgb(220uy, 220uy, 220uy)) - FSharpClassificationTypes.MutableVar, (Color.FromRgb(160uy, 128uy, 0uy), Color.FromRgb(255uy, 210uy, 28uy)) - FSharpClassificationTypes.Printf, (Color.FromRgb(43uy, 145uy, 175uy), Color.FromRgb(78uy, 220uy, 176uy)) - FSharpClassificationTypes.Property, (Colors.Black, Color.FromRgb(220uy, 220uy, 220uy)) - FSharpClassificationTypes.Disposable, (Color.FromRgb(43uy, 145uy, 175uy), Color.FromRgb(78uy, 220uy, 176uy)) ] - + let customColorData = // name, (light, dark) + [ + FSharpClassificationTypes.MutableVar, (Color.FromRgb(160uy, 128uy, 0uy), Color.FromRgb(255uy, 210uy, 28uy)) + FSharpClassificationTypes.Disposable, (Colors.Green, Color.FromRgb(2uy, 183uy, 43uy)) + ] let setColors _ = let fontAndColorStorage = serviceProvider.GetService(typeof) :?> IVsFontAndColorStorage @@ -90,15 +97,16 @@ module internal ClassificationDefinitions = let formatMap = classificationformatMapService.GetClassificationFormatMap(category = "text") try formatMap.BeginBatchUpdate() - for ctype, (light, dark) in colorData do + for ctype, (light, dark) in customColorData do // we don't touch the changes made by the user if fontAndColorStorage.GetItem(ctype, Array.zeroCreate 1) <> VSConstants.S_OK then let ict = classificationTypeRegistry.GetClassificationType(ctype) let oldProps = formatMap.GetTextProperties(ict) - let newProps = match getCurrentThemeId() with - | LightTheme -> oldProps.SetForeground light - | DarkTheme -> oldProps.SetForeground dark - | UnknownTheme -> oldProps + let newProps = + match getCurrentThemeId() with + | LightTheme -> oldProps.SetForeground light + | DarkTheme -> oldProps.SetForeground dark + | UnknownTheme -> oldProps formatMap.SetTextProperties(ict, newProps) fontAndColorStorage.CloseCategory() |> ignore finally formatMap.EndBatchUpdate() @@ -108,7 +116,7 @@ module internal ClassificationDefinitions = interface IDisposable with member __.Dispose() = VSColorTheme.remove_ThemeChanged handler member __.GetColor(ctype) = - let light, dark = colorData |> Map.ofList |> Map.find ctype + let light, dark = customColorData |> Map.ofList |> Map.find ctype match getCurrentThemeId() with | LightTheme -> Nullable light | DarkTheme -> Nullable dark @@ -116,32 +124,13 @@ module internal ClassificationDefinitions = interface ISetThemeColors with member this.SetColors() = setColors() - - [] - let FSharpFunctionClassificationType : ClassificationTypeDefinition = null - [] let FSharpMutableVarClassificationType : ClassificationTypeDefinition = null - [] - let FSharpPrintfClassificationType : ClassificationTypeDefinition = null - - [] - let FSharpPropertyClassificationType : ClassificationTypeDefinition = null [] let FSharpDisposableClassificationType : ClassificationTypeDefinition = null - [)>] - [] - [] - [] - [] - type internal FSharpFunctionTypeFormat() as self = - inherit ClassificationFormatDefinition() - - do self.DisplayName <- SR.FSharpFunctionsOrMethodsClassificationType() - [)>] [] [] @@ -153,27 +142,6 @@ module internal ClassificationDefinitions = do self.DisplayName <- SR.FSharpMutableVarsClassificationType() self.ForegroundColor <- theme.GetColor FSharpClassificationTypes.MutableVar - [)>] - [] - [] - [] - [] - type internal FSharpPrintfTypeFormat [](theme: ThemeColors) as self = - inherit ClassificationFormatDefinition() - - do self.DisplayName <- SR.FSharpPrintfFormatClassificationType() - self.ForegroundColor <- theme.GetColor FSharpClassificationTypes.Printf - - [)>] - [] - [] - [] - [] - type internal FSharpPropertyFormat() as self = - inherit ClassificationFormatDefinition() - - do self.DisplayName <- SR.FSharpPropertiesClassificationType() - [)>] [] [] diff --git a/vsintegration/tests/UnitTests/SemanticColorizationServiceTests.fs b/vsintegration/tests/UnitTests/SemanticColorizationServiceTests.fs index 46c2f265680..e1591ed0cb1 100644 --- a/vsintegration/tests/UnitTests/SemanticColorizationServiceTests.fs +++ b/vsintegration/tests/UnitTests/SemanticColorizationServiceTests.fs @@ -7,6 +7,7 @@ open Microsoft.VisualStudio.FSharp.Editor open FSharp.Compiler.SourceCodeServices open FSharp.Compiler open Microsoft.CodeAnalysis.Text +open Microsoft.CodeAnalysis.Classification [] type SemanticClassificationServiceTests() = @@ -57,13 +58,13 @@ type SemanticClassificationServiceTests() = let anyData = ranges |> List.exists (fun struct (range, sct) -> Range.rangeContainsPos range markerPos && ((FSharpClassificationTypes.getClassificationTypeName sct) = classificationType)) Assert.False(anyData, "Classification data was found when it wasn't expected.") - [] - [] - [] - [] - [] - [] - [] + [] + [] + [] + [] + [] + [] + [] member __.Measured_Types(marker: string, classificationType: string) = verifyClassificationAtEndOfMarker( """#light (*Light*)