Skip to content

Conversation

@SebasF1349
Copy link
Contributor

Expose diagnostic.code in from_json and from_regex for better customizability

closes #243

@xiaoshihou514
Copy link
Member

I think this is not backwards compatible, best to keep the defaults.

@SebasF1349
Copy link
Contributor Author

Sorry, yesterday I had to go and forgot to mention that I didn't fix the tests yet.

It is not backwards compatible in the sense that now the message won't include the error code by default, as seen in the failing test:

Passed in:
(string) 'Very important error message'
Expected:
(string) 'Very important error message[error code 114514]'

Configuration doesn't (shouldn't) need to be changed and the code can be readded by using vim.diagnostic.config if the user prefers. Maybe a note on how to do it should be added to the docs with a simple example.

@xiaoshihou514
Copy link
Member

Good point.

@SebasF1349
Copy link
Contributor Author

I fixed the tests, but it's my first time using busted and idk if I did something wrong or the tests don't test what I would expect. The tests in spec/lint_spec.lua didn't fail before my changes, and even modifing the expected messages to gibberish it doesn't fail. I did ""fix"" them anyway to what I would expect, but idk what's wrong with the tests or my understanding of them. I did test it in my local neovim and it worked as expected.

Didn't add any example of customization, idk if that's needed or not. In any case it's outside of the plugin's scope, it's just the neovim api.

@xiaoshihou514
Copy link
Member

ok

@xiaoshihou514 xiaoshihou514 merged commit e09a8c6 into nvimdev:main Jan 18, 2026
3 checks passed
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.

Missing diagnostic.code

2 participants