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

Floating Window not opening on :GoPkgOutline #241

Closed
bab014 opened this issue Nov 21, 2022 · 30 comments
Closed

Floating Window not opening on :GoPkgOutline #241

bab014 opened this issue Nov 21, 2022 · 30 comments

Comments

@bab014
Copy link

bab014 commented Nov 21, 2022

I have guihua installed and checkhealth confirms it.

When running :GoPkgOutline I get the following error
image

Not sure if guihua is fighting with another plugin or not.

@ray-x
Copy link
Owner

ray-x commented Nov 22, 2022

Do you have a full stack trace?
you can run :messages to get a complete trace log.

@bab014
Copy link
Author

bab014 commented Nov 22, 2022

Here is the full trace after typing :messages

...e/nvim/site/pack/packer/start/go.nvim/lua/go/package.lua:99: attempt to index upvalue 'defs' (a nil value)
stack traceback:
^I...e/nvim/site/pack/packer/start/go.nvim/lua/go/package.lua:99: in function 'show_panel'
^I...e/nvim/site/pack/packer/start/go.nvim/lua/go/package.lua:238: in function <...e/nvim/site/pack/packer/start/go.nvim/lua/go/packa
ge.lua:230>

@splittingfield
Copy link

Came here to report the same issue. Checkhealth shows all is well.

nvim --version

Build type: Release
LuaJIT 2.1.0-beta3
Compiled by marc@nemesis

Features: +acl +iconv +tui 

Stacktrace

global 'dirname' (a nil value)
stack traceback:
^I...avigator.lua/lua/navigator/lspclient/clients_default.lua:84: in function 'get_root_dir'
^I...ck/packer/start/nvim-lspconfig/lua/lspconfig/configs.lua:244: in function 'try_add'
^I...ck/packer/start/nvim-lspconfig/lua/lspconfig/configs.lua:76: in function <...ck/packer/start/nvim-lspconfig/lua/lspconfig/configs.lua:75>
^I[C]: in function 'nvim_buf_set_option'
^I.../nvim/site/pack/packer/start/go.nvim/lua/go/ts/utils.lua:108: in function 'list_definitions_toc'
^I...e/nvim/site/pack/packer/start/go.nvim/lua/go/package.lua:87: in function 'render_outline'
^I...e/nvim/site/pack/packer/start/go.nvim/lua/go/package.lua:94: in function 'show_panel'
^I...e/nvim/site/pack/packer/start/go.nvim/lua/go/package.lua:238: in function <...e/nvim/site/pack/packer/start/go.nvim/lua/go/package.lua:230>
stack traceback:
^I[C]: in function 'nvim_buf_set_option'
^I.../nvim/site/pack/packer/start/go.nvim/lua/go/ts/utils.lua:108: in function 'list_definitions_toc'
^I...e/nvim/site/pack/packer/start/go.nvim/lua/go/package.lua:87: in function 'render_outline'
^I...e/nvim/site/pack/packer/start/go.nvim/lua/go/package.lua:94: in function 'show_panel'
^I...e/nvim/site/pack/packer/start/go.nvim/lua/go/package.lua:238: in function <...e/nvim/site/pack/packer/start/go.nvim/lua/go/package.lua:230>'```

@splittingfield
Copy link

I am thinking the issue is here
due to that beautifully appropriate comment :-)

ray-x added a commit to ray-x/navigator.lua that referenced this issue Nov 23, 2022
@ray-x
Copy link
Owner

ray-x commented Nov 23, 2022

Thanks! you found it. I pushed a commit for navigator.

@bab014
Copy link
Author

bab014 commented Nov 23, 2022

Thanks! So what do I need to do? Revert back?

@splittingfield
Copy link

Cool! Random question: what’s the difference between this and LSPOutline. (I know it’s not the right forum but I have your attention :-)

@bab014
Copy link
Author

bab014 commented Nov 23, 2022

Yeah, I'm very lost in all this. I updated go.nvim and still getting the same error

@ray-x
Copy link
Owner

ray-x commented Nov 23, 2022

LSPOutline is the outline of symbols in the current file.
PkgOutline is more of a Go feature that outlines all symbols in a Go package.

@ray-x
Copy link
Owner

ray-x commented Nov 23, 2022

Yeah, I'm very lost in all this. I updated go.nvim and still getting the same error
as @splittingfield mentioned, the issue was in navigator.lua. Are you happen to use that plugin together with go.nvim?
You might need to update navigator.lua

@bab014
Copy link
Author

bab014 commented Nov 23, 2022

No, I'm not using navigator.lua, I have guihua since that is what is recommended for the go.nvim plugin.

Should I also have navigator installed as well?

I have since installed navigator and I'm getting the exact same error. My original trace never mentioned anything concerning navigator

ray-x added a commit that referenced this issue Nov 23, 2022
@ray-x
Copy link
Owner

ray-x commented Nov 23, 2022

ok seems to be a different defect. Pushed another commit.
Also is your package visible to go? How about GoPkgOutline -p fmt ?

@splittingfield
Copy link

