ndmitchell / ghcid

Very low feature GHCi based IDE
Other
1.13k stars 114 forks source link

Not reload when works with -c 'ghci -x hs' #349

Open luochen1990 opened 2 years ago

luochen1990 commented 2 years ago

Reproduce:

  1. create file named test-ghcid-issue with following content:
#! /usr/bin/env nix-shell
#! nix-shell -p ghcid -p "haskellPackages.ghcWithPackages (pkgs: with pkgs; [req])" -i "ghcid -c 'ghci -Wall -x hs' -T main"

main :: IO ()
main = do
print ("hello" :: String)
  1. run ./test-ghcid-issue
  2. edit code and observe changes

Observed:

Nothing changes in step 3.

Expected:

Source file auto reload just like .hs files works.

Note:

About the ghci option -x: https://stackoverflow.com/questions/8177950/how-can-i-load-a-runhaskell-script-without-a-hs-extension-with-ghci

ndmitchell commented 2 years ago

Can you run with the --verbose option, which will produce a long list with all the information required to debug this. My guess is the parsing functions don't work, but could probably be adapted.

luochen1990 commented 2 years ago

Can you run with the --verbose option, which will produce a long list with all the information required to debug this. My guess is the parsing functions don't work, but could probably be adapted.

Following is the output with --verbose enabled:

%TESTING: main
%STDIN: main
%STDIN:
INTERNAL_GHCID.putStrLn ['#','~','G','H','C','I','D','-','F','I','N','I','S','H','-','3','2','~','#']
INTERNAL_GHCID.hPutStrLn INTERNAL_GHCID.stderr ['#','~','G','H','C','I','D','-','F','I','N','I','S','H','-','3','2','~','#']
%WAITING: /data/ws/issues/.ghcid /data/ws/dotfiles/home/.ghci /data/ws/issues/github-ghcid-349
%WAITING: /data/ws/dotfiles/home /data/ws/issues
%STDOUT: #~GHCID-START~##~GHCID-START~#"hello"
"hello"
%STDOUT: #~GHCID-START~##~GHCID-START~##~GHCID-FINISH-32~#
%STDERR: #~GHCID-FINISH-32~#
%TESTING: Completed

...done

I don't understand the meanning, but the number 32 changed everytime the file is edited and saved