mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-19 17:58:39 +00:00
Enforce single quote string usage in extension tests
Single quoted string usage is already enforced everywhere except our tests. Having this inconsistent style can confuse contributors and code generation Starting with converting over tests in the `extensions` dir
This commit is contained in:
@@ -41,14 +41,14 @@ suite('Tests for completion in CSS embedded in HTML', () => {
|
||||
{ label: 'widows: ;', documentation: `widows: |;` }
|
||||
]);
|
||||
} catch (e) {
|
||||
assert.strictEqual(e.message, "Didn't find completion item with label widows: ;");
|
||||
assert.strictEqual(e.message, `Didn't find completion item with label widows: ;`);
|
||||
}
|
||||
try {
|
||||
await testCompletionProvider('css', `.foo { wid| }`, [
|
||||
{ label: 'widows: ;', documentation: `widows: |;` }
|
||||
]);
|
||||
} catch (e) {
|
||||
assert.strictEqual(e.message, "Didn't find completion item with label widows: ;");
|
||||
assert.strictEqual(e.message, `Didn't find completion item with label widows: ;`);
|
||||
}
|
||||
await testCompletionProvider('css', `.foo { wido| }`, [
|
||||
{ label: 'widows: ;', documentation: `widows: |;` }
|
||||
|
||||
@@ -39,11 +39,11 @@ suite('github smoke test', function () {
|
||||
});
|
||||
|
||||
test('selecting non-default quick-pick item should correspond to a template', async () => {
|
||||
const template0 = Uri.file("some-imaginary-template-0");
|
||||
const template1 = Uri.file("some-imaginary-template-1");
|
||||
const template0 = Uri.file('some-imaginary-template-0');
|
||||
const template1 = Uri.file('some-imaginary-template-1');
|
||||
const templates = [template0, template1];
|
||||
|
||||
const pick = pickPullRequestTemplate(Uri.file("/"), templates);
|
||||
const pick = pickPullRequestTemplate(Uri.file('/'), templates);
|
||||
|
||||
await commands.executeCommand('workbench.action.quickOpenSelectNext');
|
||||
await commands.executeCommand('workbench.action.quickOpenSelectNext');
|
||||
@@ -53,9 +53,9 @@ suite('github smoke test', function () {
|
||||
});
|
||||
|
||||
test('selecting first quick-pick item should return undefined', async () => {
|
||||
const templates = [Uri.file("some-imaginary-file")];
|
||||
const templates = [Uri.file('some-imaginary-file')];
|
||||
|
||||
const pick = pickPullRequestTemplate(Uri.file("/"), templates);
|
||||
const pick = pickPullRequestTemplate(Uri.file('/'), templates);
|
||||
|
||||
await commands.executeCommand('workbench.action.quickOpenSelectNext');
|
||||
await commands.executeCommand('workbench.action.acceptSelectedQuickOpenItem');
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { JSDOM } from "jsdom";
|
||||
import { JSDOM } from 'jsdom';
|
||||
import { LinkDetector, linkify } from '../linkify';
|
||||
|
||||
const dom = new JSDOM();
|
||||
|
||||
@@ -7,7 +7,7 @@ import * as assert from 'assert';
|
||||
import { activate } from '..';
|
||||
import { RendererApi } from 'vscode-notebook-renderer';
|
||||
import { IDisposable, IRichRenderContext, OutputWithAppend, RenderOptions } from '../rendererTypes';
|
||||
import { JSDOM } from "jsdom";
|
||||
import { JSDOM } from 'jsdom';
|
||||
import { LinkDetector } from '../linkify';
|
||||
|
||||
const dom = new JSDOM();
|
||||
@@ -16,12 +16,12 @@ global.document = dom.window.document;
|
||||
suite('Notebook builtin output renderer', () => {
|
||||
|
||||
const error = {
|
||||
name: "TypeError",
|
||||
message: "Expected type `str`, but received type `<class \'int\'>`",
|
||||
stack: "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m" +
|
||||
"\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)" +
|
||||
"\u001b[1;32mc:\\src\\test\\ws1\\testing.py\u001b[0m in \u001b[0;36mline 2\n\u001b[0;32m <a href='file:///c%3A/src/test/ws1/testing.py?line=34'>35</a>\u001b[0m \u001b[39m# %%\u001b[39;00m\n\u001b[1;32m----> <a href='file:///c%3A/src/test/ws1/testing.py?line=35'>36</a>\u001b[0m \u001b[39mraise\u001b[39;00m \u001b[39mTypeError\u001b[39;00m(\u001b[39m'\u001b[39m\u001b[39merror = f\u001b[39m\u001b[39m\"\u001b[39m\u001b[39mExpected type `str`, but received type `\u001b[39m\u001b[39m{\u001b[39m\u001b[39mtype(name)}`\u001b[39m\u001b[39m\"\u001b[39m\u001b[39m'\u001b[39m)\n" +
|
||||
"\u001b[1;31mTypeError\u001b[0m: Expected type `str`, but received type `<class \'int\'>`\""
|
||||
name: 'TypeError',
|
||||
message: 'Expected type `str`, but received type `<class \'int\'>`',
|
||||
stack: '\u001b[1;31m---------------------------------------------------------------------------\u001b[0m' +
|
||||
'\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)' +
|
||||
'\u001b[1;32mc:\\src\\test\\ws1\\testing.py\u001b[0m in \u001b[0;36mline 2\n\u001b[0;32m <a href=\'file:///c%3A/src/test/ws1/testing.py?line=34\'>35</a>\u001b[0m \u001b[39m# %%\u001b[39;00m\n\u001b[1;32m----> <a href=\'file:///c%3A/src/test/ws1/testing.py?line=35\'>36</a>\u001b[0m \u001b[39mraise\u001b[39;00m \u001b[39mTypeError\u001b[39;00m(\u001b[39m\'\u001b[39m\u001b[39merror = f\u001b[39m\u001b[39m"\u001b[39m\u001b[39mExpected type `str`, but received type `\u001b[39m\u001b[39m{\u001b[39m\u001b[39mtype(name)}`\u001b[39m\u001b[39m"\u001b[39m\u001b[39m\'\u001b[39m)\n' +
|
||||
'\u001b[1;31mTypeError\u001b[0m: Expected type `str`, but received type `<class \'int\'>`"'
|
||||
};
|
||||
|
||||
const errorMimeType = 'application/vnd.code.notebook.error';
|
||||
@@ -489,13 +489,13 @@ suite('Notebook builtin output renderer', () => {
|
||||
});
|
||||
|
||||
const rawIPythonError = {
|
||||
name: "NameError",
|
||||
message: "name 'x' is not defined",
|
||||
stack: "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m" +
|
||||
"\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)" +
|
||||
"Cell \u001b[1;32mIn[2], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m \u001b[43mmyfunc\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n" +
|
||||
"Cell \u001b[1;32mIn[1], line 2\u001b[0m, in \u001b[0;36mmyfunc\u001b[1;34m()\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mmyfunc\u001b[39m():\n\u001b[1;32m----> 2\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[43mx\u001b[49m)\n" +
|
||||
"\u001b[1;31mNameError\u001b[0m: name 'x' is not defined"
|
||||
name: 'NameError',
|
||||
message: `name 'x' is not defined`,
|
||||
stack: '\u001b[1;31m---------------------------------------------------------------------------\u001b[0m' +
|
||||
'\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)' +
|
||||
'Cell \u001b[1;32mIn[2], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m \u001b[43mmyfunc\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n' +
|
||||
'Cell \u001b[1;32mIn[1], line 2\u001b[0m, in \u001b[0;36mmyfunc\u001b[1;34m()\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mmyfunc\u001b[39m():\n\u001b[1;32m----> 2\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[43mx\u001b[49m)\n' +
|
||||
`\u001b[1;31mNameError\u001b[0m: name 'x' is not defined`
|
||||
};
|
||||
|
||||
test(`Should clean up raw IPython error stack traces`, async () => {
|
||||
|
||||
@@ -4,35 +4,35 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { deepStrictEqual } from 'node:assert';
|
||||
import { getCommand, Command } from "../command";
|
||||
import { getCommand, Command } from '../command';
|
||||
|
||||
suite("fig/shell-parser/ getCommand", () => {
|
||||
suite('fig/shell-parser/ getCommand', () => {
|
||||
const aliases = {
|
||||
woman: "man",
|
||||
quote: "'q'",
|
||||
g: "git",
|
||||
woman: 'man',
|
||||
quote: `'q'`,
|
||||
g: 'git',
|
||||
};
|
||||
const getTokenText = (command: Command | null) => command?.tokens.map((token) => token.text) ?? [];
|
||||
|
||||
test("works without matching aliases", () => {
|
||||
deepStrictEqual(getTokenText(getCommand("git co ", {})), ["git", "co", ""]);
|
||||
deepStrictEqual(getTokenText(getCommand("git co ", aliases)), ["git", "co", ""]);
|
||||
deepStrictEqual(getTokenText(getCommand("woman ", {})), ["woman", ""]);
|
||||
deepStrictEqual(getTokenText(getCommand("another string ", aliases)), [
|
||||
"another",
|
||||
"string",
|
||||
"",
|
||||
test('works without matching aliases', () => {
|
||||
deepStrictEqual(getTokenText(getCommand('git co ', {})), ['git', 'co', '']);
|
||||
deepStrictEqual(getTokenText(getCommand('git co ', aliases)), ['git', 'co', '']);
|
||||
deepStrictEqual(getTokenText(getCommand('woman ', {})), ['woman', '']);
|
||||
deepStrictEqual(getTokenText(getCommand('another string ', aliases)), [
|
||||
'another',
|
||||
'string',
|
||||
'',
|
||||
]);
|
||||
});
|
||||
|
||||
test("works with regular aliases", () => {
|
||||
test('works with regular aliases', () => {
|
||||
// Don't change a single token.
|
||||
deepStrictEqual(getTokenText(getCommand("woman", aliases)), ["woman"]);
|
||||
deepStrictEqual(getTokenText(getCommand('woman', aliases)), ['woman']);
|
||||
// Change first token if length > 1.
|
||||
deepStrictEqual(getTokenText(getCommand("woman ", aliases)), ["man", ""]);
|
||||
deepStrictEqual(getTokenText(getCommand('woman ', aliases)), ['man', '']);
|
||||
// Don't change later tokens.
|
||||
deepStrictEqual(getTokenText(getCommand("man woman ", aliases)), ["man", "woman", ""]);
|
||||
deepStrictEqual(getTokenText(getCommand('man woman ', aliases)), ['man', 'woman', '']);
|
||||
// Handle quotes
|
||||
deepStrictEqual(getTokenText(getCommand("quote ", aliases)), ["q", ""]);
|
||||
deepStrictEqual(getTokenText(getCommand('quote ', aliases)), ['q', '']);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -139,7 +139,7 @@ suite('typescript function call snippets', () => {
|
||||
assert.strictEqual(
|
||||
snippetForFunctionCall(
|
||||
{ label: 'foobar', },
|
||||
[{ "text": "function", "kind": "keyword" }, { "text": " ", "kind": "space" }, { "text": "foobar", "kind": "functionName" }, { "text": "(", "kind": "punctuation" }, { "text": "alpha", "kind": "parameterName" }, { "text": ":", "kind": "punctuation" }, { "text": " ", "kind": "space" }, { "text": "string", "kind": "keyword" }, { "text": ",", "kind": "punctuation" }, { "text": " ", "kind": "space" }, { "text": "beta", "kind": "parameterName" }, { "text": "?", "kind": "punctuation" }, { "text": ":", "kind": "punctuation" }, { "text": " ", "kind": "space" }, { "text": "number", "kind": "keyword" }, { "text": " ", "kind": "space" }, { "text": "|", "kind": "punctuation" }, { "text": " ", "kind": "space" }, { "text": "undefined", "kind": "keyword" }, { "text": ",", "kind": "punctuation" }, { "text": " ", "kind": "space" }, { "text": "gamma", "kind": "parameterName" }, { "text": ":", "kind": "punctuation" }, { "text": " ", "kind": "space" }, { "text": "string", "kind": "keyword" }, { "text": ")", "kind": "punctuation" }, { "text": ":", "kind": "punctuation" }, { "text": " ", "kind": "space" }, { "text": "void", "kind": "keyword" }]
|
||||
[{ 'text': 'function', 'kind': 'keyword' }, { 'text': ' ', 'kind': 'space' }, { 'text': 'foobar', 'kind': 'functionName' }, { 'text': '(', 'kind': 'punctuation' }, { 'text': 'alpha', 'kind': 'parameterName' }, { 'text': ':', 'kind': 'punctuation' }, { 'text': ' ', 'kind': 'space' }, { 'text': 'string', 'kind': 'keyword' }, { 'text': ',', 'kind': 'punctuation' }, { 'text': ' ', 'kind': 'space' }, { 'text': 'beta', 'kind': 'parameterName' }, { 'text': '?', 'kind': 'punctuation' }, { 'text': ':', 'kind': 'punctuation' }, { 'text': ' ', 'kind': 'space' }, { 'text': 'number', 'kind': 'keyword' }, { 'text': ' ', 'kind': 'space' }, { 'text': '|', 'kind': 'punctuation' }, { 'text': ' ', 'kind': 'space' }, { 'text': 'undefined', 'kind': 'keyword' }, { 'text': ',', 'kind': 'punctuation' }, { 'text': ' ', 'kind': 'space' }, { 'text': 'gamma', 'kind': 'parameterName' }, { 'text': ':', 'kind': 'punctuation' }, { 'text': ' ', 'kind': 'space' }, { 'text': 'string', 'kind': 'keyword' }, { 'text': ')', 'kind': 'punctuation' }, { 'text': ':', 'kind': 'punctuation' }, { 'text': ' ', 'kind': 'space' }, { 'text': 'void', 'kind': 'keyword' }]
|
||||
).snippet.value,
|
||||
'foobar(${1:alpha}, ${2:beta}, ${3:gamma}$4)$0');
|
||||
});
|
||||
@@ -148,7 +148,7 @@ suite('typescript function call snippets', () => {
|
||||
assert.strictEqual(
|
||||
snippetForFunctionCall(
|
||||
{ label: 'foobar', },
|
||||
[{ "text": "function", "kind": "keyword" }, { "text": " ", "kind": "space" }, { "text": "foobar", "kind": "functionName" }, { "text": "(", "kind": "punctuation" }, { "text": "alpha", "kind": "parameterName" }, { "text": ":", "kind": "punctuation" }, { "text": " ", "kind": "space" }, { "text": "string", "kind": "keyword" }, { "text": ",", "kind": "punctuation" }, { "text": " ", "kind": "space" }, { "text": "beta", "kind": "parameterName" }, { "text": "?", "kind": "punctuation" }, { "text": ":", "kind": "punctuation" }, { "text": " ", "kind": "space" }, { "text": "number", "kind": "keyword" }, { "text": " ", "kind": "space" }, { "text": "|", "kind": "punctuation" }, { "text": " ", "kind": "space" }, { "text": "undefined", "kind": "keyword" }, { "text": ",", "kind": "punctuation" }, { "text": " ", "kind": "space" }, { "text": "gamma", "kind": "parameterName" }, { "text": "?", "kind": "punctuation" }, { "text": ":", "kind": "punctuation" }, { "text": " ", "kind": "space" }, { "text": "number", "kind": "keyword" }, { "text": " ", "kind": "space" }, { "text": "|", "kind": "punctuation" }, { "text": " ", "kind": "space" }, { "text": "undefined", "kind": "keyword" }, { "text": ")", "kind": "punctuation" }, { "text": ":", "kind": "punctuation" }, { "text": " ", "kind": "space" }, { "text": "void", "kind": "keyword" }]
|
||||
[{ 'text': 'function', 'kind': 'keyword' }, { 'text': ' ', 'kind': 'space' }, { 'text': 'foobar', 'kind': 'functionName' }, { 'text': '(', 'kind': 'punctuation' }, { 'text': 'alpha', 'kind': 'parameterName' }, { 'text': ':', 'kind': 'punctuation' }, { 'text': ' ', 'kind': 'space' }, { 'text': 'string', 'kind': 'keyword' }, { 'text': ',', 'kind': 'punctuation' }, { 'text': ' ', 'kind': 'space' }, { 'text': 'beta', 'kind': 'parameterName' }, { 'text': '?', 'kind': 'punctuation' }, { 'text': ':', 'kind': 'punctuation' }, { 'text': ' ', 'kind': 'space' }, { 'text': 'number', 'kind': 'keyword' }, { 'text': ' ', 'kind': 'space' }, { 'text': '|', 'kind': 'punctuation' }, { 'text': ' ', 'kind': 'space' }, { 'text': 'undefined', 'kind': 'keyword' }, { 'text': ',', 'kind': 'punctuation' }, { 'text': ' ', 'kind': 'space' }, { 'text': 'gamma', 'kind': 'parameterName' }, { 'text': '?', 'kind': 'punctuation' }, { 'text': ':', 'kind': 'punctuation' }, { 'text': ' ', 'kind': 'space' }, { 'text': 'number', 'kind': 'keyword' }, { 'text': ' ', 'kind': 'space' }, { 'text': '|', 'kind': 'punctuation' }, { 'text': ' ', 'kind': 'space' }, { 'text': 'undefined', 'kind': 'keyword' }, { 'text': ')', 'kind': 'punctuation' }, { 'text': ':', 'kind': 'punctuation' }, { 'text': ' ', 'kind': 'space' }, { 'text': 'void', 'kind': 'keyword' }]
|
||||
).snippet.value,
|
||||
'foobar(${1:alpha}$2)$0');
|
||||
});
|
||||
@@ -158,9 +158,9 @@ suite('typescript function call snippets', () => {
|
||||
assert.strictEqual(
|
||||
snippetForFunctionCall(
|
||||
{ label: 'foobar', },
|
||||
[{ "text": "function", "kind": "keyword" }, { "text": " ", "kind": "space" }, { "text": "foobar", "kind": "functionName" }, { "text": "(", "kind": "punctuation" }, { "text": "a", "kind": "parameterName" }, { "text": "?", "kind": "punctuation" }, { "text": ":", "kind": "punctuation" }, { "text": " ", "kind": "space" }, { "text": "number", "kind": "keyword" }, { "text": " ", "kind": "space" }, { "text": "|", "kind": "punctuation" }, { "text": " ", "kind": "space" }, { "text": "undefined", "kind": "keyword" }, { "text": ",", "kind": "punctuation" }, { "text": " ", "kind": "space" }, { "text": "b", "kind": "parameterName" }, { "text": "?", "kind": "punctuation" }, { "text": ":", "kind": "punctuation" }, { "text": " ", "kind": "space" }, { "text": "number", "kind": "keyword" }, { "text": " ", "kind": "space" }, { "text": "|", "kind": "punctuation" }, { "text": " ", "kind": "space" }, { "text": "undefined", "kind": "keyword" }, { "text": ",", "kind": "punctuation" }, { "text": " ", "kind": "space" }, { "text": "c", "kind": "parameterName" }, { "text": ":", "kind": "punctuation" }, { "text": " ", "kind": "space" }, { "text": "string", "kind": "keyword" }, { "text": ",", "kind": "punctuation" }, { "text": " ", "kind": "space" },
|
||||
{ "text": "d", "kind": "parameterName" }, { "text": "?", "kind": "punctuation" }, { "text": ":", "kind": "punctuation" }, { "text": " ", "kind": "space" }, { "text": "number", "kind": "keyword" }, { "text": " ", "kind": "space" }, { "text": "|", "kind": "punctuation" }, { "text": " ", "kind": "space" }, { "text": "undefined", "kind": "keyword" }, { "text": ",", "kind": "punctuation" }, { "text": " ", "kind": "space" }, { "text": "e", "kind": "parameterName" }, { "text": "?", "kind": "punctuation" }, { "text": ":", "kind": "punctuation" }, { "text": " ", "kind": "space" }, { "text": "number", "kind": "keyword" }, { "text": " ", "kind": "space" }, { "text": "|", "kind": "punctuation" }, { "text": " ", "kind": "space" }, { "text": "undefined", "kind": "keyword" }, { "text": ",", "kind": "punctuation" }, { "text": " ", "kind": "space" }, { "text": "f", "kind": "parameterName" }, { "text": ":", "kind": "punctuation" }, { "text": " ", "kind": "space" }, { "text": "string", "kind": "keyword" }, { "text": ",", "kind": "punctuation" }, { "text": " ", "kind": "space" },
|
||||
{ "text": "g", "kind": "parameterName" }, { "text": "?", "kind": "punctuation" }, { "text": ":", "kind": "punctuation" }, { "text": " ", "kind": "space" }, { "text": "number", "kind": "keyword" }, { "text": " ", "kind": "space" }, { "text": "|", "kind": "punctuation" }, { "text": " ", "kind": "space" }, { "text": "undefined", "kind": "keyword" }, { "text": ",", "kind": "punctuation" }, { "text": " ", "kind": "space" }, { "text": "h", "kind": "parameterName" }, { "text": "?", "kind": "punctuation" }, { "text": ":", "kind": "punctuation" }, { "text": " ", "kind": "space" }, { "text": "number", "kind": "keyword" }, { "text": " ", "kind": "space" }, { "text": "|", "kind": "punctuation" }, { "text": " ", "kind": "space" }, { "text": "undefined", "kind": "keyword" }, { "text": ")", "kind": "punctuation" }, { "text": ":", "kind": "punctuation" }, { "text": " ", "kind": "space" }, { "text": "void", "kind": "keyword" }]
|
||||
[{ 'text': 'function', 'kind': 'keyword' }, { 'text': ' ', 'kind': 'space' }, { 'text': 'foobar', 'kind': 'functionName' }, { 'text': '(', 'kind': 'punctuation' }, { 'text': 'a', 'kind': 'parameterName' }, { 'text': '?', 'kind': 'punctuation' }, { 'text': ':', 'kind': 'punctuation' }, { 'text': ' ', 'kind': 'space' }, { 'text': 'number', 'kind': 'keyword' }, { 'text': ' ', 'kind': 'space' }, { 'text': '|', 'kind': 'punctuation' }, { 'text': ' ', 'kind': 'space' }, { 'text': 'undefined', 'kind': 'keyword' }, { 'text': ',', 'kind': 'punctuation' }, { 'text': ' ', 'kind': 'space' }, { 'text': 'b', 'kind': 'parameterName' }, { 'text': '?', 'kind': 'punctuation' }, { 'text': ':', 'kind': 'punctuation' }, { 'text': ' ', 'kind': 'space' }, { 'text': 'number', 'kind': 'keyword' }, { 'text': ' ', 'kind': 'space' }, { 'text': '|', 'kind': 'punctuation' }, { 'text': ' ', 'kind': 'space' }, { 'text': 'undefined', 'kind': 'keyword' }, { 'text': ',', 'kind': 'punctuation' }, { 'text': ' ', 'kind': 'space' }, { 'text': 'c', 'kind': 'parameterName' }, { 'text': ':', 'kind': 'punctuation' }, { 'text': ' ', 'kind': 'space' }, { 'text': 'string', 'kind': 'keyword' }, { 'text': ',', 'kind': 'punctuation' }, { 'text': ' ', 'kind': 'space' },
|
||||
{ 'text': 'd', 'kind': 'parameterName' }, { 'text': '?', 'kind': 'punctuation' }, { 'text': ':', 'kind': 'punctuation' }, { 'text': ' ', 'kind': 'space' }, { 'text': 'number', 'kind': 'keyword' }, { 'text': ' ', 'kind': 'space' }, { 'text': '|', 'kind': 'punctuation' }, { 'text': ' ', 'kind': 'space' }, { 'text': 'undefined', 'kind': 'keyword' }, { 'text': ',', 'kind': 'punctuation' }, { 'text': ' ', 'kind': 'space' }, { 'text': 'e', 'kind': 'parameterName' }, { 'text': '?', 'kind': 'punctuation' }, { 'text': ':', 'kind': 'punctuation' }, { 'text': ' ', 'kind': 'space' }, { 'text': 'number', 'kind': 'keyword' }, { 'text': ' ', 'kind': 'space' }, { 'text': '|', 'kind': 'punctuation' }, { 'text': ' ', 'kind': 'space' }, { 'text': 'undefined', 'kind': 'keyword' }, { 'text': ',', 'kind': 'punctuation' }, { 'text': ' ', 'kind': 'space' }, { 'text': 'f', 'kind': 'parameterName' }, { 'text': ':', 'kind': 'punctuation' }, { 'text': ' ', 'kind': 'space' }, { 'text': 'string', 'kind': 'keyword' }, { 'text': ',', 'kind': 'punctuation' }, { 'text': ' ', 'kind': 'space' },
|
||||
{ 'text': 'g', 'kind': 'parameterName' }, { 'text': '?', 'kind': 'punctuation' }, { 'text': ':', 'kind': 'punctuation' }, { 'text': ' ', 'kind': 'space' }, { 'text': 'number', 'kind': 'keyword' }, { 'text': ' ', 'kind': 'space' }, { 'text': '|', 'kind': 'punctuation' }, { 'text': ' ', 'kind': 'space' }, { 'text': 'undefined', 'kind': 'keyword' }, { 'text': ',', 'kind': 'punctuation' }, { 'text': ' ', 'kind': 'space' }, { 'text': 'h', 'kind': 'parameterName' }, { 'text': '?', 'kind': 'punctuation' }, { 'text': ':', 'kind': 'punctuation' }, { 'text': ' ', 'kind': 'space' }, { 'text': 'number', 'kind': 'keyword' }, { 'text': ' ', 'kind': 'space' }, { 'text': '|', 'kind': 'punctuation' }, { 'text': ' ', 'kind': 'space' }, { 'text': 'undefined', 'kind': 'keyword' }, { 'text': ')', 'kind': 'punctuation' }, { 'text': ':', 'kind': 'punctuation' }, { 'text': ' ', 'kind': 'space' }, { 'text': 'void', 'kind': 'keyword' }]
|
||||
).snippet.value,
|
||||
'foobar(${1:a}, ${2:b}, ${3:c}, ${4:d}, ${5:e}, ${6:f}$7)$0');
|
||||
});
|
||||
|
||||
@@ -29,7 +29,7 @@ suite('typescript.previewer', () => {
|
||||
assert.strictEqual(
|
||||
documentationToMarkdown(
|
||||
// 'x {@link http://www.example.com/foo} y {@link https://api.jquery.com/bind/#bind-eventType-eventData-handler} z',
|
||||
[{ "text": "x ", "kind": "text" }, { "text": "{@link ", "kind": "link" }, { "text": "http://www.example.com/foo", "kind": "linkText" }, { "text": "}", "kind": "link" }, { "text": " y ", "kind": "text" }, { "text": "{@link ", "kind": "link" }, { "text": "https://api.jquery.com/bind/#bind-eventType-eventData-handler", "kind": "linkText" }, { "text": "}", "kind": "link" }, { "text": " z", "kind": "text" }],
|
||||
[{ 'text': 'x ', 'kind': 'text' }, { 'text': '{@link ', 'kind': 'link' }, { 'text': 'http://www.example.com/foo', 'kind': 'linkText' }, { 'text': '}', 'kind': 'link' }, { 'text': ' y ', 'kind': 'text' }, { 'text': '{@link ', 'kind': 'link' }, { 'text': 'https://api.jquery.com/bind/#bind-eventType-eventData-handler', 'kind': 'linkText' }, { 'text': '}', 'kind': 'link' }, { 'text': ' z', 'kind': 'text' }],
|
||||
[],
|
||||
noopToResource, undefined
|
||||
).value,
|
||||
@@ -40,7 +40,7 @@ suite('typescript.previewer', () => {
|
||||
assert.strictEqual(
|
||||
documentationToMarkdown(
|
||||
// 'x {@link http://www.example.com/foo abc xyz} y {@link http://www.example.com/bar|b a z} z',
|
||||
[{ "text": "x ", "kind": "text" }, { "text": "{@link ", "kind": "link" }, { "text": "http://www.example.com/foo abc xyz", "kind": "linkText" }, { "text": "}", "kind": "link" }, { "text": " y ", "kind": "text" }, { "text": "{@link ", "kind": "link" }, { "text": "http://www.example.com/bar b a z", "kind": "linkText" }, { "text": "}", "kind": "link" }, { "text": " z", "kind": "text" }],
|
||||
[{ 'text': 'x ', 'kind': 'text' }, { 'text': '{@link ', 'kind': 'link' }, { 'text': 'http://www.example.com/foo abc xyz', 'kind': 'linkText' }, { 'text': '}', 'kind': 'link' }, { 'text': ' y ', 'kind': 'text' }, { 'text': '{@link ', 'kind': 'link' }, { 'text': 'http://www.example.com/bar b a z', 'kind': 'linkText' }, { 'text': '}', 'kind': 'link' }, { 'text': ' z', 'kind': 'text' }],
|
||||
[],
|
||||
noopToResource, undefined
|
||||
).value,
|
||||
@@ -51,7 +51,7 @@ suite('typescript.previewer', () => {
|
||||
assert.strictEqual(
|
||||
documentationToMarkdown(
|
||||
// 'x {@linkcode http://www.example.com/foo} y {@linkplain http://www.example.com/bar} z',
|
||||
[{ "text": "x ", "kind": "text" }, { "text": "{@linkcode ", "kind": "link" }, { "text": "http://www.example.com/foo", "kind": "linkText" }, { "text": "}", "kind": "link" }, { "text": " y ", "kind": "text" }, { "text": "{@linkplain ", "kind": "link" }, { "text": "http://www.example.com/bar", "kind": "linkText" }, { "text": "}", "kind": "link" }, { "text": " z", "kind": "text" }],
|
||||
[{ 'text': 'x ', 'kind': 'text' }, { 'text': '{@linkcode ', 'kind': 'link' }, { 'text': 'http://www.example.com/foo', 'kind': 'linkText' }, { 'text': '}', 'kind': 'link' }, { 'text': ' y ', 'kind': 'text' }, { 'text': '{@linkplain ', 'kind': 'link' }, { 'text': 'http://www.example.com/bar', 'kind': 'linkText' }, { 'text': '}', 'kind': 'link' }, { 'text': ' z', 'kind': 'text' }],
|
||||
[],
|
||||
noopToResource, undefined
|
||||
).value,
|
||||
@@ -64,7 +64,7 @@ suite('typescript.previewer', () => {
|
||||
{
|
||||
name: 'param',
|
||||
// a x {@link http://www.example.com/foo abc xyz} y {@link http://www.example.com/bar|b a z} z
|
||||
text: [{ "text": "a", "kind": "parameterName" }, { "text": " ", "kind": "space" }, { "text": "x ", "kind": "text" }, { "text": "{@link ", "kind": "link" }, { "text": "http://www.example.com/foo abc xyz", "kind": "linkText" }, { "text": "}", "kind": "link" }, { "text": " y ", "kind": "text" }, { "text": "{@link ", "kind": "link" }, { "text": "http://www.example.com/bar b a z", "kind": "linkText" }, { "text": "}", "kind": "link" }, { "text": " z", "kind": "text" }],
|
||||
text: [{ 'text': 'a', 'kind': 'parameterName' }, { 'text': ' ', 'kind': 'space' }, { 'text': 'x ', 'kind': 'text' }, { 'text': '{@link ', 'kind': 'link' }, { 'text': 'http://www.example.com/foo abc xyz', 'kind': 'linkText' }, { 'text': '}', 'kind': 'link' }, { 'text': ' y ', 'kind': 'text' }, { 'text': '{@link ', 'kind': 'link' }, { 'text': 'http://www.example.com/bar b a z', 'kind': 'linkText' }, { 'text': '}', 'kind': 'link' }, { 'text': ' z', 'kind': 'text' }],
|
||||
}
|
||||
], noopToResource),
|
||||
'*@param* `a` — x [abc xyz](http://www.example.com/foo) y [b a z](http://www.example.com/bar) z');
|
||||
@@ -133,23 +133,23 @@ suite('typescript.previewer', () => {
|
||||
assert.strictEqual(
|
||||
tagsToMarkdown([
|
||||
{
|
||||
"name": "example",
|
||||
"text": [
|
||||
'name': 'example',
|
||||
'text': [
|
||||
{
|
||||
"text": "1 + 1 ",
|
||||
"kind": "text"
|
||||
'text': '1 + 1 ',
|
||||
'kind': 'text'
|
||||
},
|
||||
{
|
||||
"text": "{@link ",
|
||||
"kind": "link"
|
||||
'text': '{@link ',
|
||||
'kind': 'link'
|
||||
},
|
||||
{
|
||||
"text": "foo",
|
||||
"kind": "linkName"
|
||||
'text': 'foo',
|
||||
'kind': 'linkName'
|
||||
},
|
||||
{
|
||||
"text": "}",
|
||||
"kind": "link"
|
||||
'text': '}',
|
||||
'kind': 'link'
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -160,19 +160,19 @@ suite('typescript.previewer', () => {
|
||||
test('Should render @linkcode symbol name as code', () => {
|
||||
assert.strictEqual(
|
||||
asPlainTextWithLinks([
|
||||
{ "text": "a ", "kind": "text" },
|
||||
{ "text": "{@linkcode ", "kind": "link" },
|
||||
{ 'text': 'a ', 'kind': 'text' },
|
||||
{ 'text': '{@linkcode ', 'kind': 'link' },
|
||||
{
|
||||
"text": "dog",
|
||||
"kind": "linkName",
|
||||
"target": {
|
||||
"file": "/path/file.ts",
|
||||
"start": { "line": 7, "offset": 5 },
|
||||
"end": { "line": 7, "offset": 13 }
|
||||
'text': 'dog',
|
||||
'kind': 'linkName',
|
||||
'target': {
|
||||
'file': '/path/file.ts',
|
||||
'start': { 'line': 7, 'offset': 5 },
|
||||
'end': { 'line': 7, 'offset': 13 }
|
||||
}
|
||||
} as SymbolDisplayPart,
|
||||
{ "text": "}", "kind": "link" },
|
||||
{ "text": " b", "kind": "text" }
|
||||
{ 'text': '}', 'kind': 'link' },
|
||||
{ 'text': ' b', 'kind': 'text' }
|
||||
], noopToResource),
|
||||
'a [`dog`](command:_typescript.openJsDocLink?%5B%7B%22file%22%3A%7B%22path%22%3A%22%2Fpath%2Ffile.ts%22%2C%22scheme%22%3A%22file%22%7D%2C%22position%22%3A%7B%22line%22%3A6%2C%22character%22%3A4%7D%7D%5D) b');
|
||||
});
|
||||
@@ -180,20 +180,20 @@ suite('typescript.previewer', () => {
|
||||
test('Should render @linkcode text as code', () => {
|
||||
assert.strictEqual(
|
||||
asPlainTextWithLinks([
|
||||
{ "text": "a ", "kind": "text" },
|
||||
{ "text": "{@linkcode ", "kind": "link" },
|
||||
{ 'text': 'a ', 'kind': 'text' },
|
||||
{ 'text': '{@linkcode ', 'kind': 'link' },
|
||||
{
|
||||
"text": "dog",
|
||||
"kind": "linkName",
|
||||
"target": {
|
||||
"file": "/path/file.ts",
|
||||
"start": { "line": 7, "offset": 5 },
|
||||
"end": { "line": 7, "offset": 13 }
|
||||
'text': 'dog',
|
||||
'kind': 'linkName',
|
||||
'target': {
|
||||
'file': '/path/file.ts',
|
||||
'start': { 'line': 7, 'offset': 5 },
|
||||
'end': { 'line': 7, 'offset': 13 }
|
||||
}
|
||||
} as SymbolDisplayPart,
|
||||
{ "text": "husky", "kind": "linkText" },
|
||||
{ "text": "}", "kind": "link" },
|
||||
{ "text": " b", "kind": "text" }
|
||||
{ 'text': 'husky', 'kind': 'linkText' },
|
||||
{ 'text': '}', 'kind': 'link' },
|
||||
{ 'text': ' b', 'kind': 'text' }
|
||||
], noopToResource),
|
||||
'a [`husky`](command:_typescript.openJsDocLink?%5B%7B%22file%22%3A%7B%22path%22%3A%22%2Fpath%2Ffile.ts%22%2C%22scheme%22%3A%22file%22%7D%2C%22position%22%3A%7B%22line%22%3A6%2C%22character%22%3A4%7D%7D%5D) b');
|
||||
});
|
||||
|
||||
@@ -208,7 +208,7 @@ suite.skip('vscode API - Copy Paste', function () {
|
||||
});
|
||||
|
||||
function reverseString(str: string) {
|
||||
return str.split("").reverse().join("");
|
||||
return str.split('').reverse().join('');
|
||||
}
|
||||
|
||||
function getNextDocumentText(disposables: vscode.Disposable[], doc: vscode.TextDocument): Promise<string> {
|
||||
|
||||
@@ -9,24 +9,24 @@ import * as vscode from 'vscode';
|
||||
import { assertNoRpc, closeAllEditors, createRandomFile } from '../utils';
|
||||
|
||||
const ipynbContent = JSON.stringify({
|
||||
"cells": [
|
||||
'cells': [
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"source": ["## Header"],
|
||||
"metadata": {}
|
||||
'cell_type': 'markdown',
|
||||
'source': ['## Header'],
|
||||
'metadata': {}
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"source": ["print('hello 1')\n", "print('hello 2')"],
|
||||
"outputs": [
|
||||
'cell_type': 'code',
|
||||
'execution_count': 2,
|
||||
'source': [`print('hello 1')\n`, `print('hello 2')`],
|
||||
'outputs': [
|
||||
{
|
||||
"output_type": "stream",
|
||||
"name": "stdout",
|
||||
"text": ["hello 1\n", "hello 2\n"]
|
||||
'output_type': 'stream',
|
||||
'name': 'stdout',
|
||||
'text': ['hello 1\n', 'hello 2\n']
|
||||
}
|
||||
],
|
||||
"metadata": {}
|
||||
'metadata': {}
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
@@ -28,7 +28,7 @@ import { assertNoRpc, poll } from '../utils';
|
||||
// Disable env var relaunch for tests to prevent terminals relaunching themselves
|
||||
await config.update('environmentChangesRelaunch', false, ConfigurationTarget.Global);
|
||||
// Disable local echo in case it causes any problems in remote tests
|
||||
await config.update('localEchoEnabled', "off", ConfigurationTarget.Global);
|
||||
await config.update('localEchoEnabled', 'off', ConfigurationTarget.Global);
|
||||
await config.update('shellIntegration.enabled', false);
|
||||
});
|
||||
|
||||
|
||||
@@ -131,7 +131,7 @@ suite('Tokenization Performance', () => {
|
||||
|
||||
suiteSetup(async function () {
|
||||
originalSettingValue = workspace.getConfiguration('editor').get('experimental.preferTreeSitter');
|
||||
await workspace.getConfiguration('editor').update('experimental.preferTreeSitter', ["typescript"], ConfigurationTarget.Global);
|
||||
await workspace.getConfiguration('editor').update('experimental.preferTreeSitter', ['typescript'], ConfigurationTarget.Global);
|
||||
});
|
||||
suiteTeardown(async function () {
|
||||
await workspace.getConfiguration('editor').update('experimental.preferTreeSitter', originalSettingValue, ConfigurationTarget.Global);
|
||||
|
||||
Reference in New Issue
Block a user