I have been using this daml-mode in Emacs and I find it quite good. Much thanks to @bartfaitamas who, as I understand it, is the author of this code.
These instructions also include an lsp-mode for Daml that I haven’t had a chance to play around with yet. When I do get a chance, hopefully I can write another tutorial on that. Or maybe somebody will beat me to it.
First, create a directory ${HOME}/.emacs.d/lisp/daml-mode, and copy the following two files into that directory:
Apart from installing Emacs & Lisp, this is simple and in one location.
Thank you
P.S. What is the lag like when you demand highlighting in-code? Using VIM-LSP there is a noticeable lag, when the LSP Server is called to serve. Mildly annoying.
I notice no lag for the daml-mode syntax highlighting. As far as the lsp-mode goes, I couldn’t tell you yet. I hope to get around to trying out the LSP at some point.
The daml language server does not provide any form of syntax highlighting. That’s done on the client side by a bunch of regex specific to your editor. So it really shouldn’t introduce any lag in that regard.
Maybe it should not, but on the 8 Core Desktop, everytime the LSP-Server would detect a Daml term, I could hear the noticeable difference in CPU, therefore CPU fan activity. About 1-3 seconds, then the Daml highlighting would render and the CPU activity would drop back to normal. Verified with Htop.
I was using the Daml-on-Vim config that I posted above. No wonder it is now Headless.
I had to make a couple of tweaks to the lsp mode file to get it working with lsp-mode 8. I’m not able to attach the modified file due to being a new user, but it can be found here: GitHub gist
Also, a backslash got eaten from the .emacs snippet posted above. Here is a repaired version:
Thank you for the writeup. This worked great on my emacs doom. The only modification I had to make was to the load-path to make fit into my setup. :load-path "~/.emacs.d/lisp/daml-mode/"
lsp-mode now supports displaying script results
You need to click the “lens” next to your script declaration. It is stlil buggy a little bit: if you kill the result buffer, and then open it up again clicking on the lens, it will be empty until you change the script.
lsp-mode now gives feedback about processing, as in VSCode
Syntax highlighting now supports daml 2.x keywords
Haven’t fully tested it yet, so there might be other errors or missing some syntax highlight keywords, please let me know if that’s the case
Also, the script result page is not interactive, you can;t filter out archived contracts, etc.
Hi @bartfaitamas, it’s embarassing how long this has taken, but at any rate I submitted a PR to add this to Melpa. It’s basically a pointer to HEAD of your repo’s main branch. If no objections, I will submit a PR to yours to mention the availability of a Melpa install, and clean up a couple of small docstring linting issues checkdoc found.