Compare commits

...

2 Commits

Author SHA1 Message Date
Gerard Vermeulen
a60623b44c Fix typos and minor editing 2022-12-27 10:47:33 +01:00
Gerard Vermeulen
85d644c68a Add Python snippets for YASnippets 2022-12-27 10:45:55 +01:00
7 changed files with 69 additions and 3 deletions

View File

@ -3853,7 +3853,7 @@ mode independent [[https://github.com/joaotavora/eglot][Eglot]] configuration:
;; Replace `nil' with `t' for debugging.
(when nil
(defvar eglot-server-programs
`((python-mode . ("pylsp" "-vvv")))
`(((python-ts-mod python-mode) . ("pylsp" "-vv")))
"Shadow the definition of `eglot-server-programs' in `eglot'."))
(with-eval-after-load 'eglot
@ -4653,7 +4653,7 @@ or to increase the verbosity of [[https://github.com/python-lsp/python-lsp-serve
(with-eval-after-load 'eglot
(setq-default
eglot-workspace-configuration
;; Enable the `:pyls_ruff' plugin and ensure to disable the
;; Enable the `:pylsp_ruff' plugin and ensure to disable the
;; `:flake8', `:mccabe', and `:pycodestye' plugins.
'(:pylsp (:plugins
(:pylsp_ruff
@ -4708,7 +4708,7 @@ or to increase the verbosity of [[https://github.com/python-lsp/python-lsp-serve
;; to launch eglot automatically.
((nil ;; nil, since Emacs-29.1 filters out irrelevant variable names.
. ((eglot-workspace-configuration
;; Enable the `:pyls_ruff' plugin and ensure to disable the
;; Enable the `:pylsp_ruff' plugin and ensure to disable the
;; `:flake8', `:mccabe', and `:pycodestye' plugins.
. (:pylsp (:plugins
(:pylsp_ruff

View File

@ -0,0 +1,12 @@
# -*- coding: utf-8 -*-
# Uses .yas-setup.el.
# name : base class
# key : bcls
# expand-env: ((yas-indent-line 'fixed))
# --
class ${1:ClassName}:
"""${2:XXX}.${3:$(python-arguments-to-doc-string)}"""
def __init__(self, $3):
${3:$(python-arguments-to-self-init-string)}$0pass

View File

@ -0,0 +1,8 @@
# -*- coding: utf-8 -*-
# Uses .yas-setup.el.
# name : def function
# key : deff
# --
def ${1:name}($2):
"""${3:XXX.}${2:$(python-arguments-to-doc-string)}"""
$0pass

View File

@ -0,0 +1,9 @@
# -*- coding: utf-8 -*-
# Uses .yas-setup.el.
# name : def method
# key : defm
# --
def ${1:name}(self$2):
"""${3:XXX.}${2:$(python-arguments-to-doc-string)}"""
$0pass

View File

@ -0,0 +1,12 @@
# -*- coding: utf-8 -*-
# Uses .yas-setup.el.
# name : derived class
# key : dcls
# expand-env: ((yas-indent-line 'fixed))
# --
class ${1:ClassName}(${2:object}):
"""${3:XXX}.${4:$(python-arguments-to-doc-string)}"""
def __init__(self, $4):
${4:$(python-arguments-to-self-init-string)}$0pass

View File

@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
# name : program
# key : program
# expand-env : ((yas-indent-line 'fixed))
# --
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""${1:XXX}."""
import numpy
def main():
"""${2:XXX}."""
$0pass
if __name__ == '__main__':
main()
# Local Variables:
# mode: python
# End:

View File

@ -0,0 +1,2 @@
python-mode