Skip to content

Commit 1d02edc

Browse files
author
Omar Tawfik
committed
Enable identifier data tips in LanguageDebugInfoService
1 parent 262aef8 commit 1d02edc

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

vsintegration/src/FSharp.Editor/LanguageDebugInfoService.fs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,19 @@ type internal FSharpLanguageDebugInfoService() =
3939
else
4040
let token = tokens.[tokenIndex.Value]
4141

42-
let constructLiteralDataTip() =
42+
match token.ClassificationType with
43+
44+
| ClassificationTypeNames.StringLiteral ->
4345
new DebugDataTipInfo(token.TextSpan, sourceText.GetSubText(token.TextSpan).ToString())
4446

45-
let constructIdentifierDataTip() =
47+
| ClassificationTypeNames.Identifier ->
4648
let textLine = sourceText.Lines.GetLineFromPosition(position)
4749
match QuickParse.GetCompleteIdentifierIsland false (textLine.ToString()) (position - textLine.Start) with
4850
| None -> Unchecked.defaultof<DebugDataTipInfo>
49-
| Some(island, islandPosition, _) -> new DebugDataTipInfo(TextSpan.FromBounds(islandPosition, islandPosition + island.Length), island)
50-
51-
// FSROSLYNTODO: enable numeric literal and identifier data tips in VS
52-
match token.ClassificationType with
53-
| ClassificationTypeNames.NumericLiteral -> constructLiteralDataTip()
54-
| ClassificationTypeNames.StringLiteral -> constructLiteralDataTip()
55-
| ClassificationTypeNames.Identifier -> constructIdentifierDataTip()
51+
| Some(island, islandPosition, _) ->
52+
let islandDocumentStart = textLine.Start + islandPosition - 1 // TextSpan expects a zero-based absolute value
53+
new DebugDataTipInfo(TextSpan.FromBounds(islandDocumentStart, islandDocumentStart + island.Length), island)
54+
5655
| _ -> Unchecked.defaultof<DebugDataTipInfo>
5756

5857

0 commit comments

Comments
 (0)