-
Notifications
You must be signed in to change notification settings - Fork 647
Can't use 'go to definition' when cursor is at the end of a word #891
Comments
@roblourens Can you check what is your setting value for |
I have the same error. Switching to |
@yageek Do you have the language server enabled? I am able to repro when
Not when language server is disabled and |
My bad. It does not seems related to the cursor position. In fact, no package from the standard library is suggested, so it is not possible to jump to the declaration of the function. |
@yageek Well, that is much more serious. I did end up in such a scenario once, getting the latest for the tools solved it for me. Can you try running the command |
On my side, the issue was related to a mis configured |
@zmb3 |
Lots of the go tools behave in this way ( I believe the cause is that for:
The cursor is positioned at byte 11, and the There are two workarounds that have worked well for me:
For example, if your editor allows it, you can tell it to include I personally prefer option 2. |
Rename operation works in this case. Find All References and Go to/Peek Definition features like you said don't though. This is a corner case, so there is no rush. Will keep it open if anyone wants to take a shot at sending the updated offset to the tools |
I ran into this and assumed that gogetdoc was totally busted. I think one common use case not mentioned here thus far is for people whose muscle memory is to double-click a method to highlight it, and then hit F12. Since that places the cursor at the end of the method, it hits this bug, but it's also how I've used IDEs since forever. Maybe I'm the only one? Would love a fix either way! |
@dauntlesscarp That's a good scenario that pulls us out of the corner case. I have pushed a fix which will be available in the next update. |
Much appreciated! |
This bug fix is now out in the latest update to the Go extension (0.6.81) |
|
:fmt.Println|(stringutil.Reverse("!selpmaxe oG ,olleH"))
Println
"The text was updated successfully, but these errors were encountered: