8000 Add snippet to import using single quotes (as in Angular2) by tiangolo · Pull Request #1147 · TypeStrong/atom-typescript · GitHub
[go: up one dir, main page]

Skip to content

Add snippet to import using single quotes (as in Angular2) #1147

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

Merged
merged 1 commit into from
Dec 1, 2016
Merged

Add snippet to import using single quotes (as in Angular2) #1147

merged 1 commit into from
Dec 1, 2016

Conversation

tiangolo
Copy link
Contributor

Add snippet to import using single quotes (as in Angular2, angular-cli, etc) as importq, additional to import.

I see this has been debated here #203 and here #259.

Right now the checks run OK, but the snippet generates imports with only double quote characters.

Using the import snippet generates an import statement with double quote characters ("), and if the preferred quote character was ' it complains that they should be single quote characters. But currently there is no snippet to generate imports with single quote characters from the beginning.

I think this additional snippet might help keep happy both sides (single and double quote "sides").


All compiled assets are included (atom packages are git tags and hence the built files need to be a part of the source control)

Note: there were no changes to TS files.

@guncha
Copy link
Contributor
guncha commented Nov 29, 2016

Would it be possible to use the Preferred quote character from the settings to make sure "both sides" can use the same import snippet?

@tiangolo
Copy link
Contributor Author

I wish it was possible, but as far as I know, it isn't.

There doesn't seem to be a way to use variables to customize snippets using the standard Atom snippets.

Here are the references I see relevant: http://flight-manual.atom.io/using-atom/sections/snippets/ and https://github.com/atom/snippets.


Nevertheless, I'm one of the "single quoters" (following Angular 2 style) and I would be OK with "having to" use the alternate import snippet (importq), actually that's what I'm doing currently with my forked version. And as there is an import snippet for double quote imports, and an importr for CommonJS imports (var myModule = require('myModule')) I wouldn't see it problematic having another "kind" of import snippet.

Also, if there are people using different code styles for different projects (e.g. Angular 2 with single quotes and NodeJS with double quotes) it could be nice to have both snippets available, otherwise it would require them changing the Preferred quote character settings each time they switch to work in each project.

@guncha
Copy link
Contributor
guncha commented Dec 1, 2016

SGTM 👍

@guncha guncha merged commit 4c37a4a into TypeStrong:master Dec 1, 2016
@tiangolo
Copy link
Contributor Author
tiangolo commented Dec 1, 2016

Thanks for mergin @guncha !

@TypeStrong TypeStrong locked and limited conversation to collaborators Jan 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0