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

Haskelly choosing wrong workDir? #98

Open aryairani opened 5 years ago

aryairani commented 5 years ago

Not sure if the problem in the subject is the reason why Jump to Definition and type hovers don't work, but it seemed plausible?

My stack project is in /Users/arya/unison, but the log below seems to be looking in /Users/arya/unison/yaks/haskeline, which is a sub-package.

Also, if I press the Stack Build button, it runs stack it in /Users/arya/unison/yaks/haskeline when I want it to be running in /Users/arya/unison (where my stack.yaml is; also the directory I opened in VS Code).

Thanks in advance!

[Extension Host] Trying new Intero for document /Users/arya/unison/parser-typechecker/src/Unison/Codebase/Causal2.hs and workDir /Users/arya/unison/yaks/haskeline/
---
workbench.main.js:1402   ERR Cannot read property 'slice' of null: TypeError: Cannot read property 'slice' of null
    at InteroLocationDecoder.extractRange (/Users/arya/.vscode/extensions/ucl.haskelly-0.5.5/out/src/Providers/InteroLocationDecoder.js:24:13)
    at InteroLocationDecoder.buildLocation (/Users/arya/.vscode/extensions/ucl.haskelly-0.5.5/out/src/Providers/InteroLocationDecoder.js:11:28)
    at InteroLocationDecoder.decode (/Users/arya/.vscode/extensions/ucl.haskelly-0.5.5/out/src/Providers/InteroLocationDecoder.js:6:21)
    at HaskellDefinitionProvider.<anonymous> (/Users/arya/.vscode/extensions/ucl.haskelly-0.5.5/out/src/Providers/Definition/index.js:24:47)
    at Generator.next (<anonymous>)
    at fulfilled (/Users/arya/.vscode/extensions/ucl.haskelly-0.5.5/out/src/Providers/Definition/index.js:4:58)
aryairani commented 5 years ago

Okay, here is the output of stack query; I guess getWorkDir should expect multiple matches in its regexp and choose the one that is a prefix of dirname(filepath)? I would try this, but I don't know how to install a custom build into VSCode.

$ ▶ stack query
compiler:
  wanted: ghc-8.4.3
  actual: ghc-8.4.3
# Note: global-hints is experimental and may be renamed / removed in the future.
# See https://github.com/commercialhaskell/stack/issues/3796
global-hints:
  ghc: 8.4.3
  bytestring: 0.10.8.2
  unix: 2.7.2.2
  base: 4.11.1.0
  time: 1.8.0.2
  hpc: 0.6.0.3
  filepath: 1.4.2
  process: 1.6.3.0
  array: 0.5.2.0
  integer-gmp: 1.0.2.0
  containers: 0.5.11.0
  ghc-boot: 8.4.3
  binary: 0.8.5.1
  ghc-prim: 0.5.2.0
  ghci: 8.4.3
  rts: '1.0'
  terminfo: 0.4.1.1
  transformers: 0.5.5.0
  deepseq: 1.4.3.0
  ghc-boot-th: 8.4.3
  pretty: 1.1.3.6
  template-haskell: 2.13.0.0
  directory: 1.3.1.5
locals:
  haskeline:
    path: /Users/arya/unison/yaks/haskeline/
    version: 0.7.5.0
  easytest:
    path: /Users/arya/unison/yaks/easytest/
    version: '0.1'
  unison-parser-typechecker:
    path: /Users/arya/unison/parser-typechecker/
    version: '0.1'
aryairani commented 5 years ago

Maybe something like this:

https://repl.it/@aryairani/workDirExample