Skip to content

Commit

Permalink
colorize modules (#2036)
Browse files Browse the repository at this point in the history
fixed: namespaces are colorized as part of qualified names
  • Loading branch information
vasily-kirichenko authored and KevinRansom committed Dec 17, 2016
1 parent 8e07ffe commit 7b99170
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/fsharp/vs/service.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)) |]

Expand Down

0 comments on commit 7b99170

Please sign in to comment.