parsonsmatt / intero-neovim

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

Neomake integration with bare files and STACK_YAML #71

Open parsonsmatt opened 7 years ago

parsonsmatt commented 7 years ago

Copied from #67 (thanks @tsoernes!):

When using STACK_YAML environment variable to specify a stack.yaml file, the neomake integration fails with following message:

Error detected while processing function <SNR>51_on_stdout[26]..<SNR>51_new_response[22]..intero#maker#write_update:
line    3:
E482: Can't open file /tmp/nvimWuC10t/3 for writing: no such file or directory
tsoernes commented 7 years ago

I don't use a STACK_YAML env var (echo $STACK_YAML doesn't print anything and I haven't set it myself), I assume stack just defaults to the global yaml file when run as a bare file.

parsonsmatt commented 7 years ago

That use case is working for me, oddly enough.

tsoernes commented 7 years ago

I'm not getting this issue on my other system using the exact same init.vim, editing same file on same operating system with same neovim version so I'm not getting any wiser. The systems are configured to be as identical as possible.

rdnetto commented 7 years ago

The weird thing about this is that we switched to using a tempfile instead of .stack-work specifically because of Stack scripts. Looking at the output of tempname() on the affected system could be interesting - I suspect the /tmp/nvimWuC10t directory doesn't exist.

tsoernes commented 7 years ago

My previous analysis of this issue was incorrect.

The error happens when the line

#!/usr/bin/env stack

is either added then :wq or removed then :wq.

In either case you won't get it the second time the file is opened then :wq (without editing anything) because in case 1 (line is present) intero won't start the second time around and in case 2 (line not present) intero seem to work correctly on bare files as @rdnetto mentioned.

When replicating these steps I also get this error on my other system.

jez commented 7 years ago

It's for that reason that I think this issue is not Intero related. A while ago, I added this line to my vimrc:

au! BufRead,BufEnter *.hs setlocal filetype=haskell

This is more of a problem in the ftdetect files for haskell/conf than a problem with Intero. Maybe we should submit a bug report or a patch upstream, but I'm content merely adding this line to my vimrc. On Sat, Jul 22, 2017 at 11:23 AM tsoernes notifications@github.com wrote:

My previous analysis of this issue was incorrect.

The error happens when the line

!/usr/bin/env stack

is either added then file saved or removed then file saved. In either case you won't get it the second time the file is opened then saved (without editing anything) because in case 1 (line added) intero won't start the second time around.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/parsonsmatt/intero-neovim/issues/71#issuecomment-317194136, or mute the thread https://github.com/notifications/unsubscribe-auth/AFSaVD87F98EVTVDrghPE2kG_Ni9yu77ks5sQiIFgaJpZM4Of0kT .