michaelb/sniprun

SnipInfo Command Error and Unable to receive user input.

Closed this issue · 15 comments

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.

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

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

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.

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

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 ?

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

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 ?

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

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

I'm using macOS.

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

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

image

It isn't useful.

XDG_CACHE_HOME 😉
Sorry, I also keep making the mistake

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