Consolidate wrapWithAbbreviation and wrapIndividualLinesWithAbbreviation in one command (#116603)

fixes #109191, fixes #116738
This commit is contained in:
Jean Pierre
2021-02-19 14:33:47 -05:00
committed by GitHub
parent e66f74e0c2
commit 5d2c9bf299
6 changed files with 179 additions and 223 deletions

View File

@@ -374,6 +374,16 @@ export function getHtmlFlatNode(documentText: string, root: FlatNode | undefined
return currentNode;
}
export function isOffsetInsideOpenOrCloseTag(node: FlatNode, offset: number): boolean {
const htmlNode = node as HtmlFlatNode;
if ((htmlNode.open && offset > htmlNode.open.start && offset < htmlNode.open.end)
|| (htmlNode.close && offset > htmlNode.close.start && offset < htmlNode.close.end)) {
return true;
}
return false;
}
export function offsetRangeToSelection(document: vscode.TextDocument, start: number, end: number): vscode.Selection {
const startPos = document.positionAt(start);
const endPos = document.positionAt(end);