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

Fix Typescript generation to work with node-mavlink #778

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

GimpMaster
Copy link

@GimpMaster GimpMaster commented Feb 15, 2023

While recently testing the typescript generation with the latest node-mavlink we found a number of issues. For example

  • multi-line comments in the XML show up only as single line
  • incorrect exports/imports
  • other misc differences

This is now working with the current head of node-mavlink for us.

NOTE

Added in a helper utility method for generating a list of all messages for use with node-mavlink custom message support. This new exported function is generated in message-registry.ts

Also adjusted based on comments.

@GimpMaster GimpMaster changed the title Fix/typescript Fix Typescript generation to work with node-mavlink Feb 15, 2023
@BearToCode
Copy link

Just want to express my support for this contribution, as the current typescript generated library does not even work anymore. Me and my team would love to have this PR merged!

@@ -74,40 +76,55 @@ def generate_classes(dir, registry, msgs, xml):

f.write("/*\n{}\n*/\n".format(m.description.strip()))
for field in m.fields:
f.write("// {} {} {}\n".format(field.name, field.description.strip(), field.type))
f.write("/* {} {} {} */\n".format(field.name, field.description.strip(), field.type))
Copy link

@BearToCode BearToCode Mar 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fields comments should be moved at line 85/86, otherwise they won't show up

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I understand this comment?When I look at lines 84/85 I don't see any comments. What are you proposing?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to move the comments from here:

/*
TC ping (expects an ACK message as a response)
*/
/* timestamp Timestamp to identify when it was sent uint64_t */
export class PingTc extends MavLinkData {
	public timestamp!: number;
	...

to here:

/*
TC ping (expects an ACK message as a response)
*/
export class PingTc extends MavLinkData {
        /* Timestamp to identify when it was sent uint64_t */
	public timestamp!: number;
	...

Also notice how I removed the field name from the comment, as it is not really necessary.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to include this

@BearToCode
Copy link

BearToCode commented Mar 29, 2023

Hello, is there any repo maintainer willing to take the time to look at this PR? It's kind of a big deal for me to have it merged in the repo... Maybe @tridge ? (sorry for the mention but you are the only active repo admin I was able to find, as there's no list of collaborators)

@khancyr
Copy link
Contributor

khancyr commented Mar 29, 2023

@davidbuzz I think you are JS/TS guy, any opinion on this ?

…fields

- Added in helper utility function to create list of message ids to magic numbers for use with custom messaging in node-mavlink
@GimpMaster
Copy link
Author

Based upon feedback from this node-mavlink issue disscussion (ArduPilot/node-mavlink#21) we have this working correctly with custom messages now. I've updated the PR description.

@BearToCode
Copy link

Hello, any news?

@GimpMaster
Copy link
Author

@davidbuzz Are you able to approve?

@davidbuzz
Copy link
Contributor

The changes this pr makes in the generator/javascript/ folder should NOT be merged... thats a different generator['javascript' vs 'typescript'], please remove them from this pr. As for the typescript changes, i cant comment, as i maintain the other one. ;-)

@GimpMaster
Copy link
Author

Thanks @davidbuzz - I'm not sure how those got in there, but I will revert those two file changes. Do you know who can review the typescript changes?

@davidbuzz
Copy link
Contributor

I dont know if we have a maintainer for 'typescript' bindings, but 'git blame' them to see whos made changes b4, or who created them in the first place... or failing that, convince the rest of us with testing evidence that its better.. ;-)

@peterbarker
Copy link
Contributor

Thanks @davidbuzz - I'm not sure how those got in there, but I will revert those two file changes. Do you know who can review the typescript changes?

Ping @pascalgross - from 2019... if we don't get a response we'll probably just welcome you as the new typescript generator maintainer :-)

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

Successfully merging this pull request may close these issues.

6 participants