feat: Allow custom placement to be disabled for certain types
This commit is contained in:
@@ -73,7 +73,7 @@ return function(parent, data, template, required_type)
|
||||
|
||||
local append = template.append or {}
|
||||
|
||||
if append.position == "after" then
|
||||
if append.position == "after" and not vim.tbl_contains(append.disabled or {}, required_type) then
|
||||
local child_node = nodes:matching_child_nodes(parent, append.child_name)[1]
|
||||
if not child_node and append.fallback then
|
||||
local fallback = nodes:matching_child_nodes(parent, append.fallback)[1]
|
||||
|
||||
@@ -29,6 +29,7 @@ local template_configuration = {
|
||||
---@field child_name string Which child node to use for appending the annotation
|
||||
---@field fallback string Node to fallback if `child_name` is not found
|
||||
---@field position "'after'"|"'before'" Place the annotation relative to position with `child_name` or `fallback`
|
||||
---@field disabled table|nil Disable custom placement for provided types
|
||||
---
|
||||
--- For example, to customize the placement for a python annotation, we can use `append`, like so:
|
||||
---
|
||||
|
||||
Reference in New Issue
Block a user