Stream: compiler development

Topic: Can visitor pattern


view this post on Zulip Luke Boswell (Nov 28 2024 at 06:05):

I've been hacking away at something... and stumbled into Can. I'm just wondering if anyone could explain what the "visitor" thing is doing? From what I can gather so far it just seems to be visiting each node in the parsed AST but doesn't seem to be doing much.

view this post on Zulip Ayaz Hafiz (Nov 28 2024 at 23:14):

it’s used for some stuff in the lsp

view this post on Zulip Eli Dowling (Dec 02 2024 at 15:26):

@Luke Boswell
I can give some insight into that. We mostly use it in the lsp to drill down into the current scope of the cursor or a hover and figure out what should be available for completion at that point.

view this post on Zulip Eli Dowling (Dec 02 2024 at 15:27):

You can see the visitor.ts in the completion directory which I believe implements that trait too


Last updated: Jul 06 2025 at 12:14 UTC