Closed MaulingMonkey closed 7 years ago
My GetIdentTokenAtPosition
suggestion is a bad idea - RustF1HelpCommandHandler wants to handle more than ident tokens, best to leave the filtering of what tokens the caller wants up to the caller.
That said, I am changing/replacing the behavior of GetTokensAtPosition
(possibly with a rename) such that ide|nt
returns the same token for both left/right (whereas foo |ident
will return the whitespace and ident tokens)
Closing this as it's part of my pull request.
currentToken
is often null mid-line in my testing. As i understand it, a single character token will haveStartIndex == StopIndex
which means it can never be a current token. Whenever this happens,leftToken
ends up being the last token, even if the cursor is at the start of the line, messing with whenRustCompletionCommandHandler
triggers intellisense.I'm inclined to do the following refactorings:
Add
Utils.GetIdentTokenAtPosition
for use in e.g.RustF1HelpCommandHandler
andRustGoToDefinitioncommandHandler
, which will return the ident if the cursor is in either|
position in e.g. the expression:a |ident| b
,(|ident|)
, etc. despite the left/current tokens being[whitespace, ident]
in one case and[ident, whitespace]
in the other.Replace
GetTokensAtPosition
withGetLineTokensBeforePosition
? returningIEnumerable<IToken>
orIList<IToken>
, so we can still avoid triggering intellisense on e.g.let f
, which requires multiple tokens of lookbehind inRustCompletionCommandHandler
.