Skip to content
This repository was archived by the owner on Apr 14, 2022. It is now read-only.

Make sure tuple protocol name does not ignore unknown parameter types #206

Merged
merged 5 commits into from
Oct 5, 2018
Merged

Make sure tuple protocol name does not ignore unknown parameter types #206

merged 5 commits into from
Oct 5, 2018

Conversation

MikhailArkhipov
Copy link

Additional fix for #173 since 'SelectMany' drops empty sequences and tuples lose arguments of unknown type making them look like they have fewer arguments.

return sb.ToString();
}

private string GetParameterString(AnalysisValue[] sets) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can reuse the same StringBuilder here.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point

return "?";
}
var sb = new StringBuilder();
if (sets.Length > 1) {
Copy link
Contributor

@AlexanderSher AlexanderSher Oct 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be simplified:

If (sets.Length == 1) {
    sb.Append(sets[0] is IHasQualifiedName qn ? qn.FullyQualifiedName : sets[0].ShortDescription)
} else {
    // remaining code
}

}
for (var i = 0; i < sets.Length; i++) {
if (i > 0) {
sb.Append(", ");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

", " or ","?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

", " more readable

// Enumerate manually since SelectMany drops empty/unknown values
var sb = new StringBuilder("tuple[");
for (var i = 0; i < _values.Length; i++) {
if (i > 0) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MikhailArkhipov MikhailArkhipov merged commit 306f568 into microsoft:master Oct 5, 2018
jakebailey pushed a commit to jakebailey/python-language-server that referenced this pull request Nov 1, 2019
Make sure tuple protocol name does not ignore unknown parameter types
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants