Giter Club home page Giter Club logo

sublime-import-js's People

Contributors

alebiavati avatar lencioni avatar monovertex avatar trotzig avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

sunil-bagde dp-ny

sublime-import-js's Issues

Make sublime plugin async

From @vini175pa on February 11, 2016 2:14

Hey, how are you doing? Some time ago, I've tested this plugin and I ran into some problems. I created an issue and I was encouraged to change some little things on the code, that later on fixed my problem. This inspired me to create my own plugin, since I was having other problems.

I'm using simple-import a lot and I thought that maybe you could incorporate some things of simple-import into import-js. I'm really into React development with ES6 so I was not using import-js because I know nothing about ruby and, until the version I was using, it didn't have an import like ES6.

It`s a 470 lines python file. If you have some time to have a look I appreciate.

https://github.com/vini175pa/simple-import-js

Copied from original issue: Galooshi/import-js#194

Fix all imports freezes Sublime_text 3

Hi all,

I was trying to start using importjs, as I want to use sublime for a typescript project and when I tried to import a module by running "Importjs: fix all imports" Sublime_text totally freezes.

I also fixed my path earlier as the plugin couldn't find the importjs global installation (I use nvm) so it seems like everything is connected correctly.

OS: Ubuntu 16.04.3 LTS (xenial)
Sublime build: 3143 (stable)
Node Version: v8.2.1
Python 3 version: 3.5.2

PS. I don't use sublime that much, is there a way to get a stack trace or verbose output with it so I could help debugging the issue more??

Thank you

OSError: [Errno 22] Invalid argument

Hi, I'm getting the error in the title when trying to run Fix Imports.

It says it's coming from import-js.py, line 156, which is the stdin flush.

importjs works in CLI mode without any issue.

I'm on Windows 10. Not sure what any other information to provide right now. Any ideas?

Python error: Can't convert 'NoneType' object to str implicitly

Hi! Thank you for writing this plugin, looks like it could really speed up development! I'm trying the plugin for the first time and I'm getting this error:

['/Users/alebiavati/.nvm/versions/node/v5.9.0/bin/importjs', None, '/Users/alebiavati/code/test-project/src/test.js']
Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 568, in run_
    return self.run(edit, **args)
  File "import-js in /Users/alebiavati/Library/Application Support/Sublime Text 3/Installed Packages/ImportJS.sublime-package", line 114, in run
  File "./python3.3/subprocess.py", line 819, in __init__
  File "./python3.3/subprocess.py", line 1386, in _execute_child
TypeError: Can't convert 'NoneType' object to str implicitly

My configuration is this:

/Users/alebiavati/code/test-project/.importjs.json

{
  "lookupPaths": ["src"],
  "useRelativePaths": true,
  "importDevDependencies": true,
  "aliases": {
    "$": "third-party-libs/jquery",
    "styles": "./{filename}.scss"
  }
}

and my test file is this:

/Users/alebiavati/code/test-project/src/test.js

import MainNav from './components/MainNav';

const test = MainNav;

/Users/alebiavati/code/test-project/src/components/MainNav.js

import { Component } from 'react';

export default class MainNav extends Component { }

If I run importjs from the command line I get the proper result:

$ importjs goto MainNav src/test.js
{"messages":[],"fileContent":"import MainNav from './components/MainNav';\n\nconst test = MainNav;\n","unresolvedImports":{},"goto":"src/components/MainNav.js"}

but when using the sublime plugin I get the error above. This happens if I try to use any of the importjs commands: goto module, import word under cursor, or fix all imports.

Have you ever seen something like this?

Thanks in advance for the help! and again, great plugin!!

Importjs for Angular5

How do I use import js? The readme doesnt say what it even does or how to use it or what to expect.

But Im really curious if I can get it to help with importing modules quickly. Especially for Angular projects (typescript)

Running ImportJS command... Commands no longer working

Thanks for this package. I've been using it for a while and it's been working fine, however today it's stopped working. When I run any of the import commands it says "Running ImportJS command..." in the bar at the bottom and doesn't do anything.

Just wondering whether you have come across this before?

I've tried reinstalling the package, going through the importjs setup again, and restarting sublime but it still does the same thing.
Thanks

Mysterious line-break inserted

We have a file in our repo which, on running ImportJS: Fix all imports will insert a line-break in the middle of the file, seemingly random. The weird thing is that when running the importjs command in isolation on the command-line, the line-break isn't inserted. I've tried the same file in vim and it works the way expect it to work.

Here's an example git diff after importing with the Sublime plugin:

diff --git a/app/assets/components/pages/DistrictPage/index.jsx b/app/assets/components/pages/DistrictPage/index.jsx
index d832504..b752c66 100644
--- a/app/assets/components/pages/DistrictPage/index.jsx
+++ b/app/assets/components/pages/DistrictPage/index.jsx
@@ -1,5 +1,5 @@
-const { some } = require('underscore');
 const $ = require('jquery');
+const { some } = require('underscore');
 const DocumentTitle = require('react-document-title');
 const React = require('react');

@@ -527,7 +527,8 @@ const DistrictPage = React.createClass({
       currentProfile,
       district,
     } = this.props;
-    const canSeeVoterVerification = currentProfile.voter_verification &&
+    const canSeeVoterVerification = currentProfile.voter_verification 
+&&
       currentProfile.voter_verification.can_see_activity;

     return (

Notice the added line-break after const canSeeVoterVerification = currentProfile.voter_verification.

It should be noted that this file is quite large - over 1000 lines.

Broken Pipe

Hi,
I'm on Mac Os, using node 6.3.1, Sublime Text 3114.

I've followed the installation instruction and already tried the suggested troubleshooting, but I had not luck. I've manually set the path to: "/Users/foo/.nvm/versions/node/v6.3.1/bin/node"

I've tested this on a jsx file, I place the cursor under an components that I need to import, then either by hitting a shortcut or using the command palette I launch "Import word under cursor" and I get this error message:

{'fileContent': 'import React from \'react\';\n\n\nimport Header from "./Header";\n\n\nexport default class Layout extends React.Component {\n  static propTypes = {\n    name: React.PropTypes.string,\n  };\n\n  constructor(props) {\n    super(props);\n  }\n\n  render() {\n    return (\n      <Header/>\n      <Footer />\n    );\n  }\n}\n', 'command': 'word', 'commandArg': 'Footer', 'pathToFile': '/Users/foo/Projects/react-adminlte-custom/src/components/Layout.jsx'}
Traceback (most recent call last):
  File "/Applications/Coding/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 568, in run_
    return self.run(edit, **args)
  File "import-js in /Users/foo/Library/Application Support/Sublime Text 3/Installed Packages/ImportJS.sublime-package", line 158, in run
BrokenPipeError: [Errno 32] Broken pipe

.sublime-settings are ignored - documentation error?

v1.3.0 on sublime 3211
the sublime-settings file isn't used.
.importjs.js works fine.

Not really a functional issue if you know where to put the settings, however the documentation doesn't point you towards using .importjs.js

Cheers

.import.js config file not work

the plugin seems not work.
run import word under cursor or fix all imports just got a error message at status bar:

No JS module to import for `module_name`

I have add a .importjs.js config file at project root directory, and enable debugger options, but no debugger info shows at console.

thanks any help.

Couldn't find executable importjsd.

Hi there,
I did npm install -g import-js, I try to use it in Sublime Text but I always have this error message.

I did put in my settings

{
    "paths": ["/Users/arnaudambro/.npm/lib/node_modules/import-js/bin"]
}

but nothing changes.
Is my setting good ? I did check in the path that there is a bin folder, and there is one.

When fixing and asking for selections, does not import words that do not need prompts

To reproduce:

  1. Run fix imports on a file that has multiple words to import--some which have exact matches and some which need prompts
  2. Select matches from all prompts
  3. Examine buffer

I would expect to see all of the missing imports to be imported. Instead, I only see the ones that were prompted for. Running fix imports a second time seems to get the rest.

add import statement in top of a html file

Hi, call import command in a html file will add an import statement in the top of the file. It looks like that:

import { renderStatus } from './helper';

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Document</title>
</head>
<body>
  <script>
    renderStatus
  </script>
</body>
</html>

but, except it will in the script tag of the scope:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Document</title>
</head>
<body>
  <script>
    import { renderStatus } from './helper';
    
    renderStatus
  </script>
</body>
</html>

Thanks you great work.

Improve compatibility with nvm

Some folks might not have a system node installed but are using nvm. I thought it would work to configure the executable to point to the importjs binary installed in the .nvm directory (e.g. /Users/foo/.nvm/versions/node/v4.4.3/bin/importjs), but that gives us the "couldn't find executable" error message.

We could probably make this work by having Python use a login shell when executing the importjs command, but I'd like to avoid that if possible for performance reasons.

I think all of the plugins besides atom-import-js will likely need similar attention.

This is related to Galooshi/import-js#233

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.