Skip to content

Commit

Permalink
fix: add validation before call FixDiagnostic command
Browse files Browse the repository at this point in the history
  • Loading branch information
jellydn committed Feb 17, 2024
1 parent cb8c8c9 commit 81c5060
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lua/CopilotChat/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ M.setup = function(options)
-- Troubleshoot and fix the diagnostic issue at the current cursor position.
utils.create_cmd('CopilotChatFixDiagnostic', function()
local diagnostic = utils.get_diagnostics()
if diagnostic == 'No diagnostics available' then
vim.notify('No diagnostic issue found at the current cursor position.', vim.log.levels.INFO)
return
end

local file_name = vim.fn.expand('%:t')
local line_number = vim.fn.line('.')
-- Copy all the lines from current buffer to unnamed register
Expand Down

0 comments on commit 81c5060

Please sign in to comment.