From 2f003402d3840f1040db6facc76fdba1517550a5 Mon Sep 17 00:00:00 2001 From: Ohad Livne Date: Wed, 4 Jun 2025 22:45:51 +0300 Subject: [PATCH] Add docstrings --- .config/emacs/init.el | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.config/emacs/init.el b/.config/emacs/init.el index 81d2a3b..adafc3e 100644 --- a/.config/emacs/init.el +++ b/.config/emacs/init.el @@ -151,13 +151,14 @@ (use-package poetry) (defun load-python-env () - "Set up the Python IDE in the current project" + "Set up the Python IDE in the current project." (interactive) (progn (poetry-venv-workon) (lsp))) (defun symbols-at-point () + "Utility function to get the hierarchy of the object at point." (let* ((lsp--document-symbols-request-async t) (symbols (lsp--get-document-symbols)) (symbols-hierarchy (lsp--symbols->document-symbols-hierarchy symbols))) @@ -166,6 +167,7 @@ symbols-hierarchy))) (defun python-test-at-point () + "Use LSP to identify the test at point." (let ((symbols (symbols-at-point))) (pcase symbols (`((,class "Class") (,method "Method") . ,_) @@ -176,11 +178,14 @@ (_ ())))) (defun python-test-name-at-point () + "Create a unittest-compatible descriptor for the test at point." (let* ((path (mapcar #'substring-no-properties lsp-headerline--path-up-to-project-segments)) (filename (f-no-ext (f-filename (buffer-file-name))))) (string-join (append path (list filename) (python-test-at-point)) "."))) (defun python-run-test-at-point (debug) + "Identify and run the test at point. +When DEBUG is set, run the test in the debugger." (interactive "P") (let ((python (or (executable-find "python3") (executable-find "python")))