Open raphaelahrens opened 9 months ago
Ok. So, I believe projections needs to handle symlinks correctly. I can perhaps make Path.__eq(a, b)
method work with symlinks. I will see what I can do.
In the meanwhile, you can try to see if the dev
branch has this issue (likely still there). It tries to avoid vim.loop
, which is currently vim.uv
in nvim-0.10
. This is supposed to be the "new" projections. I will put up a migration notice in a couple of days.
Thanks for the reply.
I have checked with the dev branch (0e36a2d2a9a7ff160618bbe636bc26365d4e0487) there is still the same problem.vim.fn.getcwd()
also return the real path.
Having the same issue :P
Basic checklist
:h session
,:h mksession
, and:h sessionoptions
Expected vs Actual behavior On FreeBSD the
/home
directory is by default a symlink to/usr/home
. If theSession.store
function tries to save the session, it callsSession.info
and fails becausenil
was returned. The reason whySession.info
fails is because it receives the argumentspath
which was created by a call tovim.loop.cwd()
.vim.loop.cwd()
returns the realpath of the current working directory, which on FreeBSD is for~/projects/abc
the path/usr/home/USER/projects/abc
.For reference the code in question https://github.com/GnikDroy/projections.nvim/blob/f18a8505f84f45a0fe024cafca5b969447f63cd5/lua/projections/session.lua#L17-L37 Here the
info
function extracts theworkspace_path
and then compares this path with the path of the workspace set in the configuration. The path of the Workspace is aPath
object. InPath.new
the givenspath
is normalized https://github.com/GnikDroy/projections.nvim/blob/f18a8505f84f45a0fe024cafca5b969447f63cd5/lua/projections/path.lua#L33 The result of callingvim.fs.normalize("~/projects")
is "/home/USER/projects".This lets this condition https://github.com/GnikDroy/projections.nvim/blob/f18a8505f84f45a0fe024cafca5b969447f63cd5/lua/projections/session.lua#L25 fail since
"/usr/home/USER/projects"
is unequal to"/home/USER/projects"
.Of course this can be avoided, when I use the realpath (
usr/home/USER/projects
) inprojections_workspaces.json
. But what bothers me is that it failed silently and no session was saved, but I also have no good solution. IdeallyWorkspace.path
should hold the real path and only compare it with a real path, but I don't know if lua/neovim can get the information without relying on shell or libs.Anyway It is at least something which could be documented.
Environment information
Neovim version: v0.9.5
Operating system: FreeBSD 14.0
Projections branch/commit hash: f18a8505f84f45a0fe024cafca5b969447f63cd5
Projections config:
Projections workspace file (find this at
stdpath('data') .. 'projections_workspaces.json'
:Result of
ls -lah
from projection sessions folder (find this atstdpath('cache') .. 'projections_sessions/'
. Remove personal information as needed.Result of
tree -a -L 2
from every configured workspace (both config and workspace json file). Remove personal and unnecessary information as needed.I don't have the
tree
command on my system and I think this is irrelevant.To Reproduce Steps to reproduce the behavior: