Skip to content

Commit 9917c07

Browse files
chore: Use built in string parse instead of manual creation of language tree
1 parent 7070d83 commit 9917c07

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

lua/orgmode/parser/file.lua

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
local Range = require('orgmode.parser.range')
22
local Duration = require('orgmode.objects.duration')
33
local Section = require('orgmode.parser.section')
4-
local LanguageTree = require('vim.treesitter.languagetree')
54
local config = require('orgmode.config')
65
local utils = require('orgmode.utils')
76

@@ -170,8 +169,7 @@ end
170169
---@return File|nil
171170
function File.from_content(content, category, filename, is_archive_file)
172171
local str_content = table.concat(content, '\n')
173-
local trees = LanguageTree.new(str_content, 'org', {})
174-
trees = trees:parse()
172+
local trees = vim.treesitter.get_string_parser(str_content, 'org', {}):parse()
175173
if #trees > 0 then
176174
return File:new(trees[1], content, str_content, category, filename, is_archive_file)
177175
end

0 commit comments

Comments
 (0)