2 ms·
Ops, you are right. That example was because of the "sane indentation" plugin, that I installed in the hope to get better indentation. Below is an example where
by kinkdr 10y ago
Ops, you are right. That example was because of the "sane indentation" plugin, that I installed in the hope to get better indentation. Below is an example where plain Atom, without plugins, doesn't get indentation right (notice how it pushes "onEmailChange" under "login"):
const login = (email, password, remember) => a.chain(
submitting(true),
a.ajax({
request: {
url: '/api/sessions',
method: 'POST',
data: { email, password },
},
callback: (status, data) => (
a.chain(submitting(false),
a.setToken(data.token, remember),
a.setUserId(data.userId),
a.setAuth)),
})
)
const onEmailChange = (push, value) => {
push(emailChange(value))
}
- BinaryIdiot 10y agoThis is something you're copying and pasting in or you're simply writing it out? Also am I missing something or are you missing some syntax (callback has no starting brace)? Also if `const onEmailChange` shouldn't be pushed out then don't you need to end your const login sooner? I don't see where it's ended here. Granted maybe this is just some truncated example? I hadn't run into weird spacing like this yet so maybe open a bug with something small with reproduction steps?
- kinkdr 10y agoIt is something I am writing, then selecting-all and applying auto-indentation. `onEmailChange` doesn't even have an open or close curly bracket, it is the indentation format that is confusing us. Below is the same code indented by VS. const login = (email, password, remember) => a.chain( submitting(true), a.ajax({ request: { url: '/api/sessions', method: 'POST', data: { email, password }, }, callback: (status, data) => ( a.chain(submitting(false), a.setToken(data.token, remember), a.setUserId(data.userId), a.setAuth)), }) ) const onEmailChange = (push, value) => { push(emailChange(value)) } `const onEmailChange` shouldn't be under `login`. If you count the brackets you will see that `login` ends before `onEmailChange` starts. But for some reason Atom doesn't understand that. Maybe my syntax is different than most, but I see problems like this all the time with Atom. The exact same files indent fine in VS. Regarding filing a bug, I thought about it, but then I didn't think anybody would care about this.
- BinaryIdiot 10y agoHmm interesting. I tried typing out similar syntax but it seems to be indenting correctly. Then again I don't use much ES6 if at all. So not sure. I'm sure they would care though :)