static void Work() { FileManager.ClearData(); isScanning = true; isBreak = false; try { //var names = System.IO.Directory.EnumerateFiles(BabePackage.Current.CurrentSetting.Folder, "*.lua", System.IO.SearchOption.AllDirectories).Where((name) => { return name.ToLower().EndsWith(".lua"); }); var names = new List <string>(); EnumFiles(BabePackage.Current.CurrentSetting.Folder, "*.lua", names); int count = 0; foreach (var name in names) { if (isBreak) { isBreak = false; return; } var tp = new TreeParser(); tp.HandleFile(name); BabePackage.DTEHelper.GetStatusBar().Progress(true, "scan", ++count, names.Count()); } } finally { isScanning = false; BabePackage.DTEHelper.GetStatusBar().Progress(false); BabePackage.WindowManager.RefreshOutlineWnd(); GC.Collect(); } }
private OuterCompletionData() : base(null, null) { var path = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)); if (!System.IO.Directory.Exists(path)) { return; } var files = System.IO.Directory.EnumerateFiles(path, "*.lua", System.IO.SearchOption.AllDirectories); var parser = new TreeParser(); foreach (var file in files) { var Lf = parser.ParseFile(file); if (Lf != null) { this.Members.AddRange(Lf.Members); } } string[] keywords = { "and", "break", "do", "else", "elseif", "end", "false", "for", "function", "if", "in", "local", "nil", "not", "or", "repeat", "return", "then", "true", "until", "while" }; foreach (var str in keywords) { this.Members.Add(new LuaMember(null, str, -1, -1)); } }
public static void Refresh(Irony.Parsing.ParseTree tree) { if (isScanning) { return; } var file = FileManager.CurrentFile; if (file == null || BabePackage.DTEHelper.DTE.ActiveDocument == null || file.Path != BabePackage.DTEHelper.DTE.ActiveDocument.FullName) { return; } if (System.IO.File.Exists(file.Path)) { var tp = new TreeParser(); tp.Refresh(tree); BabePackage.WindowManager.RefreshEditorOutline(); BabePackage.WindowManager.RefreshOutlineWnd(); } else { //文件已经被移除 IntellisenseHelper.RemoveFile(file.Path); FileManager.CurrentFile = null; } }
static void Work() { FileManager.ClearData(); isScanning = true; isBreak = false; var names = System.IO.Directory.GetFiles(BabePackage.Current.CurrentSetting.Folder, "*.lua", System.IO.SearchOption.AllDirectories).Where((name) => { return(name.ToLower().EndsWith(".lua")); }); int count = 0; foreach (var name in names) { if (isBreak) { isBreak = false; return; } var tp = new TreeParser(); tp.HandleFile(name); DTEHelper.Current.GetStatusBar().Progress(true, "scan", ++count, names.Count()); } isScanning = false; DTEHelper.Current.GetStatusBar().Progress(false); DTEHelper.Current.RefreshOutlineWnd(); }
static void Work() { FileManager.ClearData(); isScanning = true; isBreak = false; var names = System.IO.Directory.GetFiles(BabePackage.Current.CurrentSetting.Folder, "*.lua", System.IO.SearchOption.AllDirectories).Where((name) => { return name.ToLower().EndsWith(".lua"); }); int count = 0; foreach (var name in names) { if (isBreak) { isBreak = false; return; } var tp = new TreeParser(); tp.HandleFile(name); DTEHelper.Current.GetStatusBar().Progress(true, "scan", ++count, names.Count()); } isScanning = false; DTEHelper.Current.GetStatusBar().Progress(false); DTEHelper.Current.RefreshOutlineWnd(); }
public static void SetCurrentFile(string file) { var tp = new TreeParser(); tp.HandleFile(file); FileManager.Instance.SetActiveFile(file); System.Diagnostics.Debug.Print("Current File is : " + file); }
public static void SetCurrentFile(string file) { var tp = new TreeParser(); tp.HandleFile(file); FileManager.Instance.SetActiveFile(file); BabePackage.WindowManager.RefreshEditorOutline(); System.Diagnostics.Debug.Print("Current File is : " + file); }
public static void Refresh(Irony.Parsing.ParseTree tree) { if (isScanning) return; var file = FileManager.CurrentFile; if (file == null || DTEHelper.Current.DTE.ActiveDocument == null || file.File != DTEHelper.Current.DTE.ActiveDocument.FullName) return; if (System.IO.File.Exists(file.File)) { var tp = new TreeParser(); tp.Refresh(tree); DTEHelper.Current.RefreshEditorOutline(); DTEHelper.Current.RefreshOutlineWnd(); } else { //文件已经被移除 IntellisenseHelper.RemoveFile(file.File); FileManager.CurrentFile = null; } }