-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Declarations for engine and controller scripting API #4759
Declarations for engine and controller scripting API #4759
Conversation
2cc3c59
to
b1d689c
Compare
662ede7
to
6180be6
Compare
6180be6
to
f7bf179
Compare
Sounds reasonable. Does this put any mandatory work to the mapping developer, that makes work harder as a noob contributor? |
Nothing mandatory, if you don't create the jsconfig.json file next to your mapping file, everything is as before. |
Please ping me when this PR is ready for review. I'll take a look then. |
dcb2cf5
to
573a615
Compare
48e36c1
to
a743f33
Compare
@Swiftb0y This is now ready for review! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much for working on this DX improvement.
Please also link to some parts of our more elaborate docs on the github wiki.
Also, have you considered using plain JS files containing just JSDoc comments?
Also please add a comment to the *JSProxy
-classes to point them to these definition files so they get updated when the proxy gets updated.
@JoergAtGithub please also take a look at my previous but abandoned attempt at this #2636 |
Wasn't aware of this PR. I'm not at home this week, and will address your review comments the week after. |
No problem. I just wanted to supply some context for my review comments. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you, just minor wording suggestions. I've tried to test this but I struggled getting it to work in my editor (vscodium). I'll get back to you once I figured out whats wrong.
35f238a
to
7ae4f68
Compare
After getting the jsconfig to work, I'm really annoyed by the fact that a developer needs to edit the jsconfig to reference their mapping in order for everything to work. After a bit of research and trial and error, I don't think there is anything we can do against that, right? We could get that working by making each mapping their own project (which would make sense) but that would require putting each mapping to its own folder. That's something I would like to do anyways in the future, but is out-of-scope for this PR. I think we should include a jsconfig as well. Putting this into {
"compilerOptions": {
"target": "es6",
"checkJs": true,
"lib": ["ES6"]
},
"include": [
"*.d.ts",
"common-hid-packet-parser.js",
"common-controller-scripts.js",
// add the filename of your own mapping here:
""
// make sure to exclude any changes in this file from your submission
]
} |
…ts creating new ScriptConnection objects from JavaScript
I would not like to add a |
Thats fair. Though it certainly makes it more difficult to test. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you, last couple complaints I found.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation looks good to me. LGTM otherwise. Thank you for your patience.
Done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you.
Time to celebrate twice - the PR is exactly 1 year old today. 🎂 |
Sorry, this took this long... Highly appreciate the effort though. |
Thank you for the review! |
These declarations allow modern code editors and IDEs, to show online syntax help and allows type checking (as far as JavaScript supports types).
To enable this, the mapping developer has to create a file jsconfig.json in the directory with the JavaScript mapping to edit. This file is editor independend an should work with all editors, which support the Language Server Protocol (LSP), like VS Code, Atom, Eclipse, Kate, Sublime, etc.
The jsconfig.json must have the a content like below, that allows the editor to find all include files and tells him to use ES6 syntax: