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

Sublime Text Plugin #17

Closed
OrkoHunter opened this issue Jan 10, 2017 · 19 comments
Closed

Sublime Text Plugin #17

OrkoHunter opened this issue Jan 10, 2017 · 19 comments
Labels
locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. type:editor support Issues about tools Prettier provides for use inside editor integrations.

Comments

@OrkoHunter
Copy link

Does prettier have any sublime text plugin? The README only mentions Atom and emacs.

@jlongster
Copy link
Member

Not yet! Someone else needs to build :) A PR would be great (even if it's just a link to another package)

@OrkoHunter
Copy link
Author

I feel the library is trending too fast for me to get inspired and learn how to write Sublime Text plugins ;)

@Haroenv
Copy link
Contributor

Haroenv commented Jan 10, 2017

You can however put it as a build system in sublime text, where it's just the cli command with the current file as argument (and with --write)

@jlangston
Copy link

Prettier seems great. I've been using a different sublime text plugin but it stopped working some time ago but it was pretty easy to swap out the node formatting package to use prettier. This is very much a WIP if your interested https://github.com/jlangston/sublime-jsprettier

@danreeves
Copy link

@jlangston hah, you beat me to it. Here's my WIP: https://github.com/danreeves/sublime-prettier

@jlangston
Copy link

@danreeves nice work! I figured a few might pop up around this. That said if one person's plugin is of better quality or offers a stronger feature set with either the editor or the formatter I'd be in favor around collaborating towards a more 'official' sublime prettier plugin we can add to package control. Doesn't matter if it's based off of the one I started or not. Either way this is great lots of promise around this formatter.

@danreeves
Copy link

@jlangston agreed, I'm up for discussion. This is the first Sublime plugin I've made so I couldn't tell you about best practices in the space.

I noticed yours bundles some JS files and requires an npm install inside the package. Personally, I'd rather have the package defer to a global (or local to the project) installation of prettier.

Yours does have a few nice options though; autoformat, file extensions.

@vramana vramana added the type:editor support Issues about tools Prettier provides for use inside editor integrations. label Jan 11, 2017
@scottwarren
Copy link

Have added a link in #143

@jlangston
Copy link

@danreeves We can defer to a global install or bundle it in the repo. Does your plugin support formatting just a selection vs an entire file? If it's something you'd like to spearhead maintaining we can move with your repo and just add whatever features we feel are missing. Things like auto format aren't that hard to add. I think we just want it to be configurable and expose whatever options the formatter supports and be able to act on a selection or an entire file.

Also @scottwarren thanks for adding a PR but I do think we should probably have the prettier README link to whichever plugin we collectively nominate to back and get that one into Package control and link to that page from the prettier README so it's an easier install for users.

@danreeves
Copy link

@jlangston It doesn't support it yet but from what I've written so far it would be a pretty simple addition. I'm happy to get started on adding these features and maintain it.

@danreeves
Copy link

danreeves commented Jan 17, 2017

Looks like @jonlabelle has already made a PR to packagecontrol.io, and his versions already supports using either a prepackaged or globally installed prettier, so maybe lets just move on with his.

EDIT:
It doesn't work nicely with nvm however. Trying to figure out how to configure it right now...

@viankakrisna
Copy link

image
Anybody having this issue on windows? I'm using 0.11.0. Linux works fine

@danreeves
Copy link

danreeves commented Jan 25, 2017

Hey @viankakrisna, if you're using the plugin linked from the readme you might get a better response from at its repo: https://github.com/jonlabelle/SublimeJsPrettier

You could also clarify the issue. I'm guessing it's the extra indentation of the function arguments, weird indeed.

@viankakrisna
Copy link

yeah, overall it's just a wacky formatting. I'm using the one from the package control. is it the same?

@viankakrisna
Copy link

will post the issue on its repo, i think it's the same

@danreeves
Copy link

@viankakrisna Yep, that's the one 👍

@jlongster This issues was resolved by #318 so should be closed?

@viankakrisna
Copy link

viankakrisna commented Jan 25, 2017

I think the issue is with prettier 0.11.0, 0.0.10 works fine
jonlabelle/SublimeJsPrettier#8 (comment)
jonlabelle/SublimeJsPrettier#9
Not really sure where the problem is

@dusty
Copy link

dusty commented Jan 28, 2017

I am using an alternative solution for sublime. Just thought I'd share, in case there are any other eslint users.

I use this eslint plugin, to pass prettier rules to eslint
https://github.com/not-an-aardvark/eslint-plugin-prettier

This this plugin to warn me on errors inside sublime
https://github.com/roadhump/SublimeLinter-eslint

Then this package to simply autofix via eslint --fix
https://github.com/TheSavior/ESLint-Formatter

I like it because I can place the rules I want to pass to prettier in my eslint config file checked into git vs matching my rules in the jsPrettier user settings with my eslint config.

eg:

# .eslintrc.json
{
  "plugins": [
    "prettier"
  ],
  "rules": {
    "prettier/prettier": ["error", { "singleQuote": true , "bracketSpacing": false }]
  }
}

@slashwhatever
Copy link

This is how I handled it in Sublime

Similar to @dusty with a few minor concessions due to legacy code considerations.

@lock lock bot added the locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. label Jul 6, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Jul 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. type:editor support Issues about tools Prettier provides for use inside editor integrations.
Projects
None yet
Development

No branches or pull requests

10 participants