Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor fixes #4623

Merged
merged 5 commits into from
Aug 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Python/Product/Analysis/Interpreter/Ast/AstPythonModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,11 @@ private static string TryGetDocFromModuleInitFile(string filePath) {
return line.Substring(quote.Length, line.Length - 2 * quote.Length).Trim();
}
var sb = new StringBuilder();
// Handle '''Text right here
line = line.Substring(quote.Length).Trim();
if (!string.IsNullOrEmpty(line)) {
sb.AppendLine(line);
}
while (true) {
line = sr.ReadLine();
if (line == null || line.EndsWithOrdinal(quote)) {
Expand Down
13 changes: 10 additions & 3 deletions Python/Product/Analysis/OverloadResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,14 @@ internal override OverloadResult WithoutLeadingParameters(int skipCount = 1) {
return new BuiltinFunctionOverloadResult(_projectState, Name, _overload, skipCount, _fallbackDoc);
}

public override string Documentation => _doc;
public override string Documentation {
get {
if (_docTask != null) {
_docTask.Wait(200);
}
return _doc;
}
}

private void Calculate() {
// initially fill in w/ a string saying we don't yet have the documentation
Expand All @@ -309,8 +316,8 @@ public override string ToString() {
}

private void DocCalculator() {
StringBuilder doc = new StringBuilder();
if (!String.IsNullOrEmpty(_overload.Documentation)) {
var doc = new StringBuilder();
if (!string.IsNullOrEmpty(_overload.Documentation)) {
doc.AppendLine(_overload.Documentation);
}

Expand Down
2 changes: 1 addition & 1 deletion Python/Product/Analysis/Values/BuiltinNamespace.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,6 @@ public override bool Equals(object obj) {
return false;
}

public override int GetHashCode() => new { hc1 = GetType().GetHashCode(), hc2 = _type.GetHashCode() }.GetHashCode();
public override int GetHashCode() => new { hc1 = GetType().GetHashCode(), hc2 = _type?.GetHashCode() }.GetHashCode();
}
}