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

SnipInfo Command Error and Unable to receive user input. #222

Closed
rileychc opened this issue Apr 7, 2023 · 15 comments
Closed

SnipInfo Command Error and Unable to receive user input. #222

rileychc opened this issue Apr 7, 2023 · 15 comments
Labels
bug Something isn't working

Comments

@rileychc
Copy link

rileychc commented Apr 7, 2023

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Open a file containing '...'
  2. Run the command '....'
  3. See error '...'

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Environment:

  • Neovim version [e.g. v0.6.1]
  • OS/distribution

Additional context
Add any other context about the problem here.

@rileychc rileychc added the bug Something isn't working label Apr 7, 2023
@michaelb
Copy link
Owner

michaelb commented Apr 8, 2023

Hey, please fill correctly your bug report.

SnipInfo works on my end (I would be tempted to say 'obviously'), so unless you provide me with enough info, I won't be able to fix your issue

@rileychc
Copy link
Author

~/.cache/sniprun/infofile.txt, I don't have this document

@rileychc
Copy link
Author

But my main problem is that I still can't pop up to receive user input, causing my cin function to be a random value.

@rileychc
Copy link
Author

local lines = lines_from(sniprun_cache_dir.."/infofile.txt") This code caused me to get a nil.

@michaelb
Copy link
Owner

michaelb commented Apr 12, 2023

But my main problem is that I still can't pop up to receive user input, causing my cin function to be a random value.

That's a limitation of sniprun. It won't be fixed in the near future, see #146

~/.cache/sniprun/infofile.txt, I don't have this document

It's supposed to be generated, and I hardly see where it can fail. Could you copy here the content of ~/.cache/sniprun/sniprun.log after trying to run SnipInfo ?

@rileychc
Copy link
Author

I can't find the sniprun folder in the .cache folder.

@michaelb
Copy link
Owner

I can't find the sniprun folder in the .cache folder.

Wut. Does sniprun even work ? (Run it on a very simple line such as "print(1)" in a python file)

Or do you have an $XDG_CACHE_DIR environment variable that's set to somewhere strange ?

@rileychc
Copy link
Author

I didn't set this $XDG_CACHE_DIR environment variable, and my sniprun can output printf("hello world");

@michaelb
Copy link
Owner

okay, so this just got from strange to stranger.

I'll explain. Sniprun (the binary part) generates stuff (including the infofile.txt, the log and some files it needs to run correctly) in a directory that's supposed to be standard

use dirs::cache_dir;

fn main() {
    println!("cache dir: {:?}", cache_dir());
}

And the Lua plugin part, that doesn't have the info, looks into $XDG_CACHE_HOME (sorry for earlier, it's ...HOME, not ...DIR), or defaults to $HOME/.cache

So, my conclusion is that these two don't point to the same location. You didn't say what OS you were running on, but possibly something isn't quite XDG-compliant.
If you can determine where the dirs crate I use locate the cache directory on your system, you should be able to export XDG_CACHE_HOME to the same location, and get SnipInfo working

@rileychc
Copy link
Author

I'm using macOS.

@rileychc
Copy link
Author

So what should I do? Specify the path XDG_CACHE_HOME in the zshrc file, or should I make other settings?

@michaelb
Copy link
Owner

I think you should specify the XDG_CACHE_DIR in your shell's rc configuration file, but preferably make it point to the value of the default cache directory on macos (google says it's ~/Library/Caches, and if you find a sniprun subdir there it's confirmed).

I'll fix the search path for the infofile, but the above should fix the issue in the meantime

@rileychc
Copy link
Author

image

It isn't useful.

@michaelb
Copy link
Owner

michaelb commented Apr 18, 2023

XDG_CACHE_HOME 😉
Sorry, I also keep making the mistake

@michaelb
Copy link
Owner

The last release also search for the temporary SnipInfo file in ~/Library/cache now, so it should be automatically fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants