Skip to content

Commit 6b8ca32

Browse files
committed
fix(javascript)!: function expression
drops support for older versions of tree-sitter-javascript
1 parent 8beb128 commit 6b8ca32

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

lua/splitjoin/languages/ecmascript/defaults.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ return {
5252
join = ECMAScript.join_function,
5353
},
5454

55-
['function'] = {
55+
function_expression = {
5656
split = ECMAScript.split_function,
5757
join = ECMAScript.join_function,
5858
},

lua/splitjoin/languages/ecmascript/functions.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function ECMAScript.split_function(node, options)
1111
local type = child:type()
1212
if type == 'formal_parameters' then append(get_text(child))
1313
elseif type == 'statement_block' then append(' {\n',indent, get_text(child):gsub('^{%s*', ''):gsub('%s*}$', ''), '\n}')
14-
elseif type == 'function' then
14+
elseif vim.startswith(type, 'function') then
1515
append('function')
1616
if node:type() == 'function_declaration' then
1717
append(' ')
@@ -55,7 +55,7 @@ function ECMAScript.join_function(node, options)
5555
for child in node:iter_children() do
5656
local type = child:type()
5757
if type == 'formal_parameters' then append(get_text(child), ' ')
58-
elseif type == 'function' then
58+
elseif vim.startswith(type, 'function') then
5959
append('function')
6060
if node:type() == 'function_declaration' then append(' ') end
6161
elseif type == 'statement_block' then

queries/javascript/splitjoin.scm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
; functions
99
(function_declaration) @splitjoin.javascript.function.declaration
10-
(function) @splitjoin.javascript.function.lambda
10+
(function_expression) @splitjoin.javascript.function.lambda
1111
(arrow_function) @splitjoin.javascript.function.arrow
1212
(arguments) @splitjoin.javascript.function.arguments
1313
(formal_parameters) @splitjoin.javascript.function.parameters

0 commit comments

Comments
 (0)