How to make damlc ide parse {-# LANGUAGE -#}?

When I run daml damlc ide to use the LSP server with vim, I need to pass it explicit arguments --ghc-option -X_____ to enable a language feature.

Is there a way to automate this, so that the LSP server infers these from the {-# LANGAUGE _____ #-} pragma in my source code, rather than having to pass them in explicitly?

damlc should always parse that pragma both in the IDE mode as well as in daml build. Do you have a concrete example where this doesn’t work?

It happens every time I start the IDE from vim. It executes daml damlc ide indirectly, as far as I know.

Can you reproduce it in VSCode? All the logic for this should be in damlc not in the editor-specific side so it shouldn’t be specific to vim.

Looks like I can reproduce it:

image

Just ran daml init and then created daml/Main.daml like above. The error says

/home/luciano/src/testextensions/daml/Main.daml:5:6: error:
Illegal declaration of a type or class operator ‘:+:’
Use TypeOperators to declare operators in type and declarations

The lanugage pragma needs to be above the module header not below. So try the following:

{-# LANGUAGE TypeOperators #-}
module Main where

:scream:

1 Like