Add tree-sitter "programming modes" supported by Hyperbole - #576
Merged
Merged
Conversation
rswgnu
requested changes
Aug 17, 2024
| . ((smart-java) . (smart-java nil 'next-tag))) | ||
| ;; | ||
| ((and (memq major-mode '(js2-mode js-mode js3-mode javascript-mode html-mode web-mode)) | ||
| ((and (memq major-mode '(js2-mode js-mode js3-mode javascript-mode html-mode web-mode js-ts-mode)) |
Owner
There was a problem hiding this comment.
Keep these mode names in alphabetical order.
| (defcustom hui-select-brace-modes | ||
| '(c++-mode c-mode java-mode objc-mode perl-mode tcl-mode) | ||
| '(c++-mode c-mode java-mode objc-mode perl-mode tcl-mode | ||
| c++-ts-mode c-ts-mode java-ts-mode) |
Owner
There was a problem hiding this comment.
Same comment as above. Check the whole PR for this ordering issue.
Collaborator
Author
There was a problem hiding this comment.
Same comment as above. Check the whole PR for this ordering issue.
The mode lists should now be sorted.
matsl
force-pushed
the
add-tree-sitter-modes
branch
from
August 18, 2024 07:46
af51c45 to
070fdff
Compare
rswgnu
approved these changes
Aug 18, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Add tree-sitter based modes for the programming modes currently
supported by Hyperbole.
Why
Hyperbole uses buffers current major mode for checking if some
functionality shall be available in the buffer. With tree-sitter comes
modes for many programming languages and those can be used instead of
the old programming modes. These new modes are not recognized by
Hyperbole and if they are used the programming language specific
buttons are not recognized.
Note
Was looking into tree-sitter and to use the c++-ts-mode in a c++
file only to realize that Hyperbole smart-c++ was not available in
that case because we don't understand what c++-ts-mode is.
This just blindly adds the tree-sitter modes to the program language
checks. There are no automatic tests that this works for all cases. On
the other hand we have no tests that it works for all the old modes
either.
It seems some old modes and tree sitter modes use the same base
mode. It could be possible to use that in Hyperbole to check for the
base mode instead to limit the modes to check for. This is not a
general pattern though so can only be applied after checking for each
programming language.
No analysis have been done if there are tree-sitter features that
Hyperbole utilized. This PR only allows the programming language to
derived by looking at the tree-sitter modes.