[BUG] Buffer reload triggers show again when autostart is enabled
mtoohey31 opened this issue · 3 comments
Issues
- I have checked existing issues and there are no issues with the same problem.
Plugin Version
- I am using the latest version of the plugin
Neovim Version
- I am using the 0.5 neovim version
Neovim Version
v0.5.1
Branch
master
Actual behavior
The :e
command here triggers the autocommand here when autostart is enabled leading to the buffer being reloaded multiple times.
Expected behavior
Show should not be triggered again if it is already running.
Steps to reproduce
First, enable autostart. If you throw print statements at the start of the show
command (maybe with something like os.clock()
appeneded so you can see changes between multiple occurrences), you'll see that it runs multiple times after entering a buffer.
Package info config
require("package-info").setup()
Other information
No response
Help
Yes, but I don't know how to start. I would need guidance (check question below)
Implementation help
There's probably multiple ways to do this, not sure what's best, we could maybe set some kind of global variable and check if it's set before running the show command when entering a buffer. If I swap :e
to :noa e
(which disables the trigger of autocommands), the show
command is only run once, but this prevents other plugins that rely on autocommands from working, so that's not a feasible solution.
Actually the fix may be simpler than I thought, is there any need to reload the buffer here if we're just showing the status? Will npm
ever update the package.json
if we're just checking the outdated dependencies?
I'm testing the removal of the line above now, if I don't run into any bugs do you want me to open a pull request?
I'm testing the removal of the line above now, if I don't run into any bugs do you want me to open a pull request?
Sure!