Skip to content

Fixing bug where native.exe --<tab> would not call native completer#3633

Merged
lzybkr merged 8 commits intoPowerShell:masterfrom
powercode:native-arg-hyphen
Jun 7, 2017
Merged

Fixing bug where native.exe --<tab> would not call native completer#3633
lzybkr merged 8 commits intoPowerShell:masterfrom
powercode:native-arg-hyphen

Conversation

@powercode
Copy link
Copy Markdown
Collaborator

@powercode powercode commented Apr 24, 2017

A case was missing when parsing the processing the current token. The result was that the registered argument completer for a native command was not called if the wordToComplete was '--'.

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.

Please use our common template:
Describe "TabCompletion"

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.

Closed.

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.

I believe the template more readable:
It "Completes native commands with '-'" {

Below too.

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.

Closed.

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.

If we don't clean up completers after each test we should move all Register-ArgumentCompleter in BeforeAll block.

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.

Please remove extra line.

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.

Closed.

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.

Please add Newline at EOF.

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.

Closed.

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.

We could use C# 7.0 pattern here too. It is better use common pattern in whole file.

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.

The same about c# 7.0 pattern.

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.

The same about c# 7.0 pattern.

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.

The same about c# 7.0 pattern.

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.

The same about c# 7.0 pattern.

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.

Closed.

@iSazonov
Copy link
Copy Markdown
Collaborator

@powercode Please add description in the PR. This can be useful for documentation.

@powercode
Copy link
Copy Markdown
Collaborator Author

@iSazonov Thanks for the review.
I've addressed your comments, except for the one about the registration of TabCompleters.
These are stored in private variables in the ExecutionContext, and as far as I know, there is no way to Unregister-ArgumentCompleter. @lzybkr ?

@iSazonov
Copy link
Copy Markdown
Collaborator

I think it's even better for tests to register several TabCompleters in BeforeAll and not remove them.

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.

Looks gorgeous! 👍

I'd like to see the same everywhere below. Now there are too many use cases for "as" and "?"

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.

For information only. Personally I do not like to use "?" in if(). Expanded condition looks much clearer.

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.

Please remove extra line.

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.

Closed.

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.

Please remove extra line.

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.

Closed.

Staffan Gustafsson added 6 commits April 25, 2017 08:30
@powercode
Copy link
Copy Markdown
Collaborator Author

Rebased master and fixed conflicting test/powershell/Host/TabCompletion/TabCompletion.Tests.ps1

Copy link
Copy Markdown
Contributor

@lzybkr lzybkr left a comment

Choose a reason for hiding this comment

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

Would it be unreasonable to ask for logic code changes only?

The C# 7 language usage is nice, but I'd rather see those sorts of changes in a distinct PR.

@iSazonov
Copy link
Copy Markdown
Collaborator

Sometimes mantainers aren't predictable - I just asked what I was getting myself.

@lzybkr
Copy link
Copy Markdown
Contributor

lzybkr commented May 23, 2017

Sometimes people aren't predictable.

PowerShell is no longer my full time job - so when I ask for something like this, it's to make things easier for me. It's already somewhat hard to keep up as a maintainer with an unrelated full time job and non-computer related responsibilities and hobbies.

If you could see our pre-GitHub history, you would certainly see that I've been guilty of changes like this, but I blame not having a good enough VCS to make it easier. So I have plenty of personal experience with the difficulties of looking at changes that mix style and logical changes - and I do think a cleaner and easier to understand history is valuable in the long run, even if it wasn't painful to review something like this in the short term.

@iSazonov
Copy link
Copy Markdown
Collaborator

I meant that often we contribute and discuss before the appointment of mantainer and before his posts - so we can not predict a review style and facilitate the mantainer's work.
I believe our workflow process could be improved, I guess we could take more from the CoreCLR/CoreFX workflows.
/cc @joeyaiello

@lzybkr
Copy link
Copy Markdown
Contributor

lzybkr commented May 24, 2017

Note that CoreFX says this:

DO NOT send PRs for upgrading code to use newer language features, though it's ok to use newer language features as part of new code that's written.

See here.

@iSazonov
Copy link
Copy Markdown
Collaborator

Yes, they were more clearly writing the workflow. We have to do the same.

@lzybkr
Copy link
Copy Markdown
Contributor

lzybkr commented Jun 7, 2017

:shipit:


Context NativeCommand {
BeforeAll {
$nativeCommand = (Get-Command -CommandType Application -TotalCount 1).Name
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It might be wiser to create an external command on testdrive and change the path, but that's a tiny bit annoying to make it portable, so I'll merge as is.

@lzybkr lzybkr merged commit 3125764 into PowerShell:master Jun 7, 2017
@powercode powercode deleted the native-arg-hyphen branch January 26, 2018 19:05
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