Вопрос

Occasionally I find myself in a situation where I mismatch curly braces, parenthesis or square brackets: {}()[] in Clojurescript. I am using leininingen and cljsbuild I have a hard time tracking down the error source. Usually it boils down to something like this:

Compiling "resources/public/js/whitespace.js" failed. clojure.lang.ExceptionInfo: java.lang.RuntimeException: Unmatched delimiter: ) at line 1

Followed by a extensive stack trace that does not seem to contain filename, line-number information.

How can I get more useful information?

My workaround so far

  • use version control to look for differences of files and their previous states. Then see where brackets where changed.

  • use vim's parens matching extensively % to the rescue.

Это было полезно?

Решение

You can use Paredit Mode to keep the S-expressions balanced while you type. In Emacs this Mode also warns you if you have an unmatched expression in a file.

There is a vim plugin that provides a Paredit Mode for vim, take a look here: https://github.com/vim-scripts/paredit.vim.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top