chore(vscode): update to 1.56.0
This commit is contained in:
@ -69,97 +69,98 @@
|
||||
}
|
||||
},
|
||||
"default": {},
|
||||
"description": "%emmetVariables%"
|
||||
"markdownDescription": "%emmetVariables%"
|
||||
},
|
||||
"emmet.syntaxProfiles": {
|
||||
"type": "object",
|
||||
"default": {},
|
||||
"description": "%emmetSyntaxProfiles%"
|
||||
"markdownDescription": "%emmetSyntaxProfiles%"
|
||||
},
|
||||
"emmet.excludeLanguages": {
|
||||
"type": "array",
|
||||
"default": [
|
||||
"markdown"
|
||||
],
|
||||
"description": "%emmetExclude%"
|
||||
"markdownDescription": "%emmetExclude%"
|
||||
},
|
||||
"emmet.extensionsPath": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"markdownDescription": "%emmetExtensionsPathItem%"
|
||||
},
|
||||
"default": [],
|
||||
"description": "%emmetExtensionsPath%"
|
||||
"markdownDescription": "%emmetExtensionsPath%"
|
||||
},
|
||||
"emmet.triggerExpansionOnTab": {
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"description": "%emmetTriggerExpansionOnTab%"
|
||||
"markdownDescription": "%emmetTriggerExpansionOnTab%"
|
||||
},
|
||||
"emmet.preferences": {
|
||||
"type": "object",
|
||||
"default": {},
|
||||
"description": "%emmetPreferences%",
|
||||
"markdownDescription": "%emmetPreferences%",
|
||||
"properties": {
|
||||
"css.intUnit": {
|
||||
"type": "string",
|
||||
"default": "px",
|
||||
"description": "%emmetPreferencesIntUnit%"
|
||||
"markdownDescription": "%emmetPreferencesIntUnit%"
|
||||
},
|
||||
"css.floatUnit": {
|
||||
"type": "string",
|
||||
"default": "em",
|
||||
"description": "%emmetPreferencesFloatUnit%"
|
||||
"markdownDescription": "%emmetPreferencesFloatUnit%"
|
||||
},
|
||||
"css.propertyEnd": {
|
||||
"type": "string",
|
||||
"default": ";",
|
||||
"description": "%emmetPreferencesCssAfter%"
|
||||
"markdownDescription": "%emmetPreferencesCssAfter%"
|
||||
},
|
||||
"sass.propertyEnd": {
|
||||
"type": "string",
|
||||
"default": "",
|
||||
"description": "%emmetPreferencesSassAfter%"
|
||||
"markdownDescription": "%emmetPreferencesSassAfter%"
|
||||
},
|
||||
"stylus.propertyEnd": {
|
||||
"type": "string",
|
||||
"default": "",
|
||||
"description": "%emmetPreferencesStylusAfter%"
|
||||
"markdownDescription": "%emmetPreferencesStylusAfter%"
|
||||
},
|
||||
"css.valueSeparator": {
|
||||
"type": "string",
|
||||
"default": ": ",
|
||||
"description": "%emmetPreferencesCssBetween%"
|
||||
"markdownDescription": "%emmetPreferencesCssBetween%"
|
||||
},
|
||||
"sass.valueSeparator": {
|
||||
"type": "string",
|
||||
"default": ": ",
|
||||
"description": "%emmetPreferencesSassBetween%"
|
||||
"markdownDescription": "%emmetPreferencesSassBetween%"
|
||||
},
|
||||
"stylus.valueSeparator": {
|
||||
"type": "string",
|
||||
"default": " ",
|
||||
"description": "%emmetPreferencesStylusBetween%"
|
||||
"markdownDescription": "%emmetPreferencesStylusBetween%"
|
||||
},
|
||||
"bem.elementSeparator": {
|
||||
"type": "string",
|
||||
"default": "__",
|
||||
"description": "%emmetPreferencesBemElementSeparator%"
|
||||
"markdownDescription": "%emmetPreferencesBemElementSeparator%"
|
||||
},
|
||||
"bem.modifierSeparator": {
|
||||
"type": "string",
|
||||
"default": "_",
|
||||
"description": "%emmetPreferencesBemModifierSeparator%"
|
||||
"markdownDescription": "%emmetPreferencesBemModifierSeparator%"
|
||||
},
|
||||
"filter.commentBefore": {
|
||||
"type": "string",
|
||||
"default": "",
|
||||
"description": "%emmetPreferencesFilterCommentBefore%"
|
||||
"markdownDescription": "%emmetPreferencesFilterCommentBefore%"
|
||||
},
|
||||
"filter.commentAfter": {
|
||||
"type": "string",
|
||||
"default": "\n<!-- /[#ID][.CLASS] -->",
|
||||
"description": "%emmetPreferencesFilterCommentAfter%"
|
||||
"markdownDescription": "%emmetPreferencesFilterCommentAfter%"
|
||||
},
|
||||
"filter.commentTrigger": {
|
||||
"type": "array",
|
||||
@ -167,26 +168,26 @@
|
||||
"id",
|
||||
"class"
|
||||
],
|
||||
"description": "%emmetPreferencesFilterCommentTrigger%"
|
||||
"markdownDescription": "%emmetPreferencesFilterCommentTrigger%"
|
||||
},
|
||||
"format.noIndentTags": {
|
||||
"type": "array",
|
||||
"default": [
|
||||
"html"
|
||||
],
|
||||
"description": "%emmetPreferencesFormatNoIndentTags%"
|
||||
"markdownDescription": "%emmetPreferencesFormatNoIndentTags%"
|
||||
},
|
||||
"format.forceIndentationForTags": {
|
||||
"type": "array",
|
||||
"default": [
|
||||
"body"
|
||||
],
|
||||
"description": "%emmetPreferencesFormatForceIndentTags%"
|
||||
"markdownDescription": "%emmetPreferencesFormatForceIndentTags%"
|
||||
},
|
||||
"profile.allowCompactBoolean": {
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"description": "%emmetPreferencesAllowCompactBoolean%"
|
||||
"markdownDescription": "%emmetPreferencesAllowCompactBoolean%"
|
||||
},
|
||||
"css.webkitProperties": {
|
||||
"type": "string",
|
||||
@ -211,17 +212,28 @@
|
||||
"css.fuzzySearchMinScore": {
|
||||
"type": "number",
|
||||
"default": 0.3,
|
||||
"description": "%emmetPreferencesCssFuzzySearchMinScore%"
|
||||
"markdownDescription": "%emmetPreferencesCssFuzzySearchMinScore%"
|
||||
},
|
||||
"output.inlineBreak": {
|
||||
"type": "number",
|
||||
"default": 0,
|
||||
"markdownDescription": "%emmetPreferencesOutputInlineBreak%"
|
||||
},
|
||||
"output.reverseAttributes": {
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"description": "%emmetPreferencesOutputReverseAttributes%"
|
||||
"markdownDescription": "%emmetPreferencesOutputReverseAttributes%"
|
||||
},
|
||||
"output.selfClosingStyle": {
|
||||
"type": "string",
|
||||
"enum": ["html", "xhtml", "xml"],
|
||||
"default": "html",
|
||||
"markdownDescription": "%emmetPreferencesOutputSelfClosingStyle%"
|
||||
},
|
||||
"css.color.short": {
|
||||
"type": "boolean",
|
||||
"default": true,
|
||||
"description": "%emmetPreferencesCssColorShort%"
|
||||
"markdownDescription": "%emmetPreferencesCssColorShort%"
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -442,5 +454,11 @@
|
||||
"image-size": "^0.5.2",
|
||||
"vscode-emmet-helper": "^2.3.0",
|
||||
"vscode-languageserver-textdocument": "^1.0.1"
|
||||
},
|
||||
"capabilities": {
|
||||
"virtualWorkspaces": true,
|
||||
"untrustedWorkspaces": {
|
||||
"supported": true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -25,36 +25,39 @@
|
||||
"command.showEmmetCommands": "Show Emmet Commands",
|
||||
"emmetSyntaxProfiles": "Define profile for specified syntax or use your own profile with specific rules.",
|
||||
"emmetExclude": "An array of languages where Emmet abbreviations should not be expanded.",
|
||||
"emmetExtensionsPath": "Path to a folder containing Emmet profiles and snippets.",
|
||||
"emmetExtensionsPath": "An array of paths, where each path can contain Emmet syntaxProfiles and/or snippet files.\nIn case of conflicts, the profiles/snippets of later paths will override those of earlier paths.\nSee https://code.visualstudio.com/docs/editor/emmet for more information and an example snippet file.",
|
||||
"emmetExtensionsPathItem": "A path containing Emmet syntaxProfiles and/or snippets.",
|
||||
"emmetShowExpandedAbbreviation": "Shows expanded Emmet abbreviations as suggestions.\nThe option `\"inMarkupAndStylesheetFilesOnly\"` applies to html, haml, jade, slim, xml, xsl, css, scss, sass, less and stylus.\nThe option `\"always\"` applies to all parts of the file regardless of markup/css.",
|
||||
"emmetShowAbbreviationSuggestions": "Shows possible Emmet abbreviations as suggestions. Not applicable in stylesheets or when emmet.showExpandedAbbreviation is set to `\"never\"`.",
|
||||
"emmetIncludeLanguages": "Enable Emmet abbreviations in languages that are not supported by default. Add a mapping here between the language and Emmet supported language.\n For example: `{\"vue-html\": \"html\", \"javascript\": \"javascriptreact\"}`",
|
||||
"emmetVariables": "Variables to be used in Emmet snippets",
|
||||
"emmetVariables": "Variables to be used in Emmet snippets.",
|
||||
"emmetTriggerExpansionOnTab": "When enabled, Emmet abbreviations are expanded when pressing TAB.",
|
||||
"emmetPreferences": "Preferences used to modify behavior of some actions and resolvers of Emmet.",
|
||||
"emmetPreferencesIntUnit": "Default unit for integer values",
|
||||
"emmetPreferencesFloatUnit": "Default unit for float values",
|
||||
"emmetPreferencesCssAfter": "Symbol to be placed at the end of CSS property when expanding CSS abbreviations",
|
||||
"emmetPreferencesSassAfter": "Symbol to be placed at the end of CSS property when expanding CSS abbreviations in Sass files",
|
||||
"emmetPreferencesStylusAfter": "Symbol to be placed at the end of CSS property when expanding CSS abbreviations in Stylus files",
|
||||
"emmetPreferencesCssBetween": "Symbol to be placed at the between CSS property and value when expanding CSS abbreviations",
|
||||
"emmetPreferencesSassBetween": "Symbol to be placed at the between CSS property and value when expanding CSS abbreviations in Sass files",
|
||||
"emmetPreferencesStylusBetween": "Symbol to be placed at the between CSS property and value when expanding CSS abbreviations in Stylus files",
|
||||
"emmetPreferencesIntUnit": "Default unit for integer values.",
|
||||
"emmetPreferencesFloatUnit": "Default unit for float values.",
|
||||
"emmetPreferencesCssAfter": "Symbol to be placed at the end of CSS property when expanding CSS abbreviations.",
|
||||
"emmetPreferencesSassAfter": "Symbol to be placed at the end of CSS property when expanding CSS abbreviations in Sass files.",
|
||||
"emmetPreferencesStylusAfter": "Symbol to be placed at the end of CSS property when expanding CSS abbreviations in Stylus files.",
|
||||
"emmetPreferencesCssBetween": "Symbol to be placed at the between CSS property and value when expanding CSS abbreviations.",
|
||||
"emmetPreferencesSassBetween": "Symbol to be placed at the between CSS property and value when expanding CSS abbreviations in Sass files.",
|
||||
"emmetPreferencesStylusBetween": "Symbol to be placed at the between CSS property and value when expanding CSS abbreviations in Stylus files.",
|
||||
"emmetShowSuggestionsAsSnippets": "If `true`, then Emmet suggestions will show up as snippets allowing you to order them as per `#editor.snippetSuggestions#` setting.",
|
||||
"emmetPreferencesBemElementSeparator": "Element separator used for classes when using the BEM filter",
|
||||
"emmetPreferencesBemModifierSeparator": "Modifier separator used for classes when using the BEM filter",
|
||||
"emmetPreferencesBemElementSeparator": "Element separator used for classes when using the BEM filter.",
|
||||
"emmetPreferencesBemModifierSeparator": "Modifier separator used for classes when using the BEM filter.",
|
||||
"emmetPreferencesFilterCommentBefore": "A definition of comment that should be placed before matched element when comment filter is applied.",
|
||||
"emmetPreferencesFilterCommentAfter": "A definition of comment that should be placed after matched element when comment filter is applied.",
|
||||
"emmetPreferencesFilterCommentTrigger": "A comma-separated list of attribute names that should exist in abbreviation for the comment filter to be applied",
|
||||
"emmetPreferencesFormatNoIndentTags": "An array of tag names that should not get inner indentation",
|
||||
"emmetPreferencesFormatForceIndentTags": "An array of tag names that should always get inner indentation",
|
||||
"emmetPreferencesAllowCompactBoolean": "If true, compact notation of boolean attributes are produced",
|
||||
"emmetPreferencesFilterCommentTrigger": "A comma-separated list of attribute names that should exist in the abbreviation for the comment filter to be applied.",
|
||||
"emmetPreferencesFormatNoIndentTags": "An array of tag names that should never get inner indentation.",
|
||||
"emmetPreferencesFormatForceIndentTags": "An array of tag names that should always get inner indentation.",
|
||||
"emmetPreferencesAllowCompactBoolean": "If `true`, compact notation of boolean attributes are produced.",
|
||||
"emmetPreferencesCssWebkitProperties": "Comma separated CSS properties that get the 'webkit' vendor prefix when used in Emmet abbreviation that starts with `-`. Set to empty string to always avoid the 'webkit' prefix.",
|
||||
"emmetPreferencesCssMozProperties": "Comma separated CSS properties that get the 'moz' vendor prefix when used in Emmet abbreviation that starts with `-`. Set to empty string to always avoid the 'moz' prefix.",
|
||||
"emmetPreferencesCssOProperties": "Comma separated CSS properties that get the 'o' vendor prefix when used in Emmet abbreviation that starts with `-`. Set to empty string to always avoid the 'o' prefix.",
|
||||
"emmetPreferencesCssMsProperties": "Comma separated CSS properties that get the 'ms' vendor prefix when used in Emmet abbreviation that starts with `-`. Set to empty string to always avoid the 'ms' prefix.",
|
||||
"emmetPreferencesCssFuzzySearchMinScore": "The minimum score (from 0 to 1) that fuzzy-matched abbreviation should achieve. Lower values may produce many false-positive matches, higher values may reduce possible matches.",
|
||||
"emmetOptimizeStylesheetParsing": "When set to `false`, the whole file is parsed to determine if current position is valid for expanding Emmet abbreviations. When set to `true`, only the content around the current position in CSS/SCSS/Less files is parsed.",
|
||||
"emmetPreferencesOutputInlineBreak": "The number of sibling inline elements needed for line breaks to be placed between those elements. If `0`, inline elements are always expanded onto a single line.",
|
||||
"emmetPreferencesOutputReverseAttributes": "If `true`, reverses attribute merging directions when resolving snippets.",
|
||||
"emmetPreferencesCssColorShort": "If `true`, color values like #f will be expanded to #fff instead of #ffffff."
|
||||
"emmetPreferencesOutputSelfClosingStyle": "Style of self-closing tags: html (`<br>`), xml (`<br/>`) or xhtml (`<br />`).",
|
||||
"emmetPreferencesCssColorShort": "If `true`, color values like `#f` will be expanded to `#fff` instead of `#ffffff`."
|
||||
}
|
||||
|
@ -205,7 +205,7 @@ export async function wrapWithAbbreviation(args: any): Promise<boolean> {
|
||||
let inPreviewMode = false;
|
||||
async function makeChanges(inputAbbreviation: string | undefined, previewChanges: boolean): Promise<boolean> {
|
||||
const isAbbreviationValid = !!inputAbbreviation && !!inputAbbreviation.trim() && helper.isAbbreviationValid(syntax, inputAbbreviation);
|
||||
const extractedResults = isAbbreviationValid ? helper.extractAbbreviationFromText(inputAbbreviation!) : undefined;
|
||||
const extractedResults = isAbbreviationValid ? helper.extractAbbreviationFromText(inputAbbreviation!, syntax) : undefined;
|
||||
if (!extractedResults) {
|
||||
if (inPreviewMode) {
|
||||
inPreviewMode = false;
|
||||
@ -311,12 +311,12 @@ export function expandEmmetAbbreviation(args: any): Thenable<boolean | undefined
|
||||
let allAbbreviationsSame: boolean = true;
|
||||
const helper = getEmmetHelper();
|
||||
|
||||
const getAbbreviation = (document: vscode.TextDocument, selection: vscode.Selection, position: vscode.Position, syntax: string): [vscode.Range | null, string, string] => {
|
||||
const getAbbreviation = (document: vscode.TextDocument, selection: vscode.Selection, position: vscode.Position, syntax: string): [vscode.Range | null, string, string | undefined] => {
|
||||
position = document.validatePosition(position);
|
||||
let rangeToReplace: vscode.Range = selection;
|
||||
let abbr = document.getText(rangeToReplace);
|
||||
if (!rangeToReplace.isEmpty) {
|
||||
const extractedResults = helper.extractAbbreviationFromText(abbr);
|
||||
const extractedResults = helper.extractAbbreviationFromText(abbr, syntax);
|
||||
if (extractedResults) {
|
||||
return [rangeToReplace, extractedResults.abbreviation, extractedResults.filter];
|
||||
}
|
||||
|
@ -176,7 +176,8 @@ export class DefaultCompletionItemProvider implements vscode.CompletionItemProvi
|
||||
return;
|
||||
}
|
||||
|
||||
let result = helper.doComplete(toLSTextDocument(document), position, syntax, getEmmetConfiguration(syntax!));
|
||||
const config = getEmmetConfiguration(syntax!);
|
||||
const result = helper.doComplete(toLSTextDocument(document), position, syntax, config);
|
||||
|
||||
// https://github.com/microsoft/vscode/issues/86941
|
||||
if (result && result.items && result.items.length === 1) {
|
||||
|
@ -19,7 +19,7 @@ import { evaluateMathExpression } from './evaluateMathExpression';
|
||||
import { incrementDecrement } from './incrementDecrement';
|
||||
import { LANGUAGE_MODES, getMappingForIncludedLanguages, updateEmmetExtensionsPath, migrateEmmetExtensionsPath, getPathBaseName, getSyntaxes, getEmmetMode } from './util';
|
||||
import { reflectCssValue } from './reflectCssValue';
|
||||
import { addFileToParseCache, removeFileFromParseCache } from './parseDocument';
|
||||
import { addFileToParseCache, clearParseCache, removeFileFromParseCache } from './parseDocument';
|
||||
|
||||
export function activateEmmetExtension(context: vscode.ExtensionContext) {
|
||||
migrateEmmetExtensionsPath();
|
||||
@ -203,4 +203,6 @@ function registerCompletionProviders(context: vscode.ExtensionContext) {
|
||||
}
|
||||
|
||||
export function deactivate() {
|
||||
completionProvidersMapping.clear();
|
||||
clearParseCache();
|
||||
}
|
||||
|
@ -44,3 +44,7 @@ export function removeFileFromParseCache(document: TextDocument) {
|
||||
const filename = document.uri.toString();
|
||||
_parseCache.delete(filename);
|
||||
}
|
||||
|
||||
export function clearParseCache() {
|
||||
_parseCache.clear();
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ export function nextItemHTML(document: vscode.TextDocument, selectionStart: vsco
|
||||
if (currentNode.type !== 'comment') {
|
||||
// If cursor is in the tag name, select tag
|
||||
if (currentNode.open &&
|
||||
selectionEndOffset < currentNode.open.start + currentNode.name.length) {
|
||||
selectionEndOffset <= currentNode.open.start + currentNode.name.length) {
|
||||
return getSelectionFromNode(document, currentNode);
|
||||
}
|
||||
|
||||
|
@ -44,10 +44,7 @@ const htmlContents = `
|
||||
suite('Tests for Expand Abbreviations (HTML)', () => {
|
||||
const oldValueForExcludeLanguages = workspace.getConfiguration('emmet').inspect('excludeLanguages');
|
||||
const oldValueForInlcudeLanguages = workspace.getConfiguration('emmet').inspect('includeLanguages');
|
||||
teardown(() => {
|
||||
// close all editors
|
||||
return closeAllEditors;
|
||||
});
|
||||
teardown(closeAllEditors);
|
||||
|
||||
test('Expand snippets (HTML)', () => {
|
||||
return testExpandAbbreviation('html', new Selection(3, 23, 3, 23), 'img', '<img src=\"\" alt=\"\">');
|
||||
@ -442,7 +439,7 @@ suite('Tests for jsx, xml and xsl', () => {
|
||||
return withRandomFileEditor('img', 'javascriptreact', async (editor, _doc) => {
|
||||
editor.selection = new Selection(0, 6, 0, 6);
|
||||
await expandEmmetAbbreviation({ language: 'javascriptreact' });
|
||||
assert.strictEqual(editor.document.getText(), '<img src="" alt=""/>');
|
||||
assert.strictEqual(editor.document.getText(), '<img src="" alt="" />');
|
||||
return Promise.resolve();
|
||||
});
|
||||
});
|
||||
@ -452,7 +449,7 @@ suite('Tests for jsx, xml and xsl', () => {
|
||||
return withRandomFileEditor('img', 'javascriptreact', async (editor, _doc) => {
|
||||
editor.selection = new Selection(0, 6, 0, 6);
|
||||
await expandEmmetAbbreviation({ language: 'javascriptreact' });
|
||||
assert.strictEqual(editor.document.getText(), '<img src=\'\' alt=\'\'/>');
|
||||
assert.strictEqual(editor.document.getText(), '<img src=\'\' alt=\'\' />');
|
||||
return workspace.getConfiguration('emmet').update('syntaxProfiles', oldValueForSyntaxProfiles ? oldValueForSyntaxProfiles.globalValue : undefined, ConfigurationTarget.Global);
|
||||
});
|
||||
});
|
||||
|
@ -12,10 +12,7 @@ import { closeAllEditors, withRandomFileEditor } from './testUtils';
|
||||
const completionProvider = new DefaultCompletionItemProvider();
|
||||
|
||||
suite('Tests for completion in CSS embedded in HTML', () => {
|
||||
teardown(() => {
|
||||
// close all editors
|
||||
return closeAllEditors;
|
||||
});
|
||||
teardown(closeAllEditors);
|
||||
|
||||
test('style attribute & attribute value in html', async () => {
|
||||
await testHtmlCompletionProvider('<div style="|"', [{ label: 'padding: ;' }]);
|
||||
@ -81,10 +78,10 @@ function testHtmlCompletionProvider(contents: string, expectedItems: TestComplet
|
||||
assert.ok(match, `Didn't find completion item with label ${eItem.label}`);
|
||||
|
||||
if (match) {
|
||||
assert.equal(match.detail, 'Emmet Abbreviation', `Match needs to come from Emmet`);
|
||||
assert.strictEqual(match.detail, 'Emmet Abbreviation', `Match needs to come from Emmet`);
|
||||
|
||||
if (eItem.documentation) {
|
||||
assert.equal(match.documentation, eItem.documentation, `Emmet completion Documentation doesn't match`);
|
||||
assert.strictEqual(match.documentation, eItem.documentation, `Emmet completion Documentation doesn't match`);
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -122,10 +119,10 @@ function testCssCompletionProvider(contents: string, expectedItems: TestCompleti
|
||||
assert.ok(match, `Didn't find completion item with label ${eItem.label}`);
|
||||
|
||||
if (match) {
|
||||
assert.equal(match.detail, 'Emmet Abbreviation', `Match needs to come from Emmet`);
|
||||
assert.strictEqual(match.detail, 'Emmet Abbreviation', `Match needs to come from Emmet`);
|
||||
|
||||
if (eItem.documentation) {
|
||||
assert.equal(match.documentation, eItem.documentation, `Emmet completion Documentation doesn't match`);
|
||||
assert.strictEqual(match.documentation, eItem.documentation, `Emmet completion Documentation doesn't match`);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -59,7 +59,7 @@ suite('Tests for Expand Abbreviations (CSS)', () => {
|
||||
return withRandomFileEditor(cssContents, 'css', (editor, _) => {
|
||||
editor.selections = [new Selection(3, 1, 3, 6), new Selection(5, 1, 5, 6)];
|
||||
return expandEmmetAbbreviation(null).then(() => {
|
||||
assert.equal(editor.document.getText(), cssContents.replace(/pos:f/g, 'position: fixed;'));
|
||||
assert.strictEqual(editor.document.getText(), cssContents.replace(/pos:f/g, 'position: fixed;'));
|
||||
return Promise.resolve();
|
||||
});
|
||||
});
|
||||
@ -78,11 +78,11 @@ suite('Tests for Expand Abbreviations (CSS)', () => {
|
||||
return withRandomFileEditor(testContent, 'css', (editor, _) => {
|
||||
editor.selection = new Selection(3, 4, 3, 4);
|
||||
return expandEmmetAbbreviation(null).then(() => {
|
||||
assert.equal(editor.document.getText(), testContent);
|
||||
assert.strictEqual(editor.document.getText(), testContent);
|
||||
const cancelSrc = new CancellationTokenSource();
|
||||
const completionPromise = completionProvider.provideCompletionItems(editor.document, new Position(2, 10), cancelSrc.token, { triggerKind: CompletionTriggerKind.Invoke });
|
||||
if (completionPromise) {
|
||||
assert.equal(1, 2, `Invalid completion at property value`);
|
||||
assert.strictEqual(1, 2, `Invalid completion at property value`);
|
||||
}
|
||||
return Promise.resolve();
|
||||
});
|
||||
@ -101,11 +101,11 @@ nav#
|
||||
return withRandomFileEditor(testContent, 'css', (editor, _) => {
|
||||
editor.selection = new Selection(5, 4, 5, 4);
|
||||
return expandEmmetAbbreviation(null).then(() => {
|
||||
assert.equal(editor.document.getText(), testContent);
|
||||
assert.strictEqual(editor.document.getText(), testContent);
|
||||
const cancelSrc = new CancellationTokenSource();
|
||||
const completionPromise = completionProvider.provideCompletionItems(editor.document, new Position(2, 10), cancelSrc.token, { triggerKind: CompletionTriggerKind.Invoke });
|
||||
if (completionPromise) {
|
||||
assert.equal(1, 2, `Invalid completion at property value`);
|
||||
assert.strictEqual(1, 2, `Invalid completion at property value`);
|
||||
}
|
||||
return Promise.resolve();
|
||||
});
|
||||
@ -123,11 +123,11 @@ nav#
|
||||
return withRandomFileEditor(testContent, 'css', (editor, _) => {
|
||||
editor.selection = new Selection(2, 10, 2, 10);
|
||||
return expandEmmetAbbreviation(null).then(() => {
|
||||
assert.equal(editor.document.getText(), testContent);
|
||||
assert.strictEqual(editor.document.getText(), testContent);
|
||||
const cancelSrc = new CancellationTokenSource();
|
||||
const completionPromise = completionProvider.provideCompletionItems(editor.document, new Position(2, 10), cancelSrc.token, { triggerKind: CompletionTriggerKind.Invoke });
|
||||
if (completionPromise) {
|
||||
assert.equal(1, 2, `Invalid completion at property value`);
|
||||
assert.strictEqual(1, 2, `Invalid completion at property value`);
|
||||
}
|
||||
return Promise.resolve();
|
||||
});
|
||||
@ -140,11 +140,11 @@ nav#
|
||||
return withRandomFileEditor(testContent, 'css', (editor, _) => {
|
||||
editor.selection = new Selection(0, 30, 0, 30);
|
||||
return expandEmmetAbbreviation(null).then(() => {
|
||||
assert.equal(editor.document.getText(), testContent);
|
||||
assert.strictEqual(editor.document.getText(), testContent);
|
||||
const cancelSrc = new CancellationTokenSource();
|
||||
const completionPromise = completionProvider.provideCompletionItems(editor.document, new Position(0, 30), cancelSrc.token, { triggerKind: CompletionTriggerKind.Invoke });
|
||||
if (completionPromise) {
|
||||
assert.equal(1, 2, `Invalid completion at property value`);
|
||||
assert.strictEqual(1, 2, `Invalid completion at property value`);
|
||||
}
|
||||
return Promise.resolve();
|
||||
});
|
||||
@ -165,18 +165,18 @@ nav#
|
||||
const completionPromise2 = completionProvider.provideCompletionItems(editor.document, new Position(2, 14), cancelSrc.token, { triggerKind: CompletionTriggerKind.Invoke });
|
||||
|
||||
if (!completionPromise1 || !completionPromise2) {
|
||||
assert.equal(1, 2, `Completion promise wasnt returned`);
|
||||
assert.strictEqual(1, 2, `Completion promise wasnt returned`);
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
const callBack = (completionList: CompletionList, expandedText: string) => {
|
||||
if (!completionList.items || !completionList.items.length) {
|
||||
assert.equal(1, 2, `Empty Completions`);
|
||||
assert.strictEqual(1, 2, `Empty Completions`);
|
||||
return;
|
||||
}
|
||||
const emmetCompletionItem = completionList.items[0];
|
||||
assert.equal(emmetCompletionItem.label, expandedText, `Label of completion item doesnt match.`);
|
||||
assert.equal((<string>emmetCompletionItem.documentation || '').replace(/\|/g, ''), expandedText, `Docs of completion item doesnt match.`);
|
||||
assert.strictEqual(emmetCompletionItem.label, expandedText, `Label of completion item doesnt match.`);
|
||||
assert.strictEqual((<string>emmetCompletionItem.documentation || '').replace(/\|/g, ''), expandedText, `Docs of completion item doesnt match.`);
|
||||
};
|
||||
|
||||
return Promise.all<CompletionList>([completionPromise1, completionPromise2]).then(([result1, result2]) => {
|
||||
@ -184,7 +184,7 @@ nav#
|
||||
callBack(result2, '!important');
|
||||
editor.selections = [new Selection(2, 12, 2, 12), new Selection(2, 14, 2, 14)];
|
||||
return expandEmmetAbbreviation(null).then(() => {
|
||||
assert.equal(editor.document.getText(), testContent.replace('#12', '#121212').replace('!', '!important'));
|
||||
assert.strictEqual(editor.document.getText(), testContent.replace('#12', '#121212').replace('!', '!important'));
|
||||
});
|
||||
});
|
||||
});
|
||||
@ -201,11 +201,11 @@ nav#
|
||||
return withRandomFileEditor(testContent, 'css', (editor, _) => {
|
||||
editor.selection = new Selection(3, 10, 3, 10);
|
||||
return expandEmmetAbbreviation(null).then(() => {
|
||||
assert.equal(editor.document.getText(), testContent);
|
||||
assert.strictEqual(editor.document.getText(), testContent);
|
||||
const cancelSrc = new CancellationTokenSource();
|
||||
const completionPromise = completionProvider.provideCompletionItems(editor.document, new Position(3, 10), cancelSrc.token, { triggerKind: CompletionTriggerKind.Invoke });
|
||||
if (completionPromise) {
|
||||
assert.equal(1, 2, `Invalid completion at property value`);
|
||||
assert.strictEqual(1, 2, `Invalid completion at property value`);
|
||||
}
|
||||
return Promise.resolve();
|
||||
});
|
||||
@ -226,18 +226,18 @@ nav#
|
||||
const completionPromise2 = completionProvider.provideCompletionItems(editor.document, new Position(3, 14), cancelSrc.token, { triggerKind: CompletionTriggerKind.Invoke });
|
||||
|
||||
if (!completionPromise1 || !completionPromise2) {
|
||||
assert.equal(1, 2, `Completion promise wasnt returned`);
|
||||
assert.strictEqual(1, 2, `Completion promise wasnt returned`);
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
const callBack = (completionList: CompletionList, expandedText: string) => {
|
||||
if (!completionList.items || !completionList.items.length) {
|
||||
assert.equal(1, 2, `Empty Completions`);
|
||||
assert.strictEqual(1, 2, `Empty Completions`);
|
||||
return;
|
||||
}
|
||||
const emmetCompletionItem = completionList.items[0];
|
||||
assert.equal(emmetCompletionItem.label, expandedText, `Label of completion item doesnt match.`);
|
||||
assert.equal((<string>emmetCompletionItem.documentation || '').replace(/\|/g, ''), expandedText, `Docs of completion item doesnt match.`);
|
||||
assert.strictEqual(emmetCompletionItem.label, expandedText, `Label of completion item doesnt match.`);
|
||||
assert.strictEqual((<string>emmetCompletionItem.documentation || '').replace(/\|/g, ''), expandedText, `Docs of completion item doesnt match.`);
|
||||
};
|
||||
|
||||
return Promise.all<CompletionList>([completionPromise1, completionPromise2]).then(([result1, result2]) => {
|
||||
@ -245,7 +245,7 @@ nav#
|
||||
callBack(result2, '!important');
|
||||
editor.selections = [new Selection(3, 12, 3, 12), new Selection(3, 14, 3, 14)];
|
||||
return expandEmmetAbbreviation(null).then(() => {
|
||||
assert.equal(editor.document.getText(), testContent.replace('#12', '#121212').replace('!', '!important'));
|
||||
assert.strictEqual(editor.document.getText(), testContent.replace('#12', '#121212').replace('!', '!important'));
|
||||
});
|
||||
});
|
||||
});
|
||||
@ -261,11 +261,11 @@ nav#
|
||||
return withRandomFileEditor(testContent, 'css', (editor, _) => {
|
||||
editor.selection = new Selection(2, 10, 2, 10);
|
||||
return expandEmmetAbbreviation(null).then(() => {
|
||||
assert.equal(editor.document.getText(), testContent);
|
||||
assert.strictEqual(editor.document.getText(), testContent);
|
||||
const cancelSrc = new CancellationTokenSource();
|
||||
const completionPromise = completionProvider.provideCompletionItems(editor.document, new Position(2, 10), cancelSrc.token, { triggerKind: CompletionTriggerKind.Invoke });
|
||||
if (completionPromise) {
|
||||
assert.equal(1, 2, `Invalid completion at property value`);
|
||||
assert.strictEqual(1, 2, `Invalid completion at property value`);
|
||||
}
|
||||
return Promise.resolve();
|
||||
});
|
||||
@ -285,18 +285,18 @@ nav#
|
||||
const completionPromise2 = completionProvider.provideCompletionItems(editor.document, new Position(2, 14), cancelSrc.token, { triggerKind: CompletionTriggerKind.Invoke });
|
||||
|
||||
if (!completionPromise1 || !completionPromise2) {
|
||||
assert.equal(1, 2, `Completion promise wasnt returned`);
|
||||
assert.strictEqual(1, 2, `Completion promise wasnt returned`);
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
const callBack = (completionList: CompletionList, expandedText: string) => {
|
||||
if (!completionList.items || !completionList.items.length) {
|
||||
assert.equal(1, 2, `Empty Completions`);
|
||||
assert.strictEqual(1, 2, `Empty Completions`);
|
||||
return;
|
||||
}
|
||||
const emmetCompletionItem = completionList.items[0];
|
||||
assert.equal(emmetCompletionItem.label, expandedText, `Label of completion item doesnt match.`);
|
||||
assert.equal((<string>emmetCompletionItem.documentation || '').replace(/\|/g, ''), expandedText, `Docs of completion item doesnt match.`);
|
||||
assert.strictEqual(emmetCompletionItem.label, expandedText, `Label of completion item doesnt match.`);
|
||||
assert.strictEqual((<string>emmetCompletionItem.documentation || '').replace(/\|/g, ''), expandedText, `Docs of completion item doesnt match.`);
|
||||
};
|
||||
|
||||
return Promise.all<CompletionList>([completionPromise1, completionPromise2]).then(([result1, result2]) => {
|
||||
@ -304,7 +304,7 @@ nav#
|
||||
callBack(result2, '!important');
|
||||
editor.selections = [new Selection(2, 12, 2, 12), new Selection(2, 14, 2, 14)];
|
||||
return expandEmmetAbbreviation(null).then(() => {
|
||||
assert.equal(editor.document.getText(), testContent.replace('#12', '#121212').replace('!', '!important'));
|
||||
assert.strictEqual(editor.document.getText(), testContent.replace('#12', '#121212').replace('!', '!important'));
|
||||
});
|
||||
});
|
||||
});
|
||||
@ -320,11 +320,11 @@ nav#
|
||||
return withRandomFileEditor(testContent, 'css', (editor, _) => {
|
||||
editor.selection = new Selection(2, 2, 2, 2);
|
||||
return expandEmmetAbbreviation(null).then(() => {
|
||||
assert.equal(editor.document.getText(), testContent);
|
||||
assert.strictEqual(editor.document.getText(), testContent);
|
||||
const cancelSrc = new CancellationTokenSource();
|
||||
const completionPromise = completionProvider.provideCompletionItems(editor.document, new Position(2, 2), cancelSrc.token, { triggerKind: CompletionTriggerKind.Invoke });
|
||||
if (completionPromise) {
|
||||
assert.equal(1, 2, `Invalid completion of hex color at property name`);
|
||||
assert.strictEqual(1, 2, `Invalid completion of hex color at property name`);
|
||||
}
|
||||
return Promise.resolve();
|
||||
});
|
||||
@ -342,19 +342,19 @@ nav#
|
||||
const completionPromise1 = completionProvider.provideCompletionItems(editor.document, new Position(3, 6), cancelSrc.token, { triggerKind: CompletionTriggerKind.Invoke });
|
||||
const completionPromise2 = completionProvider.provideCompletionItems(editor.document, new Position(5, 6), cancelSrc.token, { triggerKind: CompletionTriggerKind.Invoke });
|
||||
if (!completionPromise1 || !completionPromise2) {
|
||||
assert.equal(1, 2, `Problem with expanding pos:f`);
|
||||
assert.strictEqual(1, 2, `Problem with expanding pos:f`);
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
const callBack = (completionList: CompletionList) => {
|
||||
if (!completionList.items || !completionList.items.length) {
|
||||
assert.equal(1, 2, `Problem with expanding pos:f`);
|
||||
assert.strictEqual(1, 2, `Problem with expanding pos:f`);
|
||||
return;
|
||||
}
|
||||
const emmetCompletionItem = completionList.items[0];
|
||||
assert.equal(emmetCompletionItem.label, expandedText, `Label of completion item doesnt match.`);
|
||||
assert.equal((<string>emmetCompletionItem.documentation || '').replace(/\|/g, ''), expandedText, `Docs of completion item doesnt match.`);
|
||||
assert.equal(emmetCompletionItem.filterText, abbreviation, `FilterText of completion item doesnt match.`);
|
||||
assert.strictEqual(emmetCompletionItem.label, expandedText, `Label of completion item doesnt match.`);
|
||||
assert.strictEqual((<string>emmetCompletionItem.documentation || '').replace(/\|/g, ''), expandedText, `Docs of completion item doesnt match.`);
|
||||
assert.strictEqual(emmetCompletionItem.filterText, abbreviation, `FilterText of completion item doesnt match.`);
|
||||
};
|
||||
|
||||
return Promise.all<CompletionList>([completionPromise1, completionPromise2]).then(([result1, result2]) => {
|
||||
@ -374,7 +374,7 @@ nav#
|
||||
new Selection(14, 5, 14, 5)
|
||||
];
|
||||
return expandEmmetAbbreviation(null).then(() => {
|
||||
assert.equal(editor.document.getText(), scssContents.replace(/p(\d\d)/g, 'padding: $1px;'));
|
||||
assert.strictEqual(editor.document.getText(), scssContents.replace(/p(\d\d)/g, 'padding: $1px;'));
|
||||
return Promise.resolve();
|
||||
});
|
||||
});
|
||||
@ -390,16 +390,16 @@ nav#
|
||||
const completionPromise3 = completionProvider.provideCompletionItems(editor.document, new Position(11, 4), cancelSrc.token, { triggerKind: CompletionTriggerKind.Invoke });
|
||||
const completionPromise4 = completionProvider.provideCompletionItems(editor.document, new Position(14, 5), cancelSrc.token, { triggerKind: CompletionTriggerKind.Invoke });
|
||||
if (!completionPromise1) {
|
||||
assert.equal(1, 2, `Problem with expanding padding abbreviations at line 3 col 4`);
|
||||
assert.strictEqual(1, 2, `Problem with expanding padding abbreviations at line 3 col 4`);
|
||||
}
|
||||
if (!completionPromise2) {
|
||||
assert.equal(1, 2, `Problem with expanding padding abbreviations at line 5 col 5`);
|
||||
assert.strictEqual(1, 2, `Problem with expanding padding abbreviations at line 5 col 5`);
|
||||
}
|
||||
if (!completionPromise3) {
|
||||
assert.equal(1, 2, `Problem with expanding padding abbreviations at line 11 col 4`);
|
||||
assert.strictEqual(1, 2, `Problem with expanding padding abbreviations at line 11 col 4`);
|
||||
}
|
||||
if (!completionPromise4) {
|
||||
assert.equal(1, 2, `Problem with expanding padding abbreviations at line 14 col 5`);
|
||||
assert.strictEqual(1, 2, `Problem with expanding padding abbreviations at line 14 col 5`);
|
||||
}
|
||||
|
||||
if (!completionPromise1 || !completionPromise2 || !completionPromise3 || !completionPromise4) {
|
||||
@ -408,13 +408,13 @@ nav#
|
||||
|
||||
const callBack = (completionList: CompletionList, abbreviation: string, expandedText: string) => {
|
||||
if (!completionList.items || !completionList.items.length) {
|
||||
assert.equal(1, 2, `Problem with expanding m10`);
|
||||
assert.strictEqual(1, 2, `Problem with expanding m10`);
|
||||
return;
|
||||
}
|
||||
const emmetCompletionItem = completionList.items[0];
|
||||
assert.equal(emmetCompletionItem.label, expandedText, `Label of completion item doesnt match.`);
|
||||
assert.equal((<string>emmetCompletionItem.documentation || '').replace(/\|/g, ''), expandedText, `Docs of completion item doesnt match.`);
|
||||
assert.equal(emmetCompletionItem.filterText, abbreviation, `FilterText of completion item doesnt match.`);
|
||||
assert.strictEqual(emmetCompletionItem.label, expandedText, `Label of completion item doesnt match.`);
|
||||
assert.strictEqual((<string>emmetCompletionItem.documentation || '').replace(/\|/g, ''), expandedText, `Docs of completion item doesnt match.`);
|
||||
assert.strictEqual(emmetCompletionItem.filterText, abbreviation, `FilterText of completion item doesnt match.`);
|
||||
};
|
||||
|
||||
return Promise.all<CompletionList>([completionPromise1, completionPromise2, completionPromise3, completionPromise4]).then(([result1, result2, result3, result4]) => {
|
||||
@ -445,7 +445,7 @@ m10
|
||||
new Selection(5, 15, 5, 15) // in the value part of property value
|
||||
];
|
||||
return expandEmmetAbbreviation(null).then(() => {
|
||||
assert.equal(editor.document.getText(), scssContentsNoExpand);
|
||||
assert.strictEqual(editor.document.getText(), scssContentsNoExpand);
|
||||
return Promise.resolve();
|
||||
});
|
||||
});
|
||||
@ -467,7 +467,7 @@ m10
|
||||
const cancelSrc = new CancellationTokenSource();
|
||||
let completionPromise = completionProvider.provideCompletionItems(editor.document, editor.selection.active, cancelSrc.token, { triggerKind: CompletionTriggerKind.Invoke });
|
||||
if (completionPromise) {
|
||||
assert.equal(1, 2, `m10 gets expanded in invalid location (outside rule)`);
|
||||
assert.strictEqual(1, 2, `m10 gets expanded in invalid location (outside rule)`);
|
||||
}
|
||||
|
||||
editor.selection = new Selection(5, 15, 5, 15); // in the value part of property value
|
||||
@ -475,7 +475,7 @@ m10
|
||||
if (completionPromise) {
|
||||
return completionPromise.then((completionList: CompletionList | undefined) => {
|
||||
if (completionList && completionList.items && completionList.items.length > 0) {
|
||||
assert.equal(1, 2, `m10 gets expanded in invalid location (n the value part of property value)`);
|
||||
assert.strictEqual(1, 2, `m10 gets expanded in invalid location (n the value part of property value)`);
|
||||
}
|
||||
return Promise.resolve();
|
||||
});
|
||||
@ -484,19 +484,18 @@ m10
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
test('Skip when typing property values when there is a nested rule in the next line (SCSS)', () => {
|
||||
return withRandomFileEditor(scssContents, 'scss', (editor, _) => {
|
||||
editor.selection = new Selection(19, 10, 19, 10);
|
||||
return expandEmmetAbbreviation(null).then(() => {
|
||||
assert.equal(editor.document.getText(), scssContents);
|
||||
const cancelSrc = new CancellationTokenSource();
|
||||
const completionPromise = completionProvider.provideCompletionItems(editor.document, new Position(19, 10), cancelSrc.token, { triggerKind: CompletionTriggerKind.Invoke });
|
||||
if (completionPromise) {
|
||||
assert.equal(1, 2, `Invalid completion at property value`);
|
||||
}
|
||||
return Promise.resolve();
|
||||
test('Skip when typing property values when there is a nested rule in the next line (SCSS)', () => {
|
||||
return withRandomFileEditor(scssContents, 'scss', (editor, _) => {
|
||||
editor.selection = new Selection(19, 10, 19, 10);
|
||||
return expandEmmetAbbreviation(null).then(() => {
|
||||
assert.strictEqual(editor.document.getText(), scssContents);
|
||||
const cancelSrc = new CancellationTokenSource();
|
||||
const completionPromise = completionProvider.provideCompletionItems(editor.document, new Position(19, 10), cancelSrc.token, { triggerKind: CompletionTriggerKind.Invoke });
|
||||
if (completionPromise) {
|
||||
assert.strictEqual(1, 2, `Invalid completion at property value`);
|
||||
}
|
||||
return Promise.resolve();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -352,17 +352,16 @@ suite('Tests for Next/Previous Select/Edit point and Balance actions', () => {
|
||||
});
|
||||
|
||||
function testSelection(selection: Selection, startChar: number, startline: number, endChar?: number, endLine?: number) {
|
||||
|
||||
assert.equal(selection.anchor.line, startline);
|
||||
assert.equal(selection.anchor.character, startChar);
|
||||
assert.strictEqual(selection.anchor.line, startline);
|
||||
assert.strictEqual(selection.anchor.character, startChar);
|
||||
if (!endLine && endLine !== 0) {
|
||||
assert.equal(selection.isSingleLine, true);
|
||||
assert.strictEqual(selection.isSingleLine, true);
|
||||
} else {
|
||||
assert.equal(selection.active.line, endLine);
|
||||
assert.strictEqual(selection.active.line, endLine);
|
||||
}
|
||||
if (!endChar && endChar !== 0) {
|
||||
assert.equal(selection.isEmpty, true);
|
||||
assert.strictEqual(selection.isEmpty, true);
|
||||
} else {
|
||||
assert.equal(selection.active.character, endChar);
|
||||
assert.strictEqual(selection.active.character, endChar);
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ suite('Tests for Increment/Decrement Emmet Commands', () => {
|
||||
return withRandomFileEditor(contents, 'txt', async (editor, doc) => {
|
||||
editor.selections = [new Selection(1, 7, 1, 10), new Selection(2, 7, 2, 10)];
|
||||
await incrementDecrement(1);
|
||||
assert.equal(doc.getText(), contents.replace('123', '124').replace('999', '1000'));
|
||||
assert.strictEqual(doc.getText(), contents.replace('123', '124').replace('999', '1000'));
|
||||
return Promise.resolve();
|
||||
});
|
||||
});
|
||||
@ -37,7 +37,7 @@ suite('Tests for Increment/Decrement Emmet Commands', () => {
|
||||
return withRandomFileEditor(contents, 'txt', async (editor, doc) => {
|
||||
editor.selections = [new Selection(1, 7, 1, 10), new Selection(2, 7, 2, 10)];
|
||||
await incrementDecrement(10);
|
||||
assert.equal(doc.getText(), contents.replace('123', '133').replace('999', '1009'));
|
||||
assert.strictEqual(doc.getText(), contents.replace('123', '133').replace('999', '1009'));
|
||||
return Promise.resolve();
|
||||
});
|
||||
});
|
||||
@ -46,7 +46,7 @@ suite('Tests for Increment/Decrement Emmet Commands', () => {
|
||||
return withRandomFileEditor(contents, 'txt', async (editor, doc) => {
|
||||
editor.selections = [new Selection(1, 7, 1, 13), new Selection(2, 7, 2, 12)];
|
||||
await incrementDecrement(0.1);
|
||||
assert.equal(doc.getText(), contents.replace('123.43', '123.53').replace('999.9', '1000'));
|
||||
assert.strictEqual(doc.getText(), contents.replace('123.43', '123.53').replace('999.9', '1000'));
|
||||
return Promise.resolve();
|
||||
});
|
||||
});
|
||||
@ -55,7 +55,7 @@ suite('Tests for Increment/Decrement Emmet Commands', () => {
|
||||
return withRandomFileEditor(contents, 'txt', async (editor, doc) => {
|
||||
editor.selections = [new Selection(1, 7, 1, 10), new Selection(3, 7, 3, 10)];
|
||||
await incrementDecrement(-1);
|
||||
assert.equal(doc.getText(), contents.replace('123', '122').replace('100', '99'));
|
||||
assert.strictEqual(doc.getText(), contents.replace('123', '122').replace('100', '99'));
|
||||
return Promise.resolve();
|
||||
});
|
||||
});
|
||||
@ -64,7 +64,7 @@ suite('Tests for Increment/Decrement Emmet Commands', () => {
|
||||
return withRandomFileEditor(contents, 'txt', async (editor, doc) => {
|
||||
editor.selections = [new Selection(1, 7, 1, 10), new Selection(3, 7, 3, 10)];
|
||||
await incrementDecrement(-10);
|
||||
assert.equal(doc.getText(), contents.replace('123', '113').replace('100', '90'));
|
||||
assert.strictEqual(doc.getText(), contents.replace('123', '113').replace('100', '90'));
|
||||
return Promise.resolve();
|
||||
});
|
||||
});
|
||||
@ -73,8 +73,8 @@ suite('Tests for Increment/Decrement Emmet Commands', () => {
|
||||
return withRandomFileEditor(contents, 'txt', async (editor, doc) => {
|
||||
editor.selections = [new Selection(1, 7, 1, 13), new Selection(3, 7, 3, 10)];
|
||||
await incrementDecrement(-0.1);
|
||||
assert.equal(doc.getText(), contents.replace('123.43', '123.33').replace('100', '99.9'));
|
||||
assert.strictEqual(doc.getText(), contents.replace('123.43', '123.33').replace('100', '99.9'));
|
||||
return Promise.resolve();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -8,7 +8,7 @@ const testRunner = require('../../../../test/integration/electron/testrunner');
|
||||
|
||||
const options: any = {
|
||||
ui: 'tdd',
|
||||
color: (!process.env.BUILD_ARTIFACTSTAGINGDIRECTORY && process.platform !== 'win32'),
|
||||
color: true,
|
||||
timeout: 60000
|
||||
};
|
||||
|
||||
|
@ -5,12 +5,13 @@
|
||||
|
||||
import 'mocha';
|
||||
import * as assert from 'assert';
|
||||
import { withRandomFileEditor } from './testUtils';
|
||||
import { closeAllEditors, withRandomFileEditor } from './testUtils';
|
||||
import * as vscode from 'vscode';
|
||||
import { parsePartialStylesheet, getFlatNode } from '../util';
|
||||
import { isValidLocationForEmmetAbbreviation } from '../abbreviationActions';
|
||||
|
||||
suite('Tests for partial parse of Stylesheets', () => {
|
||||
teardown(closeAllEditors);
|
||||
|
||||
function isValid(doc: vscode.TextDocument, range: vscode.Range, syntax: string): boolean {
|
||||
const rootNode = parsePartialStylesheet(doc, range.end);
|
||||
@ -43,10 +44,10 @@ p {
|
||||
|
||||
];
|
||||
rangesForEmmet.forEach(range => {
|
||||
assert.equal(isValid(doc, range, 'css'), true);
|
||||
assert.strictEqual(isValid(doc, range, 'css'), true);
|
||||
});
|
||||
rangesNotEmmet.forEach(range => {
|
||||
assert.equal(isValid(doc, range, 'css'), false);
|
||||
assert.strictEqual(isValid(doc, range, 'css'), false);
|
||||
});
|
||||
|
||||
return Promise.resolve();
|
||||
@ -73,7 +74,7 @@ dn {
|
||||
new vscode.Range(7, 2, 7, 4) // bg after ending of badly constructed block
|
||||
];
|
||||
rangesNotEmmet.forEach(range => {
|
||||
assert.equal(isValid(doc, range, 'scss'), false);
|
||||
assert.strictEqual(isValid(doc, range, 'scss'), false);
|
||||
});
|
||||
return Promise.resolve();
|
||||
});
|
||||
@ -108,10 +109,10 @@ comment */
|
||||
new vscode.Range(10, 2, 10, 3) // p after ending of block
|
||||
];
|
||||
rangesForEmmet.forEach(range => {
|
||||
assert.equal(isValid(doc, range, 'css'), true);
|
||||
assert.strictEqual(isValid(doc, range, 'css'), true);
|
||||
});
|
||||
rangesNotEmmet.forEach(range => {
|
||||
assert.equal(isValid(doc, range, 'css'), false);
|
||||
assert.strictEqual(isValid(doc, range, 'css'), false);
|
||||
});
|
||||
return Promise.resolve();
|
||||
});
|
||||
@ -143,10 +144,10 @@ comment */
|
||||
new vscode.Range(6, 3, 6, 4) // In selector
|
||||
];
|
||||
rangesForEmmet.forEach(range => {
|
||||
assert.equal(isValid(doc, range, 'scss'), true);
|
||||
assert.strictEqual(isValid(doc, range, 'scss'), true);
|
||||
});
|
||||
rangesNotEmmet.forEach(range => {
|
||||
assert.equal(isValid(doc, range, 'scss'), false);
|
||||
assert.strictEqual(isValid(doc, range, 'scss'), false);
|
||||
});
|
||||
return Promise.resolve();
|
||||
});
|
||||
@ -175,10 +176,10 @@ comment */
|
||||
new vscode.Range(1, 66, 1, 68) // Outside any ruleset
|
||||
];
|
||||
rangesForEmmet.forEach(range => {
|
||||
assert.equal(isValid(doc, range, 'scss'), true);
|
||||
assert.strictEqual(isValid(doc, range, 'scss'), true);
|
||||
});
|
||||
rangesNotEmmet.forEach(range => {
|
||||
assert.equal(isValid(doc, range, 'scss'), false);
|
||||
assert.strictEqual(isValid(doc, range, 'scss'), false);
|
||||
});
|
||||
return Promise.resolve();
|
||||
});
|
||||
@ -210,10 +211,10 @@ p.#{dn} {
|
||||
new vscode.Range(3, 1, 3, 2), // # inside ruleset
|
||||
];
|
||||
rangesForEmmet.forEach(range => {
|
||||
assert.equal(isValid(doc, range, 'scss'), true);
|
||||
assert.strictEqual(isValid(doc, range, 'scss'), true);
|
||||
});
|
||||
rangesNotEmmet.forEach(range => {
|
||||
assert.equal(isValid(doc, range, 'scss'), false);
|
||||
assert.strictEqual(isValid(doc, range, 'scss'), false);
|
||||
});
|
||||
return Promise.resolve();
|
||||
});
|
||||
@ -248,10 +249,10 @@ ment */{
|
||||
new vscode.Range(6, 3, 6, 4) // In c inside block comment
|
||||
];
|
||||
rangesForEmmet.forEach(range => {
|
||||
assert.equal(isValid(doc, range, 'scss'), true);
|
||||
assert.strictEqual(isValid(doc, range, 'scss'), true);
|
||||
});
|
||||
rangesNotEmmet.forEach(range => {
|
||||
assert.equal(isValid(doc, range, 'scss'), false);
|
||||
assert.strictEqual(isValid(doc, range, 'scss'), false);
|
||||
});
|
||||
return Promise.resolve();
|
||||
});
|
||||
|
@ -50,7 +50,7 @@ suite('Tests for Emmet: Reflect CSS Value command', () => {
|
||||
return withRandomFileEditor(cssContents, '.css', (editor, doc) => {
|
||||
editor.selections = [new Selection(5, 10, 5, 10)];
|
||||
return reflectCssValue().then(() => {
|
||||
assert.equal(doc.getText(), cssContents.replace(/\(50deg\)/g, '(20deg)'));
|
||||
assert.strictEqual(doc.getText(), cssContents.replace(/\(50deg\)/g, '(20deg)'));
|
||||
return Promise.resolve();
|
||||
});
|
||||
});
|
||||
@ -60,7 +60,7 @@ suite('Tests for Emmet: Reflect CSS Value command', () => {
|
||||
return withRandomFileEditor(cssContents, '.css', (editor, doc) => {
|
||||
editor.selections = [new Selection(5, 2, 5, 32)];
|
||||
return reflectCssValue().then(() => {
|
||||
assert.equal(doc.getText(), cssContents.replace(/\(50deg\)/g, '(20deg)'));
|
||||
assert.strictEqual(doc.getText(), cssContents.replace(/\(50deg\)/g, '(20deg)'));
|
||||
return Promise.resolve();
|
||||
});
|
||||
});
|
||||
@ -70,7 +70,7 @@ suite('Tests for Emmet: Reflect CSS Value command', () => {
|
||||
return withRandomFileEditor(htmlContents, '.html', (editor, doc) => {
|
||||
editor.selections = [new Selection(7, 20, 7, 20)];
|
||||
return reflectCssValue().then(() => {
|
||||
assert.equal(doc.getText(), htmlContents.replace(/\(50deg\)/g, '(20deg)'));
|
||||
assert.strictEqual(doc.getText(), htmlContents.replace(/\(50deg\)/g, '(20deg)'));
|
||||
return Promise.resolve();
|
||||
});
|
||||
});
|
||||
@ -80,10 +80,10 @@ suite('Tests for Emmet: Reflect CSS Value command', () => {
|
||||
return withRandomFileEditor(htmlContents, '.html', (editor, doc) => {
|
||||
editor.selections = [new Selection(7, 4, 7, 34)];
|
||||
return reflectCssValue().then(() => {
|
||||
assert.equal(doc.getText(), htmlContents.replace(/\(50deg\)/g, '(20deg)'));
|
||||
assert.strictEqual(doc.getText(), htmlContents.replace(/\(50deg\)/g, '(20deg)'));
|
||||
return Promise.resolve();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
@ -14,10 +14,7 @@ import { splitJoinTag } from '../splitJoinTag';
|
||||
import { mergeLines } from '../mergeLines';
|
||||
|
||||
suite('Tests for Emmet actions on html tags', () => {
|
||||
teardown(() => {
|
||||
// close all editors
|
||||
return closeAllEditors;
|
||||
});
|
||||
teardown(closeAllEditors);
|
||||
|
||||
const contents = `
|
||||
<div class="hello">
|
||||
@ -60,7 +57,7 @@ suite('Tests for Emmet actions on html tags', () => {
|
||||
];
|
||||
|
||||
return updateTag('section')!.then(() => {
|
||||
assert.equal(doc.getText(), expectedContents);
|
||||
assert.strictEqual(doc.getText(), expectedContents);
|
||||
return Promise.resolve();
|
||||
});
|
||||
});
|
||||
@ -85,7 +82,7 @@ suite('Tests for Emmet actions on html tags', () => {
|
||||
];
|
||||
|
||||
return updateTag('section')!.then(() => {
|
||||
assert.equal(doc.getText(), expectedContents);
|
||||
assert.strictEqual(doc.getText(), expectedContents);
|
||||
return Promise.resolve();
|
||||
});
|
||||
});
|
||||
@ -109,7 +106,7 @@ suite('Tests for Emmet actions on html tags', () => {
|
||||
];
|
||||
|
||||
return updateTag('section')!.then(() => {
|
||||
assert.equal(doc.getText(), expectedContents);
|
||||
assert.strictEqual(doc.getText(), expectedContents);
|
||||
return Promise.resolve();
|
||||
});
|
||||
});
|
||||
@ -136,7 +133,7 @@ suite('Tests for Emmet actions on html tags', () => {
|
||||
];
|
||||
|
||||
return removeTag()!.then(() => {
|
||||
assert.equal(doc.getText(), expectedContents);
|
||||
assert.strictEqual(doc.getText(), expectedContents);
|
||||
return Promise.resolve();
|
||||
});
|
||||
});
|
||||
@ -161,7 +158,7 @@ suite('Tests for Emmet actions on html tags', () => {
|
||||
];
|
||||
|
||||
return removeTag()!.then(() => {
|
||||
assert.equal(doc.getText(), expectedContents);
|
||||
assert.strictEqual(doc.getText(), expectedContents);
|
||||
return Promise.resolve();
|
||||
});
|
||||
});
|
||||
@ -185,7 +182,7 @@ suite('Tests for Emmet actions on html tags', () => {
|
||||
];
|
||||
|
||||
return removeTag()!.then(() => {
|
||||
assert.equal(doc.getText(), expectedContents);
|
||||
assert.strictEqual(doc.getText(), expectedContents);
|
||||
return Promise.resolve();
|
||||
});
|
||||
});
|
||||
@ -211,7 +208,7 @@ suite('Tests for Emmet actions on html tags', () => {
|
||||
];
|
||||
|
||||
return splitJoinTag()!.then(() => {
|
||||
assert.equal(doc.getText(), expectedContents);
|
||||
assert.strictEqual(doc.getText(), expectedContents);
|
||||
return Promise.resolve();
|
||||
});
|
||||
});
|
||||
@ -235,7 +232,7 @@ suite('Tests for Emmet actions on html tags', () => {
|
||||
];
|
||||
|
||||
return splitJoinTag()!.then(() => {
|
||||
assert.equal(doc.getText(), expectedContents);
|
||||
assert.strictEqual(doc.getText(), expectedContents);
|
||||
return Promise.resolve();
|
||||
});
|
||||
});
|
||||
@ -259,7 +256,7 @@ suite('Tests for Emmet actions on html tags', () => {
|
||||
];
|
||||
|
||||
return splitJoinTag()!.then(() => {
|
||||
assert.equal(doc.getText(), expectedContents);
|
||||
assert.strictEqual(doc.getText(), expectedContents);
|
||||
return Promise.resolve();
|
||||
});
|
||||
});
|
||||
@ -285,7 +282,7 @@ suite('Tests for Emmet actions on html tags', () => {
|
||||
];
|
||||
|
||||
return splitJoinTag()!.then(() => {
|
||||
assert.equal(doc.getText(), expectedContents);
|
||||
assert.strictEqual(doc.getText(), expectedContents);
|
||||
return workspace.getConfiguration('emmet').update('syntaxProfiles', oldValueForSyntaxProfiles ? oldValueForSyntaxProfiles.globalValue : undefined, ConfigurationTarget.Global);
|
||||
});
|
||||
});
|
||||
@ -308,10 +305,10 @@ suite('Tests for Emmet actions on html tags', () => {
|
||||
matchTag();
|
||||
|
||||
editor.selections.forEach(selection => {
|
||||
assert.equal(selection.active.line, 8);
|
||||
assert.equal(selection.active.character, 3);
|
||||
assert.equal(selection.anchor.line, 8);
|
||||
assert.equal(selection.anchor.character, 3);
|
||||
assert.strictEqual(selection.active.line, 8);
|
||||
assert.strictEqual(selection.active.character, 3);
|
||||
assert.strictEqual(selection.anchor.line, 8);
|
||||
assert.strictEqual(selection.anchor.character, 3);
|
||||
});
|
||||
|
||||
return Promise.resolve();
|
||||
@ -334,10 +331,10 @@ suite('Tests for Emmet actions on html tags', () => {
|
||||
matchTag();
|
||||
|
||||
editor.selections.forEach(selection => {
|
||||
assert.equal(selection.active.line, 4);
|
||||
assert.equal(selection.active.character, 4);
|
||||
assert.equal(selection.anchor.line, 4);
|
||||
assert.equal(selection.anchor.character, 4);
|
||||
assert.strictEqual(selection.active.line, 4);
|
||||
assert.strictEqual(selection.active.character, 4);
|
||||
assert.strictEqual(selection.anchor.line, 4);
|
||||
assert.strictEqual(selection.anchor.character, 4);
|
||||
});
|
||||
|
||||
return Promise.resolve();
|
||||
@ -360,7 +357,7 @@ suite('Tests for Emmet actions on html tags', () => {
|
||||
];
|
||||
|
||||
return mergeLines()!.then(() => {
|
||||
assert.equal(doc.getText(), expectedContents);
|
||||
assert.strictEqual(doc.getText(), expectedContents);
|
||||
return Promise.resolve();
|
||||
});
|
||||
});
|
||||
@ -379,7 +376,7 @@ suite('Tests for Emmet actions on html tags', () => {
|
||||
];
|
||||
|
||||
return mergeLines()!.then(() => {
|
||||
assert.equal(doc.getText(), expectedContents);
|
||||
assert.strictEqual(doc.getText(), expectedContents);
|
||||
return Promise.resolve();
|
||||
});
|
||||
});
|
||||
@ -394,7 +391,7 @@ suite('Tests for Emmet actions on html tags', () => {
|
||||
];
|
||||
|
||||
return mergeLines()!.then(() => {
|
||||
assert.equal(doc.getText(), contents);
|
||||
assert.strictEqual(doc.getText(), contents);
|
||||
return Promise.resolve();
|
||||
});
|
||||
});
|
||||
|
@ -1 +0,0 @@
|
||||
DO NOT DELETE, USED BY INTEGRATION TESTS
|
@ -48,7 +48,6 @@ export function deleteFile(file: vscode.Uri): Thenable<boolean> {
|
||||
|
||||
export function closeAllEditors(): Thenable<any> {
|
||||
return vscode.commands.executeCommand('workbench.action.closeAllEditors');
|
||||
|
||||
}
|
||||
|
||||
export function withRandomFileEditor(initialContents: string, fileExtension: string = 'txt', run: (editor: vscode.TextEditor, doc: vscode.TextDocument) => Thenable<void>): Thenable<boolean> {
|
||||
@ -67,4 +66,4 @@ export function withRandomFileEditor(initialContents: string, fileExtension: str
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ suite('Tests for Toggle Comment action from Emmet (HTML)', () => {
|
||||
];
|
||||
|
||||
return toggleComment().then(() => {
|
||||
assert.equal(doc.getText(), expectedContents);
|
||||
assert.strictEqual(doc.getText(), expectedContents);
|
||||
return Promise.resolve();
|
||||
});
|
||||
});
|
||||
@ -120,7 +120,7 @@ suite('Tests for Toggle Comment action from Emmet (HTML)', () => {
|
||||
];
|
||||
|
||||
return toggleComment().then(() => {
|
||||
assert.equal(doc.getText(), expectedContents);
|
||||
assert.strictEqual(doc.getText(), expectedContents);
|
||||
return Promise.resolve();
|
||||
});
|
||||
});
|
||||
@ -158,7 +158,7 @@ suite('Tests for Toggle Comment action from Emmet (HTML)', () => {
|
||||
];
|
||||
|
||||
return toggleComment().then(() => {
|
||||
assert.equal(doc.getText(), expectedContents);
|
||||
assert.strictEqual(doc.getText(), expectedContents);
|
||||
return Promise.resolve();
|
||||
});
|
||||
});
|
||||
@ -196,7 +196,7 @@ suite('Tests for Toggle Comment action from Emmet (HTML)', () => {
|
||||
];
|
||||
|
||||
return toggleComment().then(() => {
|
||||
assert.equal(doc.getText(), expectedContents);
|
||||
assert.strictEqual(doc.getText(), expectedContents);
|
||||
return Promise.resolve();
|
||||
});
|
||||
});
|
||||
@ -241,7 +241,7 @@ suite('Tests for Toggle Comment action from Emmet (HTML)', () => {
|
||||
];
|
||||
|
||||
return toggleComment().then(() => {
|
||||
assert.equal(doc.getText(), expectedContents);
|
||||
assert.strictEqual(doc.getText(), expectedContents);
|
||||
|
||||
return Promise.resolve();
|
||||
});
|
||||
@ -272,7 +272,7 @@ suite('Tests for Toggle Comment action from Emmet (HTML)', () => {
|
||||
new Selection(4, 18, 4, 18), // cursor inside the noncommented span
|
||||
];
|
||||
return toggleComment().then(() => {
|
||||
assert.equal(doc.getText(), expectedContents);
|
||||
assert.strictEqual(doc.getText(), expectedContents);
|
||||
return Promise.resolve();
|
||||
});
|
||||
});
|
||||
@ -315,9 +315,9 @@ suite('Tests for Toggle Comment action from Emmet (CSS)', () => {
|
||||
];
|
||||
|
||||
return toggleComment().then(() => {
|
||||
assert.equal(doc.getText(), expectedContents);
|
||||
assert.strictEqual(doc.getText(), expectedContents);
|
||||
return toggleComment().then(() => {
|
||||
assert.equal(doc.getText(), contents);
|
||||
assert.strictEqual(doc.getText(), contents);
|
||||
return Promise.resolve();
|
||||
});
|
||||
});
|
||||
@ -345,9 +345,9 @@ suite('Tests for Toggle Comment action from Emmet (CSS)', () => {
|
||||
];
|
||||
|
||||
return toggleComment().then(() => {
|
||||
assert.equal(doc.getText(), expectedContents);
|
||||
assert.strictEqual(doc.getText(), expectedContents);
|
||||
//return toggleComment().then(() => {
|
||||
//assert.equal(doc.getText(), contents);
|
||||
//assert.strictEqual(doc.getText(), contents);
|
||||
return Promise.resolve();
|
||||
//});
|
||||
});
|
||||
@ -376,9 +376,9 @@ suite('Tests for Toggle Comment action from Emmet (CSS)', () => {
|
||||
];
|
||||
|
||||
return toggleComment().then(() => {
|
||||
assert.equal(doc.getText(), expectedContents);
|
||||
assert.strictEqual(doc.getText(), expectedContents);
|
||||
return toggleComment().then(() => {
|
||||
assert.equal(doc.getText(), contents);
|
||||
assert.strictEqual(doc.getText(), contents);
|
||||
return Promise.resolve();
|
||||
});
|
||||
});
|
||||
@ -404,9 +404,9 @@ suite('Tests for Toggle Comment action from Emmet (CSS)', () => {
|
||||
];
|
||||
|
||||
return toggleComment().then(() => {
|
||||
assert.equal(doc.getText(), expectedContents);
|
||||
assert.strictEqual(doc.getText(), expectedContents);
|
||||
return toggleComment().then(() => {
|
||||
assert.equal(doc.getText(), contents);
|
||||
assert.strictEqual(doc.getText(), contents);
|
||||
return Promise.resolve();
|
||||
});
|
||||
});
|
||||
@ -432,9 +432,9 @@ suite('Tests for Toggle Comment action from Emmet (CSS)', () => {
|
||||
];
|
||||
|
||||
return toggleComment().then(() => {
|
||||
assert.equal(doc.getText(), expectedContents);
|
||||
assert.strictEqual(doc.getText(), expectedContents);
|
||||
return toggleComment().then(() => {
|
||||
assert.equal(doc.getText(), contents);
|
||||
assert.strictEqual(doc.getText(), contents);
|
||||
return Promise.resolve();
|
||||
});
|
||||
});
|
||||
@ -460,9 +460,9 @@ suite('Tests for Toggle Comment action from Emmet (CSS)', () => {
|
||||
];
|
||||
|
||||
return toggleComment().then(() => {
|
||||
assert.equal(doc.getText(), expectedContents);
|
||||
assert.strictEqual(doc.getText(), expectedContents);
|
||||
return toggleComment().then(() => {
|
||||
assert.equal(doc.getText(), contents);
|
||||
assert.strictEqual(doc.getText(), contents);
|
||||
return Promise.resolve();
|
||||
});
|
||||
});
|
||||
@ -488,9 +488,9 @@ suite('Tests for Toggle Comment action from Emmet (CSS)', () => {
|
||||
];
|
||||
|
||||
return toggleComment().then(() => {
|
||||
assert.equal(doc.getText(), expectedContents);
|
||||
assert.strictEqual(doc.getText(), expectedContents);
|
||||
return toggleComment().then(() => {
|
||||
assert.equal(doc.getText(), contents);
|
||||
assert.strictEqual(doc.getText(), contents);
|
||||
return Promise.resolve();
|
||||
});
|
||||
});
|
||||
@ -517,9 +517,9 @@ suite('Tests for Toggle Comment action from Emmet (CSS)', () => {
|
||||
];
|
||||
|
||||
return toggleComment().then(() => {
|
||||
assert.equal(doc.getText(), expectedContents);
|
||||
assert.strictEqual(doc.getText(), expectedContents);
|
||||
return toggleComment().then(() => {
|
||||
assert.equal(doc.getText(), contents);
|
||||
assert.strictEqual(doc.getText(), contents);
|
||||
return Promise.resolve();
|
||||
});
|
||||
});
|
||||
@ -568,9 +568,9 @@ suite('Tests for Toggle Comment action from Emmet in nested css (SCSS)', () => {
|
||||
];
|
||||
|
||||
return toggleComment().then(() => {
|
||||
assert.equal(doc.getText(), expectedContents);
|
||||
assert.strictEqual(doc.getText(), expectedContents);
|
||||
return toggleComment().then(() => {
|
||||
assert.equal(doc.getText(), contents);
|
||||
assert.strictEqual(doc.getText(), contents);
|
||||
return Promise.resolve();
|
||||
});
|
||||
});
|
||||
@ -599,9 +599,9 @@ suite('Tests for Toggle Comment action from Emmet in nested css (SCSS)', () => {
|
||||
];
|
||||
|
||||
return toggleComment().then(() => {
|
||||
assert.equal(doc.getText(), expectedContents);
|
||||
assert.strictEqual(doc.getText(), expectedContents);
|
||||
return toggleComment().then(() => {
|
||||
assert.equal(doc.getText(), contents);
|
||||
assert.strictEqual(doc.getText(), contents);
|
||||
return Promise.resolve();
|
||||
});
|
||||
});
|
||||
@ -629,9 +629,9 @@ suite('Tests for Toggle Comment action from Emmet in nested css (SCSS)', () => {
|
||||
];
|
||||
|
||||
return toggleComment().then(() => {
|
||||
assert.equal(doc.getText(), expectedContents);
|
||||
assert.strictEqual(doc.getText(), expectedContents);
|
||||
//return toggleComment().then(() => {
|
||||
// assert.equal(doc.getText(), contents);
|
||||
// assert.strictEqual(doc.getText(), contents);
|
||||
return Promise.resolve();
|
||||
//});
|
||||
});
|
||||
@ -659,9 +659,9 @@ suite('Tests for Toggle Comment action from Emmet in nested css (SCSS)', () => {
|
||||
];
|
||||
|
||||
return toggleComment().then(() => {
|
||||
assert.equal(doc.getText(), expectedContents);
|
||||
assert.strictEqual(doc.getText(), expectedContents);
|
||||
return toggleComment().then(() => {
|
||||
assert.equal(doc.getText(), contents);
|
||||
assert.strictEqual(doc.getText(), contents);
|
||||
return Promise.resolve();
|
||||
});
|
||||
});
|
||||
@ -689,9 +689,9 @@ suite('Tests for Toggle Comment action from Emmet in nested css (SCSS)', () => {
|
||||
];
|
||||
|
||||
return toggleComment().then(() => {
|
||||
assert.equal(doc.getText(), expectedContents);
|
||||
assert.strictEqual(doc.getText(), expectedContents);
|
||||
return toggleComment().then(() => {
|
||||
assert.equal(doc.getText(), contents);
|
||||
assert.strictEqual(doc.getText(), contents);
|
||||
return Promise.resolve();
|
||||
});
|
||||
});
|
||||
@ -717,9 +717,9 @@ suite('Tests for Toggle Comment action from Emmet in nested css (SCSS)', () => {
|
||||
];
|
||||
|
||||
return toggleComment().then(() => {
|
||||
assert.equal(doc.getText(), expectedContents);
|
||||
assert.strictEqual(doc.getText(), expectedContents);
|
||||
return toggleComment().then(() => {
|
||||
assert.equal(doc.getText(), contents);
|
||||
assert.strictEqual(doc.getText(), contents);
|
||||
return Promise.resolve();
|
||||
});
|
||||
});
|
||||
@ -743,9 +743,9 @@ suite('Tests for Toggle Comment action from Emmet in nested css (SCSS)', () => {
|
||||
];
|
||||
|
||||
return toggleComment().then(() => {
|
||||
assert.equal(doc.getText(), expectedContents);
|
||||
assert.strictEqual(doc.getText(), expectedContents);
|
||||
return toggleComment().then(() => {
|
||||
assert.equal(doc.getText(), contents);
|
||||
assert.strictEqual(doc.getText(), contents);
|
||||
return Promise.resolve();
|
||||
});
|
||||
});
|
||||
|
@ -55,7 +55,7 @@ suite('Tests for Emmet actions on html tags', () => {
|
||||
];
|
||||
|
||||
return updateImageSize()!.then(() => {
|
||||
assert.equal(doc.getText(), expectedContents);
|
||||
assert.strictEqual(doc.getText(), expectedContents);
|
||||
return Promise.resolve();
|
||||
});
|
||||
});
|
||||
@ -112,7 +112,7 @@ suite('Tests for Emmet actions on html tags', () => {
|
||||
];
|
||||
|
||||
return updateImageSize()!.then(() => {
|
||||
assert.equal(doc.getText(), expectedContents);
|
||||
assert.strictEqual(doc.getText(), expectedContents);
|
||||
return Promise.resolve();
|
||||
});
|
||||
});
|
||||
@ -141,7 +141,7 @@ suite('Tests for Emmet actions on html tags', () => {
|
||||
];
|
||||
|
||||
return updateImageSize()!.then(() => {
|
||||
assert.equal(doc.getText(), expectedContents);
|
||||
assert.strictEqual(doc.getText(), expectedContents);
|
||||
return Promise.resolve();
|
||||
});
|
||||
});
|
||||
|
@ -398,12 +398,12 @@ function testWrapWithAbbreviation(selections: Selection[], abbreviation: string,
|
||||
editor.selections = selections;
|
||||
const promise = wrapWithAbbreviation({ abbreviation });
|
||||
if (!promise) {
|
||||
assert.equal(1, 2, 'Wrap with Abbreviation returned undefined.');
|
||||
assert.strictEqual(1, 2, 'Wrap with Abbreviation returned undefined.');
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
return promise.then(() => {
|
||||
assert.equal(editor.document.getText(), expectedContents);
|
||||
assert.strictEqual(editor.document.getText(), expectedContents);
|
||||
return Promise.resolve();
|
||||
});
|
||||
});
|
||||
@ -414,12 +414,12 @@ function testWrapIndividualLinesWithAbbreviation(selections: Selection[], abbrev
|
||||
editor.selections = selections;
|
||||
const promise = wrapWithAbbreviation({ abbreviation });
|
||||
if (!promise) {
|
||||
assert.equal(1, 2, 'Wrap individual lines with Abbreviation returned undefined.');
|
||||
assert.strictEqual(1, 2, 'Wrap individual lines with Abbreviation returned undefined.');
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
return promise.then(() => {
|
||||
assert.equal(editor.document.getText(), expectedContents);
|
||||
assert.strictEqual(editor.document.getText(), expectedContents);
|
||||
return Promise.resolve();
|
||||
});
|
||||
});
|
||||
|
@ -42,17 +42,13 @@ export function updateEmmetExtensionsPath(forceRefresh: boolean = false) {
|
||||
}
|
||||
if (forceRefresh || _currentExtensionsPath !== extensionsPath) {
|
||||
_currentExtensionsPath = extensionsPath;
|
||||
if (!vscode.workspace.workspaceFolders || vscode.workspace.workspaceFolders.length === 0) {
|
||||
return;
|
||||
} else {
|
||||
const rootPath = vscode.workspace.workspaceFolders[0].uri;
|
||||
const fileSystem = vscode.workspace.fs;
|
||||
helper.updateExtensionsPath(extensionsPath, fileSystem, rootPath, _homeDir).catch(err => {
|
||||
if (Array.isArray(extensionsPath) && extensionsPath.length) {
|
||||
vscode.window.showErrorMessage(err.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
const rootPath = vscode.workspace.workspaceFolders?.length ? vscode.workspace.workspaceFolders[0].uri : undefined;
|
||||
const fileSystem = vscode.workspace.fs;
|
||||
helper.updateExtensionsPath(extensionsPath, fileSystem, rootPath, _homeDir).catch(err => {
|
||||
if (Array.isArray(extensionsPath) && extensionsPath.length) {
|
||||
vscode.window.showErrorMessage(err.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -88,19 +84,19 @@ export function migrateEmmetExtensionsPath() {
|
||||
* Mapping between languages that support Emmet and completion trigger characters
|
||||
*/
|
||||
export const LANGUAGE_MODES: { [id: string]: string[] } = {
|
||||
'html': ['!', '.', '}', ':', '*', '$', ']', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
|
||||
'jade': ['!', '.', '}', ':', '*', '$', ']', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
|
||||
'slim': ['!', '.', '}', ':', '*', '$', ']', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
|
||||
'haml': ['!', '.', '}', ':', '*', '$', ']', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
|
||||
'xml': ['.', '}', '*', '$', ']', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
|
||||
'xsl': ['!', '.', '}', '*', '$', ']', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
|
||||
'html': ['!', '.', '}', ':', '*', '$', ']', '/', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
|
||||
'jade': ['!', '.', '}', ':', '*', '$', ']', '/', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
|
||||
'slim': ['!', '.', '}', ':', '*', '$', ']', '/', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
|
||||
'haml': ['!', '.', '}', ':', '*', '$', ']', '/', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
|
||||
'xml': ['.', '}', '*', '$', ']', '/', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
|
||||
'xsl': ['!', '.', '}', '*', '$', '/', ']', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
|
||||
'css': [':', '!', '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
|
||||
'scss': [':', '!', '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
|
||||
'sass': [':', '!', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
|
||||
'less': [':', '!', '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
|
||||
'stylus': [':', '!', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
|
||||
'javascriptreact': ['!', '.', '}', '*', '$', ']', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
|
||||
'typescriptreact': ['!', '.', '}', '*', '$', ']', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
|
||||
'javascriptreact': ['!', '.', '}', '*', '$', ']', '/', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
|
||||
'typescriptreact': ['!', '.', '}', '*', '$', ']', '/', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
|
||||
};
|
||||
|
||||
export function isStyleSheet(syntax: string): boolean {
|
||||
@ -380,32 +376,36 @@ export const allowedMimeTypesInScriptTag = ['text/html', 'text/plain', 'text/x-t
|
||||
* If position is inside a script tag of type template, then it will be parsed to find the inner HTML node as well
|
||||
*/
|
||||
export function getHtmlFlatNode(documentText: string, root: FlatNode | undefined, offset: number, includeNodeBoundary: boolean): HtmlFlatNode | undefined {
|
||||
const currentNode: HtmlFlatNode | undefined = <HtmlFlatNode | undefined>getFlatNode(root, offset, includeNodeBoundary);
|
||||
let currentNode: HtmlFlatNode | undefined = <HtmlFlatNode | undefined>getFlatNode(root, offset, includeNodeBoundary);
|
||||
if (!currentNode) { return; }
|
||||
|
||||
const isTemplateScript = currentNode.name === 'script' &&
|
||||
(currentNode.attributes &&
|
||||
currentNode.attributes.some(x => x.name.toString() === 'type'
|
||||
&& allowedMimeTypesInScriptTag.includes(x.value.toString())));
|
||||
if (isTemplateScript
|
||||
&& currentNode.open
|
||||
&& offset > currentNode.open.end
|
||||
&& (!currentNode.close || offset < currentNode.close.start)) {
|
||||
// blank out the rest of the document and search for the node within
|
||||
const beforePadding = ' '.repeat(currentNode.open.end);
|
||||
const endToUse = currentNode.close ? currentNode.close.start : currentNode.end;
|
||||
const scriptBodyText = beforePadding + documentText.substring(currentNode.open.end, endToUse);
|
||||
const innerRoot: HtmlFlatNode = parse(scriptBodyText);
|
||||
const scriptBodyNode = getHtmlFlatNode(scriptBodyText, innerRoot, offset, includeNodeBoundary);
|
||||
if (scriptBodyNode) {
|
||||
scriptBodyNode.parent = currentNode;
|
||||
currentNode.children.push(scriptBodyNode);
|
||||
return scriptBodyNode;
|
||||
}
|
||||
// If the currentNode is a script one, first set up its subtree and then find HTML node.
|
||||
if (currentNode.name === 'script' && currentNode.children.length === 0) {
|
||||
setUpScriptNodeSubtree(documentText, currentNode);
|
||||
currentNode = <HtmlFlatNode | undefined>getFlatNode(currentNode, offset, includeNodeBoundary) ?? currentNode;
|
||||
}
|
||||
return currentNode;
|
||||
}
|
||||
|
||||
export function setUpScriptNodeSubtree(documentText: string, scriptNode: HtmlFlatNode): void {
|
||||
const isTemplateScript = scriptNode.name === 'script' &&
|
||||
(scriptNode.attributes &&
|
||||
scriptNode.attributes.some(x => x.name.toString() === 'type'
|
||||
&& allowedMimeTypesInScriptTag.includes(x.value.toString())));
|
||||
if (isTemplateScript
|
||||
&& scriptNode.open) {
|
||||
// blank out the rest of the document and generate the subtree.
|
||||
const beforePadding = ' '.repeat(scriptNode.open.end);
|
||||
const endToUse = scriptNode.close ? scriptNode.close.start : scriptNode.end;
|
||||
const scriptBodyText = beforePadding + documentText.substring(scriptNode.open.end, endToUse);
|
||||
const innerRoot: HtmlFlatNode = parse(scriptBodyText);
|
||||
innerRoot.children.forEach(child => {
|
||||
scriptNode.children.push(child);
|
||||
child.parent = scriptNode;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export function isOffsetInsideOpenOrCloseTag(node: FlatNode, offset: number): boolean {
|
||||
const htmlNode = node as HtmlFlatNode;
|
||||
if ((htmlNode.open && offset > htmlNode.open.start && offset < htmlNode.open.end)
|
||||
@ -583,7 +583,7 @@ export function getEmmetConfiguration(syntax: string) {
|
||||
) {
|
||||
syntaxProfiles[syntax] = {
|
||||
...syntaxProfiles[syntax],
|
||||
selfClosingStyle: 'xml'
|
||||
selfClosingStyle: syntax === 'jsx' ? 'xhtml' : 'xml'
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -657,10 +657,8 @@ export function getEmbeddedCssNodeIfAny(document: vscode.TextDocument, currentNo
|
||||
const currentHtmlNode = <HtmlFlatNode>currentNode;
|
||||
if (currentHtmlNode && currentHtmlNode.open && currentHtmlNode.close) {
|
||||
const offset = document.offsetAt(position);
|
||||
if (currentHtmlNode.open.end <= offset && offset <= currentHtmlNode.close.start) {
|
||||
if (currentHtmlNode.name === 'style'
|
||||
&& currentHtmlNode.open.end < offset
|
||||
&& currentHtmlNode.close.start > offset) {
|
||||
if (currentHtmlNode.open.end < offset && offset <= currentHtmlNode.close.start) {
|
||||
if (currentHtmlNode.name === 'style') {
|
||||
const buffer = ' '.repeat(currentHtmlNode.open.end) + document.getText().substring(currentHtmlNode.open.end, currentHtmlNode.close.start);
|
||||
return parseStylesheet(buffer);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"extends": "../shared.tsconfig.json",
|
||||
"extends": "../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "./out"
|
||||
},
|
||||
@ -10,4 +10,4 @@
|
||||
"include": [
|
||||
"src/**/*"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -54,9 +54,9 @@
|
||||
integrity sha1-Rs/+oRmgoAMxKiHC2bVijLX81EI=
|
||||
|
||||
"@types/node@^12.19.9":
|
||||
version "12.20.6"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-12.20.6.tgz#7b73cce37352936e628c5ba40326193443cfba25"
|
||||
integrity sha512-sRVq8d+ApGslmkE9e3i+D3gFGk7aZHAT+G4cIpIEdLJYPsWiSPwcAnJEjddLQQDqV3Ra2jOclX/Sv6YrvGYiWA==
|
||||
version "12.20.7"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-12.20.7.tgz#1cb61fd0c85cb87e728c43107b5fd82b69bc9ef8"
|
||||
integrity sha512-gWL8VUkg8VRaCAUgG9WmhefMqHmMblxe2rVpMF86nZY/+ZysU+BkAp+3cz03AixWDSSz0ks5WX59yAhv/cDwFA==
|
||||
|
||||
emmet@^2.3.0:
|
||||
version "2.3.4"
|
||||
@ -77,9 +77,9 @@ jsonc-parser@^2.3.0:
|
||||
integrity sha512-H8jvkz1O50L3dMZCsLqiuB2tA7muqbSg1AtGEkN0leAqGjsUzDJir3Zwr02BhqdcITPg3ei3mZ+HjMocAknhhg==
|
||||
|
||||
vscode-emmet-helper@^2.3.0:
|
||||
version "2.4.2"
|
||||
resolved "https://registry.yarnpkg.com/vscode-emmet-helper/-/vscode-emmet-helper-2.4.2.tgz#98dc3275a22668f0e0ef9f2ee1fa76653d71e78f"
|
||||
integrity sha512-j6N6xBn0NOigk2RYWESFlsnMQNJm5B10UUgOeHxRpm66Kck9Bq1nxwy6qT9eqKvzxz4hpC29Xv4aPGlOzsKw3w==
|
||||
version "2.6.2"
|
||||
resolved "https://registry.yarnpkg.com/vscode-emmet-helper/-/vscode-emmet-helper-2.6.2.tgz#777b471a7851ba0ca8e4151533be7f92511f39b0"
|
||||
integrity sha512-SkL1WjZZsA+bfTo52QH4PgqXCQAJSqzOmJtAY3rOl17MKbY6iJhVv2T26PshjmUnHoXnXMNa7PcLMCS75RsQDQ==
|
||||
dependencies:
|
||||
emmet "^2.3.0"
|
||||
jsonc-parser "^2.3.0"
|
||||
|
Reference in New Issue
Block a user