[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)
|
(interactive)
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(goto-char (point-min))
|
(goto-char (point-min))
|
||||||
(remove-overlays (point-min) (point-max) 'oni-csharp--overlayp t)
|
|
||||||
(while (re-search-forward
|
(while (re-search-forward
|
||||||
(rx bol
|
(rx bol
|
||||||
(zero-or-more whitespace)
|
(zero-or-more whitespace)
|
||||||
"{"
|
(group
|
||||||
(group (minimal-match (one-or-more (or alphanumeric "-"))))
|
"{"
|
||||||
"} = {"
|
(group (minimal-match (one-or-more (or alphanumeric "-"))))
|
||||||
(group (minimal-match (one-or-more (or alphanumeric "-"))))
|
"}")
|
||||||
"}"
|
" = "
|
||||||
|
(group
|
||||||
|
"{"
|
||||||
|
(group (minimal-match (one-or-more (or alphanumeric "-"))))
|
||||||
|
"}")
|
||||||
eol)
|
eol)
|
||||||
nil
|
nil
|
||||||
:noerror)
|
:noerror)
|
||||||
(let ((current-overlay (make-overlay (line-beginning-position) (line-end-position))))
|
(add-text-properties
|
||||||
(overlay-put current-overlay 'after-string
|
(match-beginning 1) (match-end 1)
|
||||||
(propertize (format " => %s" (gethash (match-string 1) oni-csharp--projects))
|
(list 'display (gethash (match-string 2) oni-csharp--projects)
|
||||||
'face '(:foreground "#808080")))
|
'face 'font-lock-variable-name-face
|
||||||
(overlay-put current-overlay 'oni-csharp--overlayp t)
|
'help-echo (buffer-substring-no-properties
|
||||||
(overlay-put current-overlay 'evaporate t)))))
|
(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"
|
(define-derived-mode csharp-solution-mode prog-mode "Sln"
|
||||||
"A major mode for viewing and editing C# ‘.sln’ files."
|
"A major mode for viewing and editing C# ‘.sln’ files."
|
||||||
|
|
Loading…
Reference in a new issue