public HaxeComplete(ScintillaControl sci, ASExpr expr, bool autoHide, IHaxeCompletionHandler completionHandler) { Sci = sci; Expr = expr; AutoHide = autoHide; handler = completionHandler; Status = HaxeCompleteStatus.NONE; FileName = PluginBase.MainForm.CurrentDocument.FileName; }
public HaxeComplete(ScintillaControl sci, ASExpr expr, bool autoHide, IHaxeCompletionHandler completionHandler) { Sci = sci; Expr = expr; AutoHide = autoHide; handler = completionHandler; Status = HaxeCompleteStatus.NONE; FileName = PluginBase.MainForm.CurrentDocument.FileName; }
private void StartThread <T>(HaxeCompleteResultHandler <T> callback, Func <T> resultFunc) { SaveFile(); ThreadPool.QueueUserWorkItem(_ => { Status = ParseLines(handler.GetCompletion(BuildHxmlArgs(), GetFileContent())); Notify(callback, resultFunc()); }); }
/* EXECUTION */ public void GetList(HaXeCompletionResultHandler callback) { PluginBase.MainForm.CallCommand("Save", null); ThreadPool.QueueUserWorkItem(_ => { Status = ParseLines(handler.GetCompletion(BuildHxmlArgs())); Notify(callback); }); }
/* EXECUTION */ public void GetList(HaXeCompletionResultHandler callback) { PluginBase.MainForm.CallCommand("Save", null); ThreadPool.QueueUserWorkItem(_ => { Status = ParseLines(handler.GetCompletion(BuildHxmlArgs())); Notify(callback); }); }
private void StartThread <T>(HaxeCompleteResultHandler <T> callback, Func <T> resultFunc) { PluginBase.MainForm.CallCommand("Save", null); ThreadPool.QueueUserWorkItem(_ => { Status = ParseLines(handler.GetCompletion(BuildHxmlArgs())); Notify(callback, resultFunc()); }); }
public HaxeComplete(ScintillaControl sci, ASExpr expr, bool autoHide, IHaxeCompletionHandler completionHandler, HaxeCompilerService compilerService) { Sci = sci; Expr = expr; CurrentWord = Sci.GetWordFromPosition(Sci.CurrentPos); AutoHide = autoHide; handler = completionHandler; CompilerService = compilerService; Status = HaxeCompleteStatus.NONE; FileName = PluginBase.MainForm.CurrentDocument.FileName; }
public HaxeComplete(ScintillaControl sci, ASExpr expr, bool autoHide, IHaxeCompletionHandler completionHandler, HaxeCompilerService compilerService, SemVer haxeVersion) { Sci = sci; Expr = expr; CurrentWord = Sci.GetWordFromPosition(Sci.CurrentPos); AutoHide = autoHide; handler = completionHandler; CompilerService = compilerService; Status = HaxeCompleteStatus.NONE; FileName = sci.FileName; this.haxeVersion = haxeVersion; }
void OnHaxeCompleteResultHandler(HaxeComplete hc, List <HaxePositionResult> result, HaxeCompleteStatus status) { var results = new FRResults(); switch (status) { case HaxeCompleteStatus.ERROR: TraceManager.AddAsync(hc.Errors, -3); break; case HaxeCompleteStatus.USAGE: if (!IgnoreDeclarationSource) { var sci = ASContext.CurSciControl; var path = sci.FileName; if (!results.ContainsKey(path)) { results.Add(path, new List <SearchMatch>()); } var index = hc.Expr.PositionExpression; var line = sci.LineFromPosition(index); var lineStart = sci.PositionFromLine(line); var lineEnd = sci.LineEndPosition(line); var lineText = sci.GetLine(line); var value = hc.Expr.Value; results[path].Add(new SearchMatch { Column = index - lineStart, Index = index, Length = value.Length, Line = line + 1, LineStart = lineStart, LineEnd = lineEnd, LineText = lineText, Value = value }); } foreach (var it in result) { var path = it.Path; if (!results.ContainsKey(path)) { results.Add(path, new List <SearchMatch>()); } var matches = results[path]; var sci = AssociatedDocumentHelper.LoadDocument(path).SciControl; var line = it.LineStart - 1; var lineStart = sci.PositionFromLine(line); var lineEnd = sci.LineEndPosition(line); var lineText = sci.GetLine(line); var value = lineText.Substring(it.CharacterStart, it.CharacterEnd - it.CharacterStart); matches.Add(new SearchMatch { Column = it.CharacterStart, Index = lineStart + it.CharacterStart, Length = value.Length, Line = line + 1, LineStart = lineStart, LineEnd = lineEnd, LineText = lineText, Value = value }); } break; } FindFinished(results); }
private void HandlePositionResult(HaxeComplete hc, HaxePositionResult result, HaxeCompleteStatus status) { switch (status) { case HaxeCompleteStatus.ERROR: TraceManager.Add(hc.Errors, -3); break; case HaxeCompleteStatus.POSITION: if (result == null) return; ASComplete.SaveLastLookupPosition(hc.Sci); PluginBase.MainForm.OpenEditableDocument(result.Path, false); const string keywords = "(function|var|[,(])"; ASComplete.LocateMember(keywords, hc.CurrentWord, result.LineStart - 1); break; } }
internal void OnPositionResult(HaxeComplete hc, HaxePositionResult result, HaxeCompleteStatus status) { if (hc.Sci.InvokeRequired) { hc.Sci.BeginInvoke((MethodInvoker)delegate { HandlePositionResult(hc, result, status); }); } else HandlePositionResult(hc, result, status); }
internal void OnFunctionCompletionResult(HaxeComplete hc, HaxeCompleteResult result, HaxeCompleteStatus status) { resolvingFunction = false; switch (status) { case HaxeCompleteStatus.ERROR: TraceManager.AddAsync(hc.Errors, -3); break; case HaxeCompleteStatus.TYPE: hc.Expr.Position--; ASComplete.FunctionContextResolved(hc.Sci, hc.Expr, result.Type, null, true); break; } }
internal void OnDotCompletionResult(HaxeComplete hc, HaxeCompleteResult result, HaxeCompleteStatus status) { resolvingDot = false; switch (status) { case HaxeCompleteStatus.ERROR: TraceManager.AddAsync(hc.Errors, -3); break; case HaxeCompleteStatus.MEMBERS: if (result.Members != null && result.Members.Count > 0) ASComplete.DotContextResolved(hc.Sci, hc.Expr, result.Members, hc.AutoHide); break; case HaxeCompleteStatus.TYPE: // eg. Int break; } }
internal void OnCheckSyntaxResult(HaxeComplete hc, HaxeCompleteResult result, HaxeCompleteStatus status) { switch (status) { case HaxeCompleteStatus.ERROR: TraceManager.Add(hc.Errors); EventManager.DispatchEvent(this, new TextEvent(EventType.ProcessEnd, "Done(1)")); break; default: EventManager.DispatchEvent(this, new TextEvent(EventType.ProcessEnd, "Done(0)")); break; } }
void AddDiagnosticsResults(List <LintingResult> list, HaxeCompleteStatus status, List <HaxeDiagnosticsResult> results, HaxeComplete hc) { if (status == HaxeCompleteStatus.DIAGNOSTICS && results != null) { foreach (var res in results) { var range = res.Range ?? res.Args.Range; var result = new LintingResult { File = range.Path, FirstChar = range.CharacterStart, Length = range.CharacterEnd - range.CharacterStart, Line = range.LineStart + 1, }; switch (res.Severity) { case HaxeDiagnosticsSeverity.INFO: result.Severity = LintingSeverity.Info; break; case HaxeDiagnosticsSeverity.ERROR: result.Severity = LintingSeverity.Error; break; case HaxeDiagnosticsSeverity.WARNING: result.Severity = LintingSeverity.Warning; break; default: continue; } switch (res.Kind) { case HaxeDiagnosticsKind.UnusedImport: result.Description = TextHelper.GetString("Info.UnusedImport"); break; case HaxeDiagnosticsKind.UnresolvedIdentifier: result.Description = TextHelper.GetString("Info.UnresolvedIdentifier"); break; case HaxeDiagnosticsKind.CompilerError: case HaxeDiagnosticsKind.RemovableCode: result.Description = res.Args.Description; break; default: //in case new kinds are added in new compiler versions continue; } list.Add(result); } } else if (status == HaxeCompleteStatus.ERROR) { PluginBase.RunAsync(() => { TraceManager.Add(hc.Errors, (int)TraceType.Error); }); } }