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

Good way of getting cursor position #34

Open
powercode opened this issue Feb 11, 2015 · 2 comments
Open

Good way of getting cursor position #34

powercode opened this issue Feb 11, 2015 · 2 comments

Comments

@powercode
Copy link
Contributor

When writing native argument completers, it is necessary to know the cursor position.

What is the kosher way of getting it? It is not passed as a parameter, but exists in the parent scope.
Would things break if we started passing this as a third parameter to the native completers?
param($wordToComplete, $commandAst, $cursorColumn)

Or is it ok to just expect it to be there in the parent scope?

@lzybkr
Copy link
Owner

lzybkr commented Feb 13, 2015

I think I fixed this in V5 - and pass it as the third parameter, if you try the Nov WMF preview, it should have the fix. But I'm not sure TabExpansion++ can pass it - maybe if it wrapped every native argument completer and registered the wrapped script block instead.

@powercode
Copy link
Contributor Author

So the completers could we written to detect if they get a third parameter, or else fallback to legacy mode?
So it would work good on new powershell versions but not on < 4.0?

I'm fine with that...

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

No branches or pull requests

2 participants