/// <summary> /// Gets the <see cref="DotNetContext"/> for the specified offset. /// </summary> /// <param name="syntaxEditor">The <see cref="SyntaxEditor"/> to examine.</param> /// <param name="offset">The offset at which to base the context.</param> /// <param name="beforeOffset">Whether to return the context before the offset.</param> /// <param name="forParameterInfo">Whether to return the context for parameter info.</param> /// <returns>The <see cref="DotNetContext"/> for the specified offset.</returns> protected DotNetContext GetContext(SyntaxEditor syntaxEditor, int offset, bool beforeOffset, bool forParameterInfo) { // Get the compilation unit and project resolver CompilationUnit compilationUnit = syntaxEditor.Document.SemanticParseData as CompilationUnit; DotNetProjectResolver projectResolver = syntaxEditor.Document.LanguageData as DotNetProjectResolver; // Get the context if (beforeOffset) { return(CSharpContext.GetContextBeforeOffset(syntaxEditor.Document, offset, compilationUnit, projectResolver, forParameterInfo)); } else { return(CSharpContext.GetContextAtOffset(syntaxEditor.Document, offset, compilationUnit, projectResolver)); } }