Development tools?

I haven't found any discussion of preferred tools for development, like an IDE. I'm sure some here just use a text editor but I find IDEs to be helpful because I mess around in several languages, none of them with any regularity, so being proficient is just not going to happen and I need all the help I can get. I recently did an intro course on TypeScript and the instructor strongly suggested VS Code so I have a little familiarity with that. What do you use?

1 Like

I have a number of Wemos devices capturing data (readings) around my home and sending this information via MQTT to Node-RED running on a Raspberry Pi.

I used to use ESP Easy to organise the firmware inside the ESP8266s but recently I've started using Visual Code Studio (VCS) with the Platformio plug-in and must admit I'm enjoying the experience. I'm sure my coding efficiency and accuracy has improved due to the real-time syntax checker.
It is also easy to cut-n-paste (proven) code from one project to another, again saving time and frustration!!

One thing I like is you can do Over The Air (OTA) updates (once you have the code flashed onto the Wemos).

1 Like

Visual studio code.

I use it for node/js, python, c++, batch, powershell, html, and more.

When developing nodes for node-red, I often step debug and inspect what is going on. Far better than text editors and console logging. See here.

3 Likes

I use the WebStorm IDE from JetBrains, and have done so for years - before VSCode was thought of: I have felt no need to look for alternatives. I also use the C, Python and occasionally Java equivalents.

2 Likes

VScode. Free and powerful but still pretty fast. Lots of extensions installed though I don't keep them all turned on for every workspace. The most important extension by far being eslint.

I've never had a lot of time for doing ESP/Arduino coding in VScode though and still use the Arduino IDE for that.

As with Steve, I use VScode for many different languages. It even supports Jupyter notebooks now. There is also a special version for working with Azure databases.

2 Likes

It depends what platform you're developing for, and what operating system you're using, but there are a number of good IDEs which cover most options.

I've been using Visual Studio since its earliest versions (20+ years) and continue to use it both for work and for home development. It's probably the best option under Windows, and I'm using it for ESP8266 development (with the Visual Micro plugin), as well as general application (C++ & C#) and game development.

You also have the option of VS Code, which is slightly cut down Visual Studio, but is available on Linux and MacOS as well as Windows.

Another cross-platform option is Eclipse, which I've used a lot over the years as well, since my company provides Linux-based products (including our own Eclipse-based development environment for a particular SoC range of devices).

It's probably worth trying a few of these, and others mentioned in the thread, to see which best fits with your needs and development style.

1 Like

Thanks, everyone.

I started using NetBeans when I learned Java 20 years ago and never used it for anything else.

Visual Studio was mighty handy when it was free via the site license we had where I worked. Since retiring 13 years ago I've mostly used Nedit on Linux but I've done little development until getting into this home automation stuff this year.

I never heard of VS Code, or maybe have forgotten, until a few weeks ago. Crazy, right? Anyway, I'm sold it now that most of you are too. One question, though. How do you provide NR context so the editor doesn't flag everything with errors?

My question may have been lost in the dust...

I seen it but didn't understand what you meant.

Perhaps you could provide a screenshot?

1 Like

Thank you for responding and maybe I haven't gone far enough yet. I'm having trouble running VS Code on a remote machine (where NR is) and getting the display here on my desktop. Arch Linux on both boxes and when I type "code" in a terminal window (I've ssh'd to the remote box) I get a window on my desktop, just like I do with any app, but it is completely white. Until I get that resolved I won't have a screenshot to post.

However, from my brief experience in a TypeScript tutorial I'm expecting that any JS code I enter that references an external entity, like "this", will cause the editor to flag it because it doesn't know what "this" is. Does that clear it up?

I'm not sure if that's possible, or the correct way to do remote development. I would guess you'd need some sort of screen sharing, but it's not something I've ever tried with VS Code.

I've used the remote debugging features in Visual Studio, but that doesn't sound like what you're trying to do.

Since my last post I tried the reverse, running VSC on my dekstop via a terminal on the server and it works as expected. So now I'm trying to figure out what is different with the X windows between the two boxes.

Just to say that this is a common misconception. VS Code is a totally different code-base and is built around Electron. This means that it is totally Node.js based (e.g. JavaScript & V8). That is why it is available cross-platforms. It was a Microsoft initiative but though MS are still the main contributors, many others now contribute as well.

It is much simpler to use, especially for non-pro coders like myself. For me, Visual Studio and Eclipse are far too complex and take too long to learn and be comfortable with if you aren't coding all day.

You can simply declare the globals or you can do a npm dev install of the handy typings file: npm install @types/node-red -d

3 Likes

Try it the other way around. Install on your local machine then add the remote extensions from Microsoft. This lets you edit remote code as though it were local - nice! I use this to develop more complex uibuilder UI's on my home server, saves a lot of faffing around.

Remember that most Node-RED code is JavaScript not typescript even though one of the strengths of VScode is its ability to leverage TypeScript to validate JavaScript.

But the main issue you might hit is ESLint/TypeScript not knowing about Node-RED's implicit global's. You can simply declare those in your eslintrc.js file or manually at the top of your code.

VScode is otherwise excellent at guessing what is and isn't valid in an object or module/class/function.

1 Like

(I was just about to edit my previous post)

It looks like there are some additional pieces you might need to get it working, and which might be simpler than trying to get the X server connection working. I found this link :

Which is quite a long read, but details all the steps for remote development and debugging via SSH.

Ah, indeed that's true - my meaning was that it's very like Visual Studio in use, with very similar, but fewer, features, appearance and operation, and you can switch back and forward between them without too much thought (or at least that's my experience).

1 Like

Thanks, @TotallyInformation, the install works just fine and I'll check it out as soon as I get the X windows fixed.

There's no need for that.

Is this necessary with the @types/node-red installed?

I found, and read, that too. It's really much simpler with the correct X windows setup. I do it all the time with many other apps and that's why I was surprised when I ran into this blank window issue with VSC.

I'll post back here when I figure it out but I'm almost certain this is not a VSC/nodejs/NR issue at this point because, as I said in my previous post, I'm able to remotely run VSC on my desktop and it displays fine on the server which is the reverse of the way I need it.

Ha! Found the solution here:

In short, it's an Electron issue and adding --no-xshm gets it working. Why is it not an issue when run from my desktop and displayed on the other box, I don't know.

Just one question remains:

Probably not always but may depend on what you are doing and how you have structured your code. Bearing in mind that a custom node has a JavaScript file with the backend code (node.js) and an HTML file with front-end code (Node-RED Editor) so they are very different environments.

Also, if you are developing uibuilder front-end code, that is a different environment again (with no RED object).

Each might warrant a slightly different configuration for eslint.

1 Like

Great, thanks.