Skip to content

Conversation

@gigamaax
Copy link
Contributor

@gigamaax gigamaax commented Mar 31, 2025

I made another change that I'm worried might not be the right direction:

Here
https://github.com/neovim/go-client/pull/184/files#diff-4686cdf50ccf547850a2e89191f11c343519caef6fd7718fd73b7a1480606bd0L3843

I moved away from using the color map based on https://neovim.io/doc/user/syntax.html#ctermbg. I'm not sure if the ctermbg / ctermfg are expected to work with the RGB colors that are in the color map, or if maybe the color map has been enhanced since v0.9? I'm not sure if I'm avoiding the issue with this fix.

gigamaax and others added 5 commits March 29, 2025 16:15
for nvim minor verion 9, no commands are returned
for nvim minor version 10, three are returned
currently, for nightly builds, four are returend
neovim ships with default keybindings that may change per verison. the
tests, prior to this change, included these default key mappings which
make the tests fragile with each release. keeping a list of default
commands should be outside the scope of this library.

this change removes assertions against the entire set of keymaps
returned by `nvim_get_keymap` and only verifies the desired keymap has
been added and then removed.
using the colors described here rather than the color map
https://neovim.io/doc/user/syntax.html#ctermbg
v0.11 changed  the way that messages are broadcast from only to those
who are subscribed, to all channels. this test, as it's written, doesn't
make sense in that scenario.

snippet from release notes:
> vim.rpcnotify(0) and rpcnotify(0) broadcast to ALL channels. Previously
> they would "multicast" only to subscribed channels (controlled by
> nvim_subscribe()). Plugins and clients that want "multicast" behavior
> must now maintain their own list of channels.
@codecov
Copy link

codecov bot commented Mar 31, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.1%. Comparing base (dd77a91) to head (af022d4).
Report is 9 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##            main    #184     +/-   ##
=======================================
- Coverage   83.3%   83.1%   -0.2%     
=======================================
  Files         14      14             
  Lines       3132    3134      +2     
=======================================
- Hits        2610    2607      -3     
- Misses       522     527      +5     
Flag Coverage Δ
linux-1.18-nightly ?
linux-1.18-stable ?
linux-1.19-nightly ?
linux-1.19-stable ?
linux-1.20-nightly ?
linux-1.20-stable ?
linux-1.22-nightly 82.8% <100.0%> (?)
linux-1.22-stable 83.1% <100.0%> (?)
linux-1.23-nightly 82.8% <100.0%> (?)
linux-1.23-stable 83.1% <100.0%> (?)
linux-1.24-nightly 82.8% <100.0%> (?)
linux-1.24-stable 83.1% <100.0%> (?)
macos-1.18-nightly ?
macos-1.18-stable ?
macos-1.19-nightly ?
macos-1.19-stable ?
macos-1.20-nightly ?
macos-1.20-stable ?
macos-1.22-nightly 82.8% <100.0%> (?)
macos-1.22-stable 83.1% <100.0%> (?)
macos-1.23-nightly 82.8% <100.0%> (?)
macos-1.23-stable 83.1% <100.0%> (?)
macos-1.24-nightly 82.8% <100.0%> (?)
macos-1.24-stable 83.1% <100.0%> (?)
windows-1.18-nightly ?
windows-1.18-stable ?
windows-1.19-nightly ?
windows-1.19-stable ?
windows-1.20-nightly ?
windows-1.20-stable ?
windows-1.22-nightly 82.0% <100.0%> (?)
windows-1.22-stable 82.3% <100.0%> (?)
windows-1.23-nightly 82.0% <100.0%> (?)
windows-1.23-stable 82.3% <100.0%> (?)
windows-1.24-nightly 82.0% <100.0%> (?)
windows-1.24-stable 82.3% <100.0%> (?)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

gigamaax and others added 4 commits March 30, 2025 20:25
@gigamaax gigamaax marked this pull request as ready for review March 31, 2025 17:36
@justinmk
Copy link
Member

justinmk commented Apr 1, 2025

@zchee @glepnir

@zchee zchee self-requested a review April 1, 2025 18:20
@gigamaax gigamaax mentioned this pull request Jun 8, 2025
@brianhuster
Copy link

Is this still WIP?

@gigamaax
Copy link
Contributor Author

I forgot about this. after looking at this again with fresh eyes and a little bit more of a desire to figure it out (rather than just fix) I think I can say that the concern I described in the initial description is not an issue.

for context, I was worried that dropping the colormap wasn't really fixing the failing test but just making it not visible. I now think that the test set up was incorrectly to begin with.

This was the original error:

    --- FAIL: TestAPI/Highlight (0.00s)
        --- FAIL: TestAPI/Highlight/Nvim (0.00s)
            api_test.go:3865: got cterm foreground is 0 but want 16711680
        --- FAIL: TestAPI/Highlight/Batch (0.00s)
            api_test.go:3946: got cterm foreground is 0 but want 16711680
FAIL

the nvim_set_hl api is being called with CtermForegroud and CtermBackground, which take the the cterm colors, not the color map. in order to use the color map, I think we should have been calling with Foreground and Background instead. I haven't gone back to make that change mainly because aside from being able to see "Red" or whatever color, there's not a whole lot of value since we're just checking what was set was actually set.

as for how it ended up as 0, I think nvim_set_hl overflows during the cast to an int16_t -- I didn't see any validation, but I might have just missed it.

anyway, I think this is ready for a review if @zchee or @justinmk would like to take a look. if you don't agree with my analysis, I'm happy to make any changes or look at it some more. some of the tests cold probably get some more love.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants