]> git.r.bdr.sh - rbdr/tree-sitter-api-notation/blob - lua/tree-sitter-api-notation.lua
184cb573548ab36bd7b02db27fc496bf9514985e
[rbdr/tree-sitter-api-notation] / lua / tree-sitter-api-notation.lua
1
2 local M = {}
3
4 function M.setup()
5 local config_file_path = debug.getinfo(1).source:sub(2)
6 local plugin_dir = vim.fn.fnamemodify(config_file_path, ':h:h')
7 local parser_config = require 'nvim-treesitter.parsers'.get_parser_configs()
8 parser_config.api_notation = {
9 install_info = {
10 url = plugin_dir,
11 files = {'src/parser.c'},
12 branch = 'main'
13 }
14 }
15 vim.api.nvim_create_autocmd({'BufNewFile', 'BufRead'}, {
16 pattern = {'*.api', '*.apinotation'},
17 callback = function () vim.opt.filetype = 'api_notation' end
18 })
19 end
20
21 return M