Code Monkey home page Code Monkey logo

atom-typescript-modules-helper-plugin's People

Contributors

elwynelwyn avatar gabigrin avatar russaa avatar swissa avatar trixt0r avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

atom-typescript-modules-helper-plugin's Issues

Uncaught TypeError: Cannot read property 'length' of null

[Enter steps to reproduce:]

the regular expression, used for parsing imports seems to be too loose:

I encountered this error when trying to make a new import in a file where there is a imports fields within an object (in an angular/ionic project):

...
@NgModule({
  declarations: [
    ...
  ],
  imports: [
...

the import-statement detection seems to think that the imports field as an import-statement, if at any point after the imports an from occurs (in my case, the from occurred within a comment) -- in addition this means, that even when the error is prevented, the statement is inserted at the wrong place.

The pull request #14 should fix the error, and mitigate the latter problem a little: avoids matches, when "import" is only a sub-string ... in some cases, the new import statement can still be inserted at the wrong place (due to a wrongly detected import-statement), but at least then users can cut&paste the statement to the correct place.

Atom: 1.20.1 ia32
Electron: 1.6.9
OS: Windows 10
Thrown From: typescript-modules-helper package 0.8.0

Stack Trace

Uncaught TypeError: Cannot read property 'length' of null

At C:\Users\aaru01\.atom\packages\typescript-modules-helper\lib\typescript-import.coffee:235

TypeError: Cannot read property 'length' of null
    at Object.containsSymbol (/packages/typescript-modules-helper/lib/typescript-import.coffee:235:25)
    at Object.addImportStatement (/packages/typescript-modules-helper/lib/typescript-import.coffee:71:15)
    at Object.insert (/packages/typescript-modules-helper/lib/typescript-import.coffee:136:10)
    at /packages/typescript-modules-helper/lib/typescript-import.coffee:14:92)
    at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (~/AppData/Local/atom/app-1.20.1/resources/app/src/command-registry.js:265:35)
    at ~/AppData/Local/atom/app-1.20.1/resources/app/src/command-registry.js:3:65
    at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (~/AppData/Local/atom/app-1.20.1/resources/app/node_modules/atom-keymap/lib/keymap-manager.js:621:22)
    at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (~/AppData/Local/atom/app-1.20.1/resources/app/node_modules/atom-keymap/lib/keymap-manager.js:412:28)
    at WindowEventHandler.module.exports.WindowEventHandler.handleDocumentKeyEvent (~/AppData/Local/atom/app-1.20.1/resources/app/src/window-event-handler.js:100:42)
    at HTMLDocument.<anonymous> (~/AppData/Local/atom/app-1.20.1/resources/app/src/window-event-handler.js:3:65)

Commands

     -0:40.8.0 intentions:highlight (input.hidden-input)
     -0:40.5.0 editor:join-lines (input.hidden-input)
     -0:38.2.0 core:undo (input.hidden-input)
     -0:36.8.0 settings-view:open (input.hidden-input)
     -0:07.1.0 core:move-right (input.hidden-input)
     -0:06.7.0 intentions:highlight (input.hidden-input)
     -0:06.3.0 typescript-import:insert (input.hidden-input)

Non-Core Packages

api-docs 0.0.6 
atom-beautify 0.30.5 
atom-ide-ui 0.3.3 
atom-typescript 11.0.9 
autocomplete-modules 1.7.0 
busy-signal 1.4.3 
color-picker 2.2.5 
cursor-history 0.12.0 
docblockr 0.11.0 
document-outline 1.6.1 
file-type-icons 1.3.4 
git-control 0.9.0 
git-split-diff-hyperclick 0.3.12 
git-time-machine 1.5.9 
highlight-selected 0.13.1 
hyperclick 0.1.5 
ide-typescript 0.1.6 
intentions 1.1.5 
isotope-light-ui 2.3.0 
js-hyperclick 1.11.1 
js-refactor 0.7.5 
language-typescript-grammars-only 1.6.0 
last-cursor-position 0.9.2 
linter 2.2.0 
linter-eslint 8.3.2 
linter-ui-default 1.6.10 
linter-write-good 0.9.0 
markdown-helpers 0.3.0 
markdown-pdf 2.1.0 
markdown-preview-plus 2.4.10 
markdown-scroll-sync 2.1.2 
markdown-toc 0.4.2 
markdown-writer 2.7.2 
navigation-history 0.1.8 
open-recent 5.0.0 
piatto-light 2.0.2 
refactor 0.11.5 
split-diff 1.5.1 
svn 0.0.13 
symbols-list 2.4.1 
symbols-tree-view 0.14.0 
test-activeeditor 0.0.0 
tool-bar 1.1.0 
tool-bar-atom 1.7.0 
tool-bar-main 0.0.10 
tool-bar-markdown-writer 0.3.0 
tortoise-svn 0.5.1 
typescript-modules-helper 0.8.0 

Path seperator bug on Windows

This plugin works quite well...

But I found one bug for win32 platforms:
Files are required with the wrong path seperator, i.e. folders and files are seperated with \ and not with /

I fixed this issue... sending a pull request soon.

Failed to load the typescript-modules-helper package

[Enter steps to reproduce:]

  1. ...
  2. ...

Atom: 1.19.7 x64
Electron: 1.6.9
OS: Unknown Windows version
Thrown From: typescript-modules-helper package 0.8.0

Stack Trace

Failed to load the typescript-modules-helper package

At Cannot find module 'sub-atom'

Error: Cannot find module 'sub-atom'
    at Module._resolveFilename (module.js:470:15)
    at Module._resolveFilename (~/AppData/Local/atom/app-1.19.7/resources/electron.asar/common/reset-search-paths.js:35:12)
    at Function.get_Module._resolveFilename (~/AppData/Local/atom/app-1.19.7/resources/app/src/module-cache.js:354:58)
    at Module.require (~/AppData/Local/atom/app-1.19.7/resources/app/static/index.js:40:43)
    at require (~/AppData/Local/atom/app-1.19.7/resources/app/src/native-compile-cache.js:66:33)
    at /packages/atom-typescript-modules-helper-plugin-master/lib/typescript-import.coffee:1:11)
    at /packages/atom-typescript-modules-helper-plugin-master/lib/typescript-import.coffee:1:1)
    at /packages/atom-typescript-modules-helper-plugin-master/lib/typescript-import.coffee:1:1)
    at Module.get_Module._compile (~/AppData/Local/atom/app-1.19.7/resources/app/src/native-compile-cache.js:106:36)
    at Object.value [as .coffee] (~/AppData/Local/atom/app-1.19.7/resources/app/src/compile-cache.js:239:29)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.require (~/AppData/Local/atom/app-1.19.7/resources/app/static/index.js:47:45)
    at require (internal/module.js:20:19)
    at customRequire (~/AppData/Local/atom/app-1.19.7/resources/app/static/<embedded>:96:26)
    at Package.module.exports.Package.requireMainModule (~/AppData/Local/atom/app-1.19.7/resources/app/src/package.js:887:35)
    at ~/AppData/Local/atom/app-1.19.7/resources/app/src/package.js:158:34
    at Package.module.exports.Package.measure (~/AppData/Local/atom/app-1.19.7/resources/app/src/package.js:99:21)
    at Package.module.exports.Package.load (~/AppData/Local/atom/app-1.19.7/resources/app/src/package.js:144:18)
    at PackageManager.module.exports.PackageManager.loadAvailablePackage (~/AppData/Local/atom/app-1.19.7/resources/app/src/package-manager.js:565:22)
    at ~/AppData/Local/atom/app-1.19.7/resources/app/src/package-manager.js:479:25
    at Config.module.exports.Config.transact (~/AppData/Local/atom/app-1.19.7/resources/app/src/config.js:321:22)
    at PackageManager.module.exports.PackageManager.loadPackages (~/AppData/Local/atom/app-1.19.7/resources/app/src/package-manager.js:473:25)
    at ~/AppData/Local/atom/app-1.19.7/resources/app/src/atom-environment.js:810:34

