diff --git a/code/elpa/helm-xref-20211017.1334/helm-xref-autoloads.el b/code/elpa/helm-xref-20211017.1334/helm-xref-autoloads.el new file mode 100644 index 0000000..ebce63c --- /dev/null +++ b/code/elpa/helm-xref-20211017.1334/helm-xref-autoloads.el @@ -0,0 +1,47 @@ +;;; helm-xref-autoloads.el --- automatically extracted autoloads -*- lexical-binding: t -*- +;; +;;; Code: + +(add-to-list 'load-path (directory-file-name + (or (file-name-directory #$) (car load-path)))) + + +;;;### (autoloads nil "helm-xref" "helm-xref.el" (0 0 0 0)) +;;; Generated autoloads from helm-xref.el + +(autoload 'helm-xref-show-xrefs "helm-xref" "\ +Function to display XREFS. + +Needs to be set the value of `xref-show-xrefs-function'. + +\(fn XREFS ALIST)" nil nil) + +(autoload 'helm-xref-show-xrefs-27 "helm-xref" "\ +Function to display XREFS. + +Needs to be set the value of `xref-show-xrefs-function'. + +\(fn FETCHER ALIST)" nil nil) + +(autoload 'helm-xref-show-defs-27 "helm-xref" "\ +Function to display list of definitions. + +\(fn FETCHER ALIST)" nil nil) + +(if (< emacs-major-version 27) (setq xref-show-xrefs-function 'helm-xref-show-xrefs) (progn (setq xref-show-xrefs-function 'helm-xref-show-xrefs-27) (setq xref-show-definitions-function 'helm-xref-show-defs-27))) + +(register-definition-prefixes "helm-xref" '("helm-xref-")) + +;;;*** + +;;;### (autoloads nil nil ("helm-xref-pkg.el") (0 0 0 0)) + +;;;*** + +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; coding: utf-8 +;; End: +;;; helm-xref-autoloads.el ends here diff --git a/code/elpa/helm-xref-20211017.1334/helm-xref-pkg.el b/code/elpa/helm-xref-20211017.1334/helm-xref-pkg.el new file mode 100644 index 0000000..15a9a2a --- /dev/null +++ b/code/elpa/helm-xref-20211017.1334/helm-xref-pkg.el @@ -0,0 +1,13 @@ +(define-package "helm-xref" "20211017.1334" "Helm interface for xref results" + '((emacs "25.1") + (helm "1.9.4")) + :commit "ea0e4ed8a9baf236e4085cbc7178241f109a53fa" :authors + '(("Fritz Stelzer" . "brotzeitmacher@gmail.com")) + :maintainers + '(("Fritz Stelzer" . "brotzeitmacher@gmail.com")) + :maintainer + '("Fritz Stelzer" . "brotzeitmacher@gmail.com") + :url "https://github.com/brotzeit/helm-xref") +;; Local Variables: +;; no-byte-compile: t +;; End: diff --git a/code/elpa/helm-xref-20211017.1334/helm-xref.el b/code/elpa/helm-xref-20211017.1334/helm-xref.el new file mode 100644 index 0000000..40752b7 --- /dev/null +++ b/code/elpa/helm-xref-20211017.1334/helm-xref.el @@ -0,0 +1,200 @@ +;;; helm-xref.el --- Helm interface for xref results -*- lexical-binding: t -*- + +;; Copyright (C) 2017 Fritz Stelzer + +;; Author: Fritz Stelzer +;; URL: https://github.com/brotzeit/helm-xref +;; Version: 1.0 +;; Package-Requires: ((emacs "25.1") (helm "1.9.4")) + +;;; License: +;; +;; This program is free software; you can redistribute it and/or +;; modify it under the terms of the GNU General Public License +;; as published by the Free Software Foundation; either version 3 +;; of the License, or (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;;; Contributors: +;; Sanjeev Sivasankaran in 2019 changed font-face. + +;;; Code: + +(require 'helm) +(require 'helm-utils) +(require 'xref) +(require 'cl-seq) + +(defvar helm-xref-alist nil + "Holds helm candidates.") + +(defgroup helm-xref nil + "Xref with helm." + :prefix "helm-xref-" :group 'helm) + +(defface helm-xref-file-name + '((t (:inherit 'font-lock-builtin-face))) + "Face for xref file name" + :group 'helm-xref) + +(defface helm-xref-line-number + '((t (:inherit 'helm-grep-lineno))) + "Face for xref line number" + :group 'helm-xref) + +(defcustom helm-xref-candidate-formatting-function 'helm-xref-format-candidate-short + "Select the function for candidate formatting." + :type '(radio + (function-item helm-xref-format-candidate-short) + (function-item helm-xref-format-candidate-full-path) + (function-item helm-xref-format-candidate-long) + function) + :group 'helm-xref) + +(defcustom helm-xref-input "" + "Initial input in Helm." + :type 'string + :group 'helm-xref) + +(defun helm-xref-candidates-26 (xrefs) + "Convert XREF-ALIST items to helm candidates and add them to `helm-xref-alist'." + (dolist (xref xrefs) + (let* ((summary (xref-item-summary xref)) + (location (xref-item-location xref)) + (line (xref-location-line location)) + (file (xref-location-group location)) + candidate) + (setq candidate + (funcall helm-xref-candidate-formatting-function file line summary)) + (push (cons candidate xref) helm-xref-alist))) + (setq helm-xref-alist (reverse helm-xref-alist))) + +(defun helm-xref-candidates-27 (fetcher alist) + "Convert XREF-ALIST items to helm candidates and add them to `helm-xref-alist'." + (cl-assert (functionp fetcher)) + (let* ((xrefs + (or + (assoc-default 'fetched-xrefs alist) + (funcall fetcher)))) + (dolist (xref xrefs) + (let* ((summary (xref-item-summary xref)) + (location (xref-item-location xref)) + (line (xref-location-line location)) + (file (xref-location-group location)) + candidate) + (setq candidate + (funcall helm-xref-candidate-formatting-function file line summary)) + (push (cons candidate xref) helm-xref-alist)))) + (setq helm-xref-alist (reverse helm-xref-alist))) + +(defun helm-xref-format-candidate-short (file line summary) + "Build short form of candidate format with FILE, LINE, and SUMMARY." + (concat + (propertize (car (reverse (split-string file "\\/"))) + 'font-lock-face 'helm-xref-file-name) + (when (string= "integer" (type-of line)) + (concat + ":" + (propertize (int-to-string line) + 'font-lock-face 'helm-xref-line-number))) + ":" + summary)) + +(defun helm-xref-format-candidate-full-path (file line summary) + "Same as `helm-xref-format-candidate-short', but display entire path." + (concat + (propertize file 'font-lock-face 'helm-xref-file-name) + (when (string= "integer" (type-of line)) + (concat + ":" + (propertize (int-to-string line) + 'font-lock-face 'helm-xref-line-number))) + ":" + summary)) + +(defun helm-xref-format-candidate-long (file line summary) + "Use two lines for each candidate. One contains the path and the other the actual candidate." + (concat + (propertize file 'font-lock-face 'helm-xref-file-name) + (when (string= "integer" (type-of line)) + (concat + "\n:" + (propertize (int-to-string line) + 'font-lock-face 'helm-xref-line-number))) + ":" + summary)) + +(defun helm-xref-goto-xref-item (item func) + "Set buffer and point according to xref-item ITEM. + +Use FUNC to display buffer." + (let* ((summary (xref-item-summary item)) + (location (xref-item-location item)) + (marker (xref-location-marker location)) + (buf (marker-buffer marker)) + (offset (marker-position marker))) + (switch-to-buffer buf) + (goto-char offset) + (funcall func buf))) + +(defun helm-xref-source () + "Return a `helm' source for xref results." + (helm-build-sync-source "Helm Xref" + :candidates helm-xref-alist + :persistent-action (lambda (item) + (helm-xref-goto-xref-item + item '(lambda (buf) (helm-highlight-current-line)))) + :action '(("Switch to buffer" . (lambda (item) (helm-xref-goto-xref-item item 'switch-to-buffer))) + ("Other window" . (lambda (item) (helm-xref-goto-xref-item item 'switch-to-buffer-other-window)))) + :candidate-number-limit 9999)) + +;;;###autoload +(defun helm-xref-show-xrefs (xrefs _alist) + "Function to display XREFS. + +Needs to be set the value of `xref-show-xrefs-function'." + (setq helm-xref-alist nil) + (helm-xref-candidates-26 xrefs) + (helm :sources (helm-xref-source) + :truncate-lines t + :input helm-xref-input + :buffer "*helm-xref*")) + +;;;###autoload +(defun helm-xref-show-xrefs-27 (fetcher alist) + "Function to display XREFS. + +Needs to be set the value of `xref-show-xrefs-function'." + (setq helm-xref-alist nil) + (helm-xref-candidates-27 fetcher alist) + (helm :sources (helm-xref-source) + :truncate-lines t + :buffer "*helm-xref*")) + +;;;###autoload +(defun helm-xref-show-defs-27 (fetcher alist) + "Function to display list of definitions." + (let ((xrefs (funcall fetcher))) + (cond + ((not (cdr xrefs)) + (xref-pop-to-location (car xrefs) + (assoc-default 'display-action alist))) + (t + (helm-xref-show-xrefs-27 fetcher + (cons (cons 'fetched-xrefs xrefs) + alist)))))) + +;;;###autoload +(progn + (if (< emacs-major-version 27) + (setq xref-show-xrefs-function 'helm-xref-show-xrefs) + (progn + (setq xref-show-xrefs-function 'helm-xref-show-xrefs-27) + (setq xref-show-definitions-function 'helm-xref-show-defs-27)))) + +(provide 'helm-xref) +;;; helm-xref.el ends here diff --git a/code/elpa/lsp-origami-20211016.1045/lsp-origami-autoloads.el b/code/elpa/lsp-origami-20211016.1045/lsp-origami-autoloads.el new file mode 100644 index 0000000..223d635 --- /dev/null +++ b/code/elpa/lsp-origami-20211016.1045/lsp-origami-autoloads.el @@ -0,0 +1,48 @@ +;;; lsp-origami-autoloads.el --- automatically extracted autoloads -*- lexical-binding: t -*- +;; +;;; Code: + +(add-to-list 'load-path (directory-file-name + (or (file-name-directory #$) (car load-path)))) + + +;;;### (autoloads nil "lsp-origami" "lsp-origami.el" (0 0 0 0)) +;;; Generated autoloads from lsp-origami.el + +(autoload 'lsp-origami-try-enable "lsp-origami" "\ +Turn on `origami-mode' locally and try to enable `lsp-origami-mode'." t nil) + +(autoload 'lsp-origami-mode "lsp-origami" "\ +Toggle code folding support for origami. + +This is a minor mode. If called interactively, toggle the +`Lsp-Origami mode' mode. If the prefix argument is positive, +enable the mode, and if it is zero or negative, disable the mode. + +If called from Lisp, toggle the mode if ARG is `toggle'. Enable +the mode if ARG is nil, omitted, or is a positive number. +Disable the mode if ARG is a negative number. + +To check whether the minor mode is enabled in the current buffer, +evaluate `lsp-origami-mode'. + +The mode's hook is called both when the mode is enabled and when +it is disabled. + +\(fn &optional ARG)" t nil) + +(register-definition-prefixes "lsp-origami" '("lsp-origami--")) + +;;;*** + +;;;### (autoloads nil nil ("lsp-origami-pkg.el") (0 0 0 0)) + +;;;*** + +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; coding: utf-8 +;; End: +;;; lsp-origami-autoloads.el ends here diff --git a/code/elpa/lsp-origami-20211016.1045/lsp-origami-pkg.el b/code/elpa/lsp-origami-20211016.1045/lsp-origami-pkg.el new file mode 100644 index 0000000..bfe187d --- /dev/null +++ b/code/elpa/lsp-origami-20211016.1045/lsp-origami-pkg.el @@ -0,0 +1,15 @@ +(define-package "lsp-origami" "20211016.1045" "origami.el support for lsp-mode" + '((origami "1.0") + (lsp-mode "6.1")) + :commit "5b88ab77dc2696c93fa5dd9debe183821c533b71" :authors + '(("Vibhav Pant")) + :maintainers + '(("Vibhav Pant")) + :maintainer + '("Vibhav Pant") + :keywords + '("languages" "lsp-mode") + :url "https://github.com/emacs-lsp/lsp-origami") +;; Local Variables: +;; no-byte-compile: t +;; End: diff --git a/code/elpa/lsp-origami-20211016.1045/lsp-origami.el b/code/elpa/lsp-origami-20211016.1045/lsp-origami.el new file mode 100644 index 0000000..f4016cb --- /dev/null +++ b/code/elpa/lsp-origami-20211016.1045/lsp-origami.el @@ -0,0 +1,88 @@ +;;; lsp-origami.el --- origami.el support for lsp-mode -*- lexical-binding: t; -*- + +;; Copyright (C) 2019-2020 Vibhav Pant + +;; Author: Vibhav Pant +;; Version: 1.0.0 +;; Keywords: languages lsp-mode +;; Package-Requires: ((origami "1.0") (lsp-mode "6.1")) +;; URL: https://github.com/emacs-lsp/lsp-origami + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . + +;;; Commentary: + +;; lsp-origami provides support for origami.el using language server +;; protocol's "textDocument/foldingRange" functionality. It can be enabled +;; with +;; (require 'lsp-origami) +;; (add-hook 'lsp-after-open-hook #'lsp-origami-try-enable) + +;;; Code: + +(require 'origami) +(require 'lsp-mode) + +(defun lsp-origami--folding-range-to-fold (range create) + "Using the components of RANGE as arguments, execute the CREATE callback." + (funcall create + (lsp--folding-range-beg range) + (lsp--folding-range-end range) + 0 + (seq-map + (lambda (range) (lsp-origami--folding-range-to-fold range create)) + (seq-remove (lambda (child-range) + (or (eq (lsp--folding-range-beg child-range) + (lsp--folding-range-beg range)) + (eq (lsp--folding-range-end child-range) + (lsp--folding-range-end range)))) + (lsp--folding-range-children range))))) + + +(defun lsp-origami--parser (create) + "Get a list of Folding Ranges for the current buffer, with CREATE as the origami callback." + (lambda (_content) + (unless (lsp-feature? "foldingRangeProvider") + (signal 'lsp-capability-not-supported (list "foldingRangeProvider"))) + (seq-map (lambda (range) + (lsp-origami--folding-range-to-fold range create)) + (lsp--get-nested-folding-ranges)))) + +;;;###autoload +(defun lsp-origami-try-enable () + "Turn on `origami-mode' locally and try to enable `lsp-origami-mode'." + (interactive) + (origami-mode 1) + (cond ((lsp-feature? "textDocument/foldingRange") + (lsp-origami-mode 1)) + ((called-interactively-p 'any) + (signal 'lsp-capability-not-supported (list "foldingRangeProvider"))) + (t + (lsp-log "This server does not support foldingRangeProvider")))) + +;;;###autoload +(define-minor-mode lsp-origami-mode + "Toggle code folding support for origami." + :group 'lsp-origami + :global nil + (cond + (lsp-origami-mode + (setq-local origami-fold-style 'lsp-mode) + (setq-local origami-parser-alist + (cons '(lsp-mode . lsp-origami--parser) origami-parser-alist))) + (t + (setq-local origami-fold-style nil)))) + +(provide 'lsp-origami) +;;; lsp-origami.el ends here diff --git a/code/init.el b/code/init.el index d55f493..62ca7f3 100644 --- a/code/init.el +++ b/code/init.el @@ -73,7 +73,7 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; additional packages (add-to-list 'package-selected-packages - '(json-mode python-mode powershell rust-mode origami go-mode yaml-mode lua-mode) + '(helm-lsp lsp-ui lsp-mode json-mode python-mode powershell rust-mode origami go-mode yaml-mode lua-mode) ) (when (not kmn/is-dayjob) (add-to-list 'package-selected-packages