I am running go.nvim and navigator.lua.

The GoPkgOutline -f within the floating window is perfect. GoPkgOutline -p throws this error

Error executing Lua callback: ...e/nvim/site/pack/packer/start/go.nvim/lua/go/package.lua:261: table index is nil
stack traceback:
        ...e/nvim/site/pack/packer/start/go.nvim/lua/go/package.lua:261: in function 'outline'
        .../nvim/site/pack/packer/start/go.nvim/lua/go/commands.lua:187: in function <.../nvim/site/pack/packer/start/go.nvim/lua/go/commands.lua:186>

And GoPkgOutline with no arguments shows the fields of go structs, but no functions or the structs themselves.

@bab014
Copy link
Author

bab014 commented Nov 23, 2022

Well that works.
image
So clearly I am very ignorant. Maybe I'm misunderstanding how to use the command or what the command does. I was looking to see an outline of symbols in the file, and I thought this command accomplished that.

@ray-x
Copy link
Owner

ray-x commented Nov 23, 2022

I think the issue is go failed to parse the current package in your project.
I pushed a change to show the error info, could you update go.nvim again to see how it works.
by default, GoPkgOutline without a parameter should display the current package you are working on. It may be because of the project setup so the tools can not pick up your current package.

@bab014
Copy link
Author

bab014 commented Nov 23, 2022

Interesting, thank you for your prompt replies. This has been very helpful. I greatly appreciate the plugin.

@bab014
Copy link
Author

bab014 commented Nov 23, 2022

Updated the plugin, and now when I run GoPkgOutline nothing happens at all.

Actually, I see a buffers getting created when I run it
image

@ray-x
Copy link
Owner

ray-x commented Nov 23, 2022

#245 might solve this. Could you pull the latest changes?

@splittingfield
Copy link

I can next week. Family vacation time.

@splittingfield
Copy link

splittingfield commented Nov 23, 2022

Ok, so GoPkgOutline now works, but the sorting is a bit wonky. It goes Functions, Types, Functions in both the floating window and the side panel. GoPkgOutline -p gives the table index is nil error.

Error executing Lua callback: ...e/nvim/site/pack/packer/start/go.nvim/lua/go/package.lua:263: table index is nil
stack traceback:
        ...e/nvim/site/pack/packer/start/go.nvim/lua/go/package.lua:263: in function 'outline'
        .../nvim/site/pack/packer/start/go.nvim/lua/go/commands.lua:187: in function <.../nvim/site/pack/packer/start/go.nvim/lua/go/commands.lua:186>
Error executing Lua callback: ...e/nvim/site/pack/packer/start/go.nvim/lua/go/package.lua:263: table index is nil
stack traceback:
        ...e/nvim/site/pack/packer/start/go.nvim/lua/go/package.lua:263: in function 'outline'
        .../nvim/site/pack/packer/start/go.nvim/lua/go/commands.lua:187: in function <.../nvim/site/pack/packer/start/go.nvim/lua/go/commands.lua:186>

@ray-x
Copy link
Owner

ray-x commented Nov 23, 2022

@splittingfield Wondering which package you're trying to show outline. By any chance, you are running it on windows?

@splittingfield
Copy link

No. I am on mac, nvim nightly. Using go.nvim and navigator. Guihua for window.

ray-x added a commit that referenced this issue Nov 23, 2022
@ray-x
Copy link
Owner

ray-x commented Nov 23, 2022

I see what the issue. -p has to specify a package name,
E.g. GoPkgOutline -p fmt
But I add a nil check for this. You should see a more friendly error message.

@splittingfield
Copy link

Agh! Thanks! I assumed if nil it would take package of current buffer/scope.

@ray-x
Copy link
Owner

ray-x commented Nov 23, 2022

without a parameter, it will assume the current buffer. But I default it to the current buffer for -p as well.

@bab014
Copy link
Author

bab014 commented Nov 25, 2022

Sorry for the delayed response. I updated the plugin and all is working as intended.

Thank you so much for your responsiveness and eagerness to help.

@bab014
Copy link
Author

bab014 commented Nov 25, 2022

So one more side thing I've found. The lsp diagnostics your plugin ships with, I am trying to turn them off in the setup function but it is not working.

I get a fox emoji before every virtual text diagnostic. I have updated my config multiple times but cannot seem to get it to stop.

image

image

And when I don't load the go.nvim plugin
image

@ray-x
Copy link
Owner

ray-x commented Nov 25, 2022

It might releated to navigator.lua, The setup is here:

  icons = {
    icons = true, -- set to false to use system default ( if you using a terminal does not have nerd/icon)
    diagnostic_virtual_text = '🦊',

Otherwise, it should be a nerdfont.

@bab014
Copy link
Author

bab014 commented Nov 25, 2022

Thanks. Didn't even think to look there. It worked.

@ray-x
Copy link
Owner

ray-x commented Nov 25, 2022

Excellent, I will close this issue.

@ray-x ray-x closed this as completed Nov 25, 2022
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

No branches or pull requests

3 participants