Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

Atom doesn't remember added projects on start up #12495

Closed
tomasx opened this issue Aug 22, 2016 · 30 comments
Closed

Atom doesn't remember added projects on start up #12495

tomasx opened this issue Aug 22, 2016 · 30 comments

Comments

@tomasx
Copy link

tomasx commented Aug 22, 2016

This is a known limitation of the window state system; it only saves when changing focus, adding and removing windows. We should save when adding and removing project folders in addition.

Repro Steps

  1. Launch Atom in a local repository
  2. Add a second project folder using Cmd+Shift+O
  3. Exit Atom
  4. Launch Atom using the Dock icon

Expected: Both project folders to be listed in the Tree View
Actual: Only the first project folder is listed in the Tree View

Info:

  • version 1.9.9 (the bug also existed on 1.9.8)
  • Mac OS 10.10.5
  • "Open empty editor at start" is unchecked
@Nikki1993
Copy link

That is not a bug but intended behaviour. Atom opens new instance each time you launch it hence why it "doesn't remember" last opened project. You need to supply filename/project folder to it each time you launch it.

@tomasx
Copy link
Author

tomasx commented Aug 22, 2016

Hey, according to this conversation this is a bug. Please read the last 6 comments https://discuss.atom.io/t/remember-open-projects-when-reopening-atom/7053/24

Also, why on earth you wouldn't provide the functionality to remember the projects that you have added?

@Nikki1993
Copy link

Nikki1993 commented Aug 22, 2016

@tomasx I've been reading comments on github (not atom discussion forum :) ) by Atom project members and this is not a bug according to them but the way electron/atom work (not too sure on details here). You basically launch a new browser instance each time.

I agree with you, that would be convenient to remember last project opened, it is a feature request afaik but I don't know when/if it will be implemented.

P.S. just quoting atom guys here :D I am with you on this one, this should be a feature included by default :)

@DamnedScholar
Copy link

@Nikki1993 Atom is supposed to remember the very last set of root paths you had open. It uses .atom/storage/application.json to recall these paths and use the relevant IndexedDB entry to recreate the open tabs. It still does this just fine on Windows, but according to @tomasx, the functionality broke on update 1.9.8 for Mac.

@Nikki1993
Copy link

@DamnedScholar that's odd cause it never opened previously opened projects for me on Windows, Mac and Ubuntu/Solus. I remember like couple of month ago someone said that's an intended behaviour for Atom because it's the way it functions. Pardon for the false info then :P

@DamnedScholar
Copy link

@Nikki1993 You probably remember me saying that it's intended behavior that Atom forgets old projects when you open new ones (because application.json gets overwritten constantly). You seem to have the Open Empty Editor config option selected. Without that option selected, Atom is supposed to remember your most recent project.

@lee-dohm
Copy link
Contributor

@tomasx I can't replicate this using Atom v1.9.9 on Mac OS X 10.11.6. Is it possible that you don't have the correct permissions on the ~/.atom directory? How did you install Atom?

@lee-dohm
Copy link
Contributor

lee-dohm commented Aug 22, 2016

@DamnedScholar "Open Empty Editor on Start" has no effect on whether Atom remembers your last open project. It only affects the behavior when Atom starts with no project. When it starts with no project ... "Open Empty Editor on Start" being checked means that there is an untitled editor already open. If it is unchecked, there is not an editor open. You can validate this by changing the setting and opening a new Window with Cmd+Shift+N to open a new window (which opens with no project associated).

@fiando
Copy link

fiando commented Aug 22, 2016

Do you have check Chrome dev tools ? CTRL + SHIFT + I and open console tab, is any display error there ?
if error is " Uncaught (in promise) TypeError: Cannot read property 'transaction' "
try fix this issues with delete ~/.config/Atom/IndexedDB

@tomasx
Copy link
Author

tomasx commented Aug 23, 2016

@lee-dohm I'm admin on my laptop so I should have the premissions. I installed it simply by downloading the app and dragging it into applications folder

@fiando the only errors I get in console are "depricated" such as: /deep/ combinator is deprecated.

I was testing the app further and noticed that when I keep the project added for a longer time (~10min) then Atom remembers next time I open it. Moreover, if open Atom, remove the project from the tree view and quit Atom straight away - next time I open the project still is in the tree view. Is there any timer before the project is saved/removed permanently?

@zamicol
Copy link

zamicol commented Aug 24, 2016

I'm having the same exact issue, driving me nuts.

@lee-dohm
application.json is -rw-r--r--, and it's parents are drwxr-xr-x

$ atom --version
Atom : 1.9.9
Electron: 0.37.8
Chrome : 49.0.2623.75
Node : 5.10.0

The Mac (Apple) is version 10.11.6.

@fiando When I do that, I get
/deep/ combinator is deprecated. See https://www.chromestatus.com/features/6750456638341120 for more details.
and
::shadow pseudo-element is deprecated. See https://www.chromestatus.com/features/6750456638341120 for more details.

@zamicol
Copy link

zamicol commented Aug 24, 2016

Now I can't reproduce the issue. Everything seems to be working fine now and nothing has changed, other than this Mac crashing (seems to be fairly typical of it) and coming back up.

If it happens again I'll post here.

@lee-dohm
Copy link
Contributor

I was testing the app further and noticed that when I keep the project added for a longer time (~10min) then Atom remembers next time I open it.

Ok, so this sounds like it is more the real problem. Other project state like unsaved file status and open files gets stored on exit, but it appears that the list of open project folders does not. I was able to verify this using Atom v1.9.9 on Mac OS X 10.11.6.

@lee-dohm
Copy link
Contributor

I've updated the original bug to include the steps to reproduce the problem.

@hongyuan-wang
Copy link
Contributor

