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 @@ -358,10 +358,19 @@ local function format_selection_part(selection)
358358 }
359359end
360360
361+ --- @param diagnostics vim.Diagnostic[]
361362local function format_diagnostics_part (diagnostics )
363+ local diag_list = {}
364+ for _ , diag in ipairs (diagnostics ) do
365+ local short_msg = diag .message :gsub (' %s+' , ' ' ):gsub (' ^%s' , ' ' ):gsub (' %s$' , ' ' )
366+ table.insert (
367+ diag_list ,
368+ { msg = short_msg , severity = diag .severity , pos = ' l' .. diag .lnum + 1 .. ' :c' .. diag .col + 1 }
369+ )
370+ end
362371 return {
363372 type = ' text' ,
364- text = vim .json .encode ({ context_type = ' diagnostics' , content = diagnostics }),
373+ text = vim .json .encode ({ context_type = ' diagnostics' , content = diag_list }),
365374 synthetic = true ,
366375 }
367376end
You can’t perform that action at this time.
0 commit comments