Attaching Code Completion in Eclipse 2022 When Using NodeJS

Questions about applications and software
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
gmseed
Level 1
Level 1
Posts: 22
Joined: Thu Sep 08, 2022 6:26 am

Attaching Code Completion in Eclipse 2022 When Using NodeJS

Post by gmseed »

I installed the latest Eclipse IDE 2022 [v2.3.1] for JavaScript and Web Developers using the software manager on Linux Mint 21.

It comes shipped with NodeJS but when I create a new .js file there is no code completion. For example, when I include package url:

var url = require('url')

and then type "url." I don't see the members/functions of the object.

I've looked around how to attach NodeJS but haven't found how to do it.

Also, I downloaded the 3rd party NodeJS package called LoDash, which was placed in /home/node_modules/lodash. How would I also attach this to my project so that I have access to code completion?

Thanks.

PS. If I download Eclipse IDE for Enterprise Java and Web Developers for Win10, it comes ready with NodeJS code completion. I would have installed this version on Mint but it wasn't listed in the Software Manager.
Last edited by LockBot on Thu Mar 30, 2023 10:00 pm, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
spamegg
Level 14
Level 14
Posts: 5040
Joined: Mon Oct 28, 2019 2:34 am
Contact:

Re: Attaching Code Completion in Eclipse 2022 When Using NodeJS

Post by spamegg »

There is no Eclipse IDE available in the Software Manager on Mint 21. How did you get it?
Screenshot from 2022-09-30 16-01-30.png
gmseed
Level 1
Level 1
Posts: 22
Joined: Thu Sep 08, 2022 6:26 am

Re: Attaching Code Completion in Eclipse 2022 When Using NodeJS

Post by gmseed »

There is in my version, installed just a couple of weeks ago:

Linux Mint 21 Cinnamon
5.4.12

I went to:
1) Software Manager
2) Clicked on "Programming" in the lower panel
3) Searched for "eclipse"

Eclipse IDE for Java Devs and Web and JS Devs appears.
screenshot.png
User avatar
spamegg
Level 14
Level 14
Posts: 5040
Joined: Mon Oct 28, 2019 2:34 am
Contact:

Re: Attaching Code Completion in Eclipse 2022 When Using NodeJS

Post by spamegg »

I guess that must be a Flatpak then, my bad. I forgot that I disabled/removed Flatpak.

I'm guessing that you need to install some sort of plugin for Eclipse. I wouldn't trust the Software Manager for latest version of an IDE. Quite a lot of IDEs on Software Manager are just broken. I never use them. Either outdated or badly packaged. Probably better to go straight to their website and get it from there.

Personally I'd recommend using Visual Studio Code, it works great with Node/Javascript/EcmaScript and tools like npm and ESLint. It has great plugins. I've never heard of anyone using Eclipse for modern Node/JS web development. Eclipse is more part of the Java world/ecosystem.
gmseed
Level 1
Level 1
Posts: 22
Joined: Thu Sep 08, 2022 6:26 am

Re: Attaching Code Completion in Eclipse 2022 When Using NodeJS

Post by gmseed »

"I'm guessing that you need to install some sort of plugin for Eclipse." --> I always dislike the words if, could, maybe, guessing in science.

"I wouldn't trust the Software Manager for latest version of an IDE. Quite a lot of IDEs on Software Manager are just broken. I never use them. Either outdated or badly packaged. Probably better to go straight to their website and get it from there." --> These are the OFFICIAL Mint versions.

"Personally I'd recommend using Visual Studio Code, it works great with Node/Javascript/EcmaScript and tools like npm and ESLint. It has great plugins. I've never heard of anyone using Eclipse for modern Node/JS web development. Eclipse is more part of the Java world/ecosystem." --> Thanks but the post relates to Eclipse. I have used Eclipse for more than 20 years and as a result natural to continue using it. It works well on Win10/11 using NodeJS, but the issue relates to using it with a particular Mint version of Eclipse in that I can't see how to attach code completion when using NodeJS, which is strange because it comes shipped with NodeJS.

I have also posted my question on Stackoverflow to see if someone else knows the answer.
User avatar
spamegg
Level 14
Level 14
Posts: 5040
Joined: Mon Oct 28, 2019 2:34 am
Contact:

Re: Attaching Code Completion in Eclipse 2022 When Using NodeJS

Post by spamegg »

I managed to install Flatpak and this Eclipse IDE, opened up a Node project. It looks like it comes with Javascript Language Server and ESLint server pre-installed. (Says so in the Preferences.)

Code completion is working for me if I press Alt + /, it auto-completes what I'm typing.
It cycles through available options if I keep pressing Alt + / over and over.

For example, I have a file countries.js and if I type co and press Alt + / it cycles through countries, const, console, components.

I'm using ReactJS and if I type us and press Alt + / it cycles through useEffect and useState.

Similarly if I press Ctrl+Space it shows me a drop-down menu of all the possibilities. Here is a screenshot:
Screenshot from 2022-10-01 14-38-55.png
Locked

Return to “Software & Applications”