CRAG666/code_runner.nvim

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

Closed this issue ยท 18 comments

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)

@ecthelionvi is windows?

MacOS

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

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

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

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

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

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

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

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

#Edit, fixed now

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

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 = {},`

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

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

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

This fixed it for me. Thank you!