[oni-csharp] Use text properties instead of overlays
Use text properties instead of overlays and add some extra information.
This commit is contained in:
parent
7e5e8c1ce4
commit
4a8c54f922
1 changed files with 22 additions and 12 deletions
|
@ -186,24 +186,34 @@ _cs_: Solution
|
|||
(interactive)
|
||||
(save-excursion
|
||||
(goto-char (point-min))
|
||||
(remove-overlays (point-min) (point-max) 'oni-csharp--overlayp t)
|
||||
(while (re-search-forward
|
||||
(rx bol
|
||||
(zero-or-more whitespace)
|
||||
(group
|
||||
"{"
|
||||
(group (minimal-match (one-or-more (or alphanumeric "-"))))
|
||||
"} = {"
|
||||
"}")
|
||||
" = "
|
||||
(group
|
||||
"{"
|
||||
(group (minimal-match (one-or-more (or alphanumeric "-"))))
|
||||
"}"
|
||||
"}")
|
||||
eol)
|
||||
nil
|
||||
:noerror)
|
||||
(let ((current-overlay (make-overlay (line-beginning-position) (line-end-position))))
|
||||
(overlay-put current-overlay 'after-string
|
||||
(propertize (format " => %s" (gethash (match-string 1) oni-csharp--projects))
|
||||
'face '(:foreground "#808080")))
|
||||
(overlay-put current-overlay 'oni-csharp--overlayp t)
|
||||
(overlay-put current-overlay 'evaporate t)))))
|
||||
(add-text-properties
|
||||
(match-beginning 1) (match-end 1)
|
||||
(list 'display (gethash (match-string 2) oni-csharp--projects)
|
||||
'face 'font-lock-variable-name-face
|
||||
'help-echo (buffer-substring-no-properties
|
||||
(match-beginning 1) (match-end 1))
|
||||
'intangile nil))
|
||||
(add-text-properties
|
||||
(match-beginning 3) (match-end 3)
|
||||
(list 'display (gethash (match-string 4) oni-csharp--projects)
|
||||
'face 'font-lock-variable-name-face
|
||||
'help-echo (buffer-substring-no-properties
|
||||
(match-beginning 3) (match-end 3)))))))
|
||||
|
||||
(define-derived-mode csharp-solution-mode prog-mode "Sln"
|
||||
"A major mode for viewing and editing C# ‘.sln’ files."
|
||||
|
|
Loading…
Reference in a new issue