Skip to content

Commit

Permalink
fix(code_actions): Add check for 'No diagnostics available' in diagno…
Browse files Browse the repository at this point in the history
…stic prompts
  • Loading branch information
jellydn committed Feb 18, 2024
1 parent 5d5661b commit e46fa23
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lua/CopilotChat/code_actions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ local user_prompt_actions = {}

local function generate_fix_diagnostic_prompt()
local diagnostic = utils.get_diagnostics()
if diagnostic == 'No diagnostics available' then
return diagnostic
end

local file_name = vim.fn.expand('%:t')
local line_number = vim.fn.line('.')
return 'Please assist with fixing the following diagnostic issue in file: "'
Expand All @@ -23,6 +27,10 @@ end

local function generate_explain_diagnostic_prompt()
local diagnostic = utils.get_diagnostics()
if diagnostic == 'No diagnostics available' then
return diagnostic
end

local file_name = vim.fn.expand('%:t')
local line_number = vim.fn.line('.')
return 'Please explain the following diagnostic issue in file: "'
Expand Down

0 comments on commit e46fa23

Please sign in to comment.