public IEnumerable <Token> GetErrorTokens() { var tokens = snippets.Where(s => s.Type != SnippetType.Class).SelectMany(s => { var diagnostics = workspace.GetDiagnostics(documentId, s.Offset, s.Length); return(diagnostics.Where(d => d.Severity == DiagnosticSeverity.Error || d.Severity == DiagnosticSeverity.Warning).Select(diagnostic => { var quickInfo = diagnostic.GetMessage(); var isError = diagnostic.Severity == DiagnosticSeverity.Error; quickInfo = quickInfo.Replace("__Typewriter.", string.Empty); //quickInfo = quickInfo.Replace("__Code.", string.Empty); return new Token { QuickInfo = quickInfo, IsError = isError, Start = s.FromShadowIndex(diagnostic.Location.SourceSpan.Start), Length = diagnostic.Location.SourceSpan.Length }; })); }); return(tokens); }
public IEnumerable <Token> GetErrorTokens() { var tokens = snippets.Where(s => s.Type != SnippetType.Class).SelectMany(s => { var diagnostics = workspace.GetDiagnostics(documentId, s.Offset, s.Length); return(diagnostics.Select(diagnostic => new Token { QuickInfo = diagnostic.GetMessage(), Start = s.FromShadowIndex(diagnostic.Location.SourceSpan.Start), Length = diagnostic.Location.SourceSpan.Length })); }); return(tokens); }