/// <summary> /// Rebuilds the entire database /// </summary> /// <param name="project"></param> private void DoRebuild(ILuaIntellisenseProject project) { DoClear(); DoLoadStandardLibrary(); lock (this) { // use default or user-supplied method for script registration(s) if (m_broker.CustomScriptRegistrationHandler != null) { var documents = new List <ILuaIntellisenseDocument>(); m_broker.CustomScriptRegistrationHandler(m_stdLibs, ref m_scripts, ref documents); foreach (var document in documents) { ParseScript(document); } } else { foreach (ILuaIntellisenseDocument document in project.AllDocuments) { RegisterScript(document, m_stdLibs); ParseScript(document); } } } }
public void ProjectOpened(ILuaIntellisenseProject project) { m_project = project; foreach (var document in project.OpenDocuments) RegisterIntellipromptTipImageHandler(document); ProjectModified(m_project); }
public void ProjectOpened(ILuaIntellisenseProject project) { m_project = project; foreach (var document in project.OpenDocuments) { RegisterIntellipromptTipImageHandler(document); } ProjectModified(m_project); }
private static string GetReferenceText(LuatValue.IReference reference, ILuaIntellisenseProject project) { string fileContents; { var uri = new Uri(reference.Path); var document = project[uri]; var useOpenDocument = (document != null) && (!string.IsNullOrEmpty(document.Contents)); try { fileContents = useOpenDocument ? document.Contents : System.IO.File.ReadAllText(uri.LocalPath); } catch (Exception ex) { fileContents = string.Empty; ex.ToString(); } fileContents = fileContents.Replace("\r\n", "\n"); } if (string.IsNullOrEmpty(fileContents)) { return(reference.DisplayText); } int lineStart, lineEnd; for (lineStart = reference.TextRange.StartOffset; lineStart > 0; --lineStart) { if (fileContents[lineStart] == '\n') { ++lineStart; break; } } for (lineEnd = reference.TextRange.StartOffset; lineEnd < fileContents.Length; ++lineEnd) { if (fileContents[lineEnd] == '\n') { break; } } return(fileContents.Substring(lineStart, lineEnd - lineStart)); }
public static void RegisterProject(ILuaIntellisenseProject project, LuatTable stdLibs, ref List<LuatScript> scripts, ref List<ILuaIntellisenseDocument> documents) { if (project == null) return; var allDocuments = new List<ILuaIntellisenseDocument>(project.AllDocuments); documents.AddRange(allDocuments); foreach (var document in allDocuments) { var script = CreateLuatScript(document); script.Table.SetMetadataIndexTable(stdLibs); AddSledSpecificFunctions(script.Table); scripts.Add(script); } }
public void ProjectModified(ILuaIntellisenseProject project) { if (project != m_project) return; if (project == null) { Database.Clear(); Database.LoadStandardLibrary(); } else { Database.Rebuild(project); } TaskQueue.AddTask(ReparseOpenDocuments, TaskQueue.Thread.UI); }
public void ProjectModified(ILuaIntellisenseProject project) { if (project != m_project) { return; } if (project == null) { Database.Clear(); Database.LoadStandardLibrary(); } else { Database.Rebuild(project); } TaskQueue.AddTask(ReparseOpenDocuments, TaskQueue.Thread.UI); }
public static void RegisterProject(ILuaIntellisenseProject project, LuatTable stdLibs, ref List <LuatScript> scripts, ref List <ILuaIntellisenseDocument> documents) { if (project == null) { return; } var allDocuments = new List <ILuaIntellisenseDocument>(project.AllDocuments); documents.AddRange(allDocuments); foreach (var document in allDocuments) { var script = CreateLuatScript(document); script.Table.SetMetadataIndexTable(stdLibs); AddSledSpecificFunctions(script.Table); scripts.Add(script); } }
/// <summary> /// Queues a reload of the entire database /// </summary> /// <param name="project"></param> public void Rebuild(ILuaIntellisenseProject project) { m_taskQueue.AddTask(() => DoRebuild(project), TaskQueue.Thread.Worker); }
/// <summary> /// Rebuilds the entire database /// </summary> /// <param name="project"></param> private void DoRebuild(ILuaIntellisenseProject project) { DoClear(); DoLoadStandardLibrary(); lock (this) { // use default or user-supplied method for script registration(s) if (m_broker.CustomScriptRegistrationHandler != null) { var documents = new List<ILuaIntellisenseDocument>(); m_broker.CustomScriptRegistrationHandler(m_stdLibs, ref m_scripts, ref documents); foreach (var document in documents) ParseScript(document); } else { foreach (ILuaIntellisenseDocument document in project.AllDocuments) { RegisterScript(document, m_stdLibs); ParseScript(document); } } } }
private static string GetReferenceText(LuatValue.IReference reference, ILuaIntellisenseProject project) { string fileContents; { var uri = new Uri(reference.Path); var document = project[uri]; var useOpenDocument = (document != null) && (!string.IsNullOrEmpty(document.Contents)); try { fileContents = useOpenDocument ? document.Contents : System.IO.File.ReadAllText(uri.LocalPath); } catch (Exception ex) { fileContents = string.Empty; ex.ToString(); } fileContents = fileContents.Replace("\r\n", "\n"); } if (string.IsNullOrEmpty(fileContents)) return reference.DisplayText; int lineStart, lineEnd; for (lineStart = reference.TextRange.StartOffset; lineStart > 0; --lineStart) { if (fileContents[lineStart] == '\n') { ++lineStart; break; } } for (lineEnd = reference.TextRange.StartOffset; lineEnd < fileContents.Length; ++lineEnd) { if (fileContents[lineEnd] == '\n') { break; } } return fileContents.Substring(lineStart, lineEnd - lineStart); }