atom-selection-ast

1.0.1 • Public • Published

atom-selection-ast

Test if an AST node is within the current selection in Atom.

Note that you'll need to enable loc values for your AST nodes when you're parsing.

Usage

NPM

test = selection(source)

Pass in the plaintext JavaScript source for your AST to prepare the module for searching.

test(astNode, selectionRanges)

Returns true if astNode is within one of selectionRanges, where selectionRanges is an array of Atom Range values.

License

MIT. See LICENSE.md for details.

Package Sidebar

Install

npm i atom-selection-ast

Weekly Downloads

2

Version

1.0.1

License

MIT

Last publish

Collaborators

  • hughsk