public override SemanticTokensOrSemanticTokensEdits GetSemanticTokensEdits(RazorCodeDocument codeDocument, string previousResultId) { if (codeDocument is null) { throw new ArgumentNullException(nameof(codeDocument)); } var semanticRanges = TagHelperSemanticRangeVisitor.VisitAllNodes(codeDocument); IReadOnlyList <uint> previousResults = null; if (previousResultId != null) { _semanticTokensCache.TryGetValue(previousResultId, out previousResults); } var newTokens = ConvertSemanticRangesToSemanticTokens(semanticRanges, codeDocument); if (previousResults is null) { return(newTokens); } var semanticEdits = SemanticTokensEditsDiffer.ComputeSemanticTokensEdits(newTokens, previousResults); return(semanticEdits); }
public override SemanticTokensOrSemanticTokensEdits GetSemanticTokensEdits(RazorCodeDocument codeDocument, string previousResultId) { if (codeDocument is null) { throw new ArgumentNullException(nameof(codeDocument)); } var semanticRanges = TagHelperSemanticRangeVisitor.VisitAllNodes(codeDocument); var previousResults = previousResultId is null ? null : _semanticTokensCache.Get(previousResultId); var newTokens = ConvertSemanticRangesToSemanticTokens(semanticRanges, codeDocument); if (previousResults is null) { return(newTokens); } var semanticEdits = SemanticTokensEditsDiffer.ComputeSemanticTokensEdits(newTokens, previousResults); return(semanticEdits); }