Git Product home page Git Product logo

dhall-mode's Introduction

dhall-mode

MELPA Build Status

Emacs Major mode for working with Dhall configuration language.

Installation

  • Make sure that you install dhall-format and it's PATH is available to emacs via exec-path.
  • Install this extension from MELPA:
(use-package dhall-mode
  :ensure t
  :mode "\\.dhall\\'")

Demo

Dhall in Emacs

Features

  • Syntax highlighting (Using font lock)
  • Multiline support for String
  • Basic indendation, commenting
  • Automatic formatting on save (Configurable via variable). Uses dhall-format for it.
  • Error highlighting.
  • REPL support.

License

Copyright © 2017 Sibi Prabakaran

Distributed under GNU GPL, version 3.

dhall-mode's People

Contributors

endgame avatar gamb avatar justinwoo avatar michaelxavier avatar patrl avatar psibi avatar purcell avatar purcell-nec avatar regadas avatar sellout avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

dhall-mode's Issues

`dhall-eval-region` and `dhall-eval-buffer`

This can be done manually by selecting a region, running shell-command-on-region, and choosing dhall. It would be a nice explicit addition to this package though if there were to be interactive functions dhall-eval-region and dhall-eval-buffer.

error buffer takes focus

First of all, thanks for writing this package! I seem to be having an issue where, while I'm typing, as long as the expression is invalid (which is almost always true while typing), the error buffer pops up and also takes focus away. I have to hit Esc to close the error buffer and get back to typing.

If it helps, I'm using Emacs 26 with EVIL mode.

Error running timer ‘dhall-buffer-type-compute’: (wrong-type-argument stringp nil)

I get this error currently

Error running timer ‘dhall-buffer-type-compute’: (wrong-type-argument stringp nil)

with

(setq debug-on-error t)

I get to see

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  string-match("↳" nil nil)
  dhall-buffer-type()
  dhall-buffer-type-compute()
  apply(dhall-buffer-type-compute nil)
  timer-event-handler([t 23511 2211 494750 nil dhall-buffer-type-compute nil nil 157000])

any idea? - don't know if this is related to issue #18
thanks.

Buffer type compute timer

I notice that dhall-buffer-type-compute-timeris run after every change to set a variable that is used in the header line. This seems like it isn't needed when dhall-use-header-line is nil because it won't be displayed anywhere. In fact, even on moderately large files, type computing can be really expensive and make the buffer unusable. It seems to me this timer should not even be run if the type won't be used.

Also a lower priority but it seems like there could be some control over the debouncing feature you have which is currently hardcoded to 1 second right now for cases when you do want the type but you don't want to run it as frequently so it doesn't lock up the editor.

Let me know if you'd be amenable to these changes. I'm not an elisp expert but I could give it a shot.

Auto-reformatting nukes comments

I'm loving dhall-mode so far, thank you for it. The auto-reformatting is very convenient, but I've noticed that it's a bit over-zealous when it comes to comments. Comments at the very top of the file seem to stick around, but formatting will remove any others. This makes it hard to annotate type fields, etc.

Is there any way around this? Thank you.

Highlighting issue

The code

''
"''${FOO}"
bar
''

Isn't getting highlighted properly. The bar should still be inside the string.

Option to jump to definitions?

Short of digging into dhall-lsp-server, the cheapest option I could find to hop between files was:

(defun jump-to-file-at-point ()
  (interactive)
  (ring-insert find-tag-marker-ring (point-marker))
  (find-file-at-point))

option to show Type of file in `header-line`

The type of the expression in a file can be captured with a command like

dhall --plain <<< $file 2>&1 >/dev/null

This can be used in header-line-format to always display the type at the top of the window.

It should also display a reasonable message when 1. there is an error or 2. the type is too large[†].

(I might do this myself, but wanted to open the issue as a reminder until I get to it.)

[†]: Maybe some day there will be a way to acquire a shorter type without it expanding all the aliases and imports along the way.

dhall resolve is redundant?

I have a massive dhall configuration that takes almost 30 seconds to "type check" in emacs, but only takes a few seconds to type check when loading into my application.

Upon further investigation, it looks like the command this mode runs is cat <buffer> | dhall resolve | dhall type. Why is resolve necessary? My understanding of this pipeline is that it will read dhall expression, replace all imports with their dhall expressions, and then get the type of this expression. dhall type appears follow imports on its own when evaluating the type, thus skipping the creation of a potentially huge expression.

I did some quick benchmarks on my own data, and (at least in my case) taking out the resolve step results in the exact same output with 11.5x speedup:

> time cat main.dhall | dhall resolve | dhall type > /tmp/both.out
cat main.dhall  0.00s user 0.00s system 82% cpu 0.003 total
dhall resolve  4.96s user 0.22s system 99% cpu 5.181 total
dhall type > /tmp/both.out  21.89s user 0.47s system 81% cpu 27.423 total

> time cat main.dhall | dhall type > /tmp/type.out
cat main.dhall  0.00s user 0.00s system 82% cpu 0.004 total
dhall type > /tmp/type.out  2.43s user 0.15s system 99% cpu 2.592 total

> diff /tmp/both.out /tmp/type.out
<nothing>

> dhall --version
1.41.2

Make error buffer optional

Hi! I've been using and enjoying dhall-mode but I was wondering if it would be possible to add an option that when toggled on would suppress the dhall error buffer. It replaces one of the existing buffers if you have multiple buffers per window and it can be kind of disruptive to your workflow. In the mean time I'm planning on wrangling the buffer with popwin so that it always creates a new buffer that can be easily dismissed, e.g. ("*dhall errors*" :height 10 :noselect t :stick t :tail nil)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.