kawre / leetcode.nvim

A Neovim plugin enabling you to solve LeetCode problems.
MIT License
1.04k stars 44 forks source link

Unable to launch FileNotFoundError #83

Closed thedaringdev closed 6 months ago

thedaringdev commented 6 months ago

Im receiving the following error when launching leetcode.nvim.

Error detected while processing VimEnter Autocommands for "*":
Error executing lua callback: ...myNeovimPackages/start/plenary-nvim/lua/plenary/path.lua:511: FileNotFoundError
stack traceback:
        [C]: in function 'error'
        ...myNeovimPackages/start/plenary-nvim/lua/plenary/path.lua:511: in function 'mkdir'
        ...ackages/start/leetcode-nvim/lua/leetcode/config/init.lua:65: in function 'setup'
        ...ck/myNeovimPackages/start/leetcode-nvim/lua/leetcode.lua:50: in function 'start'
        ...ck/myNeovimPackages/start/leetcode-nvim/lua/leetcode.lua:92: in function <...ck/myNeovimPackages/start/leetcode-nvim/lua/leetcode.lua:91>

I believe the relevant lines of code are 61- 65 in lua/leetcode/config/init.lua.

    config.storage.home = P:new(config.user.storage.home) ---@diagnostic disable-line
    config.storage.home:mkdir()

    config.storage.cache = P:new(config.user.storage.cache) ---@diagnostic disable-line
    config.storage.cache:mkdir()

I have also confirmed the storage directory from the default configuration exist (~/.local/share/nvim/leetcode/) on my machine but it is empty.

storage = {
        home = vim.fn.stdpath("data") .. "/leetcode",
        cache = vim.fn.stdpath("cache") .. "/leetcode",
    },
kawre commented 6 months ago

What is your neovim version? Also what is the output of :lua print(vim.fn.stdpath("cache")) and does that path exist?

thedaringdev commented 6 months ago

The output from :lua print(vim.fn.stdpath("cache")) was /Users/$USER/.cache/nvim. I checked the path and it actually did not exist. After creating the nvim directory I was able successfully leetcode.nvim.

Thanks!!!