<p>I found a workaround that is sufficient to get my IDE usable.</p>
<p>**WORKAROUND: ** By comparing the cabal files for Plutus week10 (which compiles OK in IDE) with week07 (error), I discovered that adding the GHC argument <code>-fplugin-opt PlutusTx.Plugin:defer-errors</code> into the &quot;.cabal&quot; file suppressed the error and allowed IDE functions like code completion to work.    With this insight, I discovered that this issue had been reported in <a href="https://github.com/input-output-hk/plutus/issues/3454" rel="nofollow noreferrer">Plutus Issue  3454</a> and this workaround described in a <a href="https://github.com/input-output-hk/plutus-starter/pull/23" rel="nofollow noreferrer">Plutus Pull Request</a>.</p>

CC BY-SA 4.0
2021-09-24T18:43:17.490Z
Can you add a more complete example of the diff you made to the `.cabal` file?
Paymahn Moghadasian
CC BY-SA 4.0
2021-09-24T19:02:39.303Z
Here's a diff which shows how to fix this: https://github.com/paymog/plutus-pioneer-program/commit/7a1c2ff206aeaca9496075f18e2989901aeda9fe

@KenA does your VSCode navigate to type definitions with this fix? My installation keeps telling me that no definitions can be found.
Paymahn Moghadasian
CC BY-SA 4.0
2021-08-23T19:02:12.630Z
2021-08-23T19:02:12.630Z
KenA
<p>I seem to have a partial solution, that wasn't available at the time the question was asked. (I spent a lot of time trying to get my VS Code and HSL to work with a Ubuntu dev container I'd started in July of 2021, but I couldn't get it going. I was trying to get HSL to load the nix environment before building or use nix build instead of the default, but that stuff was over my head.)</p>
<p>Eventually I found the plutus-starter project and the plutus-starter container on IOHK.</p>
<p>Basic solution:</p>
<ul>
<li>clone the plutus-starter repo to local</li>
<li>open a new window in VS Code, then open the repo folder.</li>
<li>this will ask to open in a devcontainer, click yes</li>
<li>this will DL the container from Docker Hub, and create and run it. (will take a while)</li>
<li>then in the VS Code terminal, run <code>cabal update</code> and <code>cabal.repl</code></li>
<li>this will take a while to build the project.</li>
<li>Cmd-Shift-P and select Reload Window</li>
<li>This at least shows me type info on roll over, and will go to definitions and references within the project, and will show compiler errors, and have some code hints, etc.</li>
<li>The error at the top of the code file is still there though. The plutus-starter.cabal file has the <code>defer-errors</code> option defined in it, but it's behind a flag, and I'm not sure how to get HSL to set the flag to true and then send it to cabal.</li>
<li>I'm also not sure yet how to transfer this to an existing Plutus project. My approach going forward is just clone the plutus-starter repo and make a copy and then start my future projects in there.</li>
</ul>

CC BY-SA 4.0
2022-02-10T08:37:17.123Z
2022-02-10T08:37:17.123Z
marcel_g
<p>When compiling supplied code for Plutus Pioneer Program, the haskell extension for VSCode IDE reports a compilation error.  This prevents a lot of useful IDE functions from working, because the IDE doesn't analyze an uncompilable file. The code compiles correctly in ghci (cabal repl) and using command line &quot;cabal build&quot;</p>
<p>The error is related to the template Haskell code that is required to write Plutus validators.  Error states that a name is not INLINABLE, but it is.  I have verified that ghc and haskell-language-server are both using same Haskell compiler (8.10.4.20210212).  Does anyone know how to eliminate the error while using VSCode?</p>
<p>related (unanswered) Stack Exchange question: <a href="https://cardano.stackexchange.com/questions/459/haskell-ide-inlinable-error-help">related issue</a></p>
<p><a href="https://i.sstatic.net/BCmvb.png" rel="noreferrer"><img src="https://i.sstatic.net/BCmvb.png" alt="VSCode screen showing reported error" /></a></p>
<p><a href="https://i.sstatic.net/X9cXv.png" rel="noreferrer"><img src="https://i.sstatic.net/X9cXv.png" alt="VSCode screen showing code compiling without in ghc1" /></a></p>
<p><a href="https://i.sstatic.net/H3Bxw.png" rel="noreferrer"><img src="https://i.sstatic.net/H3Bxw.png" alt="Error when running haskell-language-server from command line" /></a></p>
<p><a href="https://github.com/input-output-hk/plutus-pioneer-program/blob/main/code/week07/src/Week07/EvenOdd.hs" rel="noreferrer">source code here</a></p>

