File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -343,10 +343,19 @@ local function format_selection_part(selection)
343343 }
344344end
345345
346+ --- @param diagnostics vim.Diagnostic[]
346347local function format_diagnostics_part (diagnostics )
348+ local diag_list = {}
349+ for _ , diag in ipairs (diagnostics ) do
350+ local short_msg = diag .message :gsub (' %s+' , ' ' ):gsub (' ^%s' , ' ' ):gsub (' %s$' , ' ' )
351+ table.insert (
352+ diag_list ,
353+ { msg = short_msg , severity = diag .severity , pos = ' l' .. diag .lnum + 1 .. ' :c' .. diag .col + 1 }
354+ )
355+ end
347356 return {
348357 type = ' text' ,
349- text = vim .json .encode ({ context_type = ' diagnostics' , content = diagnostics }),
358+ text = vim .json .encode ({ context_type = ' diagnostics' , content = diag_list }),
350359 synthetic = true ,
351360 }
352361end
You can’t perform that action at this time.
0 commit comments