mrcjkb / haskell-tools.nvim

🦥 Supercharge your Haskell experience in neovim!
GNU General Public License v2.0
477 stars 19 forks source link

Windows support? #172

Closed mrcjkb closed 1 year ago

mrcjkb commented 1 year ago

Discussed in https://github.com/mrcjkb/haskell-tools.nvim/discussions/171

Originally posted by **Br3akp01nt** April 6, 2023 Hey, I've been trying to get this to work on windows 11 but seem unable to do so. Healthchecks pass fine, but upon opening a haskell file, nvim just goes blank. Log files only report logging started, even when setting loglevel to debug. It seems to occur only when ht.setup or ht.start_or_attack is run, even when they are empty. I've tried running the minimal install, which works, but since setup or start_or_attack isn't run, I can't glean any useful info from that. Any tips on continued troubleshooting?
mrcjkb commented 1 year ago

@Br3akp01nt could you please give this a try with the 172-windows-support branch?

To enable debug logging at startup of the plugin, you can add the following to your config:

local ht = require('haskell-tools')
ht.setup {
  tools = { -- haskell-tools options
    log = {
      level = vim.log.levels.DEBUG,
    },
  },
  hls = {
    -- your regular config
  },
}

Once the issue has been resolved, I would disable it again, as it could impact performance.

setup is meant to be called somewhere in your config, e.g. with packer:

packer.startup(function(use)
  use('wbthomason/packer.nvim')

  use {
    'mrcjkb/haskell-tools.nvim',
    requires = {
      'nvim-lua/plenary.nvim'
    },
    config = function()
      local ht = require('haskell-tools')
      ht.setup {
        -- CONFIGS HERE
      }
    end,
  }

  end
)

setup_or_attach is supposed to go in ftplugin/haskell.lua (choose between one of them though - don't call both).

I prefer setup_or_attach, because it doesn't impact startup when I'm not working with Haskell files. But I don't know how to do that in Windows.

Br3akp01nt commented 1 year ago

Hey, that seems to have done the trick! It's no longer freezing, and I'm getting hls in the editor. The call to set the logging level still seems to produce nil errors, but the hls log is now properly populated with logging entries. Thanks a lot! Let me know if you need me to try anything else.

mrcjkb commented 1 year ago

Great to hear :tada:

Thanks for testing! :pray:

I'll publish a new release.

Regarding the nil errors:

As for logging, I tried ht.log.set_level(vim.log.levels.DEBUG) but received nil error on vim.log. Running it manually in nvim :lua require('haskell-tools').log.set_level(vim.log.levels.DEBUG) seems to have run successfully,

The examples in the readme assume you have set ht = require('haskell-tools'). Otherwise, ht will be nil. ht.log will be nil until either setup or setup_or_attach has been called.

mrcjkb commented 1 year ago

@all-contributors please add @Br3akp01nt for userTesting

allcontributors[bot] commented 1 year ago

@mrcjkb

I've put up a pull request to add @Br3akp01nt! :tada:

mrcjkb commented 1 year ago

@all-contributors please add @Br3akp01nt for bug

allcontributors[bot] commented 1 year ago

@mrcjkb

I've put up a pull request to add @Br3akp01nt! :tada:

mrcjkb commented 1 year ago

@Br3akp01nt please don't hesitate to open an issue if you run into other problems - although I might be a bit slow to fix them if I can't reproduce them on Linux.

I do expect some features (like fast-tags integration and the ghci repl) not to work properly on Windows. And of course, I will also gladly accept contributions that improve support for non-unix-like OSs :wink: