Skip to content

Commit

Permalink
Ensure we always return a table from extract.word #385
Browse files Browse the repository at this point in the history
  • Loading branch information
Oliver Caldwell committed Aug 7, 2022
1 parent 1945bca commit 08236a1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions fnl/conjure/extract.fnl
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@

(defn word []
(if (ts.enabled?)
(when-let [node (ts.get-leaf)]
(if-let [node (ts.get-leaf)]
{:range (ts.range node)
:content (ts.node->str node)})
:content (ts.node->str node)}
{:range nil
:content nil})
(legacy-word)))

(defn file-path []
Expand Down
2 changes: 1 addition & 1 deletion lua/conjure/extract.lua
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ local function word()
if node then
return {range = ts.range(node), content = ts["node->str"](node)}
else
return nil
return {range = nil, content = nil}
end
else
return legacy_word()
Expand Down

0 comments on commit 08236a1

Please sign in to comment.