make rename\gotoDef work at the end of token#752
Conversation
… parameter that will determine if token with end === position should be returned
|
👍 |
There was a problem hiding this comment.
wouldn't we want quick info to support being called at the end of a token?
|
I would model this (the naming and impl) off of Roslyn's GetTouchingToken and GetTouchingWord functions: http://source.roslyn.codeplex.com/#Microsoft.CodeAnalysis.Workspaces/Shared/Extensions/CommonSyntaxTreeExtensions.cs,cc1428a84e6b2e48 THe difference is that features then use helpers like GetTouchingWord, and that function passes in the appropriate predicate to GetTouchingToken. That way you don't need every feature to have to define an entire set of tokens it cares about. |
|
|
'Word' is the union of 'Identifier' and 'Keyword'. i.e. all the things that are words in a language like english. This is a distinct concept from things like 'string' or 'number' or 'punctuation' or 'operator'. Effectively 'words' are the alphanumeric string sequences. |
|
It's not bad per-se for features to identify the list of tokesn they care about. However, i am concerned about things like brittleness, as well as the fact that many features will end up using the same set. For example, goto-def and quick-info will need the same set. So will highlight-references. This means maintaining several duplicate lists. |
|
"One exclusion when predicate is undefined - and we can introduce helper getTouchingTokenExcludingEndPosition for this case (name is can definitely be changed)" Isn't this just FindToken ? |
|
AFAIR we do support gotoDef on numeric\string literals used in indexers and those ones are not words. Instead of "word" we can use "name" but |
|
THe right term to use in that case is 'PropertyName'. That matches the name the specs use for Identifiers/NumericLiterals/StringLiterals. So, there would be: getTouchingToken (most flexible, but reqiures the most work to consume) Thanks! |
There was a problem hiding this comment.
Can we remove this entirely. This single guy is now very confusing. i would think getTokenAtPositoin had the same semantics as getTokenContainingPosition. I didn't realize getTokenAtPosition is now just a thin wrapper over getTouchingToken.
|
👍 |
make rename\gotoDef work at the end of token
enable scenarios when cursor is positioned at the end of token