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

feat(lib): add the language name #3184

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ObserverOfTime
Copy link
Member

Problem

Bindings have no way of retrieving the name of the language.
The only exception is Node which wraps it in a N-API object.

Solution

Add a name field to the generated struct and a ts_language_name function to retrieve it.
This should be backwards compatible since it will just return NULL if unset.

@clason
Copy link
Contributor

clason commented Mar 17, 2024

Actually, I would recommend turning this into a full ts_language_info object that can also take the version, possible aliases, ... (future proof).

@ObserverOfTime
Copy link
Member Author

Looks like this actually segfaults if the compiled parser is older.
I can make it check the ABI version and only work on 15.

@ObserverOfTime
Copy link
Member Author

(Should not be merged before ABI 15 is a thing.)

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.

None yet

3 participants