From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Theodor Thornhill via "Emacs development discussions." Newsgroups: gmane.emacs.devel Subject: Re: Rename Tree-sitter major modes from "ts" to "treesit" (was Re: tree-sitter version?) Date: Fri, 25 Nov 2022 21:13:43 +0100 Message-ID: <877czin66g.fsf@thornhill.no> References: <70973BD9-26D2-4833-A429-8434FC03026B@gmail.com> <87cz9cevns.fsf@gnu.org> <8B97AC7B-54CF-41AC-9EF7-0A83F1709B98@gmail.com> <25472.55895.937365.654317@retriever.mtv.corp.google.com> <1DE461FE-EE92-4593-8191-0738D5B6640C@thornhill.no> <831qpqvn58.fsf@gnu.org> <87tu2m6c20.fsf@thornhill.no> Reply-To: Theodor Thornhill Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11473"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org, mardani29@yahoo.es, raman@google.com, casouri@gmail.com, tsdh@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Nov 25 21:14:56 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oyf68-0002h5-1f for ged-emacs-devel@m.gmane-mx.org; Fri, 25 Nov 2022 21:14:56 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oyf5C-0007a8-VZ; Fri, 25 Nov 2022 15:13:58 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oyf5B-0007Zz-IT for emacs-devel@gnu.org; Fri, 25 Nov 2022 15:13:57 -0500 Original-Received: from out-119.mta0.migadu.com ([2001:41d0:1004:224b::77]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oyf57-0002hD-8Z for emacs-devel@gnu.org; Fri, 25 Nov 2022 15:13:57 -0500 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1669407230; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=GdXKKhB99/AV3U9ErJSaUy3IUH07tgQdU5oNTfVA8Qo=; b=P68df11ALvVdo3kjvZyRgnE/Tfl7iW4qym2TyciC3Durd2QT3tiGlt75helyw0O84Qq5FI ZKx756Dh8EtCeZXvygr4SbZ9gb9OdVpy6sJhQEEXI+9hhqty7OgPrTHGHTipy/F0b2y4YW 2yDxaYOvUrRKjwe3sAlDWLOdd+Q+VJN05HUJJgcEUcWfaJ7/W/k3yB8aqKXhJbgW9w+vRj DFmGPwZi4miLeqpTxkDOTHXHCbQfDGpt1qDuoQ5dxBt16PeGncmrIyjd7cfPKwwpenxPC1 ajnXoEU0esVRuhKhKNMgWtnxDoxXHJ10JitYXnB9bI4cUjhuWksWPTQWK9nAHg== In-Reply-To: <87tu2m6c20.fsf@thornhill.no> X-Migadu-Flow: FLOW_OUT Received-SPF: pass client-ip=2001:41d0:1004:224b::77; envelope-from=theo@thornhill.no; helo=out-119.mta0.migadu.com X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:300518 Archived-At: --=-=-= Content-Type: text/plain Hi Eli, > >>> Date: Fri, 25 Nov 2022 17:38:27 +0100 >>> From: Theodor Thornhill >>> CC: casouri@gmail.com, tsdh@gnu.org >>> >>> I'd rather change ts-mode to typescript-mode or typescript-ts-mode. >> >> If there was no ts-mode before, I'm okay with renaming it to >> typescript-ts-mode. > > Ok, patch coming up Feel free to commit this, Eli. I've only done a rename. Theo --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Rename-ts-mode-to-typescript-ts-mode.patch >From 5a8d0347ad4e3373ef849d9b818459121061b593 Mon Sep 17 00:00:00 2001 From: Theodor Thornhill Date: Fri, 25 Nov 2022 21:04:18 +0100 Subject: [PATCH] Rename ts-mode to typescript-ts-mode * lisp/progmodes/ts-mode.el: File deleted. * lisp/progmodes/typescript-ts-mode.el: New mode typescript-ts-mode. * etc/NEWS: Mention the new mode. --- etc/NEWS | 2 +- .../{ts-mode.el => typescript-ts-mode.el} | 78 +++++++++---------- 2 files changed, 40 insertions(+), 40 deletions(-) rename lisp/progmodes/{ts-mode.el => typescript-ts-mode.el} (77%) diff --git a/etc/NEWS b/etc/NEWS index 0ffc849fec..3c9243784d 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2969,7 +2969,7 @@ This is a lightweight variant of 'js-mode' that is used by default when visiting JSON files. -** New mode 'ts-mode'. +** New mode 'typescript-ts-mode'. A major mode based on the tree-sitter library for editing programs in the TypeScript language. It includes support for font-locking, indentation, and navigation. diff --git a/lisp/progmodes/ts-mode.el b/lisp/progmodes/typescript-ts-mode.el similarity index 77% rename from lisp/progmodes/ts-mode.el rename to lisp/progmodes/typescript-ts-mode.el index bdef1c4576..763686bf66 100644 --- a/lisp/progmodes/ts-mode.el +++ b/lisp/progmodes/typescript-ts-mode.el @@ -1,4 +1,4 @@ -;;; ts-mode.el --- tree sitter support for TypeScript -*- lexical-binding: t; -*- +;;; typescript-ts-mode.el --- tree sitter support for TypeScript -*- lexical-binding: t; -*- ;; Copyright (C) 2022 Free Software Foundation, Inc. @@ -30,14 +30,14 @@ (declare-function treesit-parser-create "treesit.c") -(defcustom ts-mode-indent-offset 2 - "Number of spaces for each indentation step in `ts-mode'." +(defcustom typescript-ts-mode-indent-offset 2 + "Number of spaces for each indentation step in `typescript-ts-mode'." :version "29.1" :type 'integer :safe 'integerp :group 'typescript) -(defvar ts-mode--syntax-table +(defvar typescript-ts-mode--syntax-table (let ((table (make-syntax-table))) ;; Taken from the cc-langs version (modify-syntax-entry ?_ "_" table) @@ -54,9 +54,9 @@ ts-mode--syntax-table (modify-syntax-entry ?` "\"" table) (modify-syntax-entry ?\240 "." table) table) - "Syntax table for `ts-mode'.") + "Syntax table for `typescript-ts-mode'.") -(defvar ts-mode--indent-rules +(defvar typescript-ts-mode--indent-rules `((tsx ((parent-is "program") parent-bol 0) ((node-is "}") parent-bol 0) @@ -65,33 +65,33 @@ ts-mode--indent-rules ((node-is ">") parent-bol 0) ((and (parent-is "comment") comment-end) comment-start -1) ((parent-is "comment") comment-start-skip 0) - ((parent-is "ternary_expression") parent-bol ts-mode-indent-offset) - ((parent-is "member_expression") parent-bol ts-mode-indent-offset) - ((parent-is "named_imports") parent-bol ts-mode-indent-offset) - ((parent-is "statement_block") parent-bol ts-mode-indent-offset) - ((parent-is "type_arguments") parent-bol ts-mode-indent-offset) - ((parent-is "variable_declarator") parent-bol ts-mode-indent-offset) - ((parent-is "arguments") parent-bol ts-mode-indent-offset) - ((parent-is "array") parent-bol ts-mode-indent-offset) - ((parent-is "formal_parameters") parent-bol ts-mode-indent-offset) - ((parent-is "template_substitution") parent-bol ts-mode-indent-offset) - ((parent-is "object_pattern") parent-bol ts-mode-indent-offset) - ((parent-is "object") parent-bol ts-mode-indent-offset) - ((parent-is "object_type") parent-bol ts-mode-indent-offset) - ((parent-is "enum_body") parent-bol ts-mode-indent-offset) - ((parent-is "arrow_function") parent-bol ts-mode-indent-offset) - ((parent-is "parenthesized_expression") parent-bol ts-mode-indent-offset) + ((parent-is "ternary_expression") parent-bol typescript-ts-mode-indent-offset) + ((parent-is "member_expression") parent-bol typescript-ts-mode-indent-offset) + ((parent-is "named_imports") parent-bol typescript-ts-mode-indent-offset) + ((parent-is "statement_block") parent-bol typescript-ts-mode-indent-offset) + ((parent-is "type_arguments") parent-bol typescript-ts-mode-indent-offset) + ((parent-is "variable_declarator") parent-bol typescript-ts-mode-indent-offset) + ((parent-is "arguments") parent-bol typescript-ts-mode-indent-offset) + ((parent-is "array") parent-bol typescript-ts-mode-indent-offset) + ((parent-is "formal_parameters") parent-bol typescript-ts-mode-indent-offset) + ((parent-is "template_substitution") parent-bol typescript-ts-mode-indent-offset) + ((parent-is "object_pattern") parent-bol typescript-ts-mode-indent-offset) + ((parent-is "object") parent-bol typescript-ts-mode-indent-offset) + ((parent-is "object_type") parent-bol typescript-ts-mode-indent-offset) + ((parent-is "enum_body") parent-bol typescript-ts-mode-indent-offset) + ((parent-is "arrow_function") parent-bol typescript-ts-mode-indent-offset) + ((parent-is "parenthesized_expression") parent-bol typescript-ts-mode-indent-offset) ;; TSX - ((parent-is "jsx_opening_element") parent ts-mode-indent-offset) + ((parent-is "jsx_opening_element") parent typescript-ts-mode-indent-offset) ((node-is "jsx_closing_element") parent 0) - ((parent-is "jsx_element") parent ts-mode-indent-offset) + ((parent-is "jsx_element") parent typescript-ts-mode-indent-offset) ((node-is "/") parent 0) - ((parent-is "jsx_self_closing_element") parent ts-mode-indent-offset) + ((parent-is "jsx_self_closing_element") parent typescript-ts-mode-indent-offset) (no-node parent-bol 0))) "Tree-sitter indent rules.") -(defvar ts-mode--keywords +(defvar typescript-ts-mode--keywords '("!" "abstract" "as" "async" "await" "break" "case" "catch" "class" "const" "continue" "debugger" "declare" "default" "delete" "do" "else" "enum" @@ -103,14 +103,14 @@ ts-mode--keywords "while" "with" "yield") "TypeScript keywords for tree-sitter font-locking.") -(defvar ts-mode--operators +(defvar typescript-ts-mode--operators '("=" "+=" "-=" "*=" "/=" "%=" "**=" "<<=" ">>=" ">>>=" "&=" "^=" "|=" "&&=" "||=" "??=" "==" "!=" "===" "!==" ">" ">=" "<" "<=" "+" "-" "*" "/" "%" "++" "--" "**" "&" "|" "^" "~" "<<" ">>" ">>>" "&&" "||" "!" "?.") "TypeScript operators for tree-sitter font-locking.") -(defvar ts-mode--font-lock-settings +(defvar typescript-ts-mode--font-lock-settings (treesit-font-lock-rules :language 'tsx :override t @@ -128,7 +128,7 @@ ts-mode--font-lock-settings :language 'tsx :override t :feature 'keyword - `([,@ts-mode--keywords] @font-lock-keyword-face + `([,@typescript-ts-mode--keywords] @font-lock-keyword-face [(this) (super)] @font-lock-keyword-face) :language 'tsx @@ -248,7 +248,7 @@ ts-mode--font-lock-settings :language 'tsx :feature 'operator - `([,@ts-mode--operators] @font-lock-operator-face + `([,@typescript-ts-mode--operators] @font-lock-operator-face (ternary_expression ["?" ":"] @font-lock-operator-face)) :language 'tsx @@ -278,19 +278,19 @@ ts-mode--font-lock-settings "Tree-sitter font-lock settings.") ;;;###autoload -(add-to-list 'auto-mode-alist '("\\.ts\\'" . ts-mode)) +(add-to-list 'auto-mode-alist '("\\.ts\\'" . typescript-ts-mode)) ;;;###autoload -(add-to-list 'auto-mode-alist '("\\.tsx\\'" . ts-mode)) +(add-to-list 'auto-mode-alist '("\\.tsx\\'" . typescript-ts-mode)) ;;;###autoload -(define-derived-mode ts-mode prog-mode "TypeScript" +(define-derived-mode typescript-ts-mode prog-mode "TypeScript" "Major mode for editing TypeScript." :group 'typescript - :syntax-table ts-mode--syntax-table + :syntax-table typescript-ts-mode--syntax-table (cond - ;; `ts-mode' requires tree-sitter to work, so we don't check if + ;; `typescript-ts-mode' requires tree-sitter to work, so we don't check if ;; user enables tree-sitter for it. ((treesit-ready-p 'tsx) ;; Tree-sitter. @@ -308,7 +308,7 @@ ts-mode (append "{}():;," electric-indent-chars)) ;; Indent. - (setq-local treesit-simple-indent-rules ts-mode--indent-rules) + (setq-local treesit-simple-indent-rules typescript-ts-mode--indent-rules) ;; Navigation. (setq-local treesit-defun-type-regexp @@ -318,7 +318,7 @@ ts-mode "lexical_declaration"))) ;; Font-lock. - (setq-local treesit-font-lock-settings ts-mode--font-lock-settings) + (setq-local treesit-font-lock-settings typescript-ts-mode--font-lock-settings) (setq-local treesit-font-lock-feature-list '((comment declaration) (constant expression identifier keyword number string) @@ -336,6 +336,6 @@ ts-mode (js-mode) (message "Tree-sitter for TypeScript isn't available, falling back to `js-mode'")))) -(provide 'ts-mode) +(provide 'typescript-ts-mode) -;;; ts-mode.el ends here +;;; typescript-ts-mode.el ends here -- 2.34.1 --=-=-=--