Open kazimuth opened 2 years ago
(Deleting the environment variable fixed the problem, FWIW.)
Probably we should fix this on the vscode extension side by wrapping node's function. @pokey what do you think?
@rntz could you elaborate?
Alternately, we could use a hidden dir in the user directory.
Cc/ @lunixbochs any ideas?
We should wrap node's os.tmpdir() to have the same behavior as Python's gettempdir(), is what I'm suggesting. That way, unless the environment variables differ, the VSCode plugin and talon will look in the same place.
That could work, tho fwiw we have seen cases where the environment variables were different. Eg there is some VSCode extension that sets TMPDIR for some reason
there is some VSCode extension that sets TMPDIR for some reason
That was probably just me with the Nix Environment Selector extension. Nix unsets $TMPDIR
on macOS if it's pointing to /var/folders/...
. Thankfully I don't need that extension.
Ah right yeah forgot that was you. Is there a downside to using a hidden dir in home directory? It's fairly common
I mildly prefer using the temporary directory. I've put my temp dir on an in-memory filesystem so that all this command client traffic doesn't have to hit my hard drive at all.
I'm just a bit nervous about relying on tmp dir, as it seems like it's maybe not very stable between different execution environments. Might be better to use a specific path for reliability's sake
Maybe we could make the path configurable somehow, so that users can switch it to somewhere in tmp dir if they prefer that? Could allow them to specify arbitrary parent dir, or even just a flag that switches it to tmp dir. Would need to figure out how to enable configuring both client and server. Ideally they'd have the same source of truth. Maybe they could just both read some configuration file in home dir? Would want to make sure that config file is only readable / writeable by user
Can we use the Talon home? Should be a predictable path locked down on all systems.
Can we rely on it never moving? From Talon side we should be fine but from server (ie vscode) side, we'd need to hardcode the locations
It's in user dir as well, so doesn't really help with @rntz's concerns
Keeping things in ramdisks would be a good thing, yeah. How about this:
$XDG_RUNTIME_DIR
and /tmp
. Those are both typically ramdisks on Linux.TEMP
?@auscompgeek would that fix the \1
thing from Slack?
On further investigation in that Slack thread, unfortunately no - TEMP is somehow inconsistent between apps despite being on Windows 😰
On Windows ramdisks tend to not be a thing anyway, so maybe we can use the Talon home on Windows and my above suggestion elsewhere?
I would rather avoid platform-specific behavior if at all possible - unnecessary complexity. (Although I guess tempdirs are kind of platform-specific already...) Is there any problem with just making sure both sides look for temporary directories in the same order? i.e. either adjust things on the node end or on the Python end?
FWIW there's already platform-specific behaviour here: on *nix the UID is in the directory name, but not on Windows.
I would be tempted to default to the home directory, but make it configurable. The user would need to make sure that they use the same setting on Talon and ide side, so slightly more involved / finicky in that case, but I think I'd rather have the common / beginner case just work at the expense of slightly more complication for power users. We've had lots of issues now with users struggling to get started due to tmp dir problems. WDYT @rntz @auscompgeek
I still don't understand what the issue is with making sure both sides look for temporary directories in the same order. Then we don't need any settings and things will just work for everyone.
Could you give more detail about what the issues you've seen are?
I guess we could use the home dir to negotiate a location, preferring that location to be somewhere in tmp dir, tho that wouldn't solve the flatpak access problem
If we put anything in the home dir, we'd also have to put it outside of a dot directory, since we've also seen snaps prevent access to dotfiles.
\1
issue referred to previously?to be clear, if we need to put this somewhere other than a temp directory to make it work for more people out of the box, I think we should do that. I just want to (a) avoid overcomplicating things if we don't have to (b) make sure the alternative solution does work for more people out of the box. being able to use a ramdisk/tmpfs is a nice-to-have not a necessity.
Hi, I opened https://github.com/talonhub/community/pull/1362 and https://github.com/pokey/command-server/pull/21 to get the ball rolling to address this.
I had the same problem/symptoms, just that in my case it was XDG_RUNTIME_DIR
that talon looked into but not vscode/the cursorless/command server plugin
If we put anything in the home dir, we'd also have to put it outside of a dot directory, since we've also seen snaps prevent access to dotfiles.
If this is the case that disqualifies the Talon .talon
directory right?
not necessarily. see discussion in the PR
A random piece of software on my machine (Windows 10) had set this the system environment variable
TMPDIR
, which caused the vscode integration to not accept commands. I believe this is because the functionget_communication_dir_path()
usesgettempdir()
: https://github.com/knausj85/knausj_talon/blob/main/apps/vscode/command_client/command_client.py#L211-L224which checks
TMPDIR
,TEMP
, andTMP
, in order, to choose a temporary directory.On the extension side, node's
os.tmpdir()
is used to select a temporary directory: https://github.com/pokey/command-server/blob/main/src/paths.ts#L4-L12It's not documented, but I believe this must not check the TMPDIR env variable, causing the two ends of the connection to choose different directories and miss each other.
(Not sure how to fix this. You could override the directory lookup, or just switch to using a socket lol.)