@maxbrunsfeld
I can reproduce the bug too :

  1. Launch Atom
  2. Add one project folder (then don't leave the window, just do nothing)
  3. Exit Atom
  4. Launch Atom

I use 'watch cat ~/.atom/storage/application.json' command to watch 'application.json', and find that the sate will not be saved if you don't leave the current window, that means saveState() will be called just after blur event

@maxbrunsfeld
Copy link
Contributor

maxbrunsfeld commented Aug 27, 2016

Yup, this is a known limitation of the window state system; it only saves when changing focus, adding and removing windows. We should save when adding and removing project folders in addition.

@Utilityman
Copy link

Utilityman commented Sep 14, 2016

Since this is still open and I'm facing similar issues on my Mac with atom 1.10.2.-

If I add project folders and then run 'cat ~/.atom/storage/application.json' my project will be listed in an array named initialPaths.
I found that on my Mac that when you Command+Q to exit atom, application.json retains its information which allows atom to be reopened with my projects. Good stuff.

Unfortunately though when I close the app using the X (which should be a safe action), the contents of that application.json is wiped and replaced with "[]".

Perhaps a fix (if this is not the intended operation) is in the window.on('closed', function(){...}) or whatever the equivalent is in the sytem?

@sclarkso
Copy link

I'm seeing exact same behavior as @Utilityman. Latest version of Atom (1.10.2) on latest version of macOS (10.12).

@maxbrunsfeld
Copy link
Contributor

@Utilityman @sclarkso That behavior is intended; it is the convention on macOS. If you want a window to stay around the next time you open Atom, do not close it. Instead, quit the app with it open.

@azuruce
Copy link

azuruce commented Oct 12, 2016

I see this problem on
Atom : 1.11.1
Electron: 0.37.8
Chrome : 49.0.2623.75
Node : 5.10.0

Darwin nfml-szhangDUF 16.0.0 Darwin Kernel Version 16.0.0: Mon Aug 29 17:56:20 PDT 2016; root:xnu-3789.1.32~3/RELEASE_X86_64 x86_64

(mac version 10.12 macOS Sierra)

Repro steps:
Verified Settings -> Core -> Open Empty Editor On Start is unchecked
Open a project folder
Quit Atom
Verified ~/.atom/storage/application.json has the initalPaths pointed to the project opened
Open Atom again
I don't see the project that was opened before I quit is still opened.

@racineda
Copy link

racineda commented Nov 3, 2016

+1 here.

Atom: 1.11.2
macOS: 10.12.1

If I quit using CMD + Q, Atom reopens my project. However, if I quit using the red 'x' Atom opens with an empty view as ~/.atom/storage/application.json was wiped out.

@dav-garcia
Copy link

@maxbrunsfeld Despite it being a macOS convention, there are many apps that reopen your last working project no matter how you close them (most if not all IDEs for example).

It would be nice if this behaviour was a preference (switched off by default to avoid breaking the convention).

@maxbrunsfeld
Copy link
Contributor

maxbrunsfeld commented Nov 18, 2016

@dav-garcia So Sublime Text doesn't do what you're describing, and neither does vim. I'm pretty sure XCode doesn't either. Could you post a GIF of this happening with some other IDE on Mac? Specifically:

  1. Open the app
  2. Open some project
  3. Explicitly close the project using the red X button.
  4. Quite the app.
  5. Reopen the app.
  6. Does it reopen the project that you had explicitly closed?

@maxbrunsfeld
Copy link
Contributor

maxbrunsfeld commented Nov 18, 2016

@holewheat The red x button does not quit the app. It closes the current project. This is the case for all standard macOS apps.

@dav-garcia
Copy link

@maxbrunsfeld I've seen this in IntelliJ, Netbeans and Eclipse.
I know Atom is not a full blown IDE like those ones and I'm not suggesting changing the current behaviour. Instead, it could be offered as an option for those of us that prefer the classic IDE style.

@maxbrunsfeld
Copy link
Contributor

maxbrunsfeld commented Nov 18, 2016

@dav-garcia I see what you're saying, but just so we're super clear about this alternative behavior, could you post a GIF of exactly what you're seeing in those IDEs, when using the red x button?

@dav-garcia
Copy link

@maxbrunsfeld Sorry, I don't have time to do it now but I see where you are going...
Both IntelliJ and Netbeans quit completely when you hit the red x button (I don't have Eclipse here to test it).
On the other hand, Atom just closes the window, so, I understand it's not the same case.

Anyway, this (opt-in) feature would be very useful and time saving.
Maybe it's possible to rethink it in a different way.
For example, instead of being an "always restore previous state" switch, it could be a "completely quit Atom when closing the last window" switch. The effect is the same: editor state is restored.
What do you think?

@ysyfff
Copy link

ysyfff commented Mar 8, 2017

Using the "Atom->Init Script" may solve this issue in some degree. We can use the atom.open API to open some project every time the atom is opened. For example

atom.open({
  pathsToOpen:[
    '~/code/pwebpack'
    '~/code/yrn_core_demo',
    '~/code/crm_app',
  ],
  newWindow: false
})

@wootsaejao
Copy link

For those who came here looking for a way to persist added projects. Atom has the ability to open multiple folders on a single command.

$ atom /path/to/first/pasta /path/to/second/steak /path/to/third/omelet

Source: http://blog.atom.io/2015/04/15/multi-folder-projects.html

@lock
Copy link

lock bot commented Aug 6, 2018

This issue has been automatically locked since there has not been any recent activity after it was closed. If you can still reproduce this issue in Safe Mode then please open a new issue and fill out the entire issue template to ensure that we have enough information to address your issue. Thanks!

@lock lock bot locked as resolved and limited conversation to collaborators Aug 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests