unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#59968: [PATCH] Add "->" to python--treesit-operators
       [not found] <m1bko9nbgf.fsf.ref@yahoo.es>
@ 2022-12-11 16:37 ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-12-14  1:53   ` Yuan Fu
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-12-11 16:37 UTC (permalink / raw)
  To: 59968

[-- Attachment #1: Type: text/plain, Size: 206 bytes --]

Tags: patch


Python has a "->" operator to specify the return type of functions.
For example:

def add(a: int, b: int) -> int:
    return a + b

The following patch adds support for it in python-ts-mode.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Add-to-python-treesit-operators.patch --]
[-- Type: text/patch, Size: 1032 bytes --]

From 18b8e2e2719726f8f7c06f8374b39b51e15c42b2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Daniel=20Mart=C3=ADn?= <mardani29@yahoo.es>
Date: Sun, 11 Dec 2022 17:33:13 +0100
Subject: [PATCH] Add "->" to python--treesit-operators

* lisp/progmodes/python.el (python--treesit-operators): Add "->", used
to specify the return types of functions in Python.
---
 lisp/progmodes/python.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index ebee703499..0e0898ffe2 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -993,7 +993,8 @@ python--treesit-constants
 
 (defvar python--treesit-operators
   '("-" "-=" "!=" "*" "**" "**=" "*=" "/" "//" "//=" "/=" "&" "%" "%="
-    "^" "+" "+=" "<" "<<" "<=" "<>" "=" "==" ">" ">=" ">>" "|" "~" "@" "@="))
+    "^" "+" "->" "+=" "<" "<<" "<=" "<>" "=" ":=" "==" ">" ">=" ">>" "|"
+    "~" "@" "@="))
 
 (defvar python--treesit-special-attributes
   '("__annotations__" "__closure__" "__code__"
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* bug#59968: [PATCH] Add "->" to python--treesit-operators
  2022-12-11 16:37 ` bug#59968: [PATCH] Add "->" to python--treesit-operators Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-12-14  1:53   ` Yuan Fu
  0 siblings, 0 replies; 2+ messages in thread
From: Yuan Fu @ 2022-12-14  1:53 UTC (permalink / raw)
  To: Daniel Martín; +Cc: 59968-done


Daniel Martín <mardani29@yahoo.es> writes:

> Tags: patch
>
>
> Python has a "->" operator to specify the return type of functions.
> For example:
>
> def add(a: int, b: int) -> int:
>     return a + b
>
> The following patch adds support for it in python-ts-mode.

Applied, thanks!

Yuan





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-12-14  1:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <m1bko9nbgf.fsf.ref@yahoo.es>
2022-12-11 16:37 ` bug#59968: [PATCH] Add "->" to python--treesit-operators Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-14  1:53   ` Yuan Fu

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).