Cool stuff
This commit is contained in:
@@ -60,7 +60,7 @@ end, { desc = 'Select surrounding treesitter node' })
|
|||||||
local swappable_nodes = { 'argument', 'array_element_initializer', 'simple_parameter', 'string', 'integer', 'member_call_expression', 'method_declaration' }
|
local swappable_nodes = { 'argument', 'array_element_initializer', 'simple_parameter', 'string', 'integer', 'member_call_expression', 'method_declaration' }
|
||||||
|
|
||||||
local function closest_swappable_node(node)
|
local function closest_swappable_node(node)
|
||||||
while node and not vim.list_contains(swappable_nodes, node:type()) do
|
while node and not vim.list_contains(swappable_nodes, node:type()) and (not node:next_named_sibling() or not node:prev_named_sibling()) do
|
||||||
node = node:parent()
|
node = node:parent()
|
||||||
end
|
end
|
||||||
return node
|
return node
|
||||||
|
|||||||
@@ -248,9 +248,7 @@ return {
|
|||||||
bs(atr('b%$', 'bool type parameter'), fmta('bool $#~', { i(0, 'var') })),
|
bs(atr('b%$', 'bool type parameter'), fmta('bool $#~', { i(0, 'var') })),
|
||||||
bs(atr('a%$', 'array type parameter'), fmta('array $#~', { i(0, 'var') })),
|
bs(atr('a%$', 'array type parameter'), fmta('array $#~', { i(0, 'var') })),
|
||||||
s(atr('$ ', 'Expand $this->'), fmta('$this->#~', { i(0) })),
|
s(atr('$ ', 'Expand $this->'), fmta('$this->#~', { i(0) })),
|
||||||
bs(
|
bs(etr('am ', 'array_map function'), {
|
||||||
etr('am ', 'array_map function'),
|
|
||||||
{
|
|
||||||
c(1, {
|
c(1, {
|
||||||
sn(nil, fmta('array_map(fn (#~) => #~, #~)', { i(2), i(3), i(1) })),
|
sn(nil, fmta('array_map(fn (#~) => #~, #~)', { i(2), i(3), i(1) })),
|
||||||
sn(
|
sn(
|
||||||
@@ -265,12 +263,9 @@ return {
|
|||||||
)
|
)
|
||||||
),
|
),
|
||||||
}),
|
}),
|
||||||
}
|
}),
|
||||||
),
|
|
||||||
bs(etr('array_map', 'array_map function'), fmta('am', {})),
|
bs(etr('array_map', 'array_map function'), fmta('am', {})),
|
||||||
bs(
|
bs(etr('af ', 'array_filter function'), {
|
||||||
etr('af ', 'array_filter function'),
|
|
||||||
{
|
|
||||||
c(1, {
|
c(1, {
|
||||||
sn(nil, fmta('array_filter(#~, fn (#~) => #~)', { i(1), i(2), i(3) })),
|
sn(nil, fmta('array_filter(#~, fn (#~) => #~)', { i(1), i(2), i(3) })),
|
||||||
sn(
|
sn(
|
||||||
@@ -285,8 +280,7 @@ return {
|
|||||||
)
|
)
|
||||||
),
|
),
|
||||||
}),
|
}),
|
||||||
}
|
}),
|
||||||
),
|
|
||||||
bs(etr('array_filter', 'array_filter function'), fmta('af', {})),
|
bs(etr('array_filter', 'array_filter function'), fmta('af', {})),
|
||||||
s(
|
s(
|
||||||
etr('php', 'php class'),
|
etr('php', 'php class'),
|
||||||
@@ -377,6 +371,9 @@ return {
|
|||||||
-------------
|
-------------
|
||||||
s(
|
s(
|
||||||
etr('bt', 'belongsTo Laravel relationship method'),
|
etr('bt', 'belongsTo Laravel relationship method'),
|
||||||
|
c(0, {
|
||||||
|
sn(
|
||||||
|
nil,
|
||||||
fmta(
|
fmta(
|
||||||
[[
|
[[
|
||||||
/**
|
/**
|
||||||
@@ -390,8 +387,28 @@ return {
|
|||||||
{ rep(1), i(0), i(1) }
|
{ rep(1), i(0), i(1) }
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
sn(
|
||||||
|
nil,
|
||||||
|
fmta(
|
||||||
|
[[
|
||||||
|
/**
|
||||||
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo<\App\Models\#~, $this>
|
||||||
|
*/
|
||||||
|
public function #~(): BelongsTo
|
||||||
|
{
|
||||||
|
return $this->belongsTo(#~::class, #~);
|
||||||
|
}
|
||||||
|
]],
|
||||||
|
{ rep(1), i(2), i(1), i(0) }
|
||||||
|
)
|
||||||
|
),
|
||||||
|
})
|
||||||
|
),
|
||||||
s(
|
s(
|
||||||
etr('hm', 'hasMany Laravel relationship method'),
|
etr('hm', 'hasMany Laravel relationship method'),
|
||||||
|
c(0, {
|
||||||
|
sn(
|
||||||
|
nil,
|
||||||
fmta(
|
fmta(
|
||||||
[[
|
[[
|
||||||
/**
|
/**
|
||||||
@@ -405,8 +422,28 @@ return {
|
|||||||
{ rep(1), i(0), i(1) }
|
{ rep(1), i(0), i(1) }
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
sn(
|
||||||
|
nil,
|
||||||
|
fmta(
|
||||||
|
[[
|
||||||
|
/**
|
||||||
|
* @return \Illuminate\Database\Eloquent\Relations\HasMany<\App\Models\#~, $this>
|
||||||
|
*/
|
||||||
|
public function #~(): HasMany
|
||||||
|
{
|
||||||
|
return $this->hasOne(#~::class, #~);
|
||||||
|
}
|
||||||
|
]],
|
||||||
|
{ rep(1), i(2), i(1), i(0) }
|
||||||
|
)
|
||||||
|
),
|
||||||
|
})
|
||||||
|
),
|
||||||
s(
|
s(
|
||||||
etr('ho', 'hasOne Laravel relationship method'),
|
etr('ho', 'hasOne Laravel relationship method'),
|
||||||
|
c(0, {
|
||||||
|
sn(
|
||||||
|
nil,
|
||||||
fmta(
|
fmta(
|
||||||
[[
|
[[
|
||||||
/**
|
/**
|
||||||
@@ -420,8 +457,28 @@ return {
|
|||||||
{ rep(1), i(0), i(1) }
|
{ rep(1), i(0), i(1) }
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
sn(
|
||||||
|
nil,
|
||||||
|
fmta(
|
||||||
|
[[
|
||||||
|
/**
|
||||||
|
* @return \Illuminate\Database\Eloquent\Relations\HasOne<\App\Models\#~, $this>
|
||||||
|
*/
|
||||||
|
public function #~(): HasOne
|
||||||
|
{
|
||||||
|
return $this->hasOne(#~::class, #~);
|
||||||
|
}
|
||||||
|
]],
|
||||||
|
{ rep(1), i(2), i(1), i(0) }
|
||||||
|
)
|
||||||
|
),
|
||||||
|
})
|
||||||
|
),
|
||||||
s(
|
s(
|
||||||
etr('bm', 'belongsToMany Laravel relationship method'),
|
etr('bm', 'belongsToMany Laravel relationship method'),
|
||||||
|
c(0, {
|
||||||
|
sn(
|
||||||
|
nil,
|
||||||
fmta(
|
fmta(
|
||||||
[[
|
[[
|
||||||
/**
|
/**
|
||||||
@@ -435,6 +492,23 @@ return {
|
|||||||
{ rep(1), i(2), i(1), i(0) }
|
{ rep(1), i(2), i(1), i(0) }
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
sn(
|
||||||
|
nil,
|
||||||
|
fmta(
|
||||||
|
[[
|
||||||
|
/**
|
||||||
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany<\App\Models\#~, $this>
|
||||||
|
*/
|
||||||
|
public function #~(): BelongsToMany
|
||||||
|
{
|
||||||
|
return $this->belongsToMany(#~::class, #~, #~);
|
||||||
|
}
|
||||||
|
]],
|
||||||
|
{ rep(1), i(2), i(1), i(3), i(0) }
|
||||||
|
)
|
||||||
|
),
|
||||||
|
})
|
||||||
|
),
|
||||||
s(
|
s(
|
||||||
atr('->wr', 'Eloquent where method'),
|
atr('->wr', 'Eloquent where method'),
|
||||||
c(0, {
|
c(0, {
|
||||||
|
|||||||
Reference in New Issue
Block a user