Skip to content

Commit 96da5b9

Browse files
authored
Docs/jsx code completion (#74)
* Update README with code completion hints Modified the Typescript section to also reference JSX code completion, with instructions on how to add the definitions .ts file to the package.json for JSX code completion support. * Add types def to package.json * Update README.md
1 parent 68ba3a5 commit 96da5b9

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,14 @@ Label.Align.ALIGN_LEFT | godot.Label.Align.ALIGN_LEFT
153153
}
154154
```
155155

156-
### TypeScript support
156+
### TypeScript support and JSX code completion
157157
- Run the menu command `Project > Tools > ECMAScript > Generate TypeScript Project` from the godot editor to generate a TypeScript project
158158
- Run `tsc -w -p .` under your project folder in the terminal to compile scripts
159159

160+
#### Code completion
161+
- Code completion in TSX will automatically work once the TypeScript project is generated by the above steps.
162+
- Code completion in JSX in VS Code is achieved by the property `"types": "./godot.d.ts"` in the generated package.json file of the TypeScript project. The `godot.d.ts` file can be generated alone via the `Project > Tools > ECMAScript > Generate TypeScript Declaration File` editor menu option and added to a `package.json` file manually to achieve this without a full TypeScript project.
163+
160164
#### Example TypeScript Usage
161165

162166
Make sure the file with extension '.tsx' so it can be compiled to a `.jsx` file then we can attach it to a node in godot editor.

misc/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@
55
},
66
"devDependencies": {
77
"typescript": "^3.9.7"
8-
}
8+
},
9+
"types": "godot.d.ts"
910
}

0 commit comments

Comments
 (0)