private void AddMessages(Source source, AuthoringSink sink, ParseTree parseTree) { var messages = parseTree.ParserMessages; foreach (var message in messages) { var line = source.GetLine(message.Location.Line); var nextSpace = line.Length; if (line.Length > message.Location.Column) nextSpace = line.IndexOfAny(" \t\n\r".ToCharArray(), message.Location.Column + 1); if (nextSpace == -1) nextSpace = line.Length; var span = new TextSpan { iStartLine = message.Location.Line, iStartIndex = message.Location.Column, iEndLine = message.Location.Line, iEndIndex = nextSpace }; var severity = Severity.Hint; switch (message.Level) { case ParserErrorLevel.Info: severity = Severity.Hint; break; case ParserErrorLevel.Warning: severity = Severity.Warning; break; case ParserErrorLevel.Error: severity = Severity.Error; break; } sink.AddError(source.GetFilePath(), message.Message, span, severity); } }
//public override IScanner GetScanner(Microsoft.VisualStudio.Text.ITextBuffer buffer) { //public override CodeWindowManager CreateCodeWindowManager(IVsCodeWindow codewindow, Source source) { // NSCodeWindow nscw = new NSCodeWindow(codewindow, source); // return nscw; //} public override void OnCloseSource(Source source) { string codefile_path = source.GetFilePath(); if (filelist.ContainsKey(codefile_path)) { string dirty_file = filelist[codefile_path]; filelist.Remove(codefile_path); if (File.Exists(dirty_file)) { try { File.Delete(dirty_file); } catch (Exception ex) { NSUtil.DebugPrintAlways("Error deleting temp file:" + ex.Message); } } NimBaseFileCreate(); } base.OnCloseSource(source); return; //CodeWindowManager cwm = GetCodeWindowManagerForSource(source); //if (cwm != null) { // IVsTextView tv; // cwm.CodeWindow.GetLastActiveView(out tv); // if (tv != null) // tv.CloseView(); //} //source.Close(); //base.OnCloseSource(source); }