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 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()
|
||||
end
|
||||
return node
|
||||
|
||||
@@ -248,9 +248,7 @@ return {
|
||||
bs(atr('b%$', 'bool type parameter'), fmta('bool $#~', { i(0, 'var') })),
|
||||
bs(atr('a%$', 'array type parameter'), fmta('array $#~', { i(0, 'var') })),
|
||||
s(atr('$ ', 'Expand $this->'), fmta('$this->#~', { i(0) })),
|
||||
bs(
|
||||
etr('am ', 'array_map function'),
|
||||
{
|
||||
bs(etr('am ', 'array_map function'), {
|
||||
c(1, {
|
||||
sn(nil, fmta('array_map(fn (#~) => #~, #~)', { i(2), i(3), i(1) })),
|
||||
sn(
|
||||
@@ -265,12 +263,9 @@ return {
|
||||
)
|
||||
),
|
||||
}),
|
||||
}
|
||||
),
|
||||
}),
|
||||
bs(etr('array_map', 'array_map function'), fmta('am', {})),
|
||||
bs(
|
||||
etr('af ', 'array_filter function'),
|
||||
{
|
||||
bs(etr('af ', 'array_filter function'), {
|
||||
c(1, {
|
||||
sn(nil, fmta('array_filter(#~, fn (#~) => #~)', { i(1), i(2), i(3) })),
|
||||
sn(
|
||||
@@ -285,8 +280,7 @@ return {
|
||||
)
|
||||
),
|
||||
}),
|
||||
}
|
||||
),
|
||||
}),
|
||||
bs(etr('array_filter', 'array_filter function'), fmta('af', {})),
|
||||
s(
|
||||
etr('php', 'php class'),
|
||||
@@ -377,6 +371,9 @@ return {
|
||||
-------------
|
||||
s(
|
||||
etr('bt', 'belongsTo Laravel relationship method'),
|
||||
c(0, {
|
||||
sn(
|
||||
nil,
|
||||
fmta(
|
||||
[[
|
||||
/**
|
||||
@@ -390,8 +387,28 @@ return {
|
||||
{ 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(
|
||||
etr('hm', 'hasMany Laravel relationship method'),
|
||||
c(0, {
|
||||
sn(
|
||||
nil,
|
||||
fmta(
|
||||
[[
|
||||
/**
|
||||
@@ -405,8 +422,28 @@ return {
|
||||
{ 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(
|
||||
etr('ho', 'hasOne Laravel relationship method'),
|
||||
c(0, {
|
||||
sn(
|
||||
nil,
|
||||
fmta(
|
||||
[[
|
||||
/**
|
||||
@@ -420,8 +457,28 @@ return {
|
||||
{ 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(
|
||||
etr('bm', 'belongsToMany Laravel relationship method'),
|
||||
c(0, {
|
||||
sn(
|
||||
nil,
|
||||
fmta(
|
||||
[[
|
||||
/**
|
||||
@@ -435,6 +492,23 @@ return {
|
||||
{ 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(
|
||||
atr('->wr', 'Eloquent where method'),
|
||||
c(0, {
|
||||
|
||||
Reference in New Issue
Block a user