diff --git a/lib/typescript-import.coffee b/lib/typescript-import.coffee index e6bcdef..34d8bfc 100644 --- a/lib/typescript-import.coffee +++ b/lib/typescript-import.coffee @@ -89,7 +89,9 @@ module.exports = TypescriptImport = if symbolLocation && selection fileFolder = path.resolve(filePath + '/..') relative = path.relative(fileFolder, symbolLocation).replace(/\.(js|ts)$/, ''); - importClause = "import #{selection} from './#{relative}';\n" + if relative[0] != '.' + relative = './' + relative + importClause = "import #{selection} from '#{relative}';\n" @addImportStatement(importClause) # editor.insertText(selection + "\nimport #{selection} from './#{relative}'") else