AutoComplete/IntelliSense in VSCode

I am using VSCode and was unable to configure IntelliSense for auto-completion from the Source folder files (like Cesium.js).

What I tried:

-Adding the “.vscode” file from the Cesium repo.

-Creating a jsconfig.json file explicitly including “Source”.

-Extensions (external libraries)

Thanks

Hi Parasect,

Take a look at this GitHub issue to get the rundown on typings files and intellisense with Cesium.

Thanks,

Gabby

Hello,

I’ve seen that Cesium has officially added typescript definitions, however I’ve had trouble getting them to actually show up with intellisense. Anyone know how I could get this working? I’m using 1.71 so I believe it should be supported.

Thanks

1 Like

I am having the same problem. I am relatively new to typescript but I can’t believe how difficult it is to get this going after Cesium has added a .d.ts file.

I tried adding at the top of my index.ts file:
///<reference path="../../node_modules/cesium/Build/Cesium/Cesium.t.ds"/>(and Cesium.js)

I’ve added this to my tsconfig.json:
`{

"extends": "./node_modules/electron-webpack/tsconfig-base.json",

"compilerOptions": {

    "types" : ["cesium", "node"]

},

"include": ["./node_modules/cesium/Build/CesiumUnminified/Cesium.js", "src/renderer/index.ts"],

"noEmitOnError": false,

"noImplicitAny": false

}`

I feel like I’ve tried everything. Please help.

The typical way to use CesiumJS with TypeScript is to install and import the cesium module via npm. When done this way, there is no additional setup or configuration needed. For example:

import { Viewer } from "cesium";

const viewer = new Viewer('cesiumContainer');

Worked for me after doing an npm install cesium in an empty TS project. Is there a reason you are attempting to use the global pre-built Cesium instead?

2 Likes