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

Fixing some strict mode typing issues in emmet

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