parsonsmatt / intero-neovim

A neovim plugin for Intero, forked from ghcmod-vim
218 stars 28 forks source link

InteroGenericType not working #136

Closed elongeau closed 6 years ago

elongeau commented 6 years ago

Hello,

I've installed intero for neovim recently, but when I try to use InteroGenericType I have this error:

Error detected while processing function intero#repl#type_at[18]..<SNR>73_ghci_supports_type_at_and_uses:
line    1:
E121: Undefined variable: g:intero_backend_info
E116: Invalid arguments for function intero#process#backend_info#version_gte
E15: Invalid expression: intero#process#backend_info#version_gte( g:intero_backend_info.version, [8, 0, 1])

I'm using

❯ nvim --version
NVIM v0.2.2
Build type: Release
LuaJIT 2.0.5
Features: +acl +iconv +jemalloc +tui

GHCi, version 8.0.2: http://www.haskell.org/ghc/

❯ stack --version
Version 1.6.3, Git revision b27e629b8c4ce369e3b8273f04db193b060000db (5454 commits) x86_64 hpack-0.20.0
owickstrom commented 6 years ago

@elongeau Not sure this is your issue, but I get that exact error when Intero is not started and I do InteroGenericType or similar. Sure your Intero session is running? Check with:

:echo g:intero_started
1 # it's started

Otherwise g:intero_started should not be defined, or be 0.

owickstrom commented 6 years ago

You can configure intero-neovim to start the Intero REPL automatically:

let g:intero_start_immediately = 1

Or you need to call :InteroOpen in some way. See :help intero for more info.

elongeau commented 6 years ago

even with let g:intero_start_immediately = 1 or :InteroOpen, :echo g:intero_started always return 0. I'll to reinstall all from scratch to see what happened

owickstrom commented 6 years ago

OK. Does the Intero buffer open, and does GHCi start in there? I'm thinking it might be a problem with the plugin not recognizing that intero/GHCi is started.

elongeau commented 6 years ago

yes, and it loads my file I can :t function of the loaded file

elongeau commented 6 years ago

my neovim's :checkhealth for information


health#nvim#check
========================================================================
## Configuration
  - OK: no issues found

## Performance
  - OK: Build type: Release

## Remote Plugins
  - OK: Up to date

## terminal
  - INFO: key_backspace (kbs) terminfo entry: key_backspace=^H
  - INFO: key_dc (kdch1) terminfo entry: key_dc=\E[3~
  - INFO: $XTERM_VERSION=''
  - INFO: $VTE_VERSION=''
  - INFO: $SSH_TTY=''

health#provider#check
========================================================================
## Clipboard (optional)
  - OK: Clipboard tool found: pbcopy

## Python 2 provider (optional)
  - INFO: Using: g:python_host_prog = "/usr/local/bin/python"
  - INFO: Executable: /usr/bin/python
  - ERROR: Command error (job=4): '/usr/bin/python' '-c' 'import neovim; print(neovim.__file__)'
    Output: Traceback (most recent call last):  File "<string>", line 1, in <module>ImportError: No module named neovim
  - INFO: Python2 version: 2.7.10
  - INFO: python-neovim version: unable to load neovim Python module
  - ERROR: Neovim Python client is not installed.
    Error: unable to load neovim Python module
    - ADVICE:
      - Run in shell: pip2 install neovim

## Python 3 provider (optional)
  - INFO: Using: g:python3_host_prog = "/usr/local/bin/python3"
  - INFO: Executable: /usr/local/bin/python3
  - INFO: Python3 version: 3.6.4
  - INFO: python3-neovim version: 0.2.1
  - OK: Latest python3-neovim is installed: 0.2.1

## Ruby provider (optional)
  - INFO: Ruby: ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-darwin16]
  - WARNING: Missing "neovim" gem.
    - ADVICE:
      - Run in shell: gem install neovim
      - Is the gem bin directory in $PATH? Check `gem environment`.
      - If you are using rvm/rbenv/chruby, try "rehashing".

## Node provider (optional)
  - INFO: Node: v9.5.0
  - WARNING: Missing "neovim" npm package.
    - ADVICE:
      - Run in shell: npm install -g neovim
      - Is the npm bin directory in $PATH?
esato commented 6 years ago

I have the exact same problem. I'm on Windows 10, Neovim v0.2.3-625-g4aa67151f.

berntan commented 6 years ago

I have the same problem on mac. I have the same versions of nvim and stack as OP.

even with let g:intero_start_immediately = 1 or :InteroOpen, :echo g:intero_started always return 0.

same for me.

berntan commented 6 years ago

I managed to find out why it didn't start up on my machine. It was my custom ghci-prompt λ:, and so the startup never got past this line: https://github.com/parsonsmatt/intero-neovim/blob/master/autoload/intero/process.vim#L219

Thank you @parsonsmatt and the other contributors for a great plugin!

elongeau commented 6 years ago

I've made the same, I'll try it asap

elongeau commented 6 years ago

I confirm @berntan suggestion, customizing the ghci prompt breaks Intero

parsonsmatt commented 6 years ago

We should be failing with a better error message.

@elongeau @berntan can you check that setting g:intero_prompt_regex fixes this?

*g:intero_prompt_regex*

  Default: `'[^-]>'`

  If you use a custom GHCi prompt, you may need to modify the prompt regex so
  that it matches your custom prompt.
elongeau commented 6 years ago

yes, with g:intero_prompt_regex my custom ghci prompt works with intero

hasufell commented 6 years ago

I have no custom ghci prompt, but the same error message. It seems there really is no proper error handling.

jankner commented 6 years ago

I had this problem, and I did not use a custom ghci prompt. The prompt simply didn't match what intero expected. It listed the modules that were in scope or something like that.

It looked like: *Main Example>

I don't know exactly how the ghci prompt usually works, but I don't think I have any special settings for it.