user2151: 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



source code here

user2151: 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 and this workaround described in a Plutus Pull Request.

2151: <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.stack.imgur.com/BCmvb.png" rel="noreferrer"><img src="https://i.stack.imgur.com/BCmvb.png" alt="VSCode screen showing reported error" /></a></p>
<p><a href="https://i.stack.imgur.com/X9cXv.png" rel="noreferrer"><img src="https://i.stack.imgur.com/X9cXv.png" alt="VSCode screen showing code compiling without in ghc1" /></a></p>
<p><a href="https://i.stack.imgur.com/H3Bxw.png" rel="noreferrer"><img src="https://i.stack.imgur.com/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>
 2151: <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>
