Hi as @Trying_to_learn says, please edit your post and put three back ticks ``` on a line above and on a line below your code so it is both formatted correctly and readable.
A Node red custom node js file (in your case computer.js) can contain multiple nodes. For example the official source for nodes tcp in, tcp out and tcp request are all in one file. You also need a matching .html file and lastly, your package.JSON needs to list them both. E.g.
In fact, I find the .html file very confusing just in itself and it definitely isn't IDE friendly. So I now write the code for that file in 3 separate files (the admin UI, the help info and the script) in a sub-folder and have a script that stitches them together. Now I can develop them properly using the full capabilities of VScode.
I agree with @TotallyInformation and @Steve-Mcl about using separate files in general. Once in a while, several nodes will share code or require simultaneous modification, so that keeping them in the same file can be convenient. A good example of how to do this cleanly is in the core link in and link out nodes (.js and.html).
??? It is the file that defines the Node-RED admin ui panel for your node.
That does make sense when the .js code is as short as the excellent link nodes. It also makes sense in the .html code in the link case as so much of its javascript is common.
However, I would go even further. I separate out common code to a separate file again. uibuilder v2 has two such libraries. 1 that contains common code that requires data from a node instance and probably a reference to RED - uilib.js and one that is generic utilities such as safely reading a JSON file - tilib.js. Each of these is required as necessary.
That is easier for the .js file. But even for the .html file, I would extend my build script - which simply merges 3 files into a template file, I would extend that with a common code file. This makes development soooo much easier because the code is really easy to read.
In fact, I might well do that now you've made me think about it since even though I'm only defining a single node, I do have quite a number of functions that I use to keep the actual admin panel definition smaller and easier to follow.
Understood. I thought you were referring specifically to the OP's .html file, not to NR .html files in general.
You are exactly right: developing nodes is quirky, since both the .js and .html files use NR-specific definitions and structures that make life difficult for standard editors and debuggers. Perhaps the developers could give us a nice IDE in their spare time .
I'd be happy if they were contained in almost anything except a <script> tag so the IDE could understand the contents. Even a custom tag would probably be ok.