在Clojurescript中定位不匹配的定界符 [英] Locating unmatched delimiters in Clojurescript

查看:71
本文介绍了在Clojurescript中定位不匹配的定界符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有时我会遇到大括号,括号或方括号不匹配的情况:Clojurescript中的 {}()[] .我正在使用 leininingen cljsbuild ,我很难跟踪错误源.通常,它归结为这样的东西:

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:

编译"resources/public/js/whitespace.js"失败.第1行的clojure.lang.ExceptionInfo:java.lang.RuntimeException:不匹配的定界符:)

随后是一个广泛的堆栈跟踪,该跟踪似乎不包含文件名和行号信息.

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

如何获取更多有用的信息?

How can I get more useful information?

到目前为止,我的解决方法

  • 使用版本控制来查找文件及其以前状态的差异.然后查看括号在哪里更改.

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

使用vim的匹配项,广泛匹配进行营救.

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

推荐答案

您可以在键入时使用Paredit模式保持S表达式平衡.在Emacs中,如果文件中的表达式不匹配,此模式还会警告您.

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.

有一个vim插件提供了vim的Paredit模式,请在此处查看: https://github.com/vim-scripts/paredit.vim .

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

这篇关于在Clojurescript中定位不匹配的定界符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