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()
47
47
end
48
48
49
49
function 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
52
51
return nil
53
52
end
54
53
55
54
return self :get_ts_matches (' (ERROR) @err' )
56
55
end
57
56
57
+ --- @return boolean
58
+ function File :has_errors ()
59
+ return self .tree :root ():has_error ()
60
+ end
61
+
58
62
function File :convert_to_file_node (node )
59
63
local text = self :get_node_text (node )
60
64
local stars = text :match (' ^%*+' )
Original file line number Diff line number Diff line change @@ -215,7 +215,7 @@ function Files.get_closest_headline(id)
215
215
error ({ message = string.format (' Failed to parse current file. %s.' , msg ) })
216
216
end
217
217
local headline = current_file :get_closest_headline (id )
218
- if not headline then
218
+ if not headline and current_file : has_errors () then
219
219
error ({ message = string.format (' Failed to parse current headline. %s.' , msg ) })
220
220
end
221
221
return headline
You can’t perform that action at this time.
0 commit comments