Starting with Visual Studio 2017 version 15.5 (currently only in Preview), you can use many of the features of Microsoft Visual Studio with Particle firmware. Things like IntelliSense work, as do features like refactoring and all sorts of linking between things in source and system firmware headers.
It’s not perfect yet, but it’s quite cool. And it works with the free Community edition. No local build or GDB yet, but those are theoretically possible, I just had trouble getting them to work and I thought I’d release just this part, because even this part is pretty awesome.
The full and lengthy instructions can be found here:
What can do you do with it? I’m glad you asked.
- Flagging of common code errors like undefined references while you type. You don’t even need to save, let alone build!
- Also things like too many arguments, for both your code and system firmware, as you type.
- Autocomplete, for both system firmware and your code. In this example, I typed
Serial.b
and it helpfully provided lots more info:
- Quick link to declaration (header file) and definition (source file). You can view all of the system firmware headers, but unfortunately not the implementations (since the whole system firmware is not indexed by IntelliSense).
- Class View for easily navigating all your classes
- Find all references. Click on source or the class view and find out where it’s used. I selected it for DS2482GetTemperatureForListCommand and found it used in 3 examples and the regular source.
- Hover over constants, both in your own source and system firmware.
- For libraries with inline documentation, hovering over the class name brings up helpful information.
- Rename a class, method or function in a few clicks. It finds all of the places to fix in all files (including my example files) and also finds comments that probably need to be changed!
- Automatic graying out of code controlled by defines, even platform defines:
- You get a bunch of new options when you right click on a .cpp file in the Solution Explorer:
- You can build and flash by DFU with one menu selection, great for Electrons:
- Build output fully integrated into the normal Visual Studio flow. Errors link into the error panel and into the code automatically.