/// <summary>Used for code completion/symbol resolution.</summary> /// <param name="editor">Can be null</param> public static ISyntaxRegion GetScopedCodeObject(IEditorData editor) { IStatement stmt; var block = SearchBlockAt(editor.SyntaxTree, editor.CaretLocation, out stmt); var vis = new ScopedObjectVisitor(editor.CaretLocation); if (stmt != null) { stmt.Accept(vis); } else { block.Accept(vis); } return(vis.IdNearCaret); }
/// <summary>Used for code completion/symbol resolution.</summary> /// <param name="editor">Can be null</param> public static ISyntaxRegion GetScopedCodeObject(IEditorData editor) { var block = SearchBlockAt(editor.SyntaxTree, editor.CaretLocation); IStatement stmt = null; if (block is DMethod) { stmt = (block as DMethod).GetSubBlockAt(editor.CaretLocation); } var vis = new ScopedObjectVisitor(editor.CaretLocation); if (stmt != null) { stmt.Accept(vis); } else { block.Accept(vis); } return(vis.IdNearCaret); }