Integration into VSCode (for Noob)

Hello,
first of all, I am a total noob and I have been out of programming for a decade, and am now only coming back to coding because Cesium is such a fantastic tool for what I am passionate about (visualising landscape models). It’s an uphill task for me as the last time I touched JavaScript was in the 1990s when it was only used for blinking icons in websites…
So apologies for asking a very basic question, and not even having the right terminology to ask it.

Having said that, here’s my question:
Trying to learn the ropes with Cesium, I’d love to have something like Intellisense in VSCode helping me along the way.

I have found discussions like

or

but I find it very hard to find any conclusive answers to the following questions:

1. Is there a way to have Intellisense for Cesium code in VSCode?
2. If yes: Is there a reasonably straight-forward way to activate it
3. If no: Is there an alternative editor/IDE where I can get this type of functionality?

I hope I don’t come across overly lazy here. I am willing to do my own homework, but at the moment a lot of my “doing homework” goes into understanding the awesome tool that is Cesium, so if someone could help me with getting some Intellisense-like functionality working without me needing to get deep into stuff like TypeScript (whatever that is) then I’d be extremely grateful!!

Best wishes,
Tobi

Hello @tobi_kellner :wave: and welcome back to the Javascript world :hugs: CesiumJS already supports TypeScript type definitions. You should check out this blog post for more details.

Hi @Aristeidis_Bampakos,
thanks for your reply!
Yes, I had seen that article, but it went totally over my head. What I am looking for is a step-by-step guide of what I need to do to make it work in VSCode.
I am not familiar with TypeScript and it somehow seems strange to me that I have to familiarise myself with a whole new programming language just to get syntax highlighting for CesiumJS :slight_smile:
So any tips here would be much appreciated!

Tobi

What does your workspace directory look like? Do you use any build tools to set up your project, or are you just writing plain HTML/JS and copying the files to a web server?

One pretty straightforward way to get this working for you is to install NodeJS, which should include the npm command line tool. Then, you can just run npm install cesium which will download the NPM package of Cesium, which includes the original (un-bundled) Cesium source code, two bundled versions, and the type definitions used by VSCode, all in “well known” directories. This setup would also be used by a variety of build tools, like Webpack, Rollup, etc.

(I work more or less exclusively in Typescript at this point, so I always have a tsconfig.json file in my projects. This could be required to get Code to recognize the type definitions, but I think installed NPM packages should get picked up without one.)

Check this out