Commands

Non-Core Packages

angular2-snippets 0.4.0 
atom-beautify 0.30.5 
simplified-chinese-menu 3.5.0 
atom-typescript 11.0.8 
typescript-modules-helper 0.8.0 
autocomplete-paths 2.11.0 
color-picker 2.2.5 
docblockr 0.11.0 
emmet 2.4.3 
git-plus 7.9.3 
language-typescript-grammars-only 1.6.0 
linter 2.2.0 
minimap 4.29.6 

improving import statements for multiple files

when importing several exported items from the same file, a new import statement is created for each one.
For example, if file1.ts exports Bob and David, and you auto-import Bob and then David, the result looks like this:

import {Bob} from './file1';
import {David} from './file1';

instead of:
import {Bob, David} from './file1';

@dokkis - FYI

Use better imports as defined on tsconfig

Example:

// tsconfig.json
...
paths: {
  "asd/*": [
    "../a/s/d/*"
  ]
},
files: [
  "../a/s/d/F"
]
...
|_a
| |_s
|   |_d
|     |_F.ts
|_tsconfig.json
|_q
  |_w
    |_e
      |_T.ts

Auto imported:

// T.ts
import {FComponent} from '../../../../a/s/d/F';

Expected:

// T.ts
import {FComponent} from 'asd/F';

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.