Skip to content

Commit

Permalink
fixes issue #4
Browse files Browse the repository at this point in the history
  • Loading branch information
neilsoult committed Dec 14, 2018
1 parent 16e101c commit 4c9208f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/core/parse-import-nodes.ts
Expand Up @@ -7,7 +7,7 @@ const ws = `[\\s\\n\\r]`;
const namespaceToken = `\\*\\s+as\\s+(${name})`;
const defaultImportToken = name;
const destructingImportToken = `(${name})(\\s+as\\s+(${name}))?`;
const destructingImport = `{(${ws}*${destructingImportToken}(,${ws}*${destructingImportToken})*${ws}*)}`;
const destructingImport = `{(${ws}*${destructingImportToken}(${ws}*,${ws}*${destructingImportToken})*${ws}*)}`;
const defaultAndDestructingImport = `${defaultImportToken}${ws}*,${ws}*${destructingImport}`;
const combinedImportTypes = `(${namespaceToken}|${defaultImportToken}|${destructingImport}|${defaultAndDestructingImport})`;
const importRegexString = `^import\\s+(${combinedImportTypes}\\s+from\\s+)?['"]([@\\w\\\\/\.-]+)['"];?\\r?\\n?`;
Expand Down Expand Up @@ -58,6 +58,7 @@ export const parseImportNodes = (document: vscode.TextDocument) => {
let match;
while (match = importRegex.exec(source)) {

// console.log('import regex match', match);
imports.push({
default: match[5] || match[18],
namedImports: parseDestructiveImports(match[6] || match[19]),
Expand Down

0 comments on commit 4c9208f

Please sign in to comment.