7 ms·
I want to like Atom but I find the indentation problems make it unusable for code for me. I really wish the would focus on fixing that before adding more second
by kinkdr 10y ago
I want to like Atom but I find the indentation problems make it unusable for code for me. I really wish the would focus on fixing that before adding more secondary features.
- apetresc 10y agoWhat indentation problems, out of curiosity?
- kinkdr 10y agoIt just isn't able get indentation right. For example, just a random snip out of a random file: let tree = root.render({state: store.getState(), push: store.push}) let rootNode = createElement(tree) let oldRootNode = document.getElementById('root') oldRootNode.parentElement.replaceChild(rootNode, oldRootNode) store.subscribe(() => { let newTree = root.render({state: store.getState(), push: store.push}) let patches = diff(tree, newTree) rootNode = patch(rootNode, patches) tree = newTree }) VS will get the indentation right, but Atom will not(notice how "let rootNode..." and everything after that is pushed in).
- BinaryIdiot 10y agoHmm are you using a special plugin for this? I haven't had a single indentation issue with atom and I'm also writing JavaScript all day. The only issue I've seen is opening an older file that mixes tabs and spaces when ch sometimes makes it harder to read. Even the beautify plugin seems to work well for me.
- kinkdr 10y agoOps, 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 :)
- royal_ts 10y agoe. g. when pasting content - Atom wont paste it at the same position your cursor is at, it pastes content at the very beginning of a line. Very annoying
- seando 10y agoDid you cut/copy the entire line? I've noticed that if you cut/copy the entire line then paste at the beginning of the line it gets the indentation right every time... even if the indentation is different in the two locations.