From e1fa3d6897d0bbf01a136773aa24bb85e676bfa5 Mon Sep 17 00:00:00 2001 From: Vasily Kirichenko Date: Sat, 17 Dec 2016 17:54:36 +0300 Subject: [PATCH] colorize modules fixed: namespaces are colorized as part of qualified names --- src/fsharp/vs/service.fs | 7 +++++++ .../FSharp.Editor/Classification/ColorizationService.fs | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/fsharp/vs/service.fs b/src/fsharp/vs/service.fs index 9d7de558dbb..7bb1fbdff35 100755 --- a/src/fsharp/vs/service.fs +++ b/src/fsharp/vs/service.fs @@ -1425,6 +1425,13 @@ type TypeCheckInfo | ItemOccurence.Binding _ | ItemOccurence.Pattern _), _, _, _, m) -> Some (m, FSharpTokenColorKind.TypeName) + | CNR(_, Item.ModuleOrNamespaces refs, + ( ItemOccurence.UseInType + | ItemOccurence.UseInAttribute + | ItemOccurence.Use _ + | ItemOccurence.Binding _ + | ItemOccurence.Pattern _), _, _, _, m) when refs |> List.exists (fun x -> x.IsModule) -> + Some (m, FSharpTokenColorKind.TypeName) | _ -> None) |> Seq.toArray diff --git a/vsintegration/src/FSharp.Editor/Classification/ColorizationService.fs b/vsintegration/src/FSharp.Editor/Classification/ColorizationService.fs index dccb2e71794..279271fb2e4 100644 --- a/vsintegration/src/FSharp.Editor/Classification/ColorizationService.fs +++ b/vsintegration/src/FSharp.Editor/Classification/ColorizationService.fs @@ -59,7 +59,7 @@ type internal FSharpColorizationService | FSharpCheckFileAnswer.Aborted -> [| |] | FSharpCheckFileAnswer.Succeeded(results) -> [| for (range, tokenColorKind) in results.GetExtraColorizationsAlternate() do - let span = CommonRoslynHelpers.FSharpRangeToTextSpan(sourceText, range) + let span = CommonHelpers.fixupSpan(sourceText, CommonRoslynHelpers.FSharpRangeToTextSpan(sourceText, range)) if textSpan.Contains(span.Start) || textSpan.Contains(span.End - 1) || span.Contains(textSpan) then yield ClassifiedSpan(span, CommonHelpers.compilerTokenToRoslynToken(tokenColorKind)) |]