<commit_before>;;; eglot-conf.el -- Settings for eglot
;;
;;; Commentary:
;;
;;; Code:
(require 'eglot)

(custom-set-variables
 '(eglot-auto-display-help-buffer nil)
 '(eglot-autoshutdown t))

(defvar pjones:eglot-doc-cleanup
  (list
   (list (rx (and "```haskell" ?\n (1+ (not (any ?:))) ?\n ":: ")
             (group (1+ (not (any ?`)))) ?\n "```") "`\\1`")
   (list (rx (1+ ?* (1+ (in space)))) "")
   (list (rx (and bol ?* ?\n)) ""))
  "List of regular expressions and replacement strings.
Used for cleaning up LSP server docs.")

(defun pjones:eglot-apply-doc-cleanup (string)
  "Clean STRING according to `pjones:eglot-doc-cleanup'."
  (let ((result string))
    (dolist (pat pjones:eglot-doc-cleanup)
      (while (string-match (car pat) result)
          (setq result (replace-match (cadr pat) nil nil result))))
    result))

(defun pjones:eglot--format-markup-advice (orig markup)
  "Clean docs from naughty LSP servers.
Call ORIG after modifying MARKUP"
  (let ((clean (pjones:eglot-apply-doc-cleanup (plist-get markup :value))))
    (apply orig (list (plist-put markup :value clean)))))
(advice-add
 'eglot--format-markup
 :around #'pjones:eglot--format-markup-advice)

(defun pjones:eglot--snippet-expansion-fn ()
  "Keep eglot from using yasnippet."
  nil)
(advice-add
 'eglot--snippet-expansion-fn
 :override #'pjones:eglot--snippet-expansion-fn)

;;; eglot-conf.el ends here
<commit_msg>eglot: Remove deprecated options and dead code<commit_after>;;; eglot-conf.el -- Settings for eglot
;;
;;; Commentary:
;;
;;; Code:
(require 'eglot)

(custom-set-variables
 '(eglot-autoshutdown t))

(defun pjones:eglot--snippet-expansion-fn ()
  "Keep eglot from using yasnippet."
  nil)
(advice-add
 'eglot--snippet-expansion-fn
 :override #'pjones:eglot--snippet-expansion-fn)

;;; eglot-conf.el ends here

{'fraction_non_alphanumeric': 0.1793598233995585, 'fraction_numerical': 0.0027593818984547464, 'mean_word_length': 3.967123287671233, 'pattern_counts': {'":': 1, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2598671', 'n_tokens_mistral': 706, 'n_tokens_neox': 693, 'n_words': 165}