WIP child ranges

This commit is contained in:
Ashi Krishnan
2018-07-05 13:09:22 -04:00
parent aca13c1d6d
commit 302ee1e2c1

View File

@@ -571,7 +571,25 @@ class LanguageLayer {
}
}
_rangesForInjectionNode (node) {
/**
* @param node {Parser.SyntaxNode}
* @param fromChildrenOfType {Object}
*/
_rangesForInjectionNode (node, fromChildrenOfType) {
if (!fromChildrenOfType)
return this._textRangesForInjectionNode(node)
const ranges = []
for (const child of node.namedChildren) {
if (fromChildrenOfType[child.type])
ranges.push(...this._textRangesForInjectionNode(child))
}
return ranges
}
/**
* @param node {Parser.SyntaxNode}
*/
_textRangesForInjectionNode (node) {
const result = []
let position = node.startPosition
let index = node.startIndex