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

Check list length before handling the godoc result #2339

Merged
merged 1 commit into from
Jun 4, 2019
Merged

Check list length before handling the godoc result #2339

merged 1 commit into from
Jun 4, 2019

Conversation

paco0x
Copy link
Contributor

@paco0x paco0x commented Jun 4, 2019

Fix the index out of range issue when handling empty result from gopls

When using go_info_mode='gopls', there's an index-out-of-range issue when handling empty result from gopls. This occurs frequently when you turned on go_auto_type_info and the cursor hovered on something like an imported package name.

For example, use the code above:

fmt.Println("test")

When running :GoInfo on the word fmt, vim says:

vim-go: [info] SUCCESS
Error detected while processing function <SNR>153_on_stdout[1]..<SNR>153_neocb[58]..286[33]..<SNR>152_hoverHandler[9]..<SNR>152_info[1]..<SNR>152_infoFromHoverContent:
line    1:
E684: list index out of range: 0
Press ENTER or type command to continue
Error detected while processing function <SNR>153_on_stdout[1]..<SNR>153_neocb[58]..286[33]..<SNR>152_hoverHandler[9]..<SNR>152_info[1]..<SNR>152_infoFromHoverContent:
line    1:
E15: Invalid expression: a:content[0]
Press ENTER or type command to continue
Error detected while processing function <SNR>153_on_stdout[1]..<SNR>153_neocb:
line   58:
E170: Missing :endwhile
Press ENTER or type command to continue

Fix the index out of range issue when handling empty result from gopls

Signed-off-by: Penghui Liao <liaoishere@gmail.com>
@paco0x paco0x changed the title Check list length before hanlding the godoc result Check list length before handling the godoc result Jun 4, 2019
@bhcleek
Copy link
Collaborator

bhcleek commented Jun 4, 2019

Thank you.

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

Successfully merging this pull request may close these issues.

2 participants