-
-
Notifications
You must be signed in to change notification settings - Fork 959
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
feat(diagnostic): add diagnostic.displayByVimDiagnostic
#5236
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #5236 +/- ##
==========================================
- Coverage 97.37% 97.35% -0.02%
==========================================
Files 291 291
Lines 27027 27038 +11
Branches 5607 5610 +3
==========================================
+ Hits 26317 26323 +6
- Misses 496 498 +2
- Partials 214 217 +3 ☔ View full report in Codecov by Sentry. |
bd057c8
to
b9d5d8f
Compare
b9d5d8f
to
5d5c363
Compare
@luisdavim @davidosomething I've improved this. Add |
c609ba6
to
5425139
Compare
diagnostic.displayByNvimDiagnostic
5425139
to
a91b5af
Compare
diagnostic.displayByNvimDiagnostic
diagnostic.displayByVimDiagnostic
94b7c09
to
58cc3a4
Compare
|
||
local diagnostics = {} | ||
for _, d in ipairs(items) do | ||
diagnostics[#diagnostics + 1] = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add a user-definable function call here
i.e. diagnostics[#diagnostics + 1] = config.diagnosticFormatter({ ... })
or just on the message line
as in https://github.com/davidosomething/coc-diagnostics-shim.nvim/blob/main/lua/coc-diagnostics-shim/init.lua#L61
the use case is to apply formatting to the diagnostic message
i am currently able to do it by intercepting ale or via my diagnostic shim plugin (e.g. https://github.com/davidosomething/coc-diagnostics-shim.nvim/blob/main/lua/coc-diagnostics-shim/init.lua#L16 )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can format the message with vim.diagnostic.config
, for example:
vim.diagnostic.config({
virtual_text = {
format = function(diagnostic)
return string.format('%s %s ', 'ꜰᴏʀᴍᴀᴛᴛᴇᴅ ᴡɪᴛʜ ꜰᴏʀᴍᴀᴛ-ᴛs-ᴇʀʀᴏʀs.ɴᴠɪᴍ', diagnostic.message)
end,
},
})
set coc.nvim's diagnostics to nvim's `vim.diagnostic`, disabled by default. This should be useful for nvim's diagnostic-related plugins that request diagnostic from `vim.diagnostic`
58cc3a4
to
2a5c5cd
Compare
The
diagnostic.displayByVimDiagnostic
configuration will set diagnostics to nvim'svim.diagnostic
, and prevent coc.nvim's handler to display them in virtualText/sign/floating etc.