Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hughsk/atom-selection-ast
Test if an AST node is within the current selection in Atom
https://github.com/hughsk/atom-selection-ast
Last synced: 8 days ago
JSON representation
Test if an AST node is within the current selection in Atom
- Host: GitHub
- URL: https://github.com/hughsk/atom-selection-ast
- Owner: hughsk
- License: other
- Created: 2015-05-16T05:27:59.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-05-16T05:39:03.000Z (over 9 years ago)
- Last Synced: 2024-10-17T16:41:24.647Z (22 days ago)
- Language: JavaScript
- Size: 113 KB
- Stars: 4
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# atom-selection-ast
![](http://img.shields.io/badge/stability-stable-orange.svg?style=flat)
![](http://img.shields.io/npm/v/atom-selection-ast.svg?style=flat)
![](http://img.shields.io/npm/dm/atom-selection-ast.svg?style=flat)
![](http://img.shields.io/npm/l/atom-selection-ast.svg?style=flat)Test if an AST node is within the current selection in
[Atom](http://atom.io/).Note that you'll need to enable `loc` values for your AST
nodes when you're parsing.## Usage
[![NPM](https://nodei.co/npm/atom-selection-ast.png)](https://nodei.co/npm/atom-selection-ast/)
### `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](https://atom.io/docs/api/v0.199.0/Range) values.## License
MIT. See [LICENSE.md](http://github.com/hughsk/atom-selection-ast/blob/master/LICENSE.md) for details.