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

Tagging support #13

Closed
avodonosov opened this issue May 29, 2023 · 2 comments
Closed

Tagging support #13

avodonosov opened this issue May 29, 2023 · 2 comments

Comments

@avodonosov
Copy link
Collaborator

avodonosov commented May 29, 2023

The tree-sitter tags command can be used to implement "go to definition" functions. (In particular at github, I assume.)

It is documented here: https://tree-sitter.github.io/tree-sitter/code-navigation-systems

It does not work for tree-sitter-commonlisp. Right now (after fixing #12) if I run tree-sitter tags ~/prj/cl+ssl/cl-plus-ssl/src/package.lisp I get just

No tags config found for path "/home/anton/prj/cl+ssl/cl-plus-ssl/src/streams.lisp"

To support tagging, the languiage impl should provide a queries/tags.scm file.
An example: The tree-sitter-ruby

After adding #14, the same tags command as above prints function definition locations. The function names are not package qualified, but I think it may be even better that way for github code navigation currently, as symbol references produced by tree-sitter parse command are also not package qualified (unless in the source code they have a package prefix)

initialize-instance      | function     def (50, 11) - (50, 30) `(defmethod initialize-instance :after ((stream ssl-stream)`
print-object     | function     def (61, 11) - (61, 23) `(defmethod print-object ((object ssl-stream) stream)`
stream-element-type      | function     def (73, 11) - (73, 30) `(defmethod stream-element-type ((stream ssl-stream))`
close            | function     def (76, 11) - (76, 16) `(defmethod close ((stream ssl-stream) &key abort)`
open-stream-p    | function     def (95, 11) - (95, 24) `(defmethod open-stream-p ((stream ssl-stream))`
stream-listen    | function     def (98, 11) - (98, 24) `(defmethod stream-listen ((stream ssl-stream))`
stream-read-byte         | function     def (109, 11) - (109, 27) `(defmethod stream-read-byte ((stream ssl-stream))`
stream-read-sequence     | function     def (123, 11) - (123, 31) `(defmethod stream-read-sequence ((stream ssl-stream) seq start end &key)`
stream-write-byte        | function     def (146, 11) - (146, 28) `(defmethod stream-write-byte ((stream ssl-stream) b)`
while            | function     def (154, 10) - (154, 15) `(defmacro while (cond &body body)`
stream-write-sequence    | function     def (157, 11) - (157, 32) `(defmethod stream-write-sequence ((stream ssl-stream) seq start end &key)`
stream-finish-output     | function     def (175, 11) - (175, 31) `(defmethod stream-finish-output ((stream ssl-stream))`
stream-force-output      | function     def (178, 11) - (178, 30) `(defmethod stream-force-output ((stream ssl-stream))`
install-nonblock-flag    | function     def (190, 7) - (190, 28) `(defun install-nonblock-flag (fd)`
install-nonblock-flag    | function     def (201, 7) - (201, 28) `(defun install-nonblock-flag (fd)`
install-nonblock-flag    | function     def (208, 7) - (208, 28) `(defun install-nonblock-flag (fd)`
install-nonblock-flag    | function     def (212, 7) - (212, 28) `(defun install-nonblock-flag (fd)`
install-handle-and-bio   | function     def (227, 7) - (227, 29) `(defun install-handle-and-bio (stream handle socket unwrap-stream-p)`
install-key-and-cert     | function     def (263, 7) - (263, 27) `(defun install-key-and-cert (handle key certificate)`
x509-certificate-names   | function     def (276, 7) - (276, 29) `(defun x509-certificate-names (x509-certificate)`
ssl-stream-handle        | function     def (289, 11) - (289, 28) `(defmethod ssl-stream-handle ((stream flexi-streams:flexi-stream))`
ssl-stream-x509-certificate      | function     def (292, 7) - (292, 34) `(defun ssl-stream-x509-certificate (ssl-stream)`
ssl-load-global-verify-locations         | function     def (295, 7) - (295, 39) `(defun ssl-load-global-verify-locations (&rest pathnames)`
ssl-set-global-default-verify-paths      | function     def (309, 7) - (309, 42) `(defun ssl-set-global-default-verify-paths ()`
ssl-check-verify-p       | function     def (316, 7) - (316, 25) `(defun ssl-check-verify-p ()`
ssl-verify-init  | function     def (330, 7) - (330, 22) `(defun ssl-verify-init (&key`
maybe-verify-client-stream       | function     def (348, 7) - (348, 33) `(defun maybe-verify-client-stream (ssl-stream verify-mode hostname)`
handle-external-format   | function     def (373, 7) - (373, 29) `(defun handle-external-format (stream ef)`
with-new-ssl     | function     def (378, 10) - (378, 22) `(defmacro with-new-ssl ((var) &body body)`
make-alpn-proto-string   | function     def (403, 7) - (403, 29) `(defun make-alpn-proto-string (protocols)`
make-ssl-client-stream   | function     def (412, 7) - (412, 29) `(defun make-ssl-client-stream (socket`
make-ssl-server-stream   | function     def (554, 7) - (554, 29) `(defun make-ssl-server-stream (socket`
get-selected-alpn-protocol       | function     def (599, 7) - (599, 33) `(defun get-selected-alpn-protocol (ssl-stream)`
stream-fd        | function     def (609, 12) - (609, 21) `(defgeneric stream-fd (stream)`
stream-fd        | function     def (614, 11) - (614, 20) `(defmethod stream-fd (stream) stream)`
stream-fd        | function     def (617, 11) - (617, 20) `(defmethod stream-fd ((stream sb-sys:fd-stream))`
stream-fd        | function     def (621, 11) - (621, 20) `(defmethod stream-fd ((stream system:fd-stream))`
stream-fd        | function     def (625, 11) - (625, 20) `(defmethod stream-fd ((stream ccl::basic-stream))`
stream-fd        | function     def (629, 11) - (629, 20) `(defmethod stream-fd ((stream stream))`
stream-fd        | function     def (634, 11) - (634, 20) `(defmethod stream-fd ((stream two-way-stream))`
stream-fd        | function     def (638, 11) - (638, 20) `(defmethod stream-fd ((stream stream))`
stream-fd        | function     def (642, 11) - (642, 20) `(defmethod stream-fd ((stream comm::socket-stream))`
stream-fd        | function     def (657, 13) - (657, 22) `(defmethod stream-fd ((stream system::socket-stream))`
@avodonosov
Copy link
Collaborator Author

Updated #14 to include also function references

@theHamsta
Copy link
Member

Fixed by #14

I'm not using this functionality, so I won't add more tags myself, but contributions are welcome!

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

No branches or pull requests

2 participants