TabExpansionPlusPlus icon indicating copy to clipboard operation
TabExpansionPlusPlus copied to clipboard

Good way of getting cursor position

Open powercode opened this issue 10 years ago • 2 comments

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?

powercode avatar Feb 11 '15 21:02 powercode

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.

lzybkr avatar Feb 13 '15 15:02 lzybkr

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...

powercode avatar Feb 13 '15 16:02 powercode