Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Rework passing array literal to native commands#5301

Merged
daxian-dbw merged 2 commits into
PowerShell:masterPowerShell/PowerShell:masterfrom
lzybkr:fix_array_native_argslzybkr/PowerShell:fix_array_native_argsCopy head branch name to clipboard
Nov 7, 2017
Merged

Rework passing array literal to native commands#5301
daxian-dbw merged 2 commits into
PowerShell:masterPowerShell/PowerShell:masterfrom
lzybkr:fix_array_native_argslzybkr/PowerShell:fix_array_native_argsCopy head branch name to clipboard

Conversation

@lzybkr

@lzybkr lzybkr commented Nov 2, 2017

Copy link
Copy Markdown
Contributor

Now that the Ast is passed through to the NativeCommandParameterBinder, there is a cleaner fix to ensuring we pass the correct text to a command that uses PowerShell array syntax.

@lzybkr lzybkr requested a review from BrucePay as a code owner November 2, 2017 01:52
}

It "Should handle PowerShell arrays with or without spaces correctly: <arguments>" -TestCases @(
@{arguments = "a 1,2"; expected = "a", "1,2"}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

let's add something boring, like a,1,2 here as well

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

There is no difference between 2 and 3 elements - it's just spaces around the argument(s) that matter.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Should we add 1,2 3?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I really didn't need a 1,2, 1,2 would have been sufficient, but I had a bug in the test with array vs. scalar and the first thought I had was to add a to force array. I'm fixing by using @() instead to force array.

@iSazonov iSazonov left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Leave a comment

"array argument and ArrayLiteralAst differ in number of elements");

int currentElement = -1;
string separator = "";

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Should we use String.Empty?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

No reason to imo.

var beforeNext = next.Extent.StartOffset - 1;

if (afterPrev == beforeNext)
return ",";

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Could you please use one line formatting as above in line 357?
Below too in 376 and 379.

}

It "Should handle PowerShell arrays with or without spaces correctly: <arguments>" -TestCases @(
@{arguments = "a 1,2"; expected = "a", "1,2"}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Should we add 1,2 3?

@daxian-dbw daxian-dbw self-assigned this Nov 6, 2017

@daxian-dbw daxian-dbw left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.