Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use tiled-api npm package #37

Closed
bjorn opened this issue Mar 24, 2022 · 6 comments
Closed

Use tiled-api npm package #37

bjorn opened this issue Mar 24, 2022 · 6 comments

Comments

@bjorn
Copy link
Member

bjorn commented Mar 24, 2022

Since a while we have an NPM package called tiled-api: https://www.npmjs.com/package/@mapeditor/tiled-api

Using it in an extension enables code completion and API documentation to show up in a JS editor, like VS Code. It would be nice to set this up for this extension as well.

@justdaft
Copy link

justdaft commented Mar 25, 2022 via email

@nerochiaro
Copy link
Contributor

Since a while we have an NPM package called tiled-api: https://www.npmjs.com/package/@mapeditor/tiled-api

Using it in an extension enables code completion and API documentation to show up in a JS editor, like VS Code. It would be nice to set this up for this extension as well.

Could you please elaborate a bit on what would you consider "setting this up" for the extension ?
Just having a package.json for the project with the types package appearing in the devDependencies ?

@bjorn
Copy link
Member Author

bjorn commented Jul 22, 2022

Could you please elaborate a bit on what would you consider "setting this up" for the extension ?
Just having a package.json for the project with the types package appearing in the devDependencies ?

Yes, and for the source files to be modified to take advantage of it where necessary. In JS files, you often need type annotations in comments to tell VS Code the type of variables, function parameters and return values.

@nerochiaro
Copy link
Contributor

Right. I have always found specifying types as JSDoc comments a bit painful, and much prefer the type annotation syntax of typescript. But I guess since we are dealing with the QT JS engine, there's no other way to do it since we don't want to have to rebuild the extension every time something changes.

@eleniums
Copy link
Contributor

eleniums commented Jul 26, 2022

Closed by PR #49

@bjorn
Copy link
Member Author

bjorn commented Jul 29, 2022

But I guess since we are dealing with the QT JS engine, there's no other way to do it since we don't want to have to rebuild the extension every time something changes.

Right, some extensions are written in TypeScript and just deal with the compilation step somehow, like https://github.com/sponge/keen-tiled. Anyway I'm not advocating to port this extension to TypeScript.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants