提交 f1c7c19a 编写于 作者: M Matt Bierner

Fixing some strict mode typing issues in emmet

上级 86ceb0c8
......@@ -216,7 +216,7 @@ function doWrapping(individualLines: boolean, args: any) {
}
return '';
}
const abbreviationPromise = (args && args['abbreviation']) ? Promise.resolve(args['abbreviation']) : vscode.window.showInputBox({ prompt: 'Enter Abbreviation', validateInput: inputChanged });
const abbreviationPromise: Thenable<string | undefined> = (args && args['abbreviation']) ? Promise.resolve(args['abbreviation']) : vscode.window.showInputBox({ prompt: 'Enter Abbreviation', validateInput: inputChanged });
return abbreviationPromise.then(inputAbbreviation => {
return makeChanges(inputAbbreviation, true);
});
......@@ -637,7 +637,7 @@ function expandAbbr(input: ExpandAbbreviationInput): string | undefined {
}
function getSyntaxFromArgs(args: Object): string | undefined {
function getSyntaxFromArgs(args: { [x: string]: string }): string | undefined {
const mappedModes = getMappingForIncludedLanguages();
const language: string = args['language'];
const parentMode: string = args['parentMode'];
......
......@@ -406,7 +406,7 @@ nav#
return Promise.resolve();
}
const callBack = (completionList: CompletionList, abbreviation, expandedText) => {
const callBack = (completionList: CompletionList, abbreviation: string, expandedText: string) => {
if (!completionList.items || !completionList.items.length) {
assert.equal(1, 2, `Problem with expanding m10`);
return;
......@@ -473,7 +473,7 @@ m10
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 });
if (completionPromise) {
return completionPromise.then((completionList: CompletionList) => {
return completionPromise.then((completionList: CompletionList | undefined) => {
if (completionList && completionList.items && completionList.items.length > 0) {
assert.equal(1, 2, `m10 gets expanded in invalid location (n the value part of property value)`);
}
......@@ -486,18 +486,18 @@ m10
});
test('Skip when typing property values when there is a nested rule in the next line (SCSS)', () => {
return withRandomFileEditor(scssContents, 'scss', (editor, doc) => {
editor.selection = new Selection(19, 10, 19, 10);
return expandEmmetAbbreviation(null).then(() => {
assert.equal(editor.document.getText(), scssContents);
const cancelSrc = new CancellationTokenSource();
const completionPromise = completionProvider.provideCompletionItems(editor.document, new Position(19, 10), cancelSrc.token, { triggerKind: CompletionTriggerKind.Invoke });
if (completionPromise) {
assert.equal(1, 2, `Invalid completion at property value`);
}
return Promise.resolve();
});
test('Skip when typing property values when there is a nested rule in the next line (SCSS)', () => {
return withRandomFileEditor(scssContents, 'scss', (editor, doc) => {
editor.selection = new Selection(19, 10, 19, 10);
return expandEmmetAbbreviation(null).then(() => {
assert.equal(editor.document.getText(), scssContents);
const cancelSrc = new CancellationTokenSource();
const completionPromise = completionProvider.provideCompletionItems(editor.document, new Position(19, 10), cancelSrc.token, { triggerKind: CompletionTriggerKind.Invoke });
if (completionPromise) {
assert.equal(1, 2, `Invalid completion at property value`);
}
return Promise.resolve();
});
});
});
......@@ -26,7 +26,7 @@ declare module 'EmmetNode' {
export interface CssToken extends Token {
size: number
item(number): any
item(number: number): any
type: string
}
......@@ -85,8 +85,8 @@ declare module 'EmmetNode' {
backUp(n: number): number
current(): string
substring(from: Position, to: Position): string
eat(match): boolean
eatWhile(match): boolean
eat(match: any): boolean
eatWhile(match: any): boolean
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册