Skip to content

Conversation

@ivanrg99
Copy link

@ivanrg99 ivanrg99 commented Dec 6, 2025

Hi! Love the project!

I added fennel support for locals/vars and then function-like forms (lambdas, fns and macros), as well as tests.

Feedback is welcome

@github-actions github-actions bot requested a review from stevearc December 6, 2025 13:38
Copy link
Owner

@stevearc stevearc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! Left a couple of questions/suggestions

Comment on lines +407 to +423
M.fennel = {
postprocess = function(bufnr, item, match)
local node = node_from_match(match, "symbol")
local full_form = get_node_text(node, bufnr)

if item.kind == "Function" then
local name = string.match(full_form, "[λ fn lambda macro] (%S+) %[")
item.name = name ~= nil and name or "<Anonymous>"
elseif item.kind == "Class" or item.kind == "Struct" then
local kind = (item.kind == "Class") and "local" or "var"
local query = kind .. " (%S+)"
local name = string.match(full_form, query) or "<parse error>"
item.name = name
else
item.name = "<parse error>"
end
end,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of using these extensions to extract the name, could you just adjust the treesitter queries? The @name capture group can be used to select the node that contains the name.

Comment on lines +10 to +14
(local_form
(#set! "kind" "Class")) @symbol @root

(var_form
(#set! "kind" "Struct")) @symbol @root
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do Struct and Class make sense for these? I would assume that this more naturally maps to the Variable type

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants