Feature: last session filesystem time #61
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Here is an attempt at implementing the last session by using the filesystem last write time, instead of a symlink.
The symlink adds a bunch of complication about keeping it in sync, and I'm pretty syre there is a bug around deleting a session from telescope not removing the symlink. I'm also unsure how well supported these are on Windows.
The second commit in the PR serves to remove the symlink for exisiting users. We may wish to incorporate this, otherwise a symlink will persist unless the users manually remove it. I'm unsure how long this feature should remain, the alternative is to mark this as a possible breaking change and have the users clean up the symlink themselves. I'll leave this decision up to @jedrzejboczar as to how you want to manage this plugin.
There might very well be a much better way to implement this, but I found that the query module did most of what was needed already, so have just leveraged that. Please disregard any or all of this PR if there are better ways to achieve this feature. Treat this as a proof of concept.
Do note that when executing
:PossessionLoad
I get the following error, which might be an issue with my specific Neovim config, or it could be something I've done incorrectly in the PR.It's also worth noting the comment in
commands.lua
from line 98. Because autosave might be enabled, using mtime can trigger a flip flop effect if you run:PossessionLoad
multiple times; it will toggle the last two sessions. We may or may not want this. The comment suggests ways to avoid this, but this toggling effect, or not, is open for discussion.