local M = {}
function M.setup()
+ local config_file_path = debug.getinfo(1).source:sub(2)
+ local plugin_dir = vim.fn.fnamemodify(config_file_path, ':h:h')
local parser_config = require 'nvim-treesitter.parsers'.get_parser_configs()
parser_config.api_notation = {
install_info = {
- url = vim.fn.expand('%:p:h:h'),
+ url = plugin_dir,
files = {'src/parser.c'},
branch = 'main'
}
}
- vim.api.nvim_create_autocmd({'BufNewFile', 'BufRead'}, {
- pattern = {'*.api', '*.apinotation'},
- callback = function () vim.opt.filetype = 'api_notation' end
+ vim.filetype.add({
+ extension = {
+ api = 'api_notation',
+ apinotation = 'api_notation'
+ }
})
end