提交 44af823c 编写于 作者: K Kevin Ransom (msft) 提交者: GitHub

Merge pull request #3102 from vasily-kirichenko/fix-exception-coloring

Color F# exceptions as ref types / fix coloring of backticked enum fields
......@@ -1231,6 +1231,8 @@ type TypeCheckInfo
if minfos |> List.exists (fun minfo -> isStructTy g minfo.EnclosingType) then
Some (m, SemanticClassificationType.ValueType)
else Some (m, SemanticClassificationType.ReferenceType)
| CNR(_, Item.ExnCase _, LegitTypeOccurence, _, _, _, m) ->
Some (m, SemanticClassificationType.ReferenceType)
| CNR(_, Item.ModuleOrNamespaces refs, LegitTypeOccurence, _, _, _, m) when refs |> List.exists (fun x -> x.IsModule) ->
Some (m, SemanticClassificationType.Module)
| CNR(_, (Item.ActivePatternCase _ | Item.UnionCase _ | Item.ActivePatternResult _), _, _, _, _, m) ->
......
......@@ -610,9 +610,15 @@ module internal Tokenizer =
/// Fix invalid span if it appears to have redundant suffix and prefix.
let fixupSpan (sourceText: SourceText, span: TextSpan) : TextSpan =
let text = sourceText.GetSubText(span).ToString()
match text.LastIndexOf '.' with
| -1 | 0 -> span
| index -> TextSpan(span.Start + index + 1, text.Length - index - 1)
// backticked ident
if text.EndsWith "``" then
match text.[..text.Length - 3].LastIndexOf "``" with
| -1 | 0 -> span
| index -> TextSpan(span.Start + index, text.Length - index)
else
match text.LastIndexOf '.' with
| -1 | 0 -> span
| index -> TextSpan(span.Start + index + 1, text.Length - index - 1)
let isValidNameForSymbol (lexerSymbolKind: LexerSymbolKind, symbol: FSharpSymbol, name: string) : bool =
let doubleBackTickDelimiter = "``"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册