haskelly-dev / Haskelly

Haskelly is a VS Code extension that provides complete support for casual and expert Haskell development.
https://marketplace.visualstudio.com/items?itemName=UCL.haskelly
GNU General Public License v3.0
152 stars 17 forks source link

"Haskell: Stack Build" starts with `cd "'1.4.1.2'"`, a non-existent directory #75

Closed carlpaten closed 6 years ago

carlpaten commented 6 years ago

Here's what shows up in the integrated terminal in VS Code after I run Haskell: Stack Build:

PS C:\Users\me\Projects\Dust> cd "'1.4.1.2'"
cd : Cannot find path 'C:\Users\me\Projects\Dust\'1.4.1.2'' because it does not exist.
At line:1 char:1
+ cd "'1.4.1.2'"
+ ~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (C:\Users\me\Projects\Dust\'1.4.1.2':String) [Set-Location], ItemNotFoundException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.SetLocationCommand

PS C:\Users\me\Projects\Dust> stack build --fast
?[0mDust-0.1.0.0: build (lib + exe)?[0m
?[0mPreprocessing library for Dust-0.1.0.0..?[0m
?[0mBuilding library for Dust-0.1.0.0..?[0m
?[0mPreprocessing executable 'Dust-exe' for Dust-0.1.0.0..?[0m
?[0mBuilding executable 'Dust-exe' for Dust-0.1.0.0..?[0m
?[0m[2 of 2] Compiling Main             ( app\Main.hs, .stack-work\dist\5c8418a7\build\Dust-exe\Dust-exe-tmp\Main.o )?[0m
?[0m?[0m
?[0m?[;1mapp\Main.hs:6:8: ?[;1m?[31merror:?[0m?[0m?[;1m?[0m?[0m?[;1m?[0m
?[0m    * Variable not in scope: someFunc2 :: IO ()?[0m
?[0m    * Perhaps you meant `someFunc' (imported from Lib)?[0m?[0m?[0m
?[0m?[;1m?[34m  |?[0m?[0m?[0m
?[0m?[;1m?[34m6 |?[0m?[0m main = ?[;1m?[31msomeFunc2?[0m?[0m?[0m
?[0m?[;1m?[34m  |?[0m?[0m?[;1m?[31m        ^^^^^^^^^?[0m?[0m?[0m
?[0m?[0m?[0m?[0m?[0m

--  While building custom Setup.hs for package Dust-0.1.0.0 using:
      C:\Stack\setup-exe-cache\x86_64-windows\Cabal-simple_Z6RU0evB_2.0.1.0_ghc-8.2.2.exe --builddir=.stack-work\dist\5c8418a7 build lib:Dust exe:Dust-exe --ghc-options " -ddump-hi -ddump-to-file -fdiagnostics-color=always"
    Process exited with code: ExitFailure 1
PS C:\Users\me\Projects\Dust>

(Note also the color codes, I don't think they should be there but that looks like an upstream issue, whether in VS Code or Windows itself.)

jartur commented 6 years ago

It's because of the code in workDir.ts here

const re = /.*path:\s*(.*?)\s*?\n/

This regex now matches a stack query result which contains the package named filepath of version 1.4.1.2. I tested locally with changing the regex to have a required whitespace before the path part like this

const re = /.*\spath:\s*(.*?)\s*?\n/

and it fixed the problem for me.

jartur commented 6 years ago

Created a pull request for a simple fix #77

martrik commented 6 years ago

This bug has been fixed in version 0.5.3 thanks to MR #77.