mirror of
https://github.com/microsoft/vscode.git
synced 2026-07-10 16:58:55 -05:00
Use | undefined instead of ? for some readonly properties on objects that we control
For #124362 This includes: - Event objects - Context objects passed to providers - Managed objects such as `TextEditor`
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
|
||||
import 'mocha';
|
||||
import * as assert from 'assert';
|
||||
import { Selection, workspace, CancellationTokenSource, CompletionTriggerKind, ConfigurationTarget } from 'vscode';
|
||||
import { Selection, workspace, CancellationTokenSource, CompletionTriggerKind, ConfigurationTarget, CompletionContext } from 'vscode';
|
||||
import { withRandomFileEditor, closeAllEditors } from './testUtils';
|
||||
import { expandEmmetAbbreviation } from '../abbreviationActions';
|
||||
import { DefaultCompletionItemProvider } from '../defaultCompletionProvider';
|
||||
@@ -41,6 +41,11 @@ const htmlContents = `
|
||||
</body>
|
||||
`;
|
||||
|
||||
const invokeCompletionContext: CompletionContext = {
|
||||
triggerKind: CompletionTriggerKind.Invoke,
|
||||
triggerCharacter: undefined,
|
||||
};
|
||||
|
||||
suite('Tests for Expand Abbreviations (HTML)', () => {
|
||||
const oldValueForExcludeLanguages = workspace.getConfiguration('emmet').inspect('excludeLanguages');
|
||||
const oldValueForInlcudeLanguages = workspace.getConfiguration('emmet').inspect('includeLanguages');
|
||||
@@ -67,7 +72,7 @@ suite('Tests for Expand Abbreviations (HTML)', () => {
|
||||
return withRandomFileEditor('img', 'html', async (editor, _doc) => {
|
||||
editor.selection = new Selection(0, 3, 0, 3);
|
||||
const cancelSrc = new CancellationTokenSource();
|
||||
const completionPromise = completionProvider.provideCompletionItems(editor.document, editor.selection.active, cancelSrc.token, { triggerKind: CompletionTriggerKind.Invoke });
|
||||
const completionPromise = completionProvider.provideCompletionItems(editor.document, editor.selection.active, cancelSrc.token, invokeCompletionContext);
|
||||
if (!completionPromise) {
|
||||
assert.strictEqual(!completionPromise, false, `Got unexpected undefined instead of a completion promise`);
|
||||
return Promise.resolve();
|
||||
@@ -167,7 +172,7 @@ suite('Tests for Expand Abbreviations (HTML)', () => {
|
||||
return withRandomFileEditor(htmlContents, 'html', (editor, _doc) => {
|
||||
editor.selection = new Selection(2, 4, 2, 4);
|
||||
const cancelSrc = new CancellationTokenSource();
|
||||
const completionPromise = completionProvider.provideCompletionItems(editor.document, editor.selection.active, cancelSrc.token, { triggerKind: CompletionTriggerKind.Invoke });
|
||||
const completionPromise = completionProvider.provideCompletionItems(editor.document, editor.selection.active, cancelSrc.token, invokeCompletionContext);
|
||||
assert.strictEqual(!completionPromise, true, `Got unexpected comapletion promise instead of undefined`);
|
||||
return Promise.resolve();
|
||||
});
|
||||
@@ -186,7 +191,7 @@ suite('Tests for Expand Abbreviations (HTML)', () => {
|
||||
return withRandomFileEditor(htmlContents, 'html', (editor, _doc) => {
|
||||
editor.selection = new Selection(9, 8, 9, 8);
|
||||
const cancelSrc = new CancellationTokenSource();
|
||||
const completionPromise = completionProvider.provideCompletionItems(editor.document, editor.selection.active, cancelSrc.token, { triggerKind: CompletionTriggerKind.Invoke });
|
||||
const completionPromise = completionProvider.provideCompletionItems(editor.document, editor.selection.active, cancelSrc.token, invokeCompletionContext);
|
||||
assert.strictEqual(!completionPromise, true, `Got unexpected comapletion promise instead of undefined`);
|
||||
return Promise.resolve();
|
||||
});
|
||||
@@ -207,7 +212,7 @@ suite('Tests for Expand Abbreviations (HTML)', () => {
|
||||
return withRandomFileEditor(fileContents, 'html', (editor, _doc) => {
|
||||
editor.selection = new Selection(0, 6, 0, 6);
|
||||
const cancelSrc = new CancellationTokenSource();
|
||||
const completionPromise = completionProvider.provideCompletionItems(editor.document, editor.selection.active, cancelSrc.token, { triggerKind: CompletionTriggerKind.Invoke });
|
||||
const completionPromise = completionProvider.provideCompletionItems(editor.document, editor.selection.active, cancelSrc.token, invokeCompletionContext);
|
||||
assert.strictEqual(!completionPromise, true, `Got unexpected comapletion promise instead of undefined`);
|
||||
return Promise.resolve();
|
||||
});
|
||||
@@ -233,7 +238,7 @@ suite('Tests for Expand Abbreviations (HTML)', () => {
|
||||
return withRandomFileEditor(htmlContents, 'html', async (editor, _doc) => {
|
||||
editor.selection = new Selection(13, 16, 13, 19);
|
||||
const cancelSrc = new CancellationTokenSource();
|
||||
const completionPromise = completionProvider.provideCompletionItems(editor.document, editor.selection.active, cancelSrc.token, { triggerKind: CompletionTriggerKind.Invoke });
|
||||
const completionPromise = completionProvider.provideCompletionItems(editor.document, editor.selection.active, cancelSrc.token, invokeCompletionContext);
|
||||
if (!completionPromise) {
|
||||
assert.strictEqual(1, 2, `Problem with expanding m10`);
|
||||
return Promise.resolve();
|
||||
@@ -282,7 +287,7 @@ suite('Tests for Expand Abbreviations (HTML)', () => {
|
||||
return withRandomFileEditor('<div style="m10" class="hello"></div>', 'html', async (editor, _doc) => {
|
||||
editor.selection = new Selection(0, 15, 0, 15);
|
||||
const cancelSrc = new CancellationTokenSource();
|
||||
const completionPromise = completionProvider.provideCompletionItems(editor.document, editor.selection.active, cancelSrc.token, { triggerKind: CompletionTriggerKind.Invoke });
|
||||
const completionPromise = completionProvider.provideCompletionItems(editor.document, editor.selection.active, cancelSrc.token, invokeCompletionContext);
|
||||
if (!completionPromise) {
|
||||
assert.strictEqual(1, 2, `Problem with expanding m10`);
|
||||
return Promise.resolve();
|
||||
@@ -321,7 +326,7 @@ suite('Tests for Expand Abbreviations (HTML)', () => {
|
||||
return withRandomFileEditor(htmlContents, 'html', async (editor, _doc) => {
|
||||
editor.selection = new Selection(21, 12, 21, 12);
|
||||
const cancelSrc = new CancellationTokenSource();
|
||||
const completionPromise = completionProvider.provideCompletionItems(editor.document, editor.selection.active, cancelSrc.token, { triggerKind: CompletionTriggerKind.Invoke });
|
||||
const completionPromise = completionProvider.provideCompletionItems(editor.document, editor.selection.active, cancelSrc.token, invokeCompletionContext);
|
||||
if (!completionPromise) {
|
||||
assert.strictEqual(1, 2, `Problem with expanding span.hello`);
|
||||
return Promise.resolve();
|
||||
@@ -352,7 +357,7 @@ suite('Tests for Expand Abbreviations (HTML)', () => {
|
||||
return withRandomFileEditor(htmlContents, 'html', (editor, _doc) => {
|
||||
editor.selection = new Selection(24, 12, 24, 12);
|
||||
const cancelSrc = new CancellationTokenSource();
|
||||
const completionPromise = completionProvider.provideCompletionItems(editor.document, editor.selection.active, cancelSrc.token, { triggerKind: CompletionTriggerKind.Invoke });
|
||||
const completionPromise = completionProvider.provideCompletionItems(editor.document, editor.selection.active, cancelSrc.token, invokeCompletionContext);
|
||||
assert.strictEqual(!completionPromise, true, `Got unexpected comapletion promise instead of undefined`);
|
||||
return Promise.resolve();
|
||||
});
|
||||
@@ -379,7 +384,7 @@ suite('Tests for Expand Abbreviations (HTML)', () => {
|
||||
await withRandomFileEditor(htmlContents, 'html', async (editor, _doc) => {
|
||||
editor.selection = new Selection(24, 10, 24, 10);
|
||||
const cancelSrc = new CancellationTokenSource();
|
||||
const completionPromise = completionProvider.provideCompletionItems(editor.document, editor.selection.active, cancelSrc.token, { triggerKind: CompletionTriggerKind.Invoke });
|
||||
const completionPromise = completionProvider.provideCompletionItems(editor.document, editor.selection.active, cancelSrc.token, invokeCompletionContext);
|
||||
if (!completionPromise) {
|
||||
assert.strictEqual(1, 2, `Problem with expanding span.bye`);
|
||||
return Promise.resolve();
|
||||
@@ -519,7 +524,7 @@ function testHtmlCompletionProvider(selection: Selection, abbreviation: string,
|
||||
return withRandomFileEditor(htmlContents, 'html', async (editor, _doc) => {
|
||||
editor.selection = selection;
|
||||
const cancelSrc = new CancellationTokenSource();
|
||||
const completionPromise = completionProvider.provideCompletionItems(editor.document, editor.selection.active, cancelSrc.token, { triggerKind: CompletionTriggerKind.Invoke });
|
||||
const completionPromise = completionProvider.provideCompletionItems(editor.document, editor.selection.active, cancelSrc.token, invokeCompletionContext);
|
||||
if (!completionPromise) {
|
||||
if (!shouldFail) {
|
||||
assert.strictEqual(1, 2, `Problem with expanding ${abbreviation} to ${expandedText}`);
|
||||
@@ -545,7 +550,7 @@ function testNoCompletion(syntax: string, fileContents: string, selection: Selec
|
||||
return withRandomFileEditor(fileContents, syntax, (editor, _doc) => {
|
||||
editor.selection = selection;
|
||||
const cancelSrc = new CancellationTokenSource();
|
||||
const completionPromise = completionProvider.provideCompletionItems(editor.document, editor.selection.active, cancelSrc.token, { triggerKind: CompletionTriggerKind.Invoke });
|
||||
const completionPromise = completionProvider.provideCompletionItems(editor.document, editor.selection.active, cancelSrc.token, invokeCompletionContext);
|
||||
assert.strictEqual(!completionPromise, true, `Got unexpected comapletion promise instead of undefined`);
|
||||
return Promise.resolve();
|
||||
});
|
||||
|
||||
@@ -61,7 +61,7 @@ function testHtmlCompletionProvider(contents: string, expectedItems: TestComplet
|
||||
editor.document,
|
||||
editor.selection.active,
|
||||
cancelSrc.token,
|
||||
{ triggerKind: CompletionTriggerKind.Invoke }
|
||||
{ triggerKind: CompletionTriggerKind.Invoke, triggerCharacter: undefined }
|
||||
);
|
||||
if (!completionPromise) {
|
||||
return Promise.resolve();
|
||||
@@ -102,7 +102,7 @@ function testCssCompletionProvider(contents: string, expectedItems: TestCompleti
|
||||
editor.document,
|
||||
editor.selection.active,
|
||||
cancelSrc.token,
|
||||
{ triggerKind: CompletionTriggerKind.Invoke }
|
||||
{ triggerKind: CompletionTriggerKind.Invoke, triggerCharacter: undefined }
|
||||
);
|
||||
if (!completionPromise) {
|
||||
return Promise.resolve();
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import 'mocha';
|
||||
import * as assert from 'assert';
|
||||
import { Selection, CompletionList, CancellationTokenSource, Position, CompletionTriggerKind } from 'vscode';
|
||||
import { Selection, CompletionList, CancellationTokenSource, Position, CompletionTriggerKind, CompletionContext } from 'vscode';
|
||||
import { withRandomFileEditor, closeAllEditors } from './testUtils';
|
||||
import { expandEmmetAbbreviation } from '../abbreviationActions';
|
||||
import { DefaultCompletionItemProvider } from '../defaultCompletionProvider';
|
||||
@@ -51,6 +51,10 @@ const scssContents = `
|
||||
}
|
||||
`;
|
||||
|
||||
const invokeCompletionContext: CompletionContext = {
|
||||
triggerKind: CompletionTriggerKind.Invoke,
|
||||
triggerCharacter: undefined,
|
||||
};
|
||||
|
||||
suite('Tests for Expand Abbreviations (CSS)', () => {
|
||||
teardown(closeAllEditors);
|
||||
@@ -80,7 +84,7 @@ suite('Tests for Expand Abbreviations (CSS)', () => {
|
||||
return expandEmmetAbbreviation(null).then(() => {
|
||||
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 });
|
||||
const completionPromise = completionProvider.provideCompletionItems(editor.document, new Position(2, 10), cancelSrc.token, invokeCompletionContext);
|
||||
if (completionPromise) {
|
||||
assert.strictEqual(1, 2, `Invalid completion at property value`);
|
||||
}
|
||||
@@ -103,7 +107,7 @@ nav#
|
||||
return expandEmmetAbbreviation(null).then(() => {
|
||||
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 });
|
||||
const completionPromise = completionProvider.provideCompletionItems(editor.document, new Position(2, 10), cancelSrc.token, invokeCompletionContext);
|
||||
if (completionPromise) {
|
||||
assert.strictEqual(1, 2, `Invalid completion at property value`);
|
||||
}
|
||||
@@ -125,7 +129,7 @@ nav#
|
||||
return expandEmmetAbbreviation(null).then(() => {
|
||||
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 });
|
||||
const completionPromise = completionProvider.provideCompletionItems(editor.document, new Position(2, 10), cancelSrc.token, invokeCompletionContext);
|
||||
if (completionPromise) {
|
||||
assert.strictEqual(1, 2, `Invalid completion at property value`);
|
||||
}
|
||||
@@ -142,7 +146,7 @@ nav#
|
||||
return expandEmmetAbbreviation(null).then(() => {
|
||||
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 });
|
||||
const completionPromise = completionProvider.provideCompletionItems(editor.document, new Position(0, 30), cancelSrc.token, invokeCompletionContext);
|
||||
if (completionPromise) {
|
||||
assert.strictEqual(1, 2, `Invalid completion at property value`);
|
||||
}
|
||||
@@ -161,8 +165,8 @@ nav#
|
||||
|
||||
return withRandomFileEditor(testContent, 'css', (editor, _) => {
|
||||
const cancelSrc = new CancellationTokenSource();
|
||||
const completionPromise1 = completionProvider.provideCompletionItems(editor.document, new Position(2, 12), cancelSrc.token, { triggerKind: CompletionTriggerKind.Invoke });
|
||||
const completionPromise2 = completionProvider.provideCompletionItems(editor.document, new Position(2, 14), cancelSrc.token, { triggerKind: CompletionTriggerKind.Invoke });
|
||||
const completionPromise1 = completionProvider.provideCompletionItems(editor.document, new Position(2, 12), cancelSrc.token, invokeCompletionContext);
|
||||
const completionPromise2 = completionProvider.provideCompletionItems(editor.document, new Position(2, 14), cancelSrc.token, invokeCompletionContext);
|
||||
|
||||
if (!completionPromise1 || !completionPromise2) {
|
||||
assert.strictEqual(1, 2, `Completion promise wasnt returned`);
|
||||
@@ -203,7 +207,7 @@ nav#
|
||||
return expandEmmetAbbreviation(null).then(() => {
|
||||
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 });
|
||||
const completionPromise = completionProvider.provideCompletionItems(editor.document, new Position(3, 10), cancelSrc.token, invokeCompletionContext);
|
||||
if (completionPromise) {
|
||||
assert.strictEqual(1, 2, `Invalid completion at property value`);
|
||||
}
|
||||
@@ -222,8 +226,8 @@ nav#
|
||||
|
||||
return withRandomFileEditor(testContent, 'css', (editor, _) => {
|
||||
const cancelSrc = new CancellationTokenSource();
|
||||
const completionPromise1 = completionProvider.provideCompletionItems(editor.document, new Position(3, 12), cancelSrc.token, { triggerKind: CompletionTriggerKind.Invoke });
|
||||
const completionPromise2 = completionProvider.provideCompletionItems(editor.document, new Position(3, 14), cancelSrc.token, { triggerKind: CompletionTriggerKind.Invoke });
|
||||
const completionPromise1 = completionProvider.provideCompletionItems(editor.document, new Position(3, 12), cancelSrc.token, invokeCompletionContext);
|
||||
const completionPromise2 = completionProvider.provideCompletionItems(editor.document, new Position(3, 14), cancelSrc.token, invokeCompletionContext);
|
||||
|
||||
if (!completionPromise1 || !completionPromise2) {
|
||||
assert.strictEqual(1, 2, `Completion promise wasnt returned`);
|
||||
@@ -263,7 +267,7 @@ nav#
|
||||
return expandEmmetAbbreviation(null).then(() => {
|
||||
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 });
|
||||
const completionPromise = completionProvider.provideCompletionItems(editor.document, new Position(2, 10), cancelSrc.token, invokeCompletionContext);
|
||||
if (completionPromise) {
|
||||
assert.strictEqual(1, 2, `Invalid completion at property value`);
|
||||
}
|
||||
@@ -281,8 +285,8 @@ nav#
|
||||
|
||||
return withRandomFileEditor(testContent, 'css', (editor, _) => {
|
||||
const cancelSrc = new CancellationTokenSource();
|
||||
const completionPromise1 = completionProvider.provideCompletionItems(editor.document, new Position(2, 12), cancelSrc.token, { triggerKind: CompletionTriggerKind.Invoke });
|
||||
const completionPromise2 = completionProvider.provideCompletionItems(editor.document, new Position(2, 14), cancelSrc.token, { triggerKind: CompletionTriggerKind.Invoke });
|
||||
const completionPromise1 = completionProvider.provideCompletionItems(editor.document, new Position(2, 12), cancelSrc.token, invokeCompletionContext);
|
||||
const completionPromise2 = completionProvider.provideCompletionItems(editor.document, new Position(2, 14), cancelSrc.token, invokeCompletionContext);
|
||||
|
||||
if (!completionPromise1 || !completionPromise2) {
|
||||
assert.strictEqual(1, 2, `Completion promise wasnt returned`);
|
||||
@@ -322,7 +326,7 @@ nav#
|
||||
return expandEmmetAbbreviation(null).then(() => {
|
||||
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 });
|
||||
const completionPromise = completionProvider.provideCompletionItems(editor.document, new Position(2, 2), cancelSrc.token, invokeCompletionContext);
|
||||
if (completionPromise) {
|
||||
assert.strictEqual(1, 2, `Invalid completion of hex color at property name`);
|
||||
}
|
||||
@@ -339,8 +343,8 @@ nav#
|
||||
return withRandomFileEditor(cssContents, 'css', (editor, _) => {
|
||||
editor.selection = new Selection(3, 1, 3, 6);
|
||||
const cancelSrc = new CancellationTokenSource();
|
||||
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 });
|
||||
const completionPromise1 = completionProvider.provideCompletionItems(editor.document, new Position(3, 6), cancelSrc.token, invokeCompletionContext);
|
||||
const completionPromise2 = completionProvider.provideCompletionItems(editor.document, new Position(5, 6), cancelSrc.token, invokeCompletionContext);
|
||||
if (!completionPromise1 || !completionPromise2) {
|
||||
assert.strictEqual(1, 2, `Problem with expanding pos:f`);
|
||||
return Promise.resolve();
|
||||
@@ -385,10 +389,10 @@ nav#
|
||||
return withRandomFileEditor(scssContents, 'scss', (editor, _) => {
|
||||
editor.selection = new Selection(3, 4, 3, 4);
|
||||
const cancelSrc = new CancellationTokenSource();
|
||||
const completionPromise1 = completionProvider.provideCompletionItems(editor.document, new Position(3, 4), cancelSrc.token, { triggerKind: CompletionTriggerKind.Invoke });
|
||||
const completionPromise2 = completionProvider.provideCompletionItems(editor.document, new Position(5, 5), cancelSrc.token, { triggerKind: CompletionTriggerKind.Invoke });
|
||||
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 });
|
||||
const completionPromise1 = completionProvider.provideCompletionItems(editor.document, new Position(3, 4), cancelSrc.token, invokeCompletionContext);
|
||||
const completionPromise2 = completionProvider.provideCompletionItems(editor.document, new Position(5, 5), cancelSrc.token, invokeCompletionContext);
|
||||
const completionPromise3 = completionProvider.provideCompletionItems(editor.document, new Position(11, 4), cancelSrc.token, invokeCompletionContext);
|
||||
const completionPromise4 = completionProvider.provideCompletionItems(editor.document, new Position(14, 5), cancelSrc.token, invokeCompletionContext);
|
||||
if (!completionPromise1) {
|
||||
assert.strictEqual(1, 2, `Problem with expanding padding abbreviations at line 3 col 4`);
|
||||
}
|
||||
@@ -465,13 +469,13 @@ m10
|
||||
return withRandomFileEditor(scssContentsNoExpand, 'scss', (editor, _) => {
|
||||
editor.selection = new Selection(1, 3, 1, 3); // outside rule
|
||||
const cancelSrc = new CancellationTokenSource();
|
||||
let completionPromise = completionProvider.provideCompletionItems(editor.document, editor.selection.active, cancelSrc.token, { triggerKind: CompletionTriggerKind.Invoke });
|
||||
let completionPromise = completionProvider.provideCompletionItems(editor.document, editor.selection.active, cancelSrc.token, invokeCompletionContext);
|
||||
if (completionPromise) {
|
||||
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
|
||||
completionPromise = completionProvider.provideCompletionItems(editor.document, editor.selection.active, cancelSrc.token, { triggerKind: CompletionTriggerKind.Invoke });
|
||||
completionPromise = completionProvider.provideCompletionItems(editor.document, editor.selection.active, cancelSrc.token, invokeCompletionContext);
|
||||
if (completionPromise) {
|
||||
return completionPromise.then((completionList: CompletionList | undefined) => {
|
||||
if (completionList && completionList.items && completionList.items.length > 0) {
|
||||
@@ -490,7 +494,7 @@ m10
|
||||
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 });
|
||||
const completionPromise = completionProvider.provideCompletionItems(editor.document, new Position(19, 10), cancelSrc.token, invokeCompletionContext);
|
||||
if (completionPromise) {
|
||||
assert.strictEqual(1, 2, `Invalid completion at property value`);
|
||||
}
|
||||
|
||||
36
src/vs/vscode.d.ts
vendored
36
src/vs/vscode.d.ts
vendored
@@ -541,7 +541,7 @@ declare module 'vscode' {
|
||||
* The {@link TextEditorSelectionChangeKind change kind} which has triggered this
|
||||
* event. Can be `undefined`.
|
||||
*/
|
||||
readonly kind?: TextEditorSelectionChangeKind;
|
||||
readonly kind: TextEditorSelectionChangeKind | undefined
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1124,7 +1124,7 @@ declare module 'vscode' {
|
||||
* isn't one of the main editors, e.g. an embedded editor, or when the editor
|
||||
* column is larger than three.
|
||||
*/
|
||||
readonly viewColumn?: ViewColumn;
|
||||
readonly viewColumn: ViewColumn | undefined;
|
||||
|
||||
/**
|
||||
* Perform an edit on the document associated with this text editor.
|
||||
@@ -2227,7 +2227,7 @@ declare module 'vscode' {
|
||||
*
|
||||
* Actions not of this kind are filtered out before being shown by the [lightbulb](https://code.visualstudio.com/docs/editor/editingevolved#_code-action).
|
||||
*/
|
||||
readonly only?: CodeActionKind;
|
||||
readonly only: CodeActionKind | undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3918,7 +3918,7 @@ declare module 'vscode' {
|
||||
* This is `undefined` when signature help is not triggered by typing, such as when manually invoking
|
||||
* signature help or when moving the cursor.
|
||||
*/
|
||||
readonly triggerCharacter?: string;
|
||||
readonly triggerCharacter: string | undefined;
|
||||
|
||||
/**
|
||||
* `true` if signature help was already showing when it was triggered.
|
||||
@@ -3934,7 +3934,7 @@ declare module 'vscode' {
|
||||
* The `activeSignatureHelp` has its [`SignatureHelp.activeSignature`] field updated based on
|
||||
* the user arrowing through available signatures.
|
||||
*/
|
||||
readonly activeSignatureHelp?: SignatureHelp;
|
||||
readonly activeSignatureHelp: SignatureHelp | undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -4250,11 +4250,11 @@ declare module 'vscode' {
|
||||
/**
|
||||
* Character that triggered the completion item provider.
|
||||
*
|
||||
* `undefined` if provider was not triggered by a character.
|
||||
* `undefined` if the provider was not triggered by a character.
|
||||
*
|
||||
* The trigger character is already in the document when the completion provider is triggered.
|
||||
*/
|
||||
readonly triggerCharacter?: string;
|
||||
readonly triggerCharacter: string | undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -7687,7 +7687,7 @@ declare module 'vscode' {
|
||||
/**
|
||||
* Controls if the find widget is enabled in the panel.
|
||||
*
|
||||
* Defaults to false.
|
||||
* Defaults to `false`.
|
||||
*/
|
||||
readonly enableFindWidget?: boolean;
|
||||
|
||||
@@ -7743,7 +7743,7 @@ declare module 'vscode' {
|
||||
* Editor position of the panel. This property is only set if the webview is in
|
||||
* one of the editor view columns.
|
||||
*/
|
||||
readonly viewColumn?: ViewColumn;
|
||||
readonly viewColumn: ViewColumn | undefined;
|
||||
|
||||
/**
|
||||
* Whether the panel is active (focused by the user).
|
||||
@@ -8121,14 +8121,14 @@ declare module 'vscode' {
|
||||
* If this is provided, your extension should restore the editor from the backup instead of reading the file
|
||||
* from the user's workspace.
|
||||
*/
|
||||
readonly backupId?: string;
|
||||
readonly backupId: string | undefined
|
||||
|
||||
/**
|
||||
* If the URI is an untitled file, this will be populated with the byte data of that file
|
||||
*
|
||||
* If this is provided, your extension should utilize this byte data rather than executing fs APIs on the URI passed in
|
||||
*/
|
||||
readonly untitledDocumentData?: Uint8Array;
|
||||
readonly untitledDocumentData: Uint8Array | undefined
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -10343,9 +10343,9 @@ declare module 'vscode' {
|
||||
|
||||
/**
|
||||
* The reason why the document was changed.
|
||||
* Is undefined if the reason is not known.
|
||||
* Is `undefined` if the reason is not known.
|
||||
*/
|
||||
readonly reason?: TextDocumentChangeReason;
|
||||
readonly reason: TextDocumentChangeReason | undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -11742,7 +11742,7 @@ declare module 'vscode' {
|
||||
/**
|
||||
* The most recent {@link NotebookCellExecutionSummary execution summary} for this cell.
|
||||
*/
|
||||
readonly executionSummary?: NotebookCellExecutionSummary;
|
||||
readonly executionSummary: NotebookCellExecutionSummary | undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -12898,7 +12898,7 @@ declare module 'vscode' {
|
||||
/**
|
||||
* Event specific information.
|
||||
*/
|
||||
readonly body?: any;
|
||||
readonly body: any | undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -13889,19 +13889,19 @@ declare module 'vscode' {
|
||||
/**
|
||||
* The {@link AuthenticationSession}s of the {@link AuthenticationProvider} that have been added.
|
||||
*/
|
||||
readonly added?: readonly AuthenticationSession[];
|
||||
readonly added: readonly AuthenticationSession[] | undefined
|
||||
|
||||
/**
|
||||
* The {@link AuthenticationSession}s of the {@link AuthenticationProvider} that have been removed.
|
||||
*/
|
||||
readonly removed?: readonly AuthenticationSession[];
|
||||
readonly removed: readonly AuthenticationSession[] | undefined
|
||||
|
||||
/**
|
||||
* The {@link AuthenticationSession}s of the {@link AuthenticationProvider} that have been changed.
|
||||
* A session changes when its data excluding the id are updated. An example of this is a session refresh that results in a new
|
||||
* access token being set for the session.
|
||||
*/
|
||||
readonly changed?: readonly AuthenticationSession[];
|
||||
readonly changed: readonly AuthenticationSession[] | undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1477,9 +1477,9 @@ export interface ISignatureHelpDto {
|
||||
|
||||
export interface ISignatureHelpContextDto {
|
||||
readonly triggerKind: modes.SignatureHelpTriggerKind;
|
||||
readonly triggerCharacter?: string;
|
||||
readonly triggerCharacter: string | undefined;
|
||||
readonly isRetrigger: boolean;
|
||||
readonly activeSignatureHelp?: ISignatureHelpDto;
|
||||
readonly activeSignatureHelp: ISignatureHelpDto | undefined;
|
||||
}
|
||||
|
||||
export interface IInlayHintDto {
|
||||
|
||||
@@ -1442,7 +1442,7 @@ export enum CompletionTriggerKind {
|
||||
|
||||
export interface CompletionContext {
|
||||
readonly triggerKind: CompletionTriggerKind;
|
||||
readonly triggerCharacter?: string;
|
||||
readonly triggerCharacter: string | undefined;
|
||||
}
|
||||
|
||||
export enum CompletionItemKind {
|
||||
|
||||
Reference in New Issue
Block a user