Skip to content

Commit

Permalink
feat: Set chat and overlay filetypes to their names
Browse files Browse the repository at this point in the history
This improves support for various integrations like nvim-cmp and edgy

Signed-off-by: Tomas Slusny <[email protected]>
  • Loading branch information
deathbeam committed Mar 23, 2024
1 parent f4f607c commit 83561e9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lua/CopilotChat/chat.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ local Chat = class(function(self, mark_ns, help, on_buf_create)
self.buf_create = function()
local bufnr = vim.api.nvim_create_buf(false, true)
vim.api.nvim_buf_set_name(bufnr, 'copilot-chat')
vim.bo[bufnr].filetype = 'markdown'
vim.bo[bufnr].filetype = 'copilot-chat'
vim.bo[bufnr].syntax = 'markdown'
local ok, parser = pcall(vim.treesitter.get_parser, bufnr, 'markdown')
if ok and parser then
Expand Down
2 changes: 1 addition & 1 deletion lua/CopilotChat/overlay.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ local Overlay = class(function(self, name, mark_ns, hl_ns, help, on_buf_create)

self.buf_create = function()
local bufnr = vim.api.nvim_create_buf(false, true)
vim.bo[bufnr].filetype = name
vim.api.nvim_buf_set_name(bufnr, name)
return bufnr
end
Expand All @@ -41,7 +42,6 @@ end
function Overlay:show(text, filetype, syntax, winnr)
self:validate()

vim.bo[self.bufnr].filetype = filetype
vim.api.nvim_win_set_buf(winnr, self.bufnr)

vim.bo[self.bufnr].modifiable = true
Expand Down

0 comments on commit 83561e9

Please sign in to comment.