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

repl isnt loading file #177

Closed
Alper-Celik opened this issue Apr 9, 2023 · 5 comments · Fixed by #178
Closed

repl isnt loading file #177

Alper-Celik opened this issue Apr 9, 2023 · 5 comments · Fixed by #178
Assignees
Labels
bug Something isn't working

Comments

@Alper-Celik
Copy link

Neovim version (nvim -v)

v0.8.3

Operating system/version

NixOS unstable

Output of haskell-language-server-wrapper --version

haskell-language-server version: 1.9.1.0 (GHC: 9.2.7)

How to reproduce the issue

nvim -u minimal.lua test.hs
:lua require("haskell-tools").repl.toggle(vim.api.nvim_buf_get_name(0))

Expected behaviour

getting file file loaded like when executing ghci /tmp/tmp.EZRKVayefQ/test.hs

GHCi, version 9.2.7: https://www.haskell.org/ghc/  :? for help
[1 of 1] Compiling Main             ( /tmp/tmp.EZRKVayefQ/test.hs, interpreted )
Ok, one module loaded.
ghci> 

Actual behaviour

but opening fron neovim casues argument to be quated while passing to ghc and preveneting from loading

GHCi, version 9.2.7: https://www.haskell.org/ghc/  :? for help
Warning: ignoring unrecognised input `"/tmp/tmp.EZRKVayefQ/test.hs"'
ghci> 

Log files

No response

The minimal config used to reproduce this issue.

minimal.lua :

-- Minimal nvim config with packer
-- Assumes a directory in $NVIM_DATA_MINIMAL
-- Start with $NVIM_DATA_MINIMAL=$(mktemp -d) nvim -u minimal.lua
-- Then exit out of neovim and start again.

-- Ignore default config
local fn = vim.fn
local config_path = fn.stdpath('config')
vim.opt.runtimepath:remove(config_path)

-- Ignore default plugins
local data_path = fn.stdpath('data')
local pack_path = data_path .. '/site'
vim.opt.packpath:remove(pack_path)

--append temporary config and pack dir
data_path = os.getenv('NVIM_DATA_MINIMAL')
if not data_path then
  error('$NVIM_DATA_MINIMAL environment variable not set!')
end
vim.opt.runtimepath:append('.')
vim.opt.runtimepath:append(data_path)
vim.opt.runtimepath:append(data_path .. '/site/pack/packer/start/plenary.nvim')
vim.opt.packpath:append(data_path .. '/site')

-- bootstrap packer
local packer_install_path = data_path .. '/site/pack/packer/start/packer.nvim'
local install_plugins = false

if vim.fn.empty(vim.fn.glob(packer_install_path)) > 0 then
  vim.cmd('!git clone [email protected]:wbthomason/packer.nvim ' .. packer_install_path)
  vim.cmd('packadd packer.nvim')
  install_plugins = true
else
  vim.cmd('packadd packer.nvim')
end

local packer = require('packer')

packer.init {
  package_root = data_path .. '/site/pack',
  compile_path = data_path .. '/plugin/packer_compiled.lua',
}

vim.cmd('runtime! plugin/plenary.vim')

packer.startup(function(use)
  use('wbthomason/packer.nvim')
  use {
    'MrcJkb/haskell-tools.nvim',
    requires = {
      'nvim-lua/plenary.nvim',
    },
    config = function()
      -- Paste setup here
    end,
  }

  if install_plugins then
    packer.sync()
  end
end)

local ht = require('haskell-tools')
ht.setup()

test.hs :

test x = x + 10
@Alper-Celik Alper-Celik added the bug Something isn't working label Apr 9, 2023
@Alper-Celik
Copy link
Author

Alper-Celik commented Apr 9, 2023

i tested this bug only on single file
but this bug looks like this bug present in project loading too

my temprorary hack for using in iron.nvim :

local iron = require("iron.core")
iron.setup({
	config = {
		repl_definition = {
			haskell = {
				command = function(meta)
					local file = vim.api.nvim_buf_get_name(meta.current_bufnr)
					-- call `require` in case iron is set up before haskell-tools
					cmd = require("haskell-tools").repl.mk_repl_cmd(file)

					local last_cmd = ""
					for key, value in pairs(cmd) do
						last_cmd = last_cmd .. " " .. value
					end
					print(last_cmd)
					return last_cmd
				end,
			},
		},

	},
})

@Alper-Celik Alper-Celik changed the title repl doesnt loading file repl isnt loading file Apr 9, 2023
@mrcjkb
Copy link
Owner

mrcjkb commented Apr 9, 2023

Thanks for reporting this!

I added the quotes in #98 to fix #92.
It seems like the quoting only works with the toggleterm handler, but not the builtin one.

@mrcjkb mrcjkb self-assigned this Apr 9, 2023
@mrcjkb mrcjkb linked a pull request Apr 9, 2023 that will close this issue
@mrcjkb
Copy link
Owner

mrcjkb commented Apr 9, 2023

Should be fixed now :)

@mrcjkb
Copy link
Owner

mrcjkb commented Apr 9, 2023

@all-contributors please add @Alper-Celik for bug.

@allcontributors
Copy link
Contributor

@mrcjkb

I've put up a pull request to add @Alper-Celik! 🎉

mrcjkb pushed a commit that referenced this issue Apr 9, 2023
Adds @Alper-Celik as a contributor for bug.

This was requested by mrcjkb [in this
comment](#177 (comment))

[skip ci]

---------

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
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

Successfully merging a pull request may close this issue.

2 participants