<plutus><haskell><vscode><ide>
haskell-language-server used in VSCode Haskell extension produces spurious INLINABLE compilation error message
# haskell-language-server used in VSCode Haskell extension produces spurious INLINABLE compilation error message

(Asked by: username_0 on 2021-08-21)

When compiling supplied code for Plutus Pioneer Program, the haskell extension for VSCode IDE reports a compilation error. This prevents a lot of useful IDE functions from working, because the IDE doesn't analyze an uncompilable file. The code compiles correctly in ghci (cabal repl) and using command line "cabal build"

The error is related to the template Haskell code that is required to write Plutus validators. Error states that a name is not INLINABLE, but it is. I have verified that ghc and haskell-language-server are both using same Haskell compiler (8.10.4.20210212). Does anyone know how to eliminate the error while using VSCode?

related (unanswered) Stack Exchange question: [related issue](https://cardano.stackexchange.com/questions/459/haskell-ide-inlinable-error-help)

[![VSCode screen showing reported error](https://i.sstatic.net/BCmvb.png)](https://i.sstatic.net/BCmvb.png)

[![VSCode screen showing code compiling without in ghc1](https://i.sstatic.net/X9cXv.png)](https://i.sstatic.net/X9cXv.png)

[![Error when running haskell-language-server from command line](https://i.sstatic.net/H3Bxw.png)](https://i.sstatic.net/H3Bxw.png)

[source code here](https://github.com/input-output-hk/plutus-pioneer-program/blob/main/code/week07/src/Week07/EvenOdd.hs)

**Tags:** plutus, haskell, vscode, ide

---

## 2 answers

### Answer by username_0 on 2021-08-23. Score: 3

I found a workaround that is sufficient to get my IDE usable.

\*\*WORKAROUND: \*\* By comparing the cabal files for Plutus week10 (which compiles OK in IDE) with week07 (error), I discovered that adding the GHC argument `-fplugin-opt PlutusTx.Plugin:defer-errors` into the ".cabal" file suppressed the error and allowed IDE functions like code completion to work. With this insight, I discovered that this issue had been reported in [Plutus Issue 3454](https://github.com/input-output-hk/plutus/issues/3454) and this workaround described in a [Plutus Pull Request](https://github.com/input-output-hk/plutus-starter/pull/23).

> **Comments:**
> **username_1**: Can you add a more complete example of the diff you made to the `.cabal` file?  
> **username_1**: Here's a diff which shows how to fix this: https://github.com/paymog/plutus-pioneer-program/commit/7a1c2ff206aeaca9496075f18e2989901aeda9fe  @KenA does your VSCode navigate to type definitions with this fix? My installation keeps telling me that no definitions can be found.  

---

### Answer by username_2 on 2022-02-10. Score: 0

I seem to have a partial solution, that wasn't available at the time the question was asked. (I spent a lot of time trying to get my VS Code and HSL to work with a Ubuntu dev container I'd started in July of 2021, but I couldn't get it going. I was trying to get HSL to load the nix environment before building or use nix build instead of the default, but that stuff was over my head.)

Eventually I found the plutus-starter project and the plutus-starter container on IOHK.

Basic solution:

* clone the plutus-starter repo to local
* open a new window in VS Code, then open the repo folder.
* this will ask to open in a devcontainer, click yes
* this will DL the container from Docker Hub, and create and run it. (will take a while)
* then in the VS Code terminal, run `cabal update` and `cabal.repl`
* this will take a while to build the project.
* Cmd-Shift-P and select Reload Window
* This at least shows me type info on roll over, and will go to definitions and references within the project, and will show compiler errors, and have some code hints, etc.
* The error at the top of the code file is still there though. The plutus-starter.cabal file has the `defer-errors` option defined in it, but it's behind a flag, and I'm not sure how to get HSL to set the flag to true and then send it to cabal.
* I'm also not sure yet how to transfer this to an existing Plutus project. My approach going forward is just clone the plutus-starter repo and make a copy and then start my future projects in there.


---

