File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed
Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -47,14 +47,18 @@ function File:_parse()
4747end
4848
4949function File :get_errors ()
50- local has_error = self .tree :root ():has_error ()
51- if not has_error then
50+ if not self :has_errors () then
5251 return nil
5352 end
5453
5554 return self :get_ts_matches (' (ERROR) @err' )
5655end
5756
57+ --- @return boolean
58+ function File :has_errors ()
59+ return self .tree :root ():has_error ()
60+ end
61+
5862function File :convert_to_file_node (node )
5963 local text = self :get_node_text (node )
6064 local stars = text :match (' ^%*+' )
Original file line number Diff line number Diff line change @@ -215,7 +215,7 @@ function Files.get_closest_headline(id)
215215 error ({ message = string.format (' Failed to parse current file. %s.' , msg ) })
216216 end
217217 local headline = current_file :get_closest_headline (id )
218- if not headline then
218+ if not headline and current_file : has_errors () then
219219 error ({ message = string.format (' Failed to parse current headline. %s.' , msg ) })
220220 end
221221 return headline
You can’t perform that action at this time.
0 commit comments