Skip to content

Commit 1da1090

Browse files
committed
✨ Add vim.filetype
1 parent a341c99 commit 1da1090

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

packages/texcat/lua/texcat/syntaxes/treesitter.lua

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
---@copyright 2025
44
local lfs = require 'lfs'
55
local ltreesitter = require 'ltreesitter'
6+
local filetype = require 'vim.filetype'
7+
68
local T = require 'texcat.themes'
9+
710
local M = {
811
Treesitter = {}
912
}
@@ -196,11 +199,10 @@ function M.Treesitter:list()
196199
end
197200

198201
---detect file type
199-
---TODO: /usr/share/nvim/runtime/lua/vim/filetype.lua
200202
---@param filename string
201203
---@return string ft
202204
function M.Treesitter.detect(filename)
203-
return require 'texcat.syntaxes.tmlanguage'.TMLanguage.detect(filename)
205+
return filetype.match { filename = filename }
204206
end
205207

206208
return M

packages/texcat/lux.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ url = "https://github.com/ustctug/texrocks/archive/$(VERSION).zip"
1515
dir = "texrocks-$(VERSION)/packages/$(PACKAGE)"
1616

1717
[dependencies]
18+
vim = " >= 0.0.4"
1819
argparse = "0.7.1-1"
1920
lua-template = "1.0.0-1"
2021
warna = "0.3.5-2"

0 commit comments

Comments
 (0)