EditorToken StoreLexerError(EditorToken token) { if (_lexerError != null) { _haveLexerErrors = true; _lexerError.OriginalValue = token.Value; token.Value = _lexerError; _lexerError = null; } return(token); }
protected SyntaxClassifierForVS(VSBuffer ctx) { _ctx = ctx; _wrappedBuffer = new TextSnapshotAsSourceFile(Buffer.CurrentSnapshot); Buffer.Changed += OnTextBufferChanged; _lexerMessageSink = new MessageSinkFromDelegate((severity, context, fmt, args) => { if (severity >= Severity.Note) { _lexerError = new LexerMessage { OriginalValue = _lexerError, Msg = new LogMessage(severity, context, fmt, args) } } ; }); InitClassificationTypes(); }
protected SyntaxClassifierForVS(VSBuffer ctx) { _ctx = ctx; _wrappedBuffer = new TextSnapshotAsSourceFile(Buffer.CurrentSnapshot); Buffer.Changed += OnTextBufferChanged; _lexerMessageSink = new MessageSinkFromDelegate((severity, context, fmt, args) => { if (severity >= Severity.Note) _lexerError = new LexerMessage { OriginalValue = _lexerError, Msg = new MessageHolder.Message(severity, context, fmt, args) }; }); InitClassificationTypes(); }
protected virtual ITagSpan <ErrorTag> LexerMessageToErrorTagSpan(ITextSnapshot vsSnapshot, Token t, LexerMessage lmsg) { StringBuilder str = new StringBuilder(); AppendMessage(str, lmsg.Msg); while (lmsg.OriginalValue is LexerMessage) { lmsg = lmsg.OriginalValue as LexerMessage; str.Append("\n"); AppendMessage(str, lmsg.Msg); } string errorType = "syntax error"; if (lmsg.Msg.Severity < Severity.Error) { errorType = "compiler warning"; } return(new TagSpan <ErrorTag>( new SnapshotSpan(Buffer.CurrentSnapshot, new Span(t.StartIndex, t.Length)), new ErrorTag(errorType, str.ToString()))); }
EditorToken StoreLexerError(EditorToken token) { if (_lexerError != null) { _haveLexerErrors = true; _lexerError.OriginalValue = token.Value; token.Value = _lexerError; _lexerError = null; } return token; }