Enable emmet to function inside script templates. #51180 (#51256)

This commit is contained in:
Jackson Kearl
2018-06-06 14:14:24 -07:00
committed by Ramya Rao
parent 0493de9e30
commit 21c02bad2e
10 changed files with 207 additions and 21 deletions

View File

@@ -4,8 +4,8 @@
*--------------------------------------------------------------------------------------------*/
import * as vscode from 'vscode';
import { getNodesInBetween, getNode, parseDocument, sameNodes, isStyleSheet, validate } from './util';
import { Node, Stylesheet, Rule, HtmlNode } from 'EmmetNode';
import { getNodesInBetween, getNode, getHtmlNode, parseDocument, sameNodes, isStyleSheet, validate } from './util';
import { Node, Stylesheet, Rule } from 'EmmetNode';
import parseStylesheet from '@emmetio/css-parser';
import { DocumentStreamReader } from './bufferStream';
@@ -63,8 +63,8 @@ function toggleCommentHTML(document: vscode.TextDocument, selection: vscode.Sele
const selectionStart = selection.isReversed ? selection.active : selection.anchor;
const selectionEnd = selection.isReversed ? selection.anchor : selection.active;
let startNode = <HtmlNode>getNode(rootNode, selectionStart, true);
let endNode = <HtmlNode>getNode(rootNode, selectionEnd, true);
let startNode = getHtmlNode(document, rootNode, selectionStart, true);
let endNode = getHtmlNode(document, rootNode, selectionEnd, true);
if (!startNode || !endNode) {
return [];