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

add tree-sitter-jsdoc #2650

Merged

Conversation

the-mikedavis
Copy link
Member

connects #2648

This is a pretty small grammar. The injection for comments is already set up in runtime/queries/javascript/injections.scm. Github also uses this for their syntax highlighting, like in:

/**
 * Extract the string matched by the regex and return both the resulting string
 * and the matched string
 *
 * @param {string} source
 * @param {RegExp} regExp
 * @returns
 */
export function extract(source, regExp) {
  const result = regExp.exec(source)
  return result ? {
    normalizedSource: source.replace(result[0], ''),
    extracted: result[1]
  } : { normalisedSource: source, extracted: '' }
}

@the-mikedavis the-mikedavis force-pushed the md-tree-sitter-jsdoc branch from cf4b8f7 to 3ed8570 Compare June 2, 2022 16:57
Copy link
Contributor

@EricCrosson EricCrosson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing! 🚀 Thanks @the-mikedavis

@the-mikedavis the-mikedavis force-pushed the md-tree-sitter-jsdoc branch from 3ed8570 to a506683 Compare June 3, 2022 01:51
@sudormrfbin sudormrfbin merged commit fd4858c into helix-editor:master Jun 3, 2022
@the-mikedavis the-mikedavis deleted the md-tree-sitter-jsdoc branch June 3, 2022 11:50
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.

3 participants