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

fix(logger): schedule vim.notify #237

Merged
merged 2 commits into from
Jan 11, 2025

Conversation

przepompownia
Copy link
Contributor

Since neovim/neovim#31900 it's using nvim_echo which cannot be called in fast mode.

@przepompownia
Copy link
Contributor Author

Not sure if we necessary need vim.in_fast_event() query here so not added it.

@przepompownia przepompownia changed the title Schedule vim.notify fix(logger): schedule vim.notify Jan 10, 2025
Since neovim/neovim#31900 it's using `nvim_echo`
which cannot be called in fast mode.
@mochaaP
Copy link
Member

mochaaP commented Jan 10, 2025

pls update the test helpers accordingly.

@przepompownia
Copy link
Contributor Author

I see that in regal_spec

stub(vim, "schedule")
-- ...
    it("should log error for non-json output", function()
        local diagnostic = parser({ output = "non-json-output", err = "json error" })
        assert.same({}, diagnostic)
        assert
            .stub(vim.schedule)
            .was_called_with(function() vim.notify("[null-ls] non-json-output", vim.log.levels.ERROR, { title = "null-ls" }) end)
    end)

seems to be a step ahead but at the moment I don't know how to mock anonymous function or work it around in another way.

@mochaaP mochaaP merged commit 0143bb5 into nvimtools:main Jan 11, 2025
3 checks passed
@przepompownia przepompownia deleted the schedule-nvim-notify branch January 11, 2025 01:32
@przepompownia
Copy link
Contributor Author

Thanks!

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