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

add AutoSession.session_exists_for_cwd() function #286

Merged
merged 1 commit into from
Apr 14, 2024

Conversation

ldelossa
Copy link
Contributor

Add a function to understand if a session exists for the given current working directory.

This is pretty helpful for start page plugins like mini.starter and others.

By calling this function when nvim is opened to a workspace folder the starter page can determine whether to show a 'restore session' option or not.

@ldelossa ldelossa force-pushed the add-session-exists-cwd-func branch from f0e90ae to 729a227 Compare April 10, 2024 15:23
Add a function to understand if a session exists for the given current
working directory.

This is pretty helpful for start page plugins like mini.starter and
others.

By calling this function when nvim is opened to a workspace folder the
starter page can determine whether to show a 'restore session' option or
not.

Signed-off-by: ldelossa <louis.delos@gmail.com>
@ldelossa ldelossa force-pushed the add-session-exists-cwd-func branch from 729a227 to a39ce39 Compare April 10, 2024 15:26
Copy link
Owner

@rmagatti rmagatti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

@rmagatti rmagatti merged commit 9e0a169 into rmagatti:main Apr 14, 2024
@ldelossa
Copy link
Contributor Author

ldelossa commented Aug 7, 2024

@rmagatti

Hey there, I just updated the plugin since this PR.

Recent changes have broken the function added here. Haven't dug deep into it yet, but the function only returns 'false' now regardless of whether sessions exists for the current working directory.

@cameronr
Copy link
Collaborator

cameronr commented Aug 7, 2024

That's probably my mistake. I'll take a look

cameronr added a commit to cameronr/auto-session that referenced this pull request Aug 7, 2024
@cameronr
Copy link
Collaborator

cameronr commented Aug 7, 2024

I forgot to check legacy (old format) session file names; fix submitted in PR #345

As background, I recently introduced a new session file name format to address a number of issues. I forgot to check for legacy names in session_exists_for_cwd. Once you load a session it'll convert to the new format automatically. :SessionSearch will show you which sessions are the legacy format (but that's just for info, you don't have to do anything special for them)

@cameronr
Copy link
Collaborator

cameronr commented Aug 7, 2024

@ldelossa should be fixed now. let me know if it's not working for you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants