Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to get IDE support in VSCode working #3454

Closed
segersb opened this issue Jun 29, 2021 · 6 comments
Closed

Unable to get IDE support in VSCode working #3454

segersb opened this issue Jun 29, 2021 · 6 comments
Assignees
Labels

Comments

@segersb
Copy link

segersb commented Jun 29, 2021

Area

[X] Plutus Foundation Related to the GHC plugin, Haskell-to-Plutus compiler, on-chain code
[X] Plutus Application Framework Related to the Plutus application backend (PAB), emulator, Plutus libraries
[-] Marlowe Related to Marlowe
[X] Other Any other topic (Playgrounds, etc.)

Summary

I'm having troubles setting up VSCode to have code completion while developing with Plutus.
The cleanest solution I have tried was to use a fresh Ubuntu VM in VirtualBox and start from the "plutus-starter" project:
https://github.com/input-output-hk/plutus-starter

The full error can be found below, here is the start:
Reference to a name which is not a local, a builtin, or an external INLINABLE function: Variable PlutusTx.Eq.$fEqByteString

Steps to reproduce

VM (more than 1 cpu is needed otherwise haskell-language-server hangs)
Install Ubuntu
Install Docker
Install VSCode
Install the VSCode Remote Development extension pack

Clone https://github.com/input-output-hk/plutus-starter
Execute 'mkdir -p ~/.cabal/packages'
Open plutus-starter in VSCode, It will ask if you want to open it in the container, say yes.
Execute 'cabal update' in terminal
Execute 'cabal install' in terminal
Open the file examples/src/Plutus/Contracts/Game.hs in VSCode
Click in the file and wait for the processing to be done

Expected behavior

There should be no errors in the IDE since 'cabal build' is successful
See the attached screenshot to see the error I get

System info (please complete the following information):

Screenshots and attachments

workspace

Additional context

Note I get the same error message when executing 'haskell-language-server' directly in the terminal.

Complete error message:
Program error: GHC Core to PLC plugin: E043:Error: Reference to a name which is not a local, a builtin, or an external INLINABLE function: Variable PlutusTx.Eq.$fEqByteString
[DFunId(nt)]
No unfolding
Context: Compiling expr: PlutusTx.Eq.$fEqByteString
Context: Compiling expr: PlutusTx.Eq.$fEqByteString
cast (PlutusTx.Eq.N:Eq[0] <Data.ByteString.Internal.ByteString>_N
:: GHC.Types.Coercible
(PlutusTx.Eq.Eq Data.ByteString.Internal.ByteString)
(Data.ByteString.Internal.ByteString
-> Data.ByteString.Internal.ByteString -> GHC.Types.Bool))
Context: Compiling expr: (PlutusTx.Eq.$fEqByteString
cast (PlutusTx.Eq.N:Eq[0] <Data.ByteString.Internal.ByteString>_N
:: GHC.Types.Coercible
(PlutusTx.Eq.Eq Data.ByteString.Internal.ByteString)
(Data.ByteString.Internal.ByteString
-> Data.ByteString.Internal.ByteString -> GHC.Types.Bool)))
(ds_dqOC
cast (Plutus.Contracts.Game.N:HashedString[0]
:: GHC.Types.Coercible
Plutus.Contracts.Game.HashedString
Data.ByteString.Internal.ByteString))
Context: Compiling expr: (PlutusTx.Eq.$fEqByteString
cast (PlutusTx.Eq.N:Eq[0] <Data.ByteString.Internal.ByteString>_N
:: GHC.Types.Coercible
(PlutusTx.Eq.Eq Data.ByteString.Internal.ByteString)
(Data.ByteString.Internal.ByteString
-> Data.ByteString.Internal.ByteString -> GHC.Types.Bool)))
(ds_dqOC
cast (Plutus.Contracts.Game.N:HashedString[0]
:: GHC.Types.Coercible
Plutus.Contracts.Game.HashedString
Data.ByteString.Internal.ByteString))
(PlutusTx.Builtins.sha2_256
(ds_dqOD
cast (Plutus.Contracts.Game.N:ClearString[0]
:: GHC.Types.Coercible
Plutus.Contracts.Game.ClearString
Data.ByteString.Internal.ByteString)))
Context: Compiling expr: \ (ds_dqOD [Occ=Once]
:: Plutus.Contracts.Game.ClearString) ->
(PlutusTx.Eq.$fEqByteString
cast (PlutusTx.Eq.N:Eq[0] <Data.ByteString.Internal.ByteString>_N
:: GHC.Types.Coercible
(PlutusTx.Eq.Eq Data.ByteString.Internal.ByteString)
(Data.ByteString.Internal.ByteString
-> Data.ByteString.Internal.ByteString -> GHC.Types.Bool)))
(ds_dqOC
cast (Plutus.Contracts.Game.N:HashedString[0]
:: GHC.Types.Coercible
Plutus.Contracts.Game.HashedString
Data.ByteString.Internal.ByteString))
(PlutusTx.Builtins.sha2_256
(ds_dqOD
cast (Plutus.Contracts.Game.N:ClearString[0]
:: GHC.Types.Coercible
Plutus.Contracts.Game.ClearString
Data.ByteString.Internal.ByteString)))
Context: Compiling expr: \ (ds_dqOC [Occ=Once]
:: Plutus.Contracts.Game.HashedString)
(ds_dqOD [Occ=Once] :: Plutus.Contracts.Game.ClearString) ->
(PlutusTx.Eq.$fEqByteString
cast (PlutusTx.Eq.N:Eq[0] <Data.ByteString.Internal.ByteString>_N
:: GHC.Types.Coercible
(PlutusTx.Eq.Eq Data.ByteString.Internal.ByteString)
(Data.ByteString.Internal.ByteString
-> Data.ByteString.Internal.ByteString -> GHC.Types.Bool)))
(ds_dqOC
cast (Plutus.Contracts.Game.N:HashedString[0]
:: GHC.Types.Coercible
Plutus.Contracts.Game.HashedString
Data.ByteString.Internal.ByteString))
(PlutusTx.Builtins.sha2_256
(ds_dqOD
cast (Plutus.Contracts.Game.N:ClearString[0]
:: GHC.Types.Coercible
Plutus.Contracts.Game.ClearString
Data.ByteString.Internal.ByteString)))
Context: Compiling definition of: Plutus.Contracts.Game.isGoodGuess
Context: Compiling expr: Plutus.Contracts.Game.isGoodGuess
Context: Compiling expr: Plutus.Contracts.Game.isGoodGuess hs
Context: Compiling expr: Plutus.Contracts.Game.isGoodGuess hs cs
Context: Compiling expr: \ _ [Occ=Dead] ->
Plutus.Contracts.Game.isGoodGuess hs cs
Context: Compiling expr: \ (cs [Occ=Once]
:: Plutus.Contracts.Game.ClearString)
_ [Occ=Dead] ->
Plutus.Contracts.Game.isGoodGuess hs cs
Context: Compiling expr: \ (hs [Occ=Once]
:: Plutus.Contracts.Game.HashedString)
(cs [Occ=Once] :: Plutus.Contracts.Game.ClearString)
_ [Occ=Dead] ->
Plutus.Contracts.Game.isGoodGuess hs cs
Context: Compiling definition of: Plutus.Contracts.Game.validateGuess
Context: Compiling expr: Plutus.Contracts.Game.validateGuess
Context: Compiling expr at "main:Plutus.Contracts.Game:(102,8)-(102,46)"

@segersb segersb added the bug label Jun 29, 2021
@segersb segersb changed the title Issuew Unable to get IDE support in VSCode working Jun 29, 2021
@luigy luigy self-assigned this Jun 29, 2021
@luigy
Copy link
Contributor

luigy commented Jun 29, 2021

It seems running cabal build from /workspaces/plutus-starter is key in order to reproduce the reported issue. When I first ran this up to cabal update and let Dev Container load the file(it took some time) it got haskell-language-server working properly. I'm waiting on cabal build to finish to see if it changes anything else

@luigy
Copy link
Contributor

luigy commented Jun 29, 2021

cabal build finishing didn't change much with respect to the plugin error. I tried to repro my original behavior with a clean environment as the first run I did, but no luck. Taking a closer look

@segersb
Copy link
Author

segersb commented Jun 29, 2021

I tried doing a 'cabal clean' + running the VSCode command 'Haskell: Restart Haskell LSP server', but I still got the error.

@FrankC01
Copy link

I'm having the same issue

@franleplant
Copy link

Same issue over here

@luigy
Copy link
Contributor

luigy commented Aug 26, 2021

Fixes have now landed on plutus-starter input-output-hk/plutus-starter#29. Just ensure the flag defer-plugin-errors is enabled. Please reopen if you're still experiencing any problems

Thanks @silky for putting a new release of the container and bumping

@luigy luigy closed this as completed Aug 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants