mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-20 02:08:47 +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: |;` }
|
{ label: 'widows: ;', documentation: `widows: |;` }
|
||||||
]);
|
]);
|
||||||
} catch (e) {
|
} 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 {
|
try {
|
||||||
await testCompletionProvider('css', `.foo { wid| }`, [
|
await testCompletionProvider('css', `.foo { wid| }`, [
|
||||||
{ label: 'widows: ;', documentation: `widows: |;` }
|
{ label: 'widows: ;', documentation: `widows: |;` }
|
||||||
]);
|
]);
|
||||||
} catch (e) {
|
} 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| }`, [
|
await testCompletionProvider('css', `.foo { wido| }`, [
|
||||||
{ label: 'widows: ;', documentation: `widows: |;` }
|
{ 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 () => {
|
test('selecting non-default quick-pick item should correspond to a template', async () => {
|
||||||
const template0 = Uri.file("some-imaginary-template-0");
|
const template0 = Uri.file('some-imaginary-template-0');
|
||||||
const template1 = Uri.file("some-imaginary-template-1");
|
const template1 = Uri.file('some-imaginary-template-1');
|
||||||
const templates = [template0, template1];
|
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');
|
||||||
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 () => {
|
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.quickOpenSelectNext');
|
||||||
await commands.executeCommand('workbench.action.acceptSelectedQuickOpenItem');
|
await commands.executeCommand('workbench.action.acceptSelectedQuickOpenItem');
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
import * as assert from 'assert';
|
import * as assert from 'assert';
|
||||||
import { JSDOM } from "jsdom";
|
import { JSDOM } from 'jsdom';
|
||||||
import { LinkDetector, linkify } from '../linkify';
|
import { LinkDetector, linkify } from '../linkify';
|
||||||
|
|
||||||
const dom = new JSDOM();
|
const dom = new JSDOM();
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import * as assert from 'assert';
|
|||||||
import { activate } from '..';
|
import { activate } from '..';
|
||||||
import { RendererApi } from 'vscode-notebook-renderer';
|
import { RendererApi } from 'vscode-notebook-renderer';
|
||||||
import { IDisposable, IRichRenderContext, OutputWithAppend, RenderOptions } from '../rendererTypes';
|
import { IDisposable, IRichRenderContext, OutputWithAppend, RenderOptions } from '../rendererTypes';
|
||||||
import { JSDOM } from "jsdom";
|
import { JSDOM } from 'jsdom';
|
||||||
import { LinkDetector } from '../linkify';
|
import { LinkDetector } from '../linkify';
|
||||||
|
|
||||||
const dom = new JSDOM();
|
const dom = new JSDOM();
|
||||||
@@ -16,12 +16,12 @@ global.document = dom.window.document;
|
|||||||
suite('Notebook builtin output renderer', () => {
|
suite('Notebook builtin output renderer', () => {
|
||||||
|
|
||||||
const error = {
|
const error = {
|
||||||
name: "TypeError",
|
name: 'TypeError',
|
||||||
message: "Expected type `str`, but received type `<class \'int\'>`",
|
message: 'Expected type `str`, but received type `<class \'int\'>`',
|
||||||
stack: "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m" +
|
stack: '\u001b[1;31m---------------------------------------------------------------------------\u001b[0m' +
|
||||||
"\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)" +
|
'\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;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\'>`\""
|
'\u001b[1;31mTypeError\u001b[0m: Expected type `str`, but received type `<class \'int\'>`"'
|
||||||
};
|
};
|
||||||
|
|
||||||
const errorMimeType = 'application/vnd.code.notebook.error';
|
const errorMimeType = 'application/vnd.code.notebook.error';
|
||||||
@@ -489,13 +489,13 @@ suite('Notebook builtin output renderer', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const rawIPythonError = {
|
const rawIPythonError = {
|
||||||
name: "NameError",
|
name: 'NameError',
|
||||||
message: "name 'x' is not defined",
|
message: `name 'x' is not defined`,
|
||||||
stack: "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m" +
|
stack: '\u001b[1;31m---------------------------------------------------------------------------\u001b[0m' +
|
||||||
"\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)" +
|
'\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[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" +
|
'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"
|
`\u001b[1;31mNameError\u001b[0m: name 'x' is not defined`
|
||||||
};
|
};
|
||||||
|
|
||||||
test(`Should clean up raw IPython error stack traces`, async () => {
|
test(`Should clean up raw IPython error stack traces`, async () => {
|
||||||
|
|||||||
@@ -4,35 +4,35 @@
|
|||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
import { deepStrictEqual } from 'node:assert';
|
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 = {
|
const aliases = {
|
||||||
woman: "man",
|
woman: 'man',
|
||||||
quote: "'q'",
|
quote: `'q'`,
|
||||||
g: "git",
|
g: 'git',
|
||||||
};
|
};
|
||||||
const getTokenText = (command: Command | null) => command?.tokens.map((token) => token.text) ?? [];
|
const getTokenText = (command: Command | null) => command?.tokens.map((token) => token.text) ?? [];
|
||||||
|
|
||||||
test("works without matching aliases", () => {
|
test('works without matching aliases', () => {
|
||||||
deepStrictEqual(getTokenText(getCommand("git co ", {})), ["git", "co", ""]);
|
deepStrictEqual(getTokenText(getCommand('git co ', {})), ['git', 'co', '']);
|
||||||
deepStrictEqual(getTokenText(getCommand("git co ", aliases)), ["git", "co", ""]);
|
deepStrictEqual(getTokenText(getCommand('git co ', aliases)), ['git', 'co', '']);
|
||||||
deepStrictEqual(getTokenText(getCommand("woman ", {})), ["woman", ""]);
|
deepStrictEqual(getTokenText(getCommand('woman ', {})), ['woman', '']);
|
||||||
deepStrictEqual(getTokenText(getCommand("another string ", aliases)), [
|
deepStrictEqual(getTokenText(getCommand('another string ', aliases)), [
|
||||||
"another",
|
'another',
|
||||||
"string",
|
'string',
|
||||||
"",
|
'',
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("works with regular aliases", () => {
|
test('works with regular aliases', () => {
|
||||||
// Don't change a single token.
|
// Don't change a single token.
|
||||||
deepStrictEqual(getTokenText(getCommand("woman", aliases)), ["woman"]);
|
deepStrictEqual(getTokenText(getCommand('woman', aliases)), ['woman']);
|
||||||
// Change first token if length > 1.
|
// Change first token if length > 1.
|
||||||
deepStrictEqual(getTokenText(getCommand("woman ", aliases)), ["man", ""]);
|
deepStrictEqual(getTokenText(getCommand('woman ', aliases)), ['man', '']);
|
||||||
// Don't change later tokens.
|
// Don't change later tokens.
|
||||||
deepStrictEqual(getTokenText(getCommand("man woman ", aliases)), ["man", "woman", ""]);
|
deepStrictEqual(getTokenText(getCommand('man woman ', aliases)), ['man', 'woman', '']);
|
||||||
// Handle quotes
|
// 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(
|
assert.strictEqual(
|
||||||
snippetForFunctionCall(
|
snippetForFunctionCall(
|
||||||
{ label: 'foobar', },
|
{ 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,
|
).snippet.value,
|
||||||
'foobar(${1:alpha}, ${2:beta}, ${3:gamma}$4)$0');
|
'foobar(${1:alpha}, ${2:beta}, ${3:gamma}$4)$0');
|
||||||
});
|
});
|
||||||
@@ -148,7 +148,7 @@ suite('typescript function call snippets', () => {
|
|||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
snippetForFunctionCall(
|
snippetForFunctionCall(
|
||||||
{ label: 'foobar', },
|
{ 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,
|
).snippet.value,
|
||||||
'foobar(${1:alpha}$2)$0');
|
'foobar(${1:alpha}$2)$0');
|
||||||
});
|
});
|
||||||
@@ -158,9 +158,9 @@ suite('typescript function call snippets', () => {
|
|||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
snippetForFunctionCall(
|
snippetForFunctionCall(
|
||||||
{ label: 'foobar', },
|
{ 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': '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': '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': '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,
|
).snippet.value,
|
||||||
'foobar(${1:a}, ${2:b}, ${3:c}, ${4:d}, ${5:e}, ${6:f}$7)$0');
|
'foobar(${1:a}, ${2:b}, ${3:c}, ${4:d}, ${5:e}, ${6:f}$7)$0');
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ suite('typescript.previewer', () => {
|
|||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
documentationToMarkdown(
|
documentationToMarkdown(
|
||||||
// 'x {@link http://www.example.com/foo} y {@link https://api.jquery.com/bind/#bind-eventType-eventData-handler} z',
|
// '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
|
noopToResource, undefined
|
||||||
).value,
|
).value,
|
||||||
@@ -40,7 +40,7 @@ suite('typescript.previewer', () => {
|
|||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
documentationToMarkdown(
|
documentationToMarkdown(
|
||||||
// 'x {@link http://www.example.com/foo abc xyz} y {@link http://www.example.com/bar|b a z} z',
|
// '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
|
noopToResource, undefined
|
||||||
).value,
|
).value,
|
||||||
@@ -51,7 +51,7 @@ suite('typescript.previewer', () => {
|
|||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
documentationToMarkdown(
|
documentationToMarkdown(
|
||||||
// 'x {@linkcode http://www.example.com/foo} y {@linkplain http://www.example.com/bar} z',
|
// '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
|
noopToResource, undefined
|
||||||
).value,
|
).value,
|
||||||
@@ -64,7 +64,7 @@ suite('typescript.previewer', () => {
|
|||||||
{
|
{
|
||||||
name: 'param',
|
name: 'param',
|
||||||
// a x {@link http://www.example.com/foo abc xyz} y {@link http://www.example.com/bar|b a z} z
|
// 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),
|
], noopToResource),
|
||||||
'*@param* `a` — x [abc xyz](http://www.example.com/foo) y [b a z](http://www.example.com/bar) z');
|
'*@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(
|
assert.strictEqual(
|
||||||
tagsToMarkdown([
|
tagsToMarkdown([
|
||||||
{
|
{
|
||||||
"name": "example",
|
'name': 'example',
|
||||||
"text": [
|
'text': [
|
||||||
{
|
{
|
||||||
"text": "1 + 1 ",
|
'text': '1 + 1 ',
|
||||||
"kind": "text"
|
'kind': 'text'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"text": "{@link ",
|
'text': '{@link ',
|
||||||
"kind": "link"
|
'kind': 'link'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"text": "foo",
|
'text': 'foo',
|
||||||
"kind": "linkName"
|
'kind': 'linkName'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"text": "}",
|
'text': '}',
|
||||||
"kind": "link"
|
'kind': 'link'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -160,19 +160,19 @@ suite('typescript.previewer', () => {
|
|||||||
test('Should render @linkcode symbol name as code', () => {
|
test('Should render @linkcode symbol name as code', () => {
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
asPlainTextWithLinks([
|
asPlainTextWithLinks([
|
||||||
{ "text": "a ", "kind": "text" },
|
{ 'text': 'a ', 'kind': 'text' },
|
||||||
{ "text": "{@linkcode ", "kind": "link" },
|
{ 'text': '{@linkcode ', 'kind': 'link' },
|
||||||
{
|
{
|
||||||
"text": "dog",
|
'text': 'dog',
|
||||||
"kind": "linkName",
|
'kind': 'linkName',
|
||||||
"target": {
|
'target': {
|
||||||
"file": "/path/file.ts",
|
'file': '/path/file.ts',
|
||||||
"start": { "line": 7, "offset": 5 },
|
'start': { 'line': 7, 'offset': 5 },
|
||||||
"end": { "line": 7, "offset": 13 }
|
'end': { 'line': 7, 'offset': 13 }
|
||||||
}
|
}
|
||||||
} as SymbolDisplayPart,
|
} as SymbolDisplayPart,
|
||||||
{ "text": "}", "kind": "link" },
|
{ 'text': '}', 'kind': 'link' },
|
||||||
{ "text": " b", "kind": "text" }
|
{ 'text': ' b', 'kind': 'text' }
|
||||||
], noopToResource),
|
], 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');
|
'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', () => {
|
test('Should render @linkcode text as code', () => {
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
asPlainTextWithLinks([
|
asPlainTextWithLinks([
|
||||||
{ "text": "a ", "kind": "text" },
|
{ 'text': 'a ', 'kind': 'text' },
|
||||||
{ "text": "{@linkcode ", "kind": "link" },
|
{ 'text': '{@linkcode ', 'kind': 'link' },
|
||||||
{
|
{
|
||||||
"text": "dog",
|
'text': 'dog',
|
||||||
"kind": "linkName",
|
'kind': 'linkName',
|
||||||
"target": {
|
'target': {
|
||||||
"file": "/path/file.ts",
|
'file': '/path/file.ts',
|
||||||
"start": { "line": 7, "offset": 5 },
|
'start': { 'line': 7, 'offset': 5 },
|
||||||
"end": { "line": 7, "offset": 13 }
|
'end': { 'line': 7, 'offset': 13 }
|
||||||
}
|
}
|
||||||
} as SymbolDisplayPart,
|
} as SymbolDisplayPart,
|
||||||
{ "text": "husky", "kind": "linkText" },
|
{ 'text': 'husky', 'kind': 'linkText' },
|
||||||
{ "text": "}", "kind": "link" },
|
{ 'text': '}', 'kind': 'link' },
|
||||||
{ "text": " b", "kind": "text" }
|
{ 'text': ' b', 'kind': 'text' }
|
||||||
], noopToResource),
|
], 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');
|
'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) {
|
function reverseString(str: string) {
|
||||||
return str.split("").reverse().join("");
|
return str.split('').reverse().join('');
|
||||||
}
|
}
|
||||||
|
|
||||||
function getNextDocumentText(disposables: vscode.Disposable[], doc: vscode.TextDocument): Promise<string> {
|
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';
|
import { assertNoRpc, closeAllEditors, createRandomFile } from '../utils';
|
||||||
|
|
||||||
const ipynbContent = JSON.stringify({
|
const ipynbContent = JSON.stringify({
|
||||||
"cells": [
|
'cells': [
|
||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
'cell_type': 'markdown',
|
||||||
"source": ["## Header"],
|
'source': ['## Header'],
|
||||||
"metadata": {}
|
'metadata': {}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
'cell_type': 'code',
|
||||||
"execution_count": 2,
|
'execution_count': 2,
|
||||||
"source": ["print('hello 1')\n", "print('hello 2')"],
|
'source': [`print('hello 1')\n`, `print('hello 2')`],
|
||||||
"outputs": [
|
'outputs': [
|
||||||
{
|
{
|
||||||
"output_type": "stream",
|
'output_type': 'stream',
|
||||||
"name": "stdout",
|
'name': 'stdout',
|
||||||
"text": ["hello 1\n", "hello 2\n"]
|
'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
|
// Disable env var relaunch for tests to prevent terminals relaunching themselves
|
||||||
await config.update('environmentChangesRelaunch', false, ConfigurationTarget.Global);
|
await config.update('environmentChangesRelaunch', false, ConfigurationTarget.Global);
|
||||||
// Disable local echo in case it causes any problems in remote tests
|
// 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);
|
await config.update('shellIntegration.enabled', false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ suite('Tokenization Performance', () => {
|
|||||||
|
|
||||||
suiteSetup(async function () {
|
suiteSetup(async function () {
|
||||||
originalSettingValue = workspace.getConfiguration('editor').get('experimental.preferTreeSitter');
|
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 () {
|
suiteTeardown(async function () {
|
||||||
await workspace.getConfiguration('editor').update('experimental.preferTreeSitter', originalSettingValue, ConfigurationTarget.Global);
|
await workspace.getConfiguration('editor').update('experimental.preferTreeSitter', originalSettingValue, ConfigurationTarget.Global);
|
||||||
|
|||||||
Reference in New Issue
Block a user