Vscode ca65 intellisense extension

A place where you can keep others updated about your NES-related projects through screenshots, videos or information in general.
hobbett
Posts: 11
Joined: Thu Sep 04, 2025 10:33 pm

Vscode ca65 intellisense extension

Post by hobbett »

Hi all,

(Posted on the discord already, but posting here to try to reach more folks)

I was really interested in learning NES development but I felt discouraged by the lack of intellisense tools like the ones mainstream languages have. So, I created a ca65 vscode extension that provides LSP features like go-to-definition, hover cards, live diagnostics, and context-aware autocompletion with auto-include and auto-import.

I hope you give it a try and let me know what you think -- I'm always looking to improve the design.

You can check it out on GitHub (https://github.com/hobbett/ca65-vscode-extension), or just search for ca65 in the Vscode extension marketplace and look for the one authored by yours truly (hobbett).
hobbett
Posts: 11
Joined: Thu Sep 04, 2025 10:33 pm

Re: Vscode ca65 intellisense extension

Post by hobbett »

I've also added instructions to the README on how to build a standalone LSP executable, for those of you who don't use vscode
User avatar
segaloco
Posts: 913
Joined: Fri Aug 25, 2023 11:56 am

Re: Vscode ca65 intellisense extension

Post by segaloco »

Oh neat, I'll pull this down later and see how it works.
User avatar
segaloco
Posts: 913
Joined: Fri Aug 25, 2023 11:56 am

Re: Vscode ca65 intellisense extension

Post by segaloco »

Hey! This feature is really really helpful:
Screenshot 2025-09-05 at 10.36.26.png
I use cheap local labels all the time to minimize the amount of significant symbols in assembly units, being able to see them identified like this is great.

Regarding symbol navigation, does your extension automatically index includes or do you have to have opened them first? What I keep having happen is I open up a workspace, attempt to pull references for a symbol, and get this:
Screenshot 2025-09-05 at 10.41.32.png
However, I then go open my PPU header and a few other files, then close them again:
Screenshot 2025-09-05 at 10.42.54.png
Then I get what I'd expect to see, although note I haven't verified this is catching every reference, it seems pretty thorough either way.

Another one worth mentioning, even with the files having been opened, the extension is struggling to find subroutine references outside of a file. For instance, I can find the mentions of "main" in the main file:
Screenshot 2025-09-05 at 10.46.37.png
But it misses the externally used reference in the bootstrap startup:
Screenshot 2025-09-05 at 10.47.12.png
Great work, this is awesome, happy to offer any diagnostic help with this stuff. For the record, the project I tried this out with was https://gitlab.com/segaloco/smb3 although my NES disassemblies in general follow similar patterns of granularity. Worth noting some of my disassemblies use the directory "inc" rather than "include" for headers so would require adding that to the header include dirs. Eventually I'm migrating everything to use "include" but just haven't yet. Additionally, I use the extension ".i" rather than ".inc" for headers, and added this extension to the settings accordingly before trying the references thing above.

Edit: One more because again I want to compliment the small QoL things, having the segment in highlight references is so awesome:
Screenshot 2025-09-05 at 10.51.45.png
You do not have the required permissions to view the files attached to this post.
User avatar
segaloco
Posts: 913
Joined: Fri Aug 25, 2023 11:56 am

Re: Vscode ca65 intellisense extension

Post by segaloco »

Meh might as well just bump again one last bit for now. Something is killing indentation-based code folding:
Screenshot 2025-09-05 at 11.27.27.png
Notice the little arrow (v) next to irq_proc_40. Typically I also see such arrows next to lines like 800 and 802 offering to fold up those indented sections. I find that behavior incredibly helpful, that's half the reason I use indentation like this, auto-fold behaviors like that then make visualizing specific pathways through subroutines much easier by folding away the branches that I'm not currently studying. That's a pretty central behavior I take advantage of when using an IDE rather than vi. I would say my usage is about 70% vi/CLI and 30% VSCode when I'm on a computer that has it, so it's not the end of the world, but is certainly one of the factors that has me dip back into VSCode occasionally.
You do not have the required permissions to view the files attached to this post.
hobbett
Posts: 11
Joined: Thu Sep 04, 2025 10:33 pm

Re: Vscode ca65 intellisense extension

Post by hobbett »

Thanks for checking it out segaloco!

Regarding symbol navigation, does your extension automatically index includes or do you have to have opened them first? What I keep having happen is I open up a workspace, attempt to pull references for a symbol, and get this:
It should auto-index, so this looks like a bug... I'll investigate this further

Another one worth mentioning, even with the files having been opened, the extension is struggling to find subroutine references outside of a file. For instance, I can find the mentions of "main" in the main file:
The symbol must be .imported from the file (or any of it's includes) in order to be correctly resolved. I pulled the smb3 project and added an `.import main` to the files that used it, and it seemed to work.
Something is killing indentation-based code folding:
Folding only works for normal labels and scopes/procs/structs/enums, but not cheap local labels or anonymous labels, which are handled on-demand and treated in a separate space from the "normal" symbols.

There's not really a good way to determine nesting when it comes to labels, since there's no clear end marker -- for normal labels, I just had the folding range end to the last content line before the next normal label/scope/proc etc. For your use case of anonymous labels, it seems this would be inadequate since you have an implicit indentation nesting scheme, so it would have to be something similar to the default vscode indentation folding. Unfortunately this seems difficult to integrate with the existing indentation scheme, so I'll have to reconsider this in the future.
hobbett
Posts: 11
Joined: Thu Sep 04, 2025 10:33 pm

Re: Vscode ca65 intellisense extension

Post by hobbett »

Ah right the initial indexing doesn't work in the smb3 project because the extensions are .i and my `files.associations` detection is borked. It should work with the default `.s`, `.asm`, and `.inc` though. I should have a patch to fix this soon
hobbett
Posts: 11
Joined: Thu Sep 04, 2025 10:33 pm

Re: Vscode ca65 intellisense extension

Post by hobbett »

I just pushed version 1.4.8 which should fix the indexing.

Make sure you have the following in your settings

```
"files.associations": {
"*.i": "ca65", <-- ADD THIS SO .i FILES ARE CORRECTLY INDEXED
}
"ca65.autoIncludeExtensions": [
".inc",
".i" <-- ADD THIS SO YOU CAN AUTOINCLUDE DURING AUTOCOMPLETE
],
```
User avatar
segaloco
Posts: 913
Joined: Fri Aug 25, 2023 11:56 am

Re: Vscode ca65 intellisense extension

Post by segaloco »

Ah I wonder if the settings are related too, I added .i to autoinclude extensions but not file associations. I'll mess with that when I get a chance and let you know.
User avatar
segaloco
Posts: 913
Joined: Fri Aug 25, 2023 11:56 am

Re: Vscode ca65 intellisense extension

Post by segaloco »

Getting better, it's now able to find the reference back to the include:
Screenshot 2025-09-08 at 12.01.19.png
However, this is certainly not the only file referencing this symbol in the project. If I open and close another file, that is then added to the references, but something still seems to be stuck in analyzing the workspace:
Screenshot 2025-09-08 at 12.02.25.png
You do not have the required permissions to view the files attached to this post.
hobbett
Posts: 11
Joined: Thu Sep 04, 2025 10:33 pm

Re: Vscode ca65 intellisense extension

Post by hobbett »

Thanks so much for the testing! I've uploaded a patch at v1.4.12 to fix this. Seems I totally borked the includes resolution in my zealous effort to speed up the implementation...
User avatar
segaloco
Posts: 913
Joined: Fri Aug 25, 2023 11:56 am

Re: Vscode ca65 intellisense extension

Post by segaloco »

Good news, looks like the reference retrieval is now working correctly:
Screenshot 2025-09-09 at 12.27.04.png
Really the only other thing I would have on my wishlist is indentation-based code folding, in other words:
Screenshot 2025-09-09 at 12.32.43.png
Basically getting the arrow indicators and folding capability I'm using to hide the subroutine on line 41, but for nested indentation like the sleep loop there on line 70. Without this extension, using the default VSCode behavior, I'm able to fold these up too:
Screenshot 2025-09-09 at 12.29.58.png
This is something I find incredibly useful when doing high-level analysis, because then I can simply close up code pathways I don't care in documenting the current pathway I'm analyzing. Not a show stopper, but certainly something helpful. On the flip side, the local label display is super helpful, it's been great for verifying my flow control commentary is correct. While not every single bit of code maps cleanly to C-like control flow, most do, and it makes then reading through things so much quicker.
You do not have the required permissions to view the files attached to this post.
hobbett
Posts: 11
Joined: Thu Sep 04, 2025 10:33 pm

Re: Vscode ca65 intellisense extension

Post by hobbett »

I've uploaded v 1.4.13 which adds a setting `ca65.smartFolding` which you can disable to get the default vscode indentation-based folding. Does that fit your use case?
User avatar
segaloco
Posts: 913
Joined: Fri Aug 25, 2023 11:56 am

Re: Vscode ca65 intellisense extension

Post by segaloco »

Everything I could hope for and more:
Screenshot 2025-09-09 at 17.47.56.png
What a great extension, thanks for working with my feedback, this is frankly a game changer. I was using the alchemy65 extension for a while when I would use VSCode, but I wasn't really using any of the debug features, just the highlighting, but this is pretty next level in the editor realm.
Screenshot 2025-09-09 at 17.52.07.png
That's just nice, quite convenient. Anything here that looks "right" by the way feel free to use any screencaps for the package landing page. Sometimes it's nice to see something in action.
You do not have the required permissions to view the files attached to this post.
hobbett
Posts: 11
Joined: Thu Sep 04, 2025 10:33 pm

Re: Vscode ca65 intellisense extension

Post by hobbett »

Much obliged! Feel free to report any more issues or feature requests you might have!