public static void DoWork(string targetFile)
 {
     // ensure we have a ParseAttribute for this file
     //if (!ParseStatus.ContainsKey(targetFile))
     //{
     //    ParseStatus.Add(targetFile, new ParseAttribute());
     //}
     //ParseStatusController.EnsureExists(targetFile);
     //bool IsReparsing = false;
     //lock(_synchronizationParseStatus) {
     //    IsReparsing = ParseStatus[targetFile].IsReparsing;
     //}
     if (ParseStatusController.IsReparsing(targetFile))
     {
         // TODO what is this for? does it help with threading? (probably not)
         Thread.Sleep(50);
     }
     else
     {
         lock (_synchronizationParseStatus)
         {
             ParseStatus[targetFile].IsReparsing = true;
         }
         VerilogGlobals.ReparseWork(threadbuffer, threadFile);
         // TODO once reparsing is done in a thread, we need to tell the viewport to redraww the screen
         Thread.Sleep(10);
     }
 }
 // Step 4: The event handlers both call the UpdateAtCaretPosition method.
 void ViewLayoutChanged(object sender, TextViewLayoutChangedEventArgs e)
 {
     // If a new snapshot wasn't generated, then skip this layout 
     if (e.NewSnapshot != e.OldSnapshot)
     {
         UpdateAtCaretPosition(View.Caret.Position);
         string thisFile = VerilogLanguage.VerilogGlobals.GetDocumentPath(View.TextSnapshot);
         //VerilogGlobals.ParseStatus_EnsureExists(thisFile);
         //VerilogGlobals.ParseStatus[thisFile].NeedReparse = true;
         // VerilogGlobals.ParseStatus_NeedReparse_SetValue(thisFile, true);
         ParseStatusController.NeedReparse_SetValue(thisFile, true);
         //VerilogGlobals.NeedReparse = true;
         VerilogGlobals.Reparse(SourceBuffer, thisFile);
     }
 }
Пример #3
0
            public static void DoWork(string targetFile)
            {
                // ensure we have a ParseAttribute for this file
                //if (!ParseStatus.ContainsKey(targetFile))
                //{
                //    ParseStatus.Add(targetFile, new ParseAttribute());
                //}
                //ParseStatusController.EnsureExists(targetFile);
                //bool IsReparsing = false;
                //lock(_synchronizationParseStatus) {
                //    IsReparsing = ParseStatus[targetFile].IsReparsing;
                //}
                if (ParseStatusController.IsReparsing(targetFile))
                {
                    // TODO what is this for? does it help with threading? (probably not)
                    System.Diagnostics.Debug.WriteLine("DoWork called while IsReparsing...");

                    Thread.Sleep(50);
                }
                else
                {
                    lock (_synchronizationParseStatus)
                    {
                        ParseStatus[targetFile].IsReparsing = true;
                    }
                    //if ( 1==1 || (DateTime.Now - LastRefresh).TotalSeconds > 10)
                    //{
                    //    System.Diagnostics.Debug.WriteLine("BufferAttributes calling ReparseWork");
                    VerilogGlobals.ReparseWork(threadbuffer, threadFile);
                    //    LastRefresh = DateTime.Now;
                    //}


                    // TODO once reparsing is done in a thread, we need to tell the viewport to redraww the screen
                    // does this redraw?
                    // TheView.Selection.TextView.ViewScroller.ScrollViewportVerticallyByPixels(0);

                    Thread.Sleep(10);
                }
            }