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

Allow user to define the require templates in config #17

Open
megawac opened this issue Dec 3, 2014 · 7 comments
Open

Allow user to define the require templates in config #17

megawac opened this issue Dec 3, 2014 · 7 comments

Comments

@megawac
Copy link
Collaborator

megawac commented Dec 3, 2014

It'd be cool if we could define these 2 templates in the configuration

@yckart
Copy link

yckart commented Dec 3, 2014

@megawac

Just to be future save, I added commit hashes to the links. This is important, since the files could be changed, and the line-numbers don't persist the same "position":

Note: The hash is normally longer, I've just shortened a bit. Here's the full commit-hash: 91c3254299cf653095acf539724389b3ec13b2a4

@megawac
Copy link
Collaborator Author

megawac commented Dec 3, 2014

By the way the advantage of this is users can define it to use let instead of var for example

@garthk
Copy link

garthk commented Jan 19, 2015

+1 because I don't want the var statement and semicolon if I'm in the middle of a block of requires. I'm usually trying to maintain this:

var fs = require('fs'),
    path = require('path'),
    async = require('async'),
    _ = require('lodash');

I'd applaud madly if you could detect that situation, add the new assignment, and keep them sorted.

@dantman
Copy link
Contributor

dantman commented Feb 19, 2015

I actually think this idea should get a -1, as far as implementing it by letting custom templates be made.

@megawac's use case would be best supported by a preference that lets you choose the type of var declaration.

@garthk's use case (which is mine as well) has been mostly taken care of as the presence of any var, let, comma, opening bracket, or colon is detected. And the semicolon is gone. (Though I'm not sure what's wrong with the version in Package Control)

@megawac
Copy link
Collaborator Author

megawac commented Feb 19, 2015

Another use case is this could add support for System.js and maybe even AMD

@dantman
Copy link
Contributor

dantman commented Feb 19, 2015

Another use case is this could add support for System.js and maybe even AMD

What would System.js imports look for NodeRequire?

AMD also doesn't look like snippets could help. It would need something more complex (detecting the define, modifying the array, and modifying the arguments of the function.

The current use of insert_snippet actually probably impedes implementation of that.

@dantman
Copy link
Contributor

dantman commented Feb 19, 2015

I submitted #24 for @megawac's let use case.

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

5 participants