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

yield statements are being beautified to their own newlines since 1.5.2 #560

Closed
jemartti opened this issue Oct 16, 2014 · 16 comments
Closed
Milestone

Comments

@jemartti
Copy link

Version @1.5.2 included 820d267 to resolve #458. However, this fix introduced some unintended behaviour for beautifying code that includes yield statements; specifically, it's forcing every yield statement to start on a new line.

For example:

result = yield pgClient.query_(queryString);

is being beautified to:

result = 
    yield pgClient.query_(queryString);

when it should be remaining unchanged.

Since we're building a koa app, we're stuck with pinning to version @1.5.1 as this is causing some widespread annoyances in our codebase.

@bitwiseman bitwiseman added this to the v1.6.0 milestone Oct 17, 2014
@dashed
Copy link

dashed commented Nov 1, 2014

+1. Can confirm when using the following Sublime Text 3 plugin: https://github.com/victorporof/Sublime-HTMLPrettify

@haoxins
Copy link
Contributor

haoxins commented Nov 13, 2014

+1

2 similar comments
@dotcypress
Copy link

+1

@valentinkostadinov
Copy link

+1

@magicdawn
Copy link

+1

@jdc0589 when can this yield fixed in JsFormat

@drewhamlett
Copy link

Any news on this?

@bitwiseman
Copy link
Member

I've been busy with the job that pays me...

@drewhamlett
Copy link

Haha. I got you man. I'll get you a pull request.

@divergant
Copy link

I want to see an Extension for Brackets
like this photo
http://oi59.tinypic.com/30tri94.jpg
when I select tag the points between open and closed tag colored with red
also I have closing and opening mark in the left
just like Notepad++

@MetaMemoryT
Copy link

👍

@magicdawn
Copy link

Any Update ...

I tried to remove yield form line_starters, it just workes for this case. Don't know whether this will bring other side effects.

https://github.com/beautify-web/js-beautify/blob/master/js/lib/beautify.js#L1429

test.js

function test * (arg1) {
  var text = yield getText();
}

2015-03-04_22-06-11

should I get PR for this small modification ?

@magicdawn
Copy link

手滑 function * test 写成了 function test *

2015-03-04_22-15-22

@jemartti
Copy link
Author

jemartti commented Mar 4, 2015

@magicdawn: #458 explains why yield is placed in line_starters.

We can't keep going back and forth on these two bugs; a proper solution is needed.

@bitwiseman
Copy link
Member

@jemartti - we're not going back and forth. That bug got closed and has stayed closed, this is a follow on bug.

yield is a keyword but it could probably just be moved to reserved words.

@jemartti
Copy link
Author

jemartti commented Mar 4, 2015

@bitwiseman: I know, I'm the one that opened this issue and pointed out that it's a follow–on bug from #458 :). My comment was referring to @magicdawn's suggestion not being sufficient, as it would result in reopening the previous bug.

@bitwiseman
Copy link
Member

Ah. 😄 Got it.

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

10 participants