8000 Don't forget about .tsx · code-tree/atom-typescript@a0dc22a · GitHub
[go: up one dir, main page]

Skip to content

Commit a0dc22a

Browse files
committed
Don't forget about .tsx
1 parent 117800c commit a0dc22a

File tree

2 files changed

+14
-16
lines changed

2 files changed

+14
-16
lines changed

dist/main/atom/autoCompleteProvider.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,14 @@ function triggerAutocompletePlus() {
1111
}
1212
exports.triggerAutocompletePlus = triggerAutocompletePlus;
1313
function getModuleAutocompleteType(scopes) {
14-
var has = scopes.reduce(function (scopes, name) {
15-
scopes[name] = true;
16-
return scopes;
17-
}, {});
18-
var isString = has['string.quoted.double.ts'] || has['string.quoted.single.ts'] || false;
14+
function has(match) {
15+
return scopes.some(function (scope) { return scope.indexOf(match) !== -1; });
16+
}
17+
var isString = has('string.quoted');
1918
return {
20-
isReference: has['reference.path.string.quoted'] || has['amd.path.string.quoted'] || false,
21-
isRequire: has['meta.import-equals.external.ts'] && isString || false,
22-
isImport: has['meta.import.ts'] && isString || false
19+
isReference: has('reference.path.string.quoted') || has('amd.path.string.quoted'),
20+
isRequire: has('meta.import-equals.external') && isString,
21+
isImport: has('meta.import') && isString
2322
};
2423
}
2524
exports.provider = {

lib/main/atom/autoCompleteProvider.ts

Expand all lines: lib/main/atom/autoCompleteProvider.ts
Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,17 +73,16 @@ function getModuleAutocompleteType(scopes: string[]): {
7373
isRequire: boolean, // this only matches: import hello = require("^cursor") and not require("^")
7474
isImport: boolean // ES6 import: import hello from "^cursor"
7575
} {
76-
let has = scopes.reduce((scopes, name) => {
77-
scopes[name] = true
78-
return scopes
79-
}, {} as {[key: string]: boolean})
76+
function has(match: string): boolean {
77+
return scopes.some(scope => scope.indexOf(match) !== -1)
78+
}
8079

81-
let isString = has['string.quoted.double.ts'] || has['string.quoted.single.ts'] || false
80+
let isString = has('string.quoted')
8281

8382
return {
84-
isReference: has['reference.path.string.quoted'] || has['amd.path.string.quoted'] || false,
85-
isRequire: has['meta.import-equals.external.ts'] && isString || false,
86-
isImport: has['meta.import.ts'] && isString || false
83+
isReference: has('reference.path.string.quoted') || has('amd.path.string.quoted'),
84+
isRequire: has('meta.import-equals.external') && isString,
85+
isImport: has('meta.import') && isString
8786
}
8887
}
8988

0 commit comments

Comments
 (0)
0