Skip to content
New issue

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

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

Already on GitHub? # to your account

Distribution of "language objects" for a major mode #101

Closed
sogaiu opened this issue Feb 3, 2021 · 5 comments
Closed

Distribution of "language objects" for a major mode #101

sogaiu opened this issue Feb 3, 2021 · 5 comments
Labels
question Not a bug report or feature request

Comments

@sogaiu
Copy link
Contributor

sogaiu commented Feb 3, 2021

I've made some progress on a new Janet major mode that uses emacs-tree-sitter (as discussed here: #95 (comment))

It now has some support for:

  • indentation
  • highlighting
  • folding (comment blocks and docstrings)
  • imenu

In each case emacs-tree-sitter is used.

I'd like to make it generally available, but regarding the platform-specific grammar bits as noted in the EmacsConf 2020 presentation:

The plan is that eventually these files should be provided by the language major modes themselves. But in order to do that we need better tooling.

Is it still recommended then to make a PR to have the relevant grammar be part of tree-sitter-langs?

@ubolonton
Copy link
Collaborator

ubolonton commented Feb 5, 2021

There hasn't been tooling improvement for this, so it's still easier to let tree-sitter-langs distribute the grammar, unless the new major mode already has its own binary distribution mechanisms in place.

@ubolonton ubolonton added the question Not a bug report or feature request label Feb 5, 2021
@sogaiu
Copy link
Contributor Author

sogaiu commented Feb 5, 2021

Thank you!

@sogaiu
Copy link
Contributor Author

sogaiu commented Feb 6, 2021

I am confused about the name of the shared library.

When I build it within emacs-tree-sitter's project directory using make ensure/janet-simple the resulting file is located in langs/bin and named janet-simple.so, using a hyphen.

When I build the shared library within the tree-sitter-janet-simple project, I end up with a file named janet_simple.so, which uses an underscore.

I tested with tree-sitter-c-sharp with similar results (i.e. one way yields c-sharp.so and the other way yields c_sharp.so).

Is this something I need to be concerned with?

@ubolonton
Copy link
Collaborator

The CLI tool tree-sitter outputs names with underscores: janet_simple.so.
The function tree-sitter-langs-compile converts underscores to hyphens, to make the names more Emacs-y: janet-simple.so.
The function tree-sitter-load looks for both (hyphens first): janet-simple.so then janet_simple.so.
Further Emacs tools should assume hyphens.

This was introduced in 0.12.2.

It shouldn't be a concern.

@sogaiu
Copy link
Contributor Author

sogaiu commented Feb 6, 2021

Thank you for the explanation.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
question Not a bug report or feature request
Projects
None yet
Development

No branches or pull requests

3 participants