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

[Enhancement]: Support jsdoc types for javascript/typescript #96

Open
GNRSN opened this issue Feb 4, 2024 · 1 comment
Open

[Enhancement]: Support jsdoc types for javascript/typescript #96

GNRSN opened this issue Feb 4, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@GNRSN
Copy link

GNRSN commented Feb 4, 2024

Language affected

Javascript

Description

The jsdoc format for javascript supports adding types, including writing typescript inside the comment which can be used by the typescript compiler to typecheck js code. Since rainbow-delimiters works for both js and ts already, it would be awesome if it applied in jsdoc as well.

Example comparison with vscode:

Neovim:
Screenshot 2024-02-04 at 17 53 21

Vscode:
Screenshot 2024-02-04 at 17 57 49

@GNRSN GNRSN added the bug Something isn't working label Feb 4, 2024
@HiPhish
Copy link
Owner

HiPhish commented Feb 11, 2024

I don't think I can do anything here because the parser does not provide any useful information. Let's take this piece of Javascript code:

/**
 * A function with delimiters in type comments
 *
 * @param {{id: string, friends: {id: string}[]}} data
 */
const greet_person = ({id, friends}) => {
	return id
}

Here is the syntax tree of the entire comment:

(comment ; [51:1 - 55:3]
  (description) ; [52:4 - 46]
  (tag ; [54:4 - 54]
    (tag_name) ; [54:4 - 9]
    "{" ; [54:11 - 11]
    (type) ; [54:12 - 48]
    "}" ; [54:49 - 49]
    (identifier))) ; [54:51 - 54]

As you can see everything inside the { and } is one single node, there is no structured information. This plugin relies on Tree-sitter to provide structure information, but I don't have anything to work with here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants