我在C#代码上使用Flymake,在Windows上使用emacs v22.2.1.
Flymake的东西一直很适合我.对于那些不知道的人,您可以阅读flymake的概述,但快速的故事是,flymake重复构建您当前正在后台处理的源文件,以进行语法检查.然后,它会突出显示当前缓冲区中的编译器警告和错误.
Flymake最初并不适用于C#,但是我"修补了它",现在效果很好.如果您在emacs中编辑C#,我强烈建议您使用flymake.
我唯一的问题是UI.Flymake很好地突出显示错误和警告,然后使用包含完整错误或警告文本的工具提示插入"叠加".如果我将鼠标指针悬停在代码中突出显示的行上,则会弹出叠加工具提示.
替代文字http://i42.tinypic.com/qqu0ja.jpg
但正如您所看到的,叠加工具提示已被剪裁,并且无法正确显示.
Flymake似乎正在做正确的事情,它是覆盖部分似乎被打破.,叠加似乎做对了.这是错误显示的工具提示.
不要覆盖提示在Emacs的Windows正常工作?
我在哪里解决这个问题?
经过一些研究,我发现效果可以证明 (tooltip-show really-long-string)
它与叠加层或flymake无关.
我用tooltip-show上的defadvice解决了这个问题.
;; Reforms a single-line string ARG to a multi-line string with a max
;; of LIMIT chars on a line.
;;
;; This is intended to solve a problem with the display of tooltip text
;; in emacs on Win32 - which is that the tooltip is extended to be very very
;; long, and the final line is clipped.
;;
;; The solution is to split the text into multiple lines, and to add a
;; trailing newline to trick the tooltip logic into doing the right thing.
;;
(defun cheeso-reform-string (limit arg)
(let ((orig arg) (modified "") (curline "") word
(words (split-string arg " ")))
(while words
(progn
(setq curline "")
(while (and words (< (length curline) limit))
(progn
(setq word (car words))
(setq words (cdr words))
(setq curline (concat curline " " word))))
(setq modified (concat modified curline "\n"))))
(setq modified (concat modified " \n")))
)
(defadvice tooltip-show (before
flymake-csharp-fixup-tooltip
(arg &optional use-echo-area)
activate compile)
(progn
(if (and (not use-echo-area)
(eq major-mode 'csharp-mode))
(let ((orig (ad-get-arg 0)))
(ad-set-arg 0 (cheeso-reform-string 72 orig))
))))
Run Code Online (Sandbox Code Playgroud)
结果:
替代文字http://i41.tinypic.com/1zoylg8.jpg
| 归档时间: |
|
| 查看次数: |
552 次 |
| 最近记录: |