Skip to content
This repository has been archived by the owner on Apr 1, 2020. It is now read-only.

Some event handlers with specific file patterns don't get triggered #2250

Open
numirias opened this issue May 26, 2018 · 4 comments
Open

Some event handlers with specific file patterns don't get triggered #2250

numirias opened this issue May 26, 2018 · 4 comments

Comments

@numirias
Copy link

numirias commented May 26, 2018

Oni Version: 0.3.4
Neovim Version (Linux only): 0.2.2
Operating System: 4.16.10-1-ARCH x86_64 GNU/Linux

Describe your issue

I'm developing a Python plugin for Neovim which does some initialization on VimEnter/BufEnter when editing Python files. However, the event handlers don't get triggered inside Oni when they are limited to a file pattern.

Expected behaviour

The event handlers for VimEnter, GUIEnter and BufEnter should be triggered when Oni starts up with e.g.:

$ oni existing_file.py

Actual behaviour

None of the events seems to get raised.

Steps to reproduce

Take this sample plugin:

import neovim

@neovim.plugin
class Plugin:

    def __init__(self, nvim):
        self.nvim = nvim

    @neovim.autocmd('BufEnter', pattern='*.py')
    def event_buf_enter(self):
        self.nvim.err_write('BufEnter triggered!\n')

Install the plugin and start Oni with a file argument:

$ oni existing_file.py

The event handler will not be triggered unless you change the pattern argument to *.

(Reference ticket: numirias/semshi/issues/10)

@oni-bot
Copy link

oni-bot bot commented May 26, 2018

Hello and welcome to the Oni repository! Thanks for opening your first issue here. To help us out, please make sure to include as much detail as possible - including screenshots and logs, if possible.

@CrossR
Copy link
Member

CrossR commented May 28, 2018

I'm having a bit of look into this (slightly slower than I'd like due to being away from my PC due to a cancelled train).

First thing I've noticed is that opening things the "Oni" way (That QuickOpen/Sidebar/Opening with Open) doesn't print the 'BufEnter triggered!\n' message. However, opening files with :e my_file.py works just fine and triggers the event. It looks like in some fashion our events are not launching these events? Not fully sure why that would be the case, but I'll keep looking.

@akinsho
Copy link
Member

akinsho commented May 29, 2018

@CrossR I wonder if when opens a file the oni way if a bufEnter is triggered considering those events go via the neovim api, I'm wondering if its possible our events don't aka calls via the api don't result in a normal neovim event? tbh if thats the case could be the cause of a lot of weird behaviour

@GeorgeTG
Copy link
Contributor

GeorgeTG commented Jun 15, 2018

I've found the reason why this happens but it comes down as a bigger problem so I'm gonna open a separate issue. (#2323 )

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants