Skip to content

Commit

Permalink
Improved file type detection
Browse files Browse the repository at this point in the history
  • Loading branch information
luozhiya committed May 18, 2024
1 parent 13244e8 commit 2f015f8
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lua/fittencode/engines/actions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -283,10 +283,12 @@ function ActionsEngine.start_action(action, opts)
Log.debug('Action filetype: {}', filetype)
local langs = get_tslangs(buffer, range)
Log.debug('Action langs: {}', langs)
if filetype == 'markdown' and #langs >= 2 then
filetype = vim.tbl_filter(function(lang) return lang ~= 'markdown' end, langs)[1]
-- Markdown embeded code block
-- HTML embeded js or css
if #langs >= 2 then
filetype = vim.tbl_filter(function(lang) return lang ~= filetype end, langs)[1]
end
Log.debug('Action filetype: {}', filetype)
Log.debug('Action real filetype: {}', filetype)

local prompt_opts = {
window = window,
Expand Down

0 comments on commit 2f015f8

Please sign in to comment.