Atom / platform.io : no ctags navigation on Arduino sources


#1

Quick intro: total newbie to Atom (1.25.0 x64) / Platform (3.5.3a8) / Arduino. Using Debian Stable with the exuberant-ctags package installed and "ctags -R " has been run at the top of the project tree.
Also, I had a halfway decent knowledge of C / C++ in a previous life as a student.

Searched for ctags here but I’m still unsure if I am having the same issues or not. From what I remember, ctags is supposed to show symbols and enable navigation to / from definition… at lease this is what atom-ctags promises.

Issue no.1) I have two similar entries in the context menu when I right-click on a symbol, slightly different spelling (“Goto Declaration”, bound to F3, and “Go to Declaration”, unbound), neither of which seems to do much. It doesn’t matter whether I activate the command from the beginning, the middle or the end of the symbol.

Issue no. 2) this is actually my goal: being able to jump from a function call to its definition. If this is merely a special case of no.1, then it also doesn’t work here. If this is something different, my question becomes: “is this at all supported?”

Thanks in advance for your help.
Regards,
Andrea


#2

Based on https://github.com/platformio/platformio-atom-ide/issues/128, this looks like it’s provided by the platformio-atom-ide package, are you using that package to work with Arduino? If so, I’d suggest reaching out to the PlatformIO community, they have a message board here:

This is from Atom’s Symbols View:

https://flight-manual.atom.io/using-atom/sections/moving-in-atom/#navigating-by-symbols

Not sure if anyone else has more experience using it that can chime in but I’ve only used it on super simple single files and it’s worked ok - would you be able to share your project so I can give it a try?


#3

Hi, Robert.

Yes, I am using Platform.io to work on Arduino. I’ll try and post the question on their own board.

You’re more than welcome to try navigating the same project I’m using, it’s not really mine and you can find it here: https://github.com/stanleyhuangyc/Freematics/tree/master/firmware_v5
(I’ve tried datalogger, which is what I am currently using, and telelogger

Thanks for your assistance.


#4

Thanks for pointing a link to the project - I gave it a try but also had trouble with Go to Declaration. Symbols View: Toggle File Symbols seems to work though.

I haven’t used that functionality very much so I’m not sure if I’m missing something simple but I also noticed there are open issues about trouble with Go to Declaration 1 so it could be a bug too I guess.


#5

Yeah, I would also think so.
I guess we’ll have to wait and see.


#6

Hmm, a couple of Platform.io upgrades have happened.
Saw a YT video suggesting to rename the source to CPP, tried it and… it works: if the source code for the project is in a file with cpp extension, the navigation to / from symbols works. Weird.
Could you try and replicate this?


#7

What was the file extension before?


#8

INO, I think it’s kind of standard practice for Arduino to use that extension.
Not my project, though, so this is not something I can change. I’ll have to see if the problems lies with ctags itself or with the way Atom & Platform use it.


#9

I could give it a try - do you have an example file that I can rename and a particular symbol to search for?


#10

Was the code being highlighted correctly?


#11

So you’re saying the extension is INO? I thought it’s normally ino.


#12

Same project I wrote above, telelogger.ino for example.
Clone it to telelogger.cpp and rebuild ctags.
Then go to the end, click process() and choose to go to definition (alt-ctrl-down) and come back. Basically, it just works for all symbols.


#13

Yeah, highlighting seems to be totally fine: grammar autodetection correctly flags it as C++ and there is no visible difference in highlighting between the original telelogger.ino and a cloned telelogger.cpp


#14

It is, I capitalized it to make it stand out in text.
“ino” is what I have in the projects.


#15

Did some research and testing today, it would seem that “ino” files are not explored when looking for symbols.

If I manually force ctags to treat “ino” as being C++ then the symbols are correctly detected, so I guess it’s really an issue with the way it’s being called by Atom.

Where should I look to check the cmdline for ctags or possibly change it?