Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Emacs, Sublime, and vim plugin support same set of features #91

Closed
trotzig opened this issue Jan 2, 2016 · 4 comments
Closed

Make Emacs, Sublime, and vim plugin support same set of features #91

trotzig opened this issue Jan 2, 2016 · 4 comments

Comments

@trotzig
Copy link
Collaborator

trotzig commented Jan 2, 2016

As I've been working to improve the Sublime plugin, I've enhanced the command-line interface to support more usecases. I've noticed that the Emacs plugin only supports a subset of the commands available:

  • Import single variable
  • Goto

The Sublime and vim plugins both support all of these commands:

  • Import single variable
  • Import all undefined variables
  • Fix imports
  • Goto

They're also able to resolve variables that resolve to multiple js modules by bringing up a selection list to pick from.

I want import-js to be the same across the board, and it would be great if Emacs could catch up. @kevinkehl: would it make sense for the Emacs plugin to also use the command line tool? I know that it uses a buffer to send messages back and forth, but there might be some things there that could be simplified by using the cli tool instead. import-js has since the first release been enhanced in a number of ways:

  • The resulting content is written to stdout, and nothing else
  • stderr is used for messaging - it will contain a json string with messages and ask_for_selections keys.
  • When the user has selected something (because ask_for_selections was in the json), you can rerun the command and pass in the selection using --selections foo:1,bar:3.
  • If --goto is passed in, the stdout will contain a path to the file to open.
  • --goto can also be used together with --selections.

I'm happy to work on this if you don't have time/feel up for it @kevinkehl. But it would be good to hear your thoughts first.

@kevinkehl
Copy link
Contributor

Let me check it out. I'll have to read how the others work. What I didn't want to do is spin up a new RVM for every time you want to use the tool, which is what would happen if you shell out every time. However, the functions specified should be quite easy to implement. The selection list might be a little more complicated, but not too difficult.

@trotzig
Copy link
Collaborator Author

trotzig commented Jan 2, 2016

Ah that makes sense. Yeah, I'd say selections were 50% of the time spent on the Sublime plugin (and that was after @janpaul123 set up the whole integration). But it would be good to get done.

import-all and fix-imports shouldn't be too involved I think.

@kevinkehl
Copy link
Contributor

I'm going to implement fix_imports, but not expose an api to do just import_all. I don't think that adds value (why import all and not fix?) and could add some confusion.

@trotzig
Copy link
Collaborator Author

trotzig commented Jan 3, 2016

I agree with you @kevinkehl. I'll go ahead and remove import-all. I'll probably improve performance of fix-imports first, right now it uses two calls to eslint.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants