Skip to content

Fix unknown-module-field for vim.loop.constants.SIGINT#666

Merged
Olical merged 2 commits intoOlical:mainfrom
russtoku:main
May 11, 2025
Merged

Fix unknown-module-field for vim.loop.constants.SIGINT#666
Olical merged 2 commits intoOlical:mainfrom
russtoku:main

Conversation

@russtoku
Copy link
Contributor

@russtoku russtoku commented May 8, 2025

This is a minor fix to quiet the diagnostics from the fennel-ls language server when working with the stdio-based Conjure clients.

Just tidying this a bit so feel free to reject this PR.

@Olical
Copy link
Owner

Olical commented May 11, 2025

I need to check but I'm surprised this works. vim.loop.constants.SIGINT actually returns 2, and the signature for uv_process_kill (which we call) takes a int signum as it's last argument. I worry that the string is being cast to a 1 or something like that so it's accidentally working but through some weird boolean-y casting.

If this is just a linting thing, maybe we can find another way to teach the language server. Or maybe I set up our own map of codes that mirror the vim constants. It is a little wordy to access it at the moment.

@Olical
Copy link
Owner

Olical commented May 11, 2025

Nevermind, I found it in the Neovim help text.

uv.process_kill({process}, {signame})                         *uv.process_kill()*

                > method form `process:kill(signame)`

                Parameters:
                - `process`: `uv_process_t userdata`
                - `signame`: `string` or `integer` or `nil` (default: `sigterm`)

So it does accept strings and there's a mapping of those strings to their signals in the same help text. Maybe you found this already and that's why you did this, just sharing that I found the proof too 😄 thanks for simplifying this, it does read better.

@Olical Olical merged commit 9fad07b into Olical:main May 11, 2025
1 check passed
@russtoku
Copy link
Contributor Author

Apologies, my description only stated a fix for an error message. I should have included some explanation about vim.loop being deprecated in Neovim 0.10 in favor of uv.loop and that the code could be clearer with just the signal name instead of the constant. Although, sometimes constants are preferred to values.

@Olical
Copy link
Owner

Olical commented May 11, 2025 via email

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

Labels

None yet

2 participants