CRAG666 / code_runner.nvim

Neovim plugin.The best code runner you could have, it is like the one in vscode but with super powers, it manages projects like in intellij but without being slow
MIT License
533 stars 38 forks source link

Not sure what is happening, but I keep getting this error #62

Closed ecthelionvi closed 1 year ago

ecthelionvi commented 1 year ago

packer.nvim: Error running config for code_runner.nvim: ...ker/start/code_runner.nvim/lua/code_runner/load_json.lua:6: bad argument #1 to 'open' ( string expected, got nil)

CRAG666 commented 1 year ago

@ecthelionvi is windows?

ecthelionvi commented 1 year ago

MacOS

ecthelionvi commented 1 year ago

Just have the basic config:

require('code_runner').setup({ -- put here the commands by filetype filetype = { java = "cd $dir && javac $fileName && java $fileNameWithoutExt", python = "python3 -u", typescript = "deno run", rust = "cd $dir && rustc $fileName && $dir/$fileNameWithoutExt" }, })

Didnt set a filetype or project path

ecthelionvi commented 1 year ago

Could it be that it is looking for:
filetype_path = vim.fn.expand('~/.config/nvim/code_runner.json'), project_path = vim.fn.expand('~/.config/nvim/project_manager.json')

I never used the json configs in the past and it worked fine though

CRAG666 commented 1 year ago

Could you please upload a video where you use the plugin, it must have the last commit that I uploaded a few minutes ago

CRAG666 commented 1 year ago

@ecthelionvi thanks

ecthelionvi commented 1 year ago

I am sorry would you like me to do? Not sure what you need to record.

CRAG666 commented 1 year ago

@ecthelionvi just create some code, for example in python and use code runner to see the behavior

ecthelionvi commented 1 year ago

Oh it pops up the error message and I no longer have access to the commands like :RunCode or anything

CRAG666 commented 1 year ago

https://user-images.githubusercontent.com/34254373/211950760-4e476279-a668-4a7c-ace2-ec4d7228a10c.mp4 I try the plugin and it doesn't have any errors. Please check your configuration because it is more strict in terms of json and lua

ecthelionvi commented 1 year ago

Works but now I am getting a zsh command not found python error for some reason

Edit, fixed now

stevie-b-g commented 1 year ago

I'm also receiving the same error after the last commits. How can one fix this?

ecthelionvi commented 1 year ago

I was able to fix the error by changing the plugin setup and using the full setup code `require('code_runner').setup { -- choose default mode (valid term, tab, float, toggle, buf) mode = 'term', -- Focus on runner window(only works on toggle, term and tab mode) focus = true, -- startinsert (see ':h inserting-ex') startinsert = false, term = { -- Position to open the terminal, this option is ignored if mode is tab position = "bot", -- window size, this option is ignored if tab is true size = 8, }, float = { -- Key that close the code_runner floating window close_key = '', -- Window border (see ':h nvim_open_win') border = "none",

-- Num from `0 - 1` for measurements
height = 0.8,
width = 0.8,
x = 0.5,
y = 0.5,

-- Highlight group for floating window/border (see ':h winhl')
border_hl = "FloatBorder",
float_hl = "Normal",

-- Transparency (see ':h winblend')
blend = 0,

}, filetype_path = "", -- No default path defined filetype = { javascript = "node", java = "cd $dir && javac $fileName && java $fileNameWithoutExt", c = "cd $dir && gcc $fileName -o $fileNameWithoutExt && $dir/$fileNameWithoutExt", cpp = "cd $dir && g++ $fileName -o $fileNameWithoutExt && $dir/$fileNameWithoutExt", python = "python -u", sh = "bash", rust = "cd $dir && rustc $fileName && $dir$fileNameWithoutExt", }, project_path = "", -- No default path defined project = {},`

ecthelionvi commented 1 year ago

I think the main issue is correctly setting the filetype path and project path

ecthelionvi commented 1 year ago

@stevie-b-g Did you try setting the file paths?

stevie-b-g commented 1 year ago

Thanks, it seems like I now need to add filetype_path and project_path in setup to resolve this.

CRAG666 commented 1 year ago

https://github.com/CRAG666/dotfiles/blob/master/config/nvim/lua/config/code_runner.lua pleace check README.md and check my dots

dorrajmachai commented 1 year ago

This fixed it for me. Thank you!