mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-22 09:38:38 +01:00
Renaming utilties for clarity
This commit is contained in:
@@ -11,7 +11,7 @@ import { TextEditor, Range, Position, window } from 'vscode';
|
||||
import * as path from 'path';
|
||||
import { getImageSize } from './imageSizeHelper';
|
||||
import { isStyleSheet } from 'vscode-emmet-helper';
|
||||
import { parse, getNode, iterateCSSToken, getCssProperty } from './util';
|
||||
import { parseDocument, getNode, iterateCSSToken, getCssPropertyFromRule } from './util';
|
||||
import { HtmlNode, CssToken, HtmlToken, Attribute, Property } from 'EmmetNode';
|
||||
import { locateFile } from './locateFile';
|
||||
import parseStylesheet from '@emmetio/css-parser';
|
||||
@@ -59,7 +59,7 @@ function updateImageSizeHTML(editor: TextEditor) {
|
||||
|
||||
function updateImageSizeStyleTag(editor: TextEditor) {
|
||||
let getPropertyInsiderStyleTag = (editor) => {
|
||||
const rootNode = parse(editor.document);
|
||||
const rootNode = parseDocument(editor.document);
|
||||
const currentNode = <HtmlNode>getNode(rootNode, editor.selection.active);
|
||||
if (currentNode && currentNode.name === 'style'
|
||||
&& currentNode.open.end.isBefore(editor.selection.active)
|
||||
@@ -109,7 +109,7 @@ function updateImageSizeCSS(editor: TextEditor, fetchNode: (editor) => Property)
|
||||
* @return {HtmlNode}
|
||||
*/
|
||||
function getImageHTMLNode(editor: TextEditor): HtmlNode {
|
||||
const rootNode = parse(editor.document);
|
||||
const rootNode = parseDocument(editor.document);
|
||||
const node = <HtmlNode>getNode(rootNode, editor.selection.active, true);
|
||||
|
||||
return node && node.name.toLowerCase() === 'img' ? node : null;
|
||||
@@ -122,7 +122,7 @@ function getImageHTMLNode(editor: TextEditor): HtmlNode {
|
||||
* @return {Property}
|
||||
*/
|
||||
function getImageCSSNode(editor: TextEditor): Property {
|
||||
const rootNode = parse(editor.document);
|
||||
const rootNode = parseDocument(editor.document);
|
||||
const node = getNode(rootNode, editor.selection.active, true);
|
||||
return node && node.type === 'property' ? <Property>node : null;
|
||||
}
|
||||
@@ -213,8 +213,8 @@ function updateHTMLTag(editor: TextEditor, node: HtmlNode, width: number, height
|
||||
*/
|
||||
function updateCSSNode(editor: TextEditor, srcProp: Property, width: number, height: number) {
|
||||
const rule = srcProp.parent;
|
||||
const widthProp = getCssProperty(rule, 'width');
|
||||
const heightProp = getCssProperty(rule, 'height');
|
||||
const widthProp = getCssPropertyFromRule(rule, 'width');
|
||||
const heightProp = getCssPropertyFromRule(rule, 'height');
|
||||
|
||||
// Detect formatting
|
||||
const separator = srcProp.separator || ': ';
|
||||
|
||||
Reference in New Issue
Block a user