haskell / haskell/haskell-language-server

Local compiler plugin cannot be loaded in ghcide even with `-fobject-code`

オープン
#730 コメント 1 件 リアクション 1 件 担当者 0 名 GitHub で見る
component: ghcide type: bug
主要言語
Haskell
スター
3k
フォーク
455
平均マージ
2日 19時間
マージ済み PR(30日)
11

説明

This was originally reported as haskell/haskell-language-server#70, but it turns out that this is a bug in ghcide, so I re-open the issue here.

### Subject of the issue
If one specifies GHC's compiler plugin provided in the *same* package, ghcide fails to find the plugin module.

### Your environment
* ghcide HEAD (10dbde048e8ac028e80f607445776c8375722f75)
* VSCode
* Describe your project: You can use the [same repro repo](/konn/hls-repro) as reported on hls.
* hie.yaml: Provided above.

### Steps to reproduce
1. Set the Languager Server path to the ghcide.
2. Open the src/Lib.hs in the editor.

### Expected behaviour
ghcide should work properly and no bugs must be reported, as `-fobject-code` flag is properly detected by hie-bios.

### Actual behaviour
`Lib` module gets the following error:

```
{
"resource": "/Users/hiromi/Documents/Programming/Haskell/git/hls-repro/src/Lib.hs",
"owner": "Haskell (hls-repro)",
"severity": 8,
"message": "Unexpected usage error\nCould not load module ‘Lib.Plugin’\nIt is a member of the hidden package ‘hls-repro-0.1.0.0’.\nPerhaps you need to add ‘hls-repro’ to the build-depends in your .cabal file.\n",
"source": "pragmas",
"startLineNumber": 1,
"startColumn": 1,
"endLineNumber": 2,
"endColumn": 1
}
```

(Note that the error message has changed since the first report)

### Possible cause
It seems that the cause of this behaviour is the lack of dependency information in `HsEnv` value obtained in `getModSummaryRule`, which is finally passed to `Development.IDE.Core.Preprocessor.preprocess`.
I once tried to expand the definition of `GhcSessionDeps` definition into `getModSummaryRule`, but it won't work since the core logic contains the call for `GetModSummaryWithoutTimestamps`, which eventually calls `GetModSummary`, resulting in cyclic dependency and ghcide stuck in the infinite loop.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。