From unknown Sun Aug 17 04:19:25 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#59691 <59691@debbugs.gnu.org> To: bug#59691 <59691@debbugs.gnu.org> Subject: Status: 29.0.60; typescript-ts-mode: any HTML-like elements causes fontification to become invalid and remaining parse-tree to become jsx-expression Reply-To: bug#59691 <59691@debbugs.gnu.org> Date: Sun, 17 Aug 2025 11:19:25 +0000 retitle 59691 29.0.60; typescript-ts-mode: any HTML-like elements causes fo= ntification to become invalid and remaining parse-tree to become jsx-expres= sion reassign 59691 emacs submitter 59691 jostein@kjonigsen.net severity 59691 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Tue Nov 29 15:03:02 2022 Received: (at submit) by debbugs.gnu.org; 29 Nov 2022 20:03:02 +0000 Received: from localhost ([127.0.0.1]:55983 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p06on-0006EZ-Pj for submit@debbugs.gnu.org; Tue, 29 Nov 2022 15:03:02 -0500 Received: from lists.gnu.org ([209.51.188.17]:49834) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p06ok-0006EN-DJ for submit@debbugs.gnu.org; Tue, 29 Nov 2022 15:03:00 -0500 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 1p06oj-0004i8-HH for bug-gnu-emacs@gnu.org; Tue, 29 Nov 2022 15:02:58 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p06og-0001KF-Jc for bug-gnu-emacs@gnu.org; Tue, 29 Nov 2022 15:02:57 -0500 Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 54F1C5C00B6; Tue, 29 Nov 2022 15:02:51 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Tue, 29 Nov 2022 15:02:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= secure.kjonigsen.net; h=cc:content-transfer-encoding :content-type:date:date:from:from:in-reply-to:message-id :mime-version:reply-to:reply-to:sender:subject:subject:to:to; s= fm3; t=1669752171; x=1669838571; bh=U6xII4GDSMYDkkNiC7Lxqx1n44C4 iT0L0JFdCp1BZz4=; b=WkgWMz/7c+AkrLZ/aXzK3nFORVZ01qykWcyUcOpLWfzG lqU5Ppoee9WQ6VD000sAcYRlOS1GfHmcogdIguW946IXj7FuBOy8S/e2YLXE8N8r Rim2f9jnQr/0/iXq7q5H13h1y18ez0grDPNfc2TnmZLbMAmwz0kaA6iFKVLWV4UO 4b0cnb/cVypRzJRC9JvQ4ij3C82gpxCzIjE1MgzK8SARBiXPkg3gmx5l8Wqt8zlQ JiToD+F7WqkJf3KfHrr2TJFx6oNQHABTZA4n+OHNsgvJQkKnCKsV4O+InQf8azBP m9/gal9MHdHuDW9L6RtcMBZew96KPAqOI2Ntdf9AkQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:date:feedback-id:feedback-id:from:from:in-reply-to :message-id:mime-version:reply-to:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; t=1669752171; x=1669838571; bh=U6xII4GDSMYDk kNiC7Lxqx1n44C4iT0L0JFdCp1BZz4=; b=GVtGMc6dNLekiEmecJNIP5gF7FW9T vjZoMKLV6rkyVS4kqMAHANgwIOEMRml6ZZLU0RUgsB7zQtWIF6ZMfFaq3CQ0FqHg wOR9Pwvz534RN5oRGhBOk5N0WkBpF36vPfgaHFBPB0CrYIcYGKB87wr8+MKnMnGI pNNBy5YQdlFkvsE/XLAYJK/Skz+tYCLPorDgK3v6/1X0+K9vP63uxj+VlJt5yCh5 T9hbJu1Y9hFYuSDUTvmSVSeoMRYW0t3uUlgP3talVpmXBqyDz8nm7JADnHnnZjWb SCUdqBfTprBWV9wCs13YvtmICOVV1oklAoApk6RKW7aCb5FaCftWjtH/Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrtddtgddutddvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfrhfvhffutgfgsehtkeertddtfeejnecuhfhrohhmpeflohhsthgv ihhnucfmjhppnhhighhsvghnuceojhhoshhtvghinhesshgvtghurhgvrdhkjhhonhhigh hsvghnrdhnvghtqeenucggtffrrghtthgvrhhnpeejgeegveejteeigfeiteeikeeffeef kedvleehfeelffehkeevvdegueeijeevgeenucffohhmrghinhepkhhjnhhighhsvghnrd hnohenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehj ohhsthgvihhnsehsvggtuhhrvgdrkhhjohhnihhgshgvnhdrnhgvth X-ME-Proxy: Feedback-ID: ib2f84088:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 29 Nov 2022 15:02:50 -0500 (EST) Message-ID: <8a2af962-4210-d01e-68d4-92d434dd2f9b@secure.kjonigsen.net> Date: Tue, 29 Nov 2022 21:02:47 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0 Content-Language: nb-NO, en-GB To: "bug-gnu-emacs@gnu.org" , Theodor Thornhill From: =?UTF-8?Q?Jostein_Kj=c3=b8nigsen?= Subject: 29.0.60; typescript-ts-mode: any HTML-like elements causes fontification to become invalid and remaining parse-tree to become jsx-expression Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=66.111.4.25; envelope-from=jostein@secure.kjonigsen.net; helo=out1-smtp.messagingengine.com X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.6 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: jostein@kjonigsen.net Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.6 (--) When I: ======= 1. Create a new TS-file, activate typescript-ts-mode 2. Write any text or code with HTML-like qualities. 3. Write more text or code I experience that: ================== The fontification after this point is permanently incorrect. Instead I expected that: ======================== Fontification to remain correct. Examples: ========= To trigger this bug you only need to include HTML-like constructs in a string:     const example = "<123>"; Or just use a TypeScript hard casts:     const result = service; After this point the remaining parse-tree becomes invalid, because the remaining parse-tree is not reported as a jsx-expreesion. -- In GNU Emacs 29.0.60 (build 1, x86_64-pc-linux-gnu, GTK+ Version  3.24.34, cairo version 1.16.0) of 2022-11-29 built on ThinkPad-T14s Repository revision: c43cdfd639518c5f2e7e7cbbaf1eca40ac957eb0 Repository branch: emacs-29 Windowing system distributor 'The X.Org Foundation', version 11.0.12201003 System Description: Ubuntu 22.10 Configured using:  'configure --with-tree-sitter' Configured features: ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER X11 XDBE XIM XINPUT2 XPM GTK3 ZLIB Important settings:   value of $LC_MONETARY: nb_NO.UTF-8   value of $LC_NUMERIC: nb_NO.UTF-8   value of $LC_TIME: nb_NO.UTF-8   value of $LANG: en_US.UTF-8   locale-coding-system: utf-8-unix Major mode: TypeScript Minor modes in effect:   global-git-commit-mode: t   magit-auto-revert-mode: t   lsp-diagnostics-mode: t   lsp-headerline-breadcrumb-mode: t   lsp-modeline-workspace-status-mode: t   lsp-modeline-diagnostics-mode: t   lsp-modeline-code-actions-mode: t   electric-pair-mode: t   treesit-explore-mode: t   lsp-completion-mode: t   editorconfig-mode: t   flycheck-mode: t   which-function-mode: t   nlinum-mode: t   company-mode: t   global-ede-mode: t   dap-tooltip-mode: t   dap-ui-many-windows-mode: t   dap-ui-controls-mode: t   dap-ui-mode: t   treemacs-filewatch-mode: t   treemacs-follow-mode: t   treemacs-git-mode: t   treemacs-fringe-indicator-mode: t   dap-auto-configure-mode: t   dap-mode: t   global-undo-tree-mode: t   undo-tree-mode: t   doom-modeline-mode: t   projectile-mode: t   ido-yes-or-no-mode: t   helm-mode: t   helm-minibuffer-history-mode: t   helm--remap-mouse-mode: t   async-bytecomp-package-mode: t   delete-selection-mode: t   global-auto-revert-mode: t   server-mode: t   shell-dirtrack-mode: t   global-hl-line-mode: t   lsp-managed-mode: t   lsp-mode: t   yas-global-mode: t   yas-minor-mode: t   tooltip-mode: t   global-eldoc-mode: t   eldoc-mode: t   show-paren-mode: t   electric-indent-mode: t   mouse-wheel-mode: t   menu-bar-mode: t   file-name-shadow-mode: t   global-font-lock-mode: t   font-lock-mode: t   blink-cursor-mode: t   column-number-mode: t   line-number-mode: t   transient-mark-mode: t   auto-composition-mode: t   auto-encryption-mode: t   auto-compression-mode: t Load-path shadows: /home/jostein/.emacs.d/elpa/transient-20221127.2242/transient hides /home/jostein/build/emacs/lisp/transient /home/jostein/.emacs.d/elpa/eglot-20221020.1010/eglot hides /home/jostein/build/emacs/lisp/progmodes/eglot Features: (shadow sort emacsbug typescript-ts-mode js git-rebase vc-hg vc-bzr vc-src vc-sccs vc-svn vc-cvs vc-rcs log-view vc bug-reference magit-extras magit-bookmark magit-submodule magit-obsolete magit-blame magit-stash magit-reflog magit-bisect magit-push magit-pull magit-fetch magit-clone magit-remote magit-commit magit-sequence magit-notes magit-worktree magit-tag magit-merge magit-branch magit-reset magit-files magit-refs magit-status magit magit-repos magit-apply magit-wip magit-log magit-diff smerge-mode git-commit log-edit message sendmail yank-media rfc822 mml mml-sec epa derived mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 ietf-drums mailabbrev gmm-utils mailheader pcvs-util magit-core magit-autorevert magit-margin magit-transient magit-process with-editor magit-mode transient magit-git magit-base magit-section crm compat-27 compat-26 dired-aux ede/dired flyspell ispell mule-util executable misearch multi-isearch helm-bookmark helm-net helm-adaptive treemacs-bookmarks treemacs-tags bookmark lsp-diagnostics lsp-headerline lsp-icons lsp-modeline face-remap mail-extr helm-command helm-elisp helm-eval helm-info view vc-git diff-mode vc-dispatcher disp-table elec-pair csharp-mode treesit cc-langs cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs winner ffap tramp-archive tramp-gvfs tramp-cache warnings time-stamp zeroconf dbus add-log lsp-zig lsp-steep lsp-svelte lsp-sqls lsp-ruby-syntax-tree lsp-yaml lsp-xml lsp-vimscript lsp-vhdl lsp-volar lsp-vetur lsp-html lsp-verilog lsp-vala lsp-v lsp-typeprof lsp-ttcn3 lsp-toml lsp-terraform lsp-tex lsp-sorbet lsp-solargraph lsp-rust lsp-rf lsp-remark lsp-racket lsp-r lsp-purescript lsp-pylsp lsp-pyls lsp-php lsp-pls lsp-perlnavigator lsp-perl lsp-openscad lsp-ocaml lsp-magik lsp-nix lsp-nim lsp-nginx lsp-mint lsp-marksman lsp-markdown lsp-lua lsp-kotlin lsp-json lsp-javascript lsp-idris lsp-haxe lsp-groovy lsp-hack lsp-graphql lsp-gleam lsp-go lsp-completion lsp-gdscript lsp-fsharp lsp-fortran lsp-eslint lsp-erlang lsp-emmet lsp-elixir lsp-elm lsp-dockerfile lsp-dhall lsp-d lsp-css lsp-csharp gnutls lsp-crystal lsp-cmake lsp-clojure lsp-semantic-tokens lsp-clangd lsp-beancount lsp-bash lsp-astro lsp-ansible lsp-angular lsp-ada lsp-actionscript ido-completing-read+ memoize minibuf-eldef elisp-slime-nav paredit editorconfig editorconfig-core editorconfig-core-handle editorconfig-fnmatch flycheck highlight-symbol which-func edebug debug backtrace nlinum linum company-oddmuse company-keywords company-etags etags fileloop generator company-gtags company-dabbrev-code company-dabbrev company-files company-clang company-capf company-cmake company-semantic company-template company-bbdb company-web-html company-web company-css web-completion-data company eww url-queue shr pixel-fill kinsoku url-file svg mm-url gnus nnheader gnus-util mail-utils range mm-util mail-prsvr ede/speedbar ede/files ede ede/detect ede/base ede/auto ede/source eieio-base eieio-speedbar speedbar ezimage dframe eieio-custom cedet dap-mouse dap-ui lsp-treemacs lsp-treemacs-generic lsp-treemacs-themes treemacs-treelib treemacs treemacs-header-line treemacs-compatibility treemacs-mode treemacs-interface treemacs-persistence treemacs-filewatch-mode treemacs-follow-mode treemacs-rendering treemacs-annotations treemacs-async treemacs-workspaces treemacs-dom treemacs-visuals treemacs-fringe-indicator treemacs-scope pulse treemacs-faces treemacs-icons treemacs-themes treemacs-core-utils pfuture treemacs-logging treemacs-customization treemacs-macros gdb-mi bindat gud bui bui-list bui-info bui-entry bui-core bui-history bui-button bui-utils lsp-lens dap-gdb-lldb dap-netcore dap-node dap-utils dom xml dap-pwsh lsp-pwsh dap-python dap-mode dap-tasks dap-launch lsp-docker yaml posframe dap-overlays undo-tree diff queue doom-modeline doom-modeline-segments doom-modeline-env doom-modeline-core all-the-icons all-the-icons-faces data-material data-weathericons data-octicons data-fileicons data-faicons data-alltheicons shrink-path compat compat-macs projectile lisp-mnt grep ibuf-ext ibuffer ibuffer-loaddefs helm-imenu ob-plantuml org ob ob-tangle ob-ref ob-lob ob-table ob-exp org-macro org-footnote org-src ob-comint org-pcomplete org-list org-faces org-entities org-version ob-emacs-lisp ob-core ob-eval org-table oc-basic bibtex ol org-keys oc org-compat org-macs org-loaddefs find-func cal-menu calendar cal-loaddefs ido-yes-or-no ido helm-mode helm-misc helm-files image-dired image-dired-tags image-dired-external image-dired-util xdg image-mode dired dired-loaddefs exif tramp tramp-loaddefs trampver tramp-integration cus-edit pp cus-load files-x tramp-compat parse-time iso8601 time-date ls-lisp helm-buffers helm-occur helm-tags helm-locate helm-grep helm-regexp format-spec helm-utils helm-help helm-types helm helm-global-bindings helm-easymenu edmacro kmacro helm-core easy-mmode async-bytecomp helm-source helm-multi-match helm-lib async helm-config delsel cl-extra autorevert server powershell advice shell pcomplete hl-line lsp-mode lsp-protocol yasnippet help-mode xref project tree-widget wid-edit spinner pcase network-stream puny nsm markdown-mode color thingatpt noutline outline icons lv inline imenu ht filenotify f f-shortdoc shortdoc s ewoc epg rfc6068 epg-config dash dracula-theme compile-eslint compile text-property-search comint ansi-osc ansi-color ring cl finder-inf git-timemachine-autoloads rx helm-projectile-autoloads expand-region-autoloads all-the-icons-autoloads dracula-theme-autoloads eglot-autoloads multiple-cursors-autoloads tree-sitter-langs-autoloads projectile-autoloads nlinum-autoloads doom-modeline-autoloads rust-mode-autoloads editorconfig-autoloads helm-autoloads helm-core-autoloads async-autoloads assess-autoloads m-buffer-autoloads cargo-autoloads package-lint-autoloads flycheck-autoloads company-autoloads magit-autoloads magit-section-autoloads web-mode-autoloads paredit-autoloads helpful-autoloads elisp-refs-autoloads js2-mode-autoloads yaml-mode-autoloads powershell-autoloads dap-mode-autoloads lsp-docker-autoloads yaml-autoloads lsp-treemacs-autoloads treemacs-autoloads posframe-autoloads hydra-autoloads pfuture-autoloads ace-window-autoloads avy-autoloads lsp-mode-autoloads markdown-mode-autoloads ht-autoloads git-commit-autoloads with-editor-autoloads transient-autoloads compat-autoloads pcache-autoloads f-autoloads popup-autoloads s-autoloads info dash-autoloads macrostep-autoloads package browse-url url url-proxy url-privacy url-expand url-methods url-history url-cookie generate-lisp-file url-domsuf url-util mailcap url-handlers url-parse auth-source cl-seq eieio eieio-core cl-macs password-cache json subr-x map byte-opt gv bytecomp byte-compile url-vars cl-loaddefs cl-lib rmc iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic indonesian philippine cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite emoji-zwj charscript charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp files window text-properties overlay sha1 md5 base64 format env code-pages mule custom widget keymap hashtable-print-readable backquote threads dbusbind inotify lcms2 dynamic-setting system-font-setting font-render-setting cairo move-toolbar gtk x-toolkit xinput2 x multi-tty make-network-process emacs) Memory information: ((conses 16 707483 89040)  (symbols 48 57220 127)  (strings 32 225052 10207)  (string-bytes 1 6824489)  (vectors 16 145796)  (vector-slots 8 2442138 178412)  (floats 8 1069 547)  (intervals 56 14048 1723)  (buffers 992 52)) -- Vennlig hilsen *Jostein Kjønigsen* jostein@kjonigsen.net 🍵 jostein@gmail.com https://jostein.kjønigsen.no From debbugs-submit-bounces@debbugs.gnu.org Tue Nov 29 16:01:06 2022 Received: (at 59691) by debbugs.gnu.org; 29 Nov 2022 21:01:06 +0000 Received: from localhost ([127.0.0.1]:56314 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p07j0-0000hk-4I for submit@debbugs.gnu.org; Tue, 29 Nov 2022 16:01:06 -0500 Received: from out2.migadu.com ([188.165.223.204]:28456) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p07ix-0000he-Bn for 59691@debbugs.gnu.org; Tue, 29 Nov 2022 16:01:04 -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=1669755662; 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; bh=1UtiQ6jCXUIHAzftdVs1ldknTnuYZ+fdDH5p9juGsKA=; b=MHyv3bpjLWXO6fgdSLJg//7me5w2g429aD4nuer/Hocf8C8i9ayHUHB2bwtpArq4vrsooI 2uOxq7Hhg+hQ2cX+or5v4yOnnrgsBj8OsPtnJtMLqgTE/dvoKpB6FgQowON+P71A+cs34/ MpnlhGcGCFNaVbqQCBC0J7FP/XTt4J6xmy+fCyaqjsO1s5MFPwGEzE2RrAPhXf8Oztb+8G 8kw0/kQyAMqAx3fu1TWUh/ytj5KADTUkOr1U/YWD41NGLeTtWqmoHrrDHywoTVAiMYY7uA ZdMDLCYbU+syS1IH/88zzn0gwrGTaPhp+BU3/4lB2uThXE9mDnG+0y2hfVL74A== From: Theodor Thornhill To: 59691@debbugs.gnu.org Subject: Html-like constructs fail in typescript Date: Tue, 29 Nov 2022 22:01:01 +0100 Message-ID: <87pmd58ohe.fsf@thornhill.no> MIME-Version: 1.0 Content-Type: text/plain X-Migadu-Flow: FLOW_OUT X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 59691 Cc: casouri@gmail.com, jostein@kjonigsen.net, eliz@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hi Jostein! I already have a fix for this bug lined up, and will send the fix as soon as I get my other stuff applied. It relies on another patch that is waiting. The solution is to create two modes: typescript-ts-mode and tsx-ts-mode. They have separate parsers, and should be treated as separate languages. That means that in a .ts file we enable the 'typescript' language, and in .tsx we enable the 'tsx' language. This exact issue is why they have two languages. In other words, we cannot support this in typescript-ts-mode. I hope to get this in pretty soon :) Theo From debbugs-submit-bounces@debbugs.gnu.org Tue Nov 29 16:37:46 2022 Received: (at 59691) by debbugs.gnu.org; 29 Nov 2022 21:37:46 +0000 Received: from localhost ([127.0.0.1]:56549 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p08IT-00017u-Sb for submit@debbugs.gnu.org; Tue, 29 Nov 2022 16:37:46 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:54071) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p08IS-00017o-LZ for 59691@debbugs.gnu.org; Tue, 29 Nov 2022 16:37:45 -0500 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 83FC25C0090; Tue, 29 Nov 2022 16:37:39 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Tue, 29 Nov 2022 16:37:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= secure.kjonigsen.net; h=cc:cc:content-transfer-encoding :content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm3; t=1669757859; x=1669844259; bh=jkUhrSOzTX nl3R/AyqwDVNnfC86T9GcsO8yPQU3kJyw=; b=n7MrAlWGAmEikD977eY6LH+jld 4YaGFA8A5HkaJoJTcZPfWFy+aqKqw0ZezWlC7+6TTAl7I8D21rlolox5cVmk6WOz hbpyuzMJz2WIPYtT1+0fQaTz3WD0l6YXDTwJ7yWqEf74ZMEmfFlySomP7u59LDdd PBq9jO+Ft1CnPZnOqtWlE/ckKcydRhl70ov+GGGd6M6fI+8s2arXlHogFSG7+Hvf C6+805x71t6EZgwV6TCBccQvRxoZ4G0fEIfqqMpsl32uh58Ch4A2QAMzER3hhe3I x0PaPtXmfa1u8vLwLM4oVx0qSVLxVqvRmvjDCjpSgUd0rVFGJ1nSTRIV1cEw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1669757859; x= 1669844259; bh=jkUhrSOzTXnl3R/AyqwDVNnfC86T9GcsO8yPQU3kJyw=; b=S rTIC2J4rh1SMnETbthglynbzWw9b2+9uKHO+I+FmsDg4zsZuzOKeLHOBYBjo60+r //bOzgFVr51kiMYO/nuSg2teOAs7El5FWA8ytAzLKslqj0iHj3BzxEMZXJRwPOSB rZA/3EJ1PlLsUU1cN/hU8AOcBN7IinADcdmjkabYyBVRxO2+0KVEQ7wkQoLFVTvU WcuPSWvKBDXUvLPrSe3v1zbyXwhuGdDK7xJxWFL7XSn14NXGwnPBFDhbmbVPb/Sl csyA2tNFBCoAWo99vM6lXG8Sj8UVOoBvVHJG/rMeJFddGYN1lx67FQwwRKZcD6Ym 6qrZh2cQqNfgRYMB1gNLA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrtddugddtkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpegtgffhggfufffkfhevjgfvofesthhqmhdthhdtjeenucfhrhhomheplfhoshht vghinhcumfhjpphnihhgshgvnhcuoehjohhsthgvihhnsehsvggtuhhrvgdrkhhjohhnih hgshgvnhdrnhgvtheqnecuggftrfgrthhtvghrnhepjeegudevffeifeegveduieetfedt gfetgfffgeeffeeghffgfefhffeggeduvddunecuffhomhgrihhnpehkjhhnihhgshgvnh drnhgvthenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhm pehjohhsthgvihhnsehsvggtuhhrvgdrkhhjohhnihhgshgvnhdrnhgvth X-ME-Proxy: Feedback-ID: ib2f84088:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 29 Nov 2022 16:37:39 -0500 (EST) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: =?utf-8?Q?Jostein_Kj=C3=B8nigsen?= Mime-Version: 1.0 (1.0) Subject: Re: Html-like constructs fail in typescript Date: Tue, 29 Nov 2022 22:37:25 +0100 Message-Id: References: <87pmd58ohe.fsf@thornhill.no> In-Reply-To: <87pmd58ohe.fsf@thornhill.no> To: Theodor Thornhill X-Mailer: iPhone Mail (20C5049e) X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 59691 Cc: 59691@debbugs.gnu.org, casouri@gmail.com, jostein@kjonigsen.net, eliz@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Nice! Should we until further notice assume that js-ts-mode suffers from the same i= ssues, and that a jsx-ts-mode might be needed too? To me it at least sounds p= lausible.=20 Speaking of duplication=E2=80=A6 Now that we have tree-sitter wouldn=E2=80=99= t it be possible to use the same parser and/or the same major-modes for JS/J= SX as we already do for TS/TSX? JS/JSX is just Typescript without the type-a= nnotations, right? Or are there good reasons for having separate modes for these? =E2=80=94 Jostein Kj=C3=B8nigsen https://jostein.kj=C3=B8nigsen.net > On 29 Nov 2022, at 22:04, Theodor Thornhill wrote: >=20 > =EF=BB=BF > Hi Jostein! >=20 > I already have a fix for this bug lined up, and will send the fix as > soon as I get my other stuff applied. It relies on another patch that > is waiting. >=20 > The solution is to create two modes: typescript-ts-mode and > tsx-ts-mode. They have separate parsers, and should be treated as > separate languages. That means that in a .ts file we enable the > 'typescript' language, and in .tsx we enable the 'tsx' language. This > exact issue is why they have two languages. >=20 > In other words, we cannot support this in typescript-ts-mode. >=20 > I hope to get this in pretty soon :) >=20 > Theo From debbugs-submit-bounces@debbugs.gnu.org Tue Nov 29 16:48:11 2022 Received: (at 59691) by debbugs.gnu.org; 29 Nov 2022 21:48:12 +0000 Received: from localhost ([127.0.0.1]:56625 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p08SZ-0001Fa-KM for submit@debbugs.gnu.org; Tue, 29 Nov 2022 16:48:11 -0500 Received: from out2.migadu.com ([188.165.223.204]:61754) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p08ST-0001FE-1Y for 59691@debbugs.gnu.org; Tue, 29 Nov 2022 16:48:10 -0500 Date: Tue, 29 Nov 2022 22:47:38 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1669758483; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HiMkKk14IU2/FvctTcgWm8Dhm/9H1dcyUSU0k0h+VS0=; b=1FmosunMwgLKd4SNR5zaPDbXdT+tb76wk8a5YLDlcM7qm0inFAHVXjCwiS4rkdbZBA97Il Srpri64mW8XWo4JNKNcdkOj+p3i0jp/5YET0sgsiZaMntXkCx+J06ElP6ryiMT8WH5gwpq EO0jI+CssQeAvra70uEPAq51cYIjJjEx854mA+5Td/46Vp425elYzdNUztvC7rYZ2NgUPI oV/u0YdfIGksWbIrkCeARGSYVdNWmb/p/izWPzDiFz7GGvVEGQidazrLMB4lbk9LxoPnQ3 tIPqo1XotHHPsKhz9P8VK0P2OpVwbLB8zYaV1F+GBnu7WkwWXqpvfVS9XkuAvw== X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Theodor Thornhill To: =?ISO-8859-1?Q?Jostein_Kj=F8nigsen?= Subject: Re: Html-like constructs fail in typescript In-Reply-To: References: <87pmd58ohe.fsf@thornhill.no> Message-ID: <1B6E5D5C-3EF3-4FDF-894D-B8577A030EF7@thornhill.no> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 59691 Cc: 59691@debbugs.gnu.org, casouri@gmail.com, jostein@kjonigsen.net, eliz@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On 29 November 2022 22:37:25 CET, "Jostein Kj=C3=B8nigsen" wrote: >Nice! > >Should we until further notice assume that js-ts-mode suffers from the sa= me issues, and that a jsx-ts-mode might be needed too? To me it at least so= unds plausible=2E=20 No, because there are no ambiguities in the grammar with types and jsx=2E > >Speaking of duplication=E2=80=A6 Now that we have tree-sitter wouldn=E2= =80=99t it be possible to use the same parser and/or the same major-modes f= or JS/JSX as we already do for TS/TSX? JS/JSX is just Typescript without th= e type-annotations, right? > >Or are there good reasons for having separate modes for these? > Not sure=2E I like that a mode maps to a tree-sitter grammar, and personal= ly I don't want to intertwine things to early=2E > From debbugs-submit-bounces@debbugs.gnu.org Wed Nov 30 05:22:16 2022 Received: (at 59691) by debbugs.gnu.org; 30 Nov 2022 10:22:16 +0000 Received: from localhost ([127.0.0.1]:60068 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p0KEJ-000723-RC for submit@debbugs.gnu.org; Wed, 30 Nov 2022 05:22:16 -0500 Received: from mail-pl1-f179.google.com ([209.85.214.179]:35694) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p0KEI-00071s-A3 for 59691@debbugs.gnu.org; Wed, 30 Nov 2022 05:22:14 -0500 Received: by mail-pl1-f179.google.com with SMTP id y4so16218194plb.2 for <59691@debbugs.gnu.org>; Wed, 30 Nov 2022 02:22:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:cc:date:message-id:subject:mime-version :content-transfer-encoding:from:from:to:cc:subject:date:message-id :reply-to; bh=IPtiR9gkQX7ZqEV8NoXt6qLxhbUYFzaBhjFNFH+VKf8=; b=bNbYagz2KXxdyeexV5U/GZwhqqP1fifL6cYFN0v12X46Xi7XLaqNZNhgMN2mgc3IIy DKMLU8pvtOVDRY67YIDhmVSLdQ7wWBn0Y9x2Iln7pkVPyLm7lrBHs1P4KaCIypAF8mEO BWn0YVc5ok/GHGtX9Fl/6nw2OE0n/KjdQFShjfWv3AtS0wT4Gl0JV1//09DVU6n38s/Q PEChIvmgoWUJeufTmmU5D0J95GE7EnhiZewjZe6faeg2j6pnxxWt21tFCwXnKUpftQRF G6Zt8TqH2YUrDffEwe6T3vOHU+HnZBZHCaN+f/zabzO0GAG7RCFTCckDt73w+1GQvlkp 3kFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:cc:date:message-id:subject:mime-version :content-transfer-encoding:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IPtiR9gkQX7ZqEV8NoXt6qLxhbUYFzaBhjFNFH+VKf8=; b=PPed7QeSQgT0GQowHGyL8RedmAQ/B0OOEeWdD4jTwyNf06rSfOB/1CLV0wmZmRjho1 oFqLW+PAr869cqnvInX96iz4ztyxUQUYTXIR+VNST7vbkbTQI2HUf2FNzI3sgwewt6xN lNf8Dh5ovOxOeX1R9wqBOlNga+AuEtVzKCHE650MRmSakYlBmwplsDpKgxuStV1q5zUk t2lw9GAGlb7+aBEIz/tk27sjCxabz04HT3VQZcEgcZvXd9tvUcMUfOoKGYkeVEFMkEqp OAHkNADlbGlGy+Pq27KN0RD6FHSJBlmJPwwbaksDGAr3rCRIDPEIQNi3ULLJqDf46ZSB lT2Q== X-Gm-Message-State: ANoB5plL7Ikpkp95UPi+2DCbzTLH0glb/CtJItJff6FrftYj2O7tRasL G6D5BG9PTI+lvHtH1obZ1Dk= X-Google-Smtp-Source: AA0mqf6dVcvE/Vam+K+bKL+zrb0n5pez4CRZ/u1jAe9Re+ilUXGOJSBSQsEP2vEaQy55dASU7PleYQ== X-Received: by 2002:a17:90a:67c1:b0:212:d484:b410 with SMTP id g1-20020a17090a67c100b00212d484b410mr71030479pjm.211.1669803728417; Wed, 30 Nov 2022 02:22:08 -0800 (PST) Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id a14-20020a170902ecce00b00186bc66d2cbsm1073348plh.73.2022.11.30.02.22.07 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 Nov 2022 02:22:08 -0800 (PST) From: Yuan Fu Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\)) Subject: Re: bug#59691: 29.0.60; typescript-ts-mode: any HTML-like elements causes fontification to become invalid and remaining parse-tree to become jsx-expression Message-Id: Date: Wed, 30 Nov 2022 02:22:06 -0800 To: Theodor Thornhill X-Mailer: Apple Mail (2.3696.120.41.1.1) X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 59691 Cc: 59691@debbugs.gnu.org, eliz@gnu.org, =?utf-8?Q?Jostein_Kj=C3=B8nigsen?= , jostein@kjonigsen.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Theodor Thornhill writes: > On 29 November 2022 22:37:25 CET, "Jostein Kj=C3=B8nigsen" = wrote: >>Nice! >> >>Should we until further notice assume that js-ts-mode suffers from >> the same issues, and that a jsx-ts-mode might be needed too? To me >> it at least sounds plausible. > > No, because there are no ambiguities in the grammar with types and = jsx. > >> >>Speaking of duplication=E2=80=A6 Now that we have tree-sitter = wouldn=E2=80=99t it be >> possible to use the same parser and/or the same major-modes for >> JS/JSX as we already do for TS/TSX? JS/JSX is just Typescript >> without the type-annotations, right? >> >>Or are there good reasons for having separate modes for these? >> > > Not sure. I like that a mode maps to a tree-sitter grammar, and = personally I don't want to intertwine things to early. No strong opinions here, but currently a user could install tree-sitter-js, and find and enable js-ts-mode, which is straightforward, which is good. Since these four modes doesn=E2=80=99t = require too much boilerplate, I think it=E2=80=99s pretty good right now. Yuan From debbugs-submit-bounces@debbugs.gnu.org Wed Nov 30 07:36:26 2022 Received: (at 59691) by debbugs.gnu.org; 30 Nov 2022 12:36:26 +0000 Received: from localhost ([127.0.0.1]:60696 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p0MK9-0004dy-VP for submit@debbugs.gnu.org; Wed, 30 Nov 2022 07:36:26 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43920) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p0MK7-0004ds-Fw for 59691@debbugs.gnu.org; Wed, 30 Nov 2022 07:36:24 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p0MK1-0004bG-Rv; Wed, 30 Nov 2022 07:36:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=sOVtySOPl5YnaEsWrzNDHMiZKYZG5jRuEv5H4CUT0t0=; b=dl7BGpFU/fJ5 ZJwVz7kS1pFUBQDjAKICn07zY6UlvG9xmXl+7Hkf1KJ/v5TDM26l7vYZhOwjZ9/RrGjcVyxK+4kEL QKKQGR2CC23adtIG61XL/SO/16AVt5xwWy14fELp3W0vzfKbiHQdxaVaAyu95gl9+bzRHV4dD4xAt nQ94HkDnsUB9GHnwaMv4XbRoZcI90eGmh+lVC4rgPkZIBB+9CVIL33t/eB1FnhHexxRkv/7Ycrmj4 TwKkgHoOowY5zkOEoxC/9JFnFZC+8jCi/hekyPZhjsDe4ov6tpemLRXLt6gxkSTYVUGr44pv0ggvt 7aMZddJFWlbUOq33XKTl6g==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p0MK1-000405-2G; Wed, 30 Nov 2022 07:36:17 -0500 Date: Wed, 30 Nov 2022 14:35:49 +0200 Message-Id: <83iliwlivu.fsf@gnu.org> From: Eli Zaretskii To: Theodor Thornhill In-Reply-To: <87pmd58ohe.fsf@thornhill.no> (message from Theodor Thornhill on Tue, 29 Nov 2022 22:01:01 +0100) Subject: Re: Html-like constructs fail in typescript References: <87pmd58ohe.fsf@thornhill.no> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 59691 Cc: 59691@debbugs.gnu.org, casouri@gmail.com, jostein@kjonigsen.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Theodor Thornhill > Cc: jostein@kjonigsen.net, casouri@gmail.com, eliz@gnu.org > Date: Tue, 29 Nov 2022 22:01:01 +0100 > > The solution is to create two modes: typescript-ts-mode and > tsx-ts-mode. They have separate parsers, and should be treated as > separate languages. That means that in a .ts file we enable the > 'typescript' language, and in .tsx we enable the 'tsx' language. This > exact issue is why they have two languages. This means the script posted by Yuan, which only creates a single grammar library for Typescript (the one for tsx), should be changed to instead produce two libraries, right? From debbugs-submit-bounces@debbugs.gnu.org Wed Nov 30 07:59:29 2022 Received: (at 59691) by debbugs.gnu.org; 30 Nov 2022 12:59:29 +0000 Received: from localhost ([127.0.0.1]:60831 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p0MgS-0004ss-U0 for submit@debbugs.gnu.org; Wed, 30 Nov 2022 07:59:29 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:37887) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p0MgR-0004sl-H2 for 59691@debbugs.gnu.org; Wed, 30 Nov 2022 07:59:28 -0500 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 6D8915C00A0; Wed, 30 Nov 2022 07:59:22 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Wed, 30 Nov 2022 07:59:22 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= secure.kjonigsen.net; h=cc:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1669813162; x= 1669899562; bh=2s4ig7GC+lC/5HsZdOddSRxO9AzRRSijZKIqzo0uG6Q=; b=Z 76Y2LCFzwPfsxnQa7uM89xaqqnw1jInHp5ivW5fgo2F5znIYIqPUqFWCyceyX4YI HqzHnaCoJWsofUM1um3q2e2GYr6mjFNcg3RjfZB8wi5p5G5cSdzkCYx/S9PMV6SN mKljwdfry4VqaMb9MOjKTO1BzYGj/9C1yx5Lu8dATOOJlwgzIZTTd4opXaq1izWc MIc2n78/upx2tBqoAffvrBmqsEP41c8DxCXdF0EZLWRzH5FXXbDegJUjf1x5BSHz SU+Y/ylTqQFQHIbiv2j555VCpo3/hkYymfXObI8HVM0SPG7wD/ax05KTV2xJAusr qQ9uRth96vTGDionpakGg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; t=1669813162; x=1669899562; bh=2s4ig7GC+lC/5HsZdOddSRxO9AzR RSijZKIqzo0uG6Q=; b=qTOlV0/1z7elUhRmNNMa8h71q4bX9IGFsCFBFVwRjRBn OL5er9Xu8xt1YOMbi58+XoJVwD02myqi+aHrpBMZenHW8ZuJYIxH9CZI+RJGyg24 slx82x0LZNLD/pIQi2VU3zN91VMWpg4VKXYk3Ic+fVZzJs/n6vwo7a7L07Ogn3HT 2lSZd898XOmUmcZEksjL2Qs5MsxI/FbyPVzT1b/1yteit48reW/as/GaihpWXRSS l6EdPFMsLIi0aM9AlWDbCIPpiLkzsJhFE2ffXONUEHhyAxsI808Vyb7vTP0+O09T 4lBaRdS+9HBW5PtnuGs79quv0e+s5L45fIWOdEC+vg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrtdefgdeggecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpegtkfffgggfuffhvfhfjgesrgdtreertdefjeenucfhrhhomheplfhoshhtvghi nhcumfhjpphnihhgshgvnhcuoehjohhsthgvihhnsehsvggtuhhrvgdrkhhjohhnihhgsh gvnhdrnhgvtheqnecuggftrfgrthhtvghrnhephfekhfffgeelffelffektdetgefftdeu uefgtdeltdekudejtdegleduuddtlefgnecuvehluhhsthgvrhfuihiivgeptdenucfrrg hrrghmpehmrghilhhfrhhomhepjhhoshhtvghinhesshgvtghurhgvrdhkjhhonhhighhs vghnrdhnvght X-ME-Proxy: Feedback-ID: ib2f84088:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 30 Nov 2022 07:59:21 -0500 (EST) Content-Type: multipart/alternative; boundary="------------IFFMtIMt6mVswTdeHkiUo2j0" Message-ID: <0c7829a2-b5e0-ca19-e3be-2b568e203bc8@secure.kjonigsen.net> Date: Wed, 30 Nov 2022 13:59:20 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0 Subject: Re: Html-like constructs fail in typescript Content-Language: nb-NO, en-GB From: =?UTF-8?Q?Jostein_Kj=c3=b8nigsen?= To: Theodor Thornhill , Yuan Fu , 59691@debbugs.gnu.org, Eli Zaretskii References: <1B6E5D5C-3EF3-4FDF-894D-B8577A030EF7@thornhill.no> <786DAB7F-F45D-405B-A4E5-4A60FD6CE7A7@secure.kjonigsen.net> In-Reply-To: <786DAB7F-F45D-405B-A4E5-4A60FD6CE7A7@secure.kjonigsen.net> X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 59691 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) This is a multi-part message in MIME format. --------------IFFMtIMt6mVswTdeHkiUo2j0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 29.11.2022 23:20, Jostein Kjønigsen wrote: > >> On 29 Nov 2022, at 22:48, Theodor Thornhill wrote: >> >>  >> >>> On 29 November 2022 22:37:25 CET, "Jostein Kjønigsen" wrote: >>> Nice! >>> >>> Should we until further notice assume that js-ts-mode suffers from the same issues, and that a jsx-ts-mode might be needed too? To me it at least sounds plausible. >> No, because there are no ambiguities in the grammar with types and jsx. >> > Note this behaviour was triggered even when a HTML-tag was contained inside a plain string. > > Even without hard typescript casts, there are places where I suspect the same issues can bleed into js-ts-mode. > > I’ll try to do more testing tomorrow. First of all - good news! Contrary to my expectations, I've tested and I cannot reproduce this issue in js-ts-mode. Even more good news: Looking deeper into this using treesit-explorer-mode (an extremely helpful tool, Yuan!), I found I may have misinterpreted the state of the parse-tree in previous report. Based on that, I would like to revise this bug report: * HTML-like constructs inside strings are --/not/-- treated at jsx_opening_elements, * only angle-bracket "hard" casts (which isn't present in Javascript) is causing issues for fontification. Also, reading up, from what I can tell "hard casts" using angle-brackets are no longer encouraged as the default way to cast:     const service = object; This is because the above code will cause a compiler error if used in TSX-files (as opposed to TS-files). Instead "as" expressions are preferred, because they work equally well for both TS & TSX-files:     const service = object as IService; That means that writing idiomatic TypeScript with typescrip-ts-mode should produce the expected behaviour, while one may encounter issues with older code. I'm not sure introducing a new major-mode for this 1 aspect of TypeScript development is worth it? Does anyone else have an opinion on this? -- Jostein --------------IFFMtIMt6mVswTdeHkiUo2j0 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit On 29.11.2022 23:20, Jostein Kjønigsen wrote:

On 29 Nov 2022, at 22:48, Theodor Thornhill <theo@thornhill.no> wrote:



On 29 November 2022 22:37:25 CET, "Jostein Kjønigsen" <jostein@secure.kjonigsen.net> wrote:
Nice!

Should we until further notice assume that js-ts-mode suffers from the same issues, and that a jsx-ts-mode might be needed too? To me it at least sounds plausible. 
No, because there are no ambiguities in the grammar with types and jsx.

Note this behaviour was triggered even when a HTML-tag was contained inside a plain string. 

Even without hard typescript casts, there are places where I suspect the same issues can bleed into js-ts-mode. 

I’ll try to do more testing tomorrow. 

First of all - good news!

Contrary to my expectations, I've tested and I cannot reproduce this issue in js-ts-mode.

Even more good news:

Looking deeper into this using treesit-explorer-mode (an extremely helpful tool, Yuan!), I found I may have misinterpreted the state of the parse-tree in previous report.

Based on that, I would like to revise this bug report:

  • HTML-like constructs inside strings are --not-- treated at jsx_opening_elements,
  • only angle-bracket "hard" casts (which isn't present in Javascript) is causing issues for fontification.

Also, reading up, from what I can tell "hard casts" using angle-brackets are no longer encouraged as the default way to cast:

    const service = <IService>object;

This is because the above code will cause a compiler error if used in TSX-files (as opposed to TS-files). Instead "as" expressions are preferred, because they work equally well for both TS & TSX-files:

    const service = object as IService;

That means that writing idiomatic TypeScript with typescrip-ts-mode should produce the expected behaviour, while one may encounter issues with older code.

I'm not sure introducing a new major-mode for this 1 aspect of TypeScript development is worth it?

Does anyone else have an opinion on this?

--
Jostein
--------------IFFMtIMt6mVswTdeHkiUo2j0-- From debbugs-submit-bounces@debbugs.gnu.org Wed Nov 30 08:02:54 2022 Received: (at 59691) by debbugs.gnu.org; 30 Nov 2022 13:02:54 +0000 Received: from localhost ([127.0.0.1]:60856 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p0Mjm-0004wI-2t for submit@debbugs.gnu.org; Wed, 30 Nov 2022 08:02:54 -0500 Received: from out2.migadu.com ([188.165.223.204]:61901) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p0Mjg-0004wB-Vv for 59691@debbugs.gnu.org; Wed, 30 Nov 2022 08:02:52 -0500 Date: Wed, 30 Nov 2022 14:00:49 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1669813367; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tP7FOW0JxgAa0K8qxMveynpvFkLozXr6DQfzx7R1rmE=; b=SVa+jaLXCGDS2XWdVur5MvzTxRbrI9mGknuYgSfQA3YCnLoaU4XXIGJySQRbDnpQWXrBX5 AMgdY6ySScfIq1I8GC/1NbldrBFKC6Cs8KvuqdndsRlKINUg015+v+YC4gkMZYTCF9p3Jc ZCjAGhvyJxhblbq571HmrJtHOnP+IHGk5itcxcYxdFzSTRfAEOLiIIprUdiSG+xLV4/0S5 46vIjLfOGc/PU7Dk5icCGgP9qgFlq52XHT/0ixew8Ie62IgWZofoDwDkNobKbSgx6sKUM/ s527TB+c8CmPOh7Qn5nMpJ7nPyUGkqYfGOTJGbxGlWRBg5Ul2wAGDDycMcfNUQ== X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Theodor Thornhill To: Eli Zaretskii Subject: Re: Html-like constructs fail in typescript In-Reply-To: <83iliwlivu.fsf@gnu.org> References: <87pmd58ohe.fsf@thornhill.no> <83iliwlivu.fsf@gnu.org> Message-ID: <8D2C4666-BB58-4C85-A080-B31B48AF947F@thornhill.no> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 59691 Cc: 59691@debbugs.gnu.org, casouri@gmail.com, jostein@kjonigsen.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On 30 November 2022 13:35:49 CET, Eli Zaretskii wrote: >> From: Theodor Thornhill >> Cc: jostein@kjonigsen=2Enet, casouri@gmail=2Ecom, eliz@gnu=2Eorg >> Date: Tue, 29 Nov 2022 22:01:01 +0100 >>=20 >> The solution is to create two modes: typescript-ts-mode and >> tsx-ts-mode=2E They have separate parsers, and should be treated as >> separate languages=2E That means that in a =2Ets file we enable the >> 'typescript' language, and in =2Etsx we enable the 'tsx' language=2E T= his >> exact issue is why they have two languages=2E > >This means the script posted by Yuan, which only creates a single grammar >library for Typescript (the one for tsx), should be changed to instead >produce two libraries, right? Yes, I can fix that when the two modes are in :) From debbugs-submit-bounces@debbugs.gnu.org Wed Nov 30 08:16:48 2022 Received: (at 59691) by debbugs.gnu.org; 30 Nov 2022 13:16:48 +0000 Received: from localhost ([127.0.0.1]:60926 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p0MxD-000547-M9 for submit@debbugs.gnu.org; Wed, 30 Nov 2022 08:16:48 -0500 Received: from out2.migadu.com ([188.165.223.204]:19511) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p0MxB-000541-Av for 59691@debbugs.gnu.org; Wed, 30 Nov 2022 08:16:46 -0500 Date: Wed, 30 Nov 2022 14:16:14 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1669814204; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=W4cca2534y/bZHXYCCAiS9YBXUW+9vy/Wh3vuzdKsWA=; b=B3r5yh83kyk3kgQQ4ikY4+liG92pg1P76+42PdbAt++0edd9whPHznkSRt4PQj2C9buO1y 3wm5pFxRYwB0y0APYpfZbJ/ZkJ4IBTCEs5Lz3iPy028g7rV/opchqrFYMVNxvz71STX+ks /VOb9btcOLeO/8TA6lHXxqVf51P32jnMlFI4OZFQXI01qeH+geXJA8V2ck/kbUfFDFhnPi 49GjLfd6Z/Y1vKLWSF90E863/QLj8hDlfsQF7ylh+ewSX/OCgmrtAyzh+aj0iMnv5k+uZO 2w9nS/S5076HQJuvDT8mKo1J+Y+0M1x8n+Nz6eWb26miXbNdAEWNHb3B1gO/9w== X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Theodor Thornhill To: =?ISO-8859-1?Q?Jostein_Kj=F8nigsen?= , Yuan Fu , 59691@debbugs.gnu.org, Eli Zaretskii Subject: Re: Html-like constructs fail in typescript In-Reply-To: <0c7829a2-b5e0-ca19-e3be-2b568e203bc8@secure.kjonigsen.net> References: <1B6E5D5C-3EF3-4FDF-894D-B8577A030EF7@thornhill.no> <786DAB7F-F45D-405B-A4E5-4A60FD6CE7A7@secure.kjonigsen.net> <0c7829a2-b5e0-ca19-e3be-2b568e203bc8@secure.kjonigsen.net> Message-ID: <5332D6E2-B0C8-423F-B88B-9A9BB4D5D6BF@thornhill.no> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 59691 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On 30 November 2022 13:59:20 CET, "Jostein Kj=C3=B8nigsen" wrote: >On 29=2E11=2E2022 23:20, Jostein Kj=C3=B8nigsen wrote: >>=20 >>> On 29 Nov 2022, at 22:48, Theodor Thornhill wrot= e: >>>=20 >>> =EF=BB=BF >>>=20 >>>> On 29 November 2022 22:37:25 CET, "Jostein Kj=C3=B8nigsen" wrote: >>>> Nice! >>>>=20 >>>> Should we until further notice assume that js-ts-mode suffers from th= e same issues, and that a jsx-ts-mode might be needed too? To me it at leas= t sounds plausible=2E >>> No, because there are no ambiguities in the grammar with types and jsx= =2E >>>=20 >> Note this behaviour was triggered even when a HTML-tag was contained in= side a plain string=2E >>=20 >> Even without hard typescript casts, there are places where I suspect th= e same issues can bleed into js-ts-mode=2E >>=20 >> I=E2=80=99ll try to do more testing tomorrow=2E > >First of all - good news! > >Contrary to my expectations, I've tested and I cannot reproduce this issu= e in js-ts-mode=2E > Yeah, that's what I've seen as well=2E >Even more good news: > >Looking deeper into this using treesit-explorer-mode (an extremely helpfu= l tool, Yuan!), I found I may have misinterpreted the state of the parse-tr= ee in previous report=2E > >Based on that, I would like to revise this bug report: > > * HTML-like constructs inside strings are --/not/-- treated at > jsx_opening_elements, That's correct! > * only angle-bracket "hard" casts (which isn't present in Javascript) > is causing issues for fontification=2E > >Also, reading up, from what I can tell "hard casts" using angle-brackets = are no longer encouraged as the default way to cast: > >=C2=A0=C2=A0=C2=A0 const service =3D object; > >This is because the above code will cause a compiler error if used in TSX= -files (as opposed to TS-files)=2E Instead "as" expressions are preferred, = because they work equally well for both TS & TSX-files: > >=C2=A0=C2=A0=C2=A0 const service =3D object as IService; > >That means that writing idiomatic TypeScript with typescrip-ts-mode shoul= d produce the expected behaviour, while one may encounter issues with older= code=2E > >I'm not sure introducing a new major-mode for this 1 aspect of TypeScript= development is worth it? > >Does anyone else have an opinion on this? > >-- >Jostein I think that because this is an actual feature it makes sense to have two = modes=2E But defaulting to tsx as the language of choice until now is ok to= o=2E Theo From debbugs-submit-bounces@debbugs.gnu.org Wed Nov 30 09:10:26 2022 Received: (at 59691) by debbugs.gnu.org; 30 Nov 2022 14:10:26 +0000 Received: from localhost ([127.0.0.1]:33025 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p0Nn8-0005f4-9p for submit@debbugs.gnu.org; Wed, 30 Nov 2022 09:10:26 -0500 Received: from eggs.gnu.org ([209.51.188.92]:47676) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p0Nn6-0005ex-4b for 59691@debbugs.gnu.org; Wed, 30 Nov 2022 09:10:25 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p0Nn0-000776-8D; Wed, 30 Nov 2022 09:10:18 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=n+wLUk43s+2fnnZ+gYvTlcTLOqe/rO9hkefilzz7URE=; b=jJt/kXiEIiJQDQrxNCJ3 3NhC79DLsc6+Sa/a9GnmwvpW55/z7sqsmq7RDi91yJVpaEJhjePfM4ZhPb7PrnnyxgFhuXopLYH5F 7jMpcUdrRIEHfcN2sBgXjhGUVbQu+gf5RbsCtPqajpA2tcMiY0a+QPqXPanCsHDWY2SIbi2E2FkOZ KKRRjYLXpop6v6Qd3hQZCPaot93XuhQ94LLy+s3c6OwrxnkGrgVut3u1TSo4+YzvsX+P3KAESMmI+ 7sxjnBxybaQqgJClA+NtiY+jTB3hVyVQcth6UXUFAEkHtM/+Ozc+H263JRs9R+w4EBzRtArGuFIIL YjSqAgKB/f7fnQ==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p0Nmy-0000kh-OX; Wed, 30 Nov 2022 09:10:18 -0500 Date: Wed, 30 Nov 2022 16:09:44 +0200 Message-Id: <831qpklejb.fsf@gnu.org> From: Eli Zaretskii To: Yuan Fu In-Reply-To: (message from Yuan Fu on Wed, 30 Nov 2022 02:22:06 -0800) Subject: Re: bug#59691: 29.0.60; typescript-ts-mode: any HTML-like elements causes fontification to become invalid and remaining parse-tree to become jsx-expression References: MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 59691 Cc: jostein@secure.kjonigsen.net, theo@thornhill.no, jostein@kjonigsen.net, 59691@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Yuan Fu > Date: Wed, 30 Nov 2022 02:22:06 -0800 > Cc: Jostein Kjønigsen , > 59691@debbugs.gnu.org, > jostein@kjonigsen.net, > eliz@gnu.org > > No strong opinions here, but currently a user could install > tree-sitter-js, and find and enable js-ts-mode, which is > straightforward, which is good. Since these four modes doesn’t require > too much boilerplate, I think it’s pretty good right now. Can we do that automatically? For example, can typescript-ts-mode call js-ts-mode when it detects that it is necessary? From debbugs-submit-bounces@debbugs.gnu.org Wed Nov 30 09:25:48 2022 Received: (at 59691) by debbugs.gnu.org; 30 Nov 2022 14:25:48 +0000 Received: from localhost ([127.0.0.1]:33101 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p0O1z-0005na-Lu for submit@debbugs.gnu.org; Wed, 30 Nov 2022 09:25:47 -0500 Received: from eggs.gnu.org ([209.51.188.92]:47214) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p0O1x-0005nQ-Ml for 59691@debbugs.gnu.org; Wed, 30 Nov 2022 09:25:46 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p0O1o-000217-4z; Wed, 30 Nov 2022 09:25:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=4jL7LM617BTQK3pkf1vsnf6PVrQUscziflmkayWm4G4=; b=KocnxNifCw4f 4m0fr2xUj625BFE7JtChXs2P48gACjIhqztx/UGh904PWw1fpIlxjDmVtEpVanUK0o51Hi0SWU2Xw NYBNeYS1F7bR4uyxioqWYT+eKHwmCiXn4kPl+jTdC8A+7QoFMaCc1rMDEpksx1+VF6cv06n5/EEQT /Jm2ppBYGVjz1DnGirt5mdL7AmtKEGjzR2jjtEBzLCvcBvhHwPH6LcZ3cRSi9zFm1Ip2QucEx44+y pz8ZkRk5/RMqlfoFrYYf34ijLhSYRM3yYhB9EEIOP36hzD5D2Mxy6WwIJbEJVbMf8YLSI/J/CUI5X 2tFNWFOBvOlptuSSnQFCtw==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p0O1n-0002sN-IE; Wed, 30 Nov 2022 09:25:35 -0500 Date: Wed, 30 Nov 2022 16:25:05 +0200 Message-Id: <83wn7cjz9a.fsf@gnu.org> From: Eli Zaretskii To: Theodor Thornhill In-Reply-To: <8D2C4666-BB58-4C85-A080-B31B48AF947F@thornhill.no> (message from Theodor Thornhill on Wed, 30 Nov 2022 14:00:49 +0100) Subject: Re: Html-like constructs fail in typescript References: <87pmd58ohe.fsf@thornhill.no> <83iliwlivu.fsf@gnu.org> <8D2C4666-BB58-4C85-A080-B31B48AF947F@thornhill.no> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 59691 Cc: 59691@debbugs.gnu.org, casouri@gmail.com, jostein@kjonigsen.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Wed, 30 Nov 2022 14:00:49 +0100 > From: Theodor Thornhill > CC: 59691@debbugs.gnu.org, jostein@kjonigsen.net, casouri@gmail.com > > > > On 30 November 2022 13:35:49 CET, Eli Zaretskii wrote: > >> From: Theodor Thornhill > >> Cc: jostein@kjonigsen.net, casouri@gmail.com, eliz@gnu.org > >> Date: Tue, 29 Nov 2022 22:01:01 +0100 > >> > >> The solution is to create two modes: typescript-ts-mode and > >> tsx-ts-mode. They have separate parsers, and should be treated as > >> separate languages. That means that in a .ts file we enable the > >> 'typescript' language, and in .tsx we enable the 'tsx' language. This > >> exact issue is why they have two languages. > > > >This means the script posted by Yuan, which only creates a single grammar > >library for Typescript (the one for tsx), should be changed to instead > >produce two libraries, right? > > Yes, I can fix that when the two modes are in :) Thanks. But now I hear that the original analysis could be incomplete, and there actually is no problem, according to Jostein's last messages? From debbugs-submit-bounces@debbugs.gnu.org Wed Nov 30 09:48:02 2022 Received: (at 59691) by debbugs.gnu.org; 30 Nov 2022 14:48:03 +0000 Received: from localhost ([127.0.0.1]:33207 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p0ONW-0005zU-CY for submit@debbugs.gnu.org; Wed, 30 Nov 2022 09:48:02 -0500 Received: from out2.migadu.com ([188.165.223.204]:60685) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p0ONT-0005yt-JW for 59691@debbugs.gnu.org; Wed, 30 Nov 2022 09:48:01 -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=1669819677; 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=faRpmcn2l4UuWYY3+kGdCWVegCRbm5Kg4mNGtQPRA0k=; b=gOC5McIE0mvHyvGWANFrl6L15ME7THi3dn4doUED+K19c5fuE83/hPVuTgfeZfiLOhl+Gv oMcL1ECigR1lyIagfmG2S9myZIGoBkcHrfwQrDBFCk+ZeOljqxS8FpImDgViH9D2yWFopq sqwJMu2hChc4RrQDQQCajYZ9XbjDbCM4hwfjDfiGqO7ukYt6DgPoEDkU9DDh26nndv4mmV /evtvCpU8gfrQ1XlBbF4nQJ9p500X4Kzft6aE8BcHrGeFHJNbQqmWdhmivl2z/DBlTbOlp H0/sRGNjy0UI1vScV5LX2jWDg/0vZWELHlnCAylw2YGVHa2SvZrVkeeljkb08A== From: Theodor Thornhill To: Eli Zaretskii Subject: Re: Html-like constructs fail in typescript In-Reply-To: <83wn7cjz9a.fsf@gnu.org> References: <87pmd58ohe.fsf@thornhill.no> <83iliwlivu.fsf@gnu.org> <8D2C4666-BB58-4C85-A080-B31B48AF947F@thornhill.no> <83wn7cjz9a.fsf@gnu.org> Date: Wed, 30 Nov 2022 15:47:56 +0100 Message-ID: <87a648lcrn.fsf@thornhill.no> MIME-Version: 1.0 Content-Type: text/plain X-Migadu-Flow: FLOW_OUT X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 59691 Cc: 59691@debbugs.gnu.org, casouri@gmail.com, jostein@kjonigsen.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Eli Zaretskii writes: >> Date: Wed, 30 Nov 2022 14:00:49 +0100 >> From: Theodor Thornhill >> CC: 59691@debbugs.gnu.org, jostein@kjonigsen.net, casouri@gmail.com >> >> >> >> On 30 November 2022 13:35:49 CET, Eli Zaretskii wrote: >> >> From: Theodor Thornhill >> >> Cc: jostein@kjonigsen.net, casouri@gmail.com, eliz@gnu.org >> >> Date: Tue, 29 Nov 2022 22:01:01 +0100 >> >> >> >> The solution is to create two modes: typescript-ts-mode and >> >> tsx-ts-mode. They have separate parsers, and should be treated as >> >> separate languages. That means that in a .ts file we enable the >> >> 'typescript' language, and in .tsx we enable the 'tsx' language. This >> >> exact issue is why they have two languages. >> > >> >This means the script posted by Yuan, which only creates a single grammar >> >library for Typescript (the one for tsx), should be changed to instead >> >produce two libraries, right? >> >> Yes, I can fix that when the two modes are in :) > > Thanks. But now I hear that the original analysis could be incomplete, and > there actually is no problem, according to Jostein's last messages? I don't think I agree with him. There are other constructs such as generics that also can cause these ambiguities, IIRC Theo From debbugs-submit-bounces@debbugs.gnu.org Wed Nov 30 10:23:12 2022 Received: (at 59691) by debbugs.gnu.org; 30 Nov 2022 15:23:12 +0000 Received: from localhost ([127.0.0.1]:33417 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p0OvY-0006Ml-6t for submit@debbugs.gnu.org; Wed, 30 Nov 2022 10:23:12 -0500 Received: from out2.migadu.com ([188.165.223.204]:43922) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p0OvV-0006Me-89 for 59691@debbugs.gnu.org; Wed, 30 Nov 2022 10:23:10 -0500 Date: Wed, 30 Nov 2022 16:21:37 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1669821788; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8l2TRoR1quV6MIflwtvhHqyGNnSGevVGDJWdp7l7Ok0=; b=kFYMvxHY1FHfqegzu0Ggc3f1f1lKwWJne3ONmQ/KZwc6J78qNClzfd3LlrCrWeXy5P5430 OGEF6tgOXsUOTEuRkgFZjzq6ZqVumkH+W5HlAZzkz1RCAIlnpHfr7zMuba3e50KrhJO7ev EdBjMGaoqHGALzu9dbnFAxGV+x3ogs6Ev6YPknJAf4/BIvaxDnsN9IFGQT7trfnzI0y2Br 2kKaYVZPlwjvTk+zhNQNEY2vJWyb2y3M1Mo32FnYaYXG9d3y8NwIFzchYknzKbUEkFap1A +HCZmez+Thl6NfKatlck0SFhbU6gmcmvhj8QaN12MjID8B7istGGUVfk8RGEvg== X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Theodor Thornhill To: Eli Zaretskii , Yuan Fu Subject: =?US-ASCII?Q?Re=3A_bug=2359691=3A_29=2E0=2E60=3B_typescript-ts-m?= =?US-ASCII?Q?ode=3A_any_HTML-like_elements__causes_fon?= =?US-ASCII?Q?tification_to_become_invalid_and_remain?= =?US-ASCII?Q?ing_parse-tree_to_become__jsx-expression?= In-Reply-To: <831qpklejb.fsf@gnu.org> References: <831qpklejb.fsf@gnu.org> Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 59691 Cc: 59691@debbugs.gnu.org, jostein@secure.kjonigsen.net, jostein@kjonigsen.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On 30 November 2022 15:09:44 CET, Eli Zaretskii wrote: >> From: Yuan Fu >> Date: Wed, 30 Nov 2022 02:22:06 -0800 >> Cc: Jostein Kj=C3=B8nigsen , >> 59691@debbugs=2Egnu=2Eorg, >> jostein@kjonigsen=2Enet, >> eliz@gnu=2Eorg >>=20 >> No strong opinions here, but currently a user could install >> tree-sitter-js, and find and enable js-ts-mode, which is >> straightforward, which is good=2E Since these four modes doesn=E2=80=99= t require >> too much boilerplate, I think it=E2=80=99s pretty good right now=2E > >Can we do that automatically? For example, can typescript-ts-mode call >js-ts-mode when it detects that it is necessary? That's not what we want=2E=20 There are three languages here from treesitters pov=2E Typescript Tsx JavaScript They are all different, and should be treated as such, imo :) Theo From debbugs-submit-bounces@debbugs.gnu.org Wed Nov 30 11:06:57 2022 Received: (at 59691) by debbugs.gnu.org; 30 Nov 2022 16:06:57 +0000 Received: from localhost ([127.0.0.1]:33617 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p0Pbs-0006j2-Tb for submit@debbugs.gnu.org; Wed, 30 Nov 2022 11:06:57 -0500 Received: from eggs.gnu.org ([209.51.188.92]:50646) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p0Pbq-0006iw-77 for 59691@debbugs.gnu.org; Wed, 30 Nov 2022 11:06:55 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p0PbW-0003J3-An; Wed, 30 Nov 2022 11:06:47 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=F504gQpEzczY6OFJlsyQSiO5207vPycTAm93fQTu644=; b=Cx8W1ji8jg4++xPOpnen yDbrpbB0n8QjWmtpRzqcucXjYE8E05jhAmDWOkuMaTAjsTk9ssMyOfFxhJZo3+j8qLWrW6YaImFqg kHMqF8yPP6EYKLfyKigdK67jzl0HQ+Zg4EuwZ1Ad8OIOPHGKiX3kP6zvoHs88kFNs3IpxX7InrTpZ xJkrnbgcewl9rSCzOcnPyMZ79Kc1ySKjHnKaQE9TxS0QQUOabb0vr94ZQMB5Bmsr/Ot5FbW298p2w wjMrXVx31M08w+4ss7VkGeQv+M3kETm/Vgtheu6EkTlDYR3X5vDSq7pTDViLQhGI+uj3di6YLZzPw bA9JE6TZ7MAL/Q==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p0PbT-0007ZJ-C4; Wed, 30 Nov 2022 11:06:32 -0500 Date: Wed, 30 Nov 2022 18:05:59 +0200 Message-Id: <83mt88jul4.fsf@gnu.org> From: Eli Zaretskii To: Theodor Thornhill In-Reply-To: (message from Theodor Thornhill on Wed, 30 Nov 2022 16:21:37 +0100) Subject: Re: bug#59691: 29.0.60; typescript-ts-mode: any HTML-like elements causes fontification to become invalid and remaining parse-tree to become jsx-expression References: <831qpklejb.fsf@gnu.org> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 59691 Cc: 59691@debbugs.gnu.org, casouri@gmail.com, jostein@secure.kjonigsen.net, jostein@kjonigsen.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Wed, 30 Nov 2022 16:21:37 +0100 > From: Theodor Thornhill > CC: jostein@secure.kjonigsen.net, 59691@debbugs.gnu.org, jostein@kjonigsen.net > > >> No strong opinions here, but currently a user could install > >> tree-sitter-js, and find and enable js-ts-mode, which is > >> straightforward, which is good. Since these four modes doesn’t require > >> too much boilerplate, I think it’s pretty good right now. > > > >Can we do that automatically? For example, can typescript-ts-mode call > >js-ts-mode when it detects that it is necessary? > > That's not what we want. > > There are three languages here from treesitters pov. > > Typescript > Tsx > JavaScript > > They are all different, and should be treated as such, imo :) Our automatic turning-on of major-modes looks at the file-name extension and little else (magic-mode-alist is not useful here). So if a file whose extension is XYZ can have more than one applicable major-mode, we should try to do something to turn on the correct mode automatically. What can we do? From debbugs-submit-bounces@debbugs.gnu.org Wed Nov 30 13:12:07 2022 Received: (at 59691) by debbugs.gnu.org; 30 Nov 2022 18:12:07 +0000 Received: from localhost ([127.0.0.1]:34237 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p0RZ0-0001k7-Ja for submit@debbugs.gnu.org; Wed, 30 Nov 2022 13:12:06 -0500 Received: from out2.migadu.com ([188.165.223.204]:62903) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p0RYy-0001k0-6S for 59691@debbugs.gnu.org; Wed, 30 Nov 2022 13:12:05 -0500 Date: Wed, 30 Nov 2022 19:10:04 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1669831922; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=baxnqUyzAN647zJSN4qIa9DA8mPdeecKVOaJwOj5qMg=; b=U07Rap6lrF11RdEpTby1IAxcOZ1g+JPRrkT/0QkGFaebjJJ26pG1HyPOJXR3R4fX2DChrc sv6FWPe9lxh1/3W6iaRIk8jr2bUBEG5vLKy1iqZ4FrHkqoE0XRNM2hM/i+TYc0Ph/ZbkSy ZRK1YPClxZYP8ILblze5hgvROwDDI2rjkLlA2bm3n6TDNwub+Uwi1DM4zXUloqJ9lTOdQ8 p/pXYyxCvgh4A+3RsLuMj5DF/DFRJ8RPVUacPvPeW1ep9hmZKRYevfe7LEL/kVjhW5TLVN XEphgHeW5LroOoruhh6/2TVejIR6j6uJ3hjoKdGpX+suMRzYuffaM8kdEa0jXg== X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Theodor Thornhill To: Eli Zaretskii Subject: =?US-ASCII?Q?Re=3A_bug=2359691=3A_29=2E0=2E60=3B_typescript-ts-m?= =?US-ASCII?Q?ode=3A_any_HTML-like_elements__causes_fon?= =?US-ASCII?Q?tification_to_become_invalid_and_remain?= =?US-ASCII?Q?ing_parse-tree_to_become__jsx-expression?= In-Reply-To: <83mt88jul4.fsf@gnu.org> References: <831qpklejb.fsf@gnu.org> <83mt88jul4.fsf@gnu.org> Message-ID: <0A18F996-F3BB-4A7D-A0BE-76C8374DE517@thornhill.no> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 59691 Cc: 59691@debbugs.gnu.org, casouri@gmail.com, jostein@secure.kjonigsen.net, jostein@kjonigsen.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On 30 November 2022 17:05:59 CET, Eli Zaretskii wrote: >> Date: Wed, 30 Nov 2022 16:21:37 +0100 >> From: Theodor Thornhill >> CC: jostein@secure=2Ekjonigsen=2Enet, 59691@debbugs=2Egnu=2Eorg, jostei= n@kjonigsen=2Enet >>=20 >> >> No strong opinions here, but currently a user could install >> >> tree-sitter-js, and find and enable js-ts-mode, which is >> >> straightforward, which is good=2E Since these four modes doesn=E2=80= =99t require >> >> too much boilerplate, I think it=E2=80=99s pretty good right now=2E >> > >> >Can we do that automatically? For example, can typescript-ts-mode cal= l >> >js-ts-mode when it detects that it is necessary? >>=20 >> That's not what we want=2E=20 >>=20 >> There are three languages here from treesitters pov=2E >>=20 >> Typescript >> Tsx >> JavaScript >>=20 >> They are all different, and should be treated as such, imo :) > >Our automatic turning-on of major-modes looks at the file-name extension = and >little else (magic-mode-alist is not useful here)=2E So if a file whose >extension is XYZ can have more than one applicable major-mode, we should = try >to do something to turn on the correct mode automatically=2E What can we= do? We are lucky because the extensions in question are ts, tsx and js=2E So w= e don't need any smartness :) Theo From debbugs-submit-bounces@debbugs.gnu.org Wed Nov 30 13:19:48 2022 Received: (at 59691) by debbugs.gnu.org; 30 Nov 2022 18:19:48 +0000 Received: from localhost ([127.0.0.1]:34293 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p0RgR-0001pE-J1 for submit@debbugs.gnu.org; Wed, 30 Nov 2022 13:19:47 -0500 Received: from eggs.gnu.org ([209.51.188.92]:37024) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p0RgJ-0001p4-JH for 59691@debbugs.gnu.org; Wed, 30 Nov 2022 13:19:46 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p0RgE-0001lo-54; Wed, 30 Nov 2022 13:19:34 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=JKvsDeCeczUOPw2Ch73UTpiM/XijykFX0vaZTwW9MIc=; b=k/jrD/BOUMdX So2CFDm8yznMwSk5k2zc4ORzeIWAIA2CjUvulAyfIHDSx1of7bJ/fbJ9ECqUMj/+YsdNaKAdMq+hU SGvm39FayIr0E/BZzUCdz1SyYd1QgctGp3J6LLJpZXwCym1ra4b8frRxinve59GMFgpKiNaIvIa1+ AXtgEAp6UGxICoC48j/0fwpm23ka8FYQJ6ZKgtJmnVDj/zlGg83QrBQKGXJbQYyyvJmLr5jcm3gcT loPP1oCYy8H7s0iMtjnmkVzOhPdyz5EDik6wP90Jpttq23ZH19h6ZpNKZyscYy+LLbDOLT0RDzlwz PhcVaYtIeI0/PP8wtvhEIA==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p0RgD-0006l6-HU; Wed, 30 Nov 2022 13:19:33 -0500 Date: Wed, 30 Nov 2022 20:19:04 +0200 Message-Id: <8335a0jofb.fsf@gnu.org> From: Eli Zaretskii To: Theodor Thornhill In-Reply-To: <0A18F996-F3BB-4A7D-A0BE-76C8374DE517@thornhill.no> (message from Theodor Thornhill on Wed, 30 Nov 2022 19:10:04 +0100) Subject: Re: bug#59691: 29.0.60; typescript-ts-mode: any HTML-like elements causes fontification to become invalid and remaining parse-tree to become jsx-expression References: <831qpklejb.fsf@gnu.org> <83mt88jul4.fsf@gnu.org> <0A18F996-F3BB-4A7D-A0BE-76C8374DE517@thornhill.no> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 59691 Cc: 59691@debbugs.gnu.org, casouri@gmail.com, jostein@secure.kjonigsen.net, jostein@kjonigsen.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Wed, 30 Nov 2022 19:10:04 +0100 > From: Theodor Thornhill > CC: casouri@gmail.com, jostein@secure.kjonigsen.net, 59691@debbugs.gnu.org, > jostein@kjonigsen.net > > >Our automatic turning-on of major-modes looks at the file-name extension and > >little else (magic-mode-alist is not useful here). So if a file whose > >extension is XYZ can have more than one applicable major-mode, we should try > >to do something to turn on the correct mode automatically. What can we do? > > We are lucky because the extensions in question are ts, tsx and js. So we don't need any smartness :) And the extensions always say unequivocally what mode to use? Then yes, we are lucky, and need just one more major mode (and one more grammar library). From debbugs-submit-bounces@debbugs.gnu.org Wed Nov 30 13:21:09 2022 Received: (at 59691) by debbugs.gnu.org; 30 Nov 2022 18:21:09 +0000 Received: from localhost ([127.0.0.1]:34303 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p0Rhl-0001ql-4j for submit@debbugs.gnu.org; Wed, 30 Nov 2022 13:21:09 -0500 Received: from out2.migadu.com ([188.165.223.204]:17158) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p0Rhj-0001qf-7p for 59691@debbugs.gnu.org; Wed, 30 Nov 2022 13:21:08 -0500 Date: Wed, 30 Nov 2022 19:20:31 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1669832463; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=P4hACwD34lQRguz5PVUoxodGF60wvhZCTzWxOnSBWIE=; b=rY/CgKcNAy2ekEfcyFq0OZ4XQQ80rws6f7dLgrcjkmNrg6Z0Z8NMXwLoudg46oKWwOdH+9 NbEphc7e+4mETiOnLDXsYg8YPA/ARGWyS54+TGaGY2N7pv8yFwaDfWqzxNw3NFNLbye8a8 FtWsrQaeNmb/7A6q8dmc6CwRAKiDfYG+yJzVptL5ZK1KD8QaDS5tM4AvT3qsffVqzCXh6c 5HNKD/pFhAPRpfPK1XXdVSpbkTAHBOzx064BwuzKmbQBQjRvlWXinLZDuXoHGtbaDGbTig WbmAtJeRIy8g11jQRaIMjSCNzxai0sir8lKavi5UnofX8F3SFsKE8uxEpY7q6Q== X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Theodor Thornhill To: Eli Zaretskii Subject: =?US-ASCII?Q?Re=3A_bug=2359691=3A_29=2E0=2E60=3B_typescript-ts-m?= =?US-ASCII?Q?ode=3A_any_HTML-like_elements__causes_fon?= =?US-ASCII?Q?tification_to_become_invalid_and_remain?= =?US-ASCII?Q?ing_parse-tree_to_become__jsx-expression?= In-Reply-To: <8335a0jofb.fsf@gnu.org> References: <831qpklejb.fsf@gnu.org> <83mt88jul4.fsf@gnu.org> <0A18F996-F3BB-4A7D-A0BE-76C8374DE517@thornhill.no> <8335a0jofb.fsf@gnu.org> Message-ID: <828054ED-149A-40E7-A75D-F9C57DBACDB8@thornhill.no> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 59691 Cc: 59691@debbugs.gnu.org, casouri@gmail.com, jostein@secure.kjonigsen.net, jostein@kjonigsen.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On 30 November 2022 19:19:04 CET, Eli Zaretskii wrote: >> Date: Wed, 30 Nov 2022 19:10:04 +0100 >> From: Theodor Thornhill >> CC: casouri@gmail=2Ecom, jostein@secure=2Ekjonigsen=2Enet, 59691@debbug= s=2Egnu=2Eorg, >> jostein@kjonigsen=2Enet >>=20 >> >Our automatic turning-on of major-modes looks at the file-name extensi= on and >> >little else (magic-mode-alist is not useful here)=2E So if a file who= se >> >extension is XYZ can have more than one applicable major-mode, we shou= ld try >> >to do something to turn on the correct mode automatically=2E What can= we do? >>=20 >> We are lucky because the extensions in question are ts, tsx and js=2E S= o we don't need any smartness :) > >And the extensions always say unequivocally what mode to use? Then yes, = we >are lucky, and need just one more major mode (and one more grammar librar= y)=2E That's right! From debbugs-submit-bounces@debbugs.gnu.org Wed Nov 30 13:22:11 2022 Received: (at 59691) by debbugs.gnu.org; 30 Nov 2022 18:22:11 +0000 Received: from localhost ([127.0.0.1]:34311 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p0Ril-0001rQ-Hr for submit@debbugs.gnu.org; Wed, 30 Nov 2022 13:22:11 -0500 Received: from out2.migadu.com ([188.165.223.204]:18214) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p0Rig-0001rK-0m for 59691@debbugs.gnu.org; Wed, 30 Nov 2022 13:22:09 -0500 Date: Wed, 30 Nov 2022 19:21:58 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1669832525; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ETvRylCIru+65igjjj5M5dExenVHZ3jCKfaZl85wFYk=; b=k+gmlm4YFMohvmez5jxv8jbR4dTEN/Abp1pWAbOLTbs6SFVKev7tERRNuqaIxCPxP03Bf5 A81XzEXowDrwjhRXytx6tzMVC9fSwFsspRkBgoQpZXu0gTm5zPSAceAnlDuLTsGXYIlSFX +nGZEcPZqc/h4DsfX3KNzuUOWr2/CYU8bshXILoW3Ht0EVtfwnte/YETZ7g82mXj0OTwqM 64I/+/YNHxEZyJamfjl8KlnjNEcvNlNuo1EDEwqvPu2Q+ltFjFHpS+7GLTUdq26lLIvVPT pbBPykjjE/A5kDRYxdyGxU4JO9dc8RBKhWe6L5ai3DCfxfdTZwA3vLsRLU2N9w== X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Theodor Thornhill To: Eli Zaretskii Subject: =?US-ASCII?Q?Re=3A_bug=2359691=3A_29=2E0=2E60=3B_typescript-ts-m?= =?US-ASCII?Q?ode=3A_any_HTML-like_elements__causes_fon?= =?US-ASCII?Q?tification_to_become_invalid_and_remain?= =?US-ASCII?Q?ing_parse-tree_to_become__jsx-expression?= In-Reply-To: <8335a0jofb.fsf@gnu.org> References: <831qpklejb.fsf@gnu.org> <83mt88jul4.fsf@gnu.org> <0A18F996-F3BB-4A7D-A0BE-76C8374DE517@thornhill.no> <8335a0jofb.fsf@gnu.org> Message-ID: <7BE15945-C463-448A-8593-E3B5D0E374FB@thornhill.no> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 59691 Cc: 59691@debbugs.gnu.org, casouri@gmail.com, jostein@secure.kjonigsen.net, jostein@kjonigsen.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On 30 November 2022 19:19:04 CET, Eli Zaretskii wrote: >> Date: Wed, 30 Nov 2022 19:10:04 +0100 >> From: Theodor Thornhill >> CC: casouri@gmail=2Ecom, jostein@secure=2Ekjonigsen=2Enet, 59691@debbug= s=2Egnu=2Eorg, >> jostein@kjonigsen=2Enet >>=20 >> >Our automatic turning-on of major-modes looks at the file-name extensi= on and >> >little else (magic-mode-alist is not useful here)=2E So if a file who= se >> >extension is XYZ can have more than one applicable major-mode, we shou= ld try >> >to do something to turn on the correct mode automatically=2E What can= we do? >>=20 >> We are lucky because the extensions in question are ts, tsx and js=2E S= o we don't need any smartness :) > >And the extensions always say unequivocally what mode to use? Then yes, = we >are lucky, and need just one more major mode (and one more grammar librar= y)=2E I have already made that commit, but it is waiting on the indent style pa= tch :) From debbugs-submit-bounces@debbugs.gnu.org Thu Dec 01 01:02:05 2022 Received: (at 59691) by debbugs.gnu.org; 1 Dec 2022 06:02:05 +0000 Received: from localhost ([127.0.0.1]:37510 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p0ce4-0004kx-SW for submit@debbugs.gnu.org; Thu, 01 Dec 2022 01:02:05 -0500 Received: from out2.migadu.com ([188.165.223.204]:19068) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p0ce1-0004ka-5K for 59691@debbugs.gnu.org; Thu, 01 Dec 2022 01:02:03 -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=1669874517; 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=z37/1e1Kg8MfuXqPL8D6aJTlKxe0iZubQclEXbVTFtU=; b=Yv+VMhVY0KWJEkNqWyRzdVuu+FVVonFDCMEQtRUu2hxrwyFpYokjmfnIslxdb6PL5Xcri6 HL4wqT+ds7YZHxIJFUB3KEFVpJ2LRNMhxzgvqpCmXIZv3BbJMCPIWbn8jWwvwfg9JSVs29 BzyL+vV8R/ttY/ygou0QfZBacgCjpPVFJw0XBhwxqwS7PGWy9SSN5FL+39ifOr48+BsE1k OuVJRv9TTFi7MlWRKr0uTVlusMbc/tlp6siDAtMvFzDo9eKfSyPnaLSW2yYRl4us7AEx5S OyoudTG+leK3lLOfaI5eBN7Dve6hvv/msGoRJ9OFnnQ3tc4JredK719AHX8weA== From: Theodor Thornhill To: Eli Zaretskii Subject: Re: bug#59691: 29.0.60; typescript-ts-mode: any HTML-like elements causes fontification to become invalid and remaining parse-tree to become jsx-expression In-Reply-To: <7BE15945-C463-448A-8593-E3B5D0E374FB@thornhill.no> References: <831qpklejb.fsf@gnu.org> <83mt88jul4.fsf@gnu.org> <0A18F996-F3BB-4A7D-A0BE-76C8374DE517@thornhill.no> <8335a0jofb.fsf@gnu.org> <7BE15945-C463-448A-8593-E3B5D0E374FB@thornhill.no> Date: Thu, 01 Dec 2022 07:01:55 +0100 Message-ID: <871qpj1x2k.fsf@thornhill.no> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Migadu-Flow: FLOW_OUT X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 59691 Cc: 59691@debbugs.gnu.org, casouri@gmail.com, jostein@secure.kjonigsen.net, jostein@kjonigsen.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain Theodor Thornhill writes: > On 30 November 2022 19:19:04 CET, Eli Zaretskii wrote: >>> Date: Wed, 30 Nov 2022 19:10:04 +0100 >>> From: Theodor Thornhill >>> CC: casouri@gmail.com, jostein@secure.kjonigsen.net, 59691@debbugs.gnu.org, >>> jostein@kjonigsen.net >>> >>> >Our automatic turning-on of major-modes looks at the file-name extension and >>> >little else (magic-mode-alist is not useful here). So if a file whose >>> >extension is XYZ can have more than one applicable major-mode, we should try >>> >to do something to turn on the correct mode automatically. What can we do? >>> >>> We are lucky because the extensions in question are ts, tsx and js. So we don't need any smartness :) >> >>And the extensions always say unequivocally what mode to use? Then yes, we >>are lucky, and need just one more major mode (and one more grammar library). > > I have already made that commit, but it is waiting on the indent style patch :) Ok, because it seems we didn't want the indent style patch let's fix this bug instead :) Attached is the new major mode. What do you think? Theo --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Add-new-TypeScript-mode-tsx-ts-mode.patch >From 5cdae535295d92dfe7feb5ad595e836f31bd3e85 Mon Sep 17 00:00:00 2001 From: Theodor Thornhill Date: Tue, 29 Nov 2022 21:39:38 +0100 Subject: [PATCH] Add new TypeScript mode tsx-ts-mode There are in fact two languages supporting TypeScript for tree-sitter. Because TSX causes some ambiguities with types there are two grammars, one called typescript and one called tsx. To account for this and to be as correct as possible we enable using both. * lisp/progmodes/typescript-ts-mode.el (typescript-ts-mode--indent-rules): Change to a function to accomodate the two languages. (typescript-ts-mode--font-lock-settings): Change to a function to accomodate the two languages. (typescript-ts-mode--base-mode): Parent mode for typescript-ts-mode and tsx-ts-mode. (typescript-ts-mode): Derive from typescript-ts-mode--base-mode and extend with language specific settings (tsx-ts-mode): New major mode that derives from typescript-ts-mode--base-mode and extend it with language specific settings Add autoload cookies for the respective file type extensions: .ts and .tsx. * etc/NEWS: Mention the new mode. --- etc/NEWS | 7 +- lisp/progmodes/typescript-ts-mode.el | 155 +++++++++++++++++---------- 2 files changed, 106 insertions(+), 56 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 4e091a5fed..439d20960b 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2972,7 +2972,12 @@ 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. -** New major mode 'c-ts-mode'. +** New mode 'tsx-ts-mode'. +A major mode based on the tree-sitter library for editing programs +in the TypeScript language, with support for TSX. It includes +support for font-locking, indentation, and navigation. + +** New mode 'c-ts-mode'. A major mode based on the tree-sitter library for editing programs in the C language. It includes support for font-locking, indentation, Imenu, which-func, and navigation. diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el index 6c926a4e3e..c1beaf3134 100644 --- a/lisp/progmodes/typescript-ts-mode.el +++ b/lisp/progmodes/typescript-ts-mode.el @@ -22,6 +22,10 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program. If not, see . + +;;; Commentary: +;; + ;;; Code: (require 'treesit) @@ -56,8 +60,10 @@ typescript-ts-mode--syntax-table table) "Syntax table for `typescript-ts-mode'.") -(defvar typescript-ts-mode--indent-rules - `((tsx +(defun typescript-ts-mode--indent-rules (language) + "Rules used for indentation. +Argument LANGUAGE is either 'typescript' or 'tsx'." + `((,language ((parent-is "program") parent-bol 0) ((node-is "}") parent-bol 0) ((node-is ")") parent-bol 0) @@ -82,14 +88,13 @@ typescript-ts-mode--indent-rules ((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 typescript-ts-mode-indent-offset) - ((node-is "jsx_closing_element") parent 0) - ((parent-is "jsx_element") parent typescript-ts-mode-indent-offset) - ((node-is "/") parent 0) - ((parent-is "jsx_self_closing_element") parent typescript-ts-mode-indent-offset) - (no-node parent-bol 0))) - "Tree-sitter indent rules.") + ,@(when (eq language 'tsx) + `(((parent-is "jsx_opening_element") parent typescript-ts-mode-indent-offset) + ((node-is "jsx_closing_element") parent 0) + ((parent-is "jsx_element") parent typescript-ts-mode-indent-offset) + ((node-is "/") parent 0) + ((parent-is "jsx_self_closing_element") parent typescript-ts-mode-indent-offset))) + (no-node parent-bol 0)))) (defvar typescript-ts-mode--keywords '("!" "abstract" "as" "async" "await" "break" @@ -110,14 +115,16 @@ typescript-ts-mode--operators "&&" "||" "!" "?.") "TypeScript operators for tree-sitter font-locking.") -(defvar typescript-ts-mode--font-lock-settings +(defun typescript-ts-mode--font-lock-settings (language) + "Tree-sitter font-lock settings. +Argument LANGUAGE is either 'typescript' or 'tsx'." (treesit-font-lock-rules - :language 'tsx + :language language :override t :feature 'comment `((comment) @font-lock-comment-face) - :language 'tsx + :language language :override t :feature 'constant `(((identifier) @font-lock-constant-face @@ -125,13 +132,13 @@ typescript-ts-mode--font-lock-settings [(true) (false) (null)] @font-lock-constant-face) - :language 'tsx + :language language :override t :feature 'keyword `([,@typescript-ts-mode--keywords] @font-lock-keyword-face [(this) (super)] @font-lock-keyword-face) - :language 'tsx + :language language :override t :feature 'string `((regex pattern: (regex_pattern)) @font-lock-string-face @@ -139,7 +146,7 @@ typescript-ts-mode--font-lock-settings (template_string) @js--fontify-template-string (template_substitution ["${" "}"] @font-lock-builtin-face)) - :language 'tsx + :language language :override t :feature 'declaration `((function @@ -177,7 +184,7 @@ typescript-ts-mode--font-lock-settings (identifier) @font-lock-function-name-face) value: (array (number) (function)))) - :language 'tsx + :language language :override t :feature 'identifier `((nested_type_identifier @@ -208,7 +215,7 @@ typescript-ts-mode--font-lock-settings (_ (_ (identifier) @font-lock-variable-name-face)) (_ (_ (_ (identifier) @font-lock-variable-name-face)))])) - :language 'tsx + :language language :override t :feature 'expression '((assignment_expression @@ -223,7 +230,7 @@ typescript-ts-mode--font-lock-settings (member_expression property: (property_identifier) @font-lock-function-name-face)])) - :language 'tsx + :language language :override t :feature 'pattern `((pair_pattern @@ -231,7 +238,7 @@ typescript-ts-mode--font-lock-settings (array_pattern (identifier) @font-lock-variable-name-face)) - :language 'tsx + :language language :override t :feature 'jsx `((jsx_opening_element @@ -248,31 +255,31 @@ typescript-ts-mode--font-lock-settings (jsx_attribute (property_identifier) @font-lock-constant-face)) - :language 'tsx + :language language :feature 'number `((number) @font-lock-number-face ((identifier) @font-lock-number-face (:match "^\\(:?NaN\\|Infinity\\)$" @font-lock-number-face))) - :language 'tsx + :language language :feature 'operator `([,@typescript-ts-mode--operators] @font-lock-operator-face (ternary_expression ["?" ":"] @font-lock-operator-face)) - :language 'tsx + :language language :feature 'bracket '((["(" ")" "[" "]" "{" "}"]) @font-lock-bracket-face) - :language 'tsx + :language language :feature 'delimiter '((["," "." ";" ":"]) @font-lock-delimiter-face) - :language 'tsx + :language language :feature 'escape-sequence :override t '((escape_sequence) @font-lock-escape-face) - :language 'tsx + :language language :override t :feature 'property `((pair value: (identifier) @font-lock-variable-name-face) @@ -280,17 +287,71 @@ typescript-ts-mode--font-lock-settings ((shorthand_property_identifier) @font-lock-property-face) ((shorthand_property_identifier_pattern) - @font-lock-property-face))) - "Tree-sitter font-lock settings.") + @font-lock-property-face)))) ;;;###autoload (add-to-list 'auto-mode-alist '("\\.ts\\'" . typescript-ts-mode)) ;;;###autoload -(add-to-list 'auto-mode-alist '("\\.tsx\\'" . typescript-ts-mode)) +(add-to-list 'auto-mode-alist '("\\.tsx\\'" . tsx-ts-mode)) ;;;###autoload -(define-derived-mode typescript-ts-mode prog-mode "TypeScript" +(define-derived-mode typescript-ts-mode--base-mode prog-mode "TypeScript" + "Major mode for editing TypeScript." + :group 'typescript + :syntax-table typescript-ts-mode--syntax-table + + ;; Comments. + (setq-local comment-start "// ") + (setq-local comment-end "") + (setq-local comment-start-skip "\\(?://+\\|/\\*+\\)\\s *") + (setq-local comment-end-skip + (rx (* (syntax whitespace)) + (group (or (syntax comment-end) + (seq (+ "*") "/"))))) + + ;; Electric + (setq-local electric-indent-chars + (append "{}():;," electric-indent-chars)) + + ;; Navigation. + (setq-local treesit-defun-type-regexp + (rx (or "class_declaration" + "method_definition" + "function_declaration" + "lexical_declaration"))) + ;; Imenu. + (setq-local imenu-create-index-function #'js--treesit-imenu) + + ;; Which-func (use imenu). + (setq-local which-func-functions nil)) + +;;;###autoload +(define-derived-mode typescript-ts-mode typescript-ts-mode--base-mode "TypeScript" + "Major mode for editing TypeScript." + :group 'typescript + :syntax-table typescript-ts-mode--syntax-table + + (when (treesit-ready-p 'typescript) + (treesit-parser-create 'typescript) + + ;; Indent. + (setq-local treesit-simple-indent-rules + (typescript-ts-mode--indent-rules 'typescript)) + + ;; Font-lock. + (setq-local treesit-font-lock-settings + (typescript-ts-mode--font-lock-settings 'typescript)) + (setq-local treesit-font-lock-feature-list + '((comment declaration) + (keyword string) + (constant expression identifier number pattern property) + (bracket delimiter))) + + (treesit-major-mode-setup))) + +;;;###autoload +(define-derived-mode tsx-ts-mode typescript-ts-mode--base-mode "TypeScript[TSX]" "Major mode for editing TypeScript." :group 'typescript :syntax-table typescript-ts-mode--syntax-table @@ -301,43 +362,27 @@ typescript-ts-mode ;; Comments. (setq-local comment-start "// ") (setq-local comment-end "") - (setq-local comment-start-skip (rx (group "/" (or (+ "/") (+ "*"))) - (* (syntax whitespace)))) + (setq-local comment-start-skip "\\(?://+\\|/\\*+\\)\\s *") (setq-local comment-end-skip (rx (* (syntax whitespace)) (group (or (syntax comment-end) (seq (+ "*") "/"))))) - ;; Electric - (setq-local electric-indent-chars - (append "{}():;," electric-indent-chars)) - ;; Indent. - (setq-local treesit-simple-indent-rules typescript-ts-mode--indent-rules) - - ;; Navigation. - (setq-local treesit-defun-type-regexp - (rx (or "class_declaration" - "method_definition" - "function_declaration" - "lexical_declaration"))) + (setq-local treesit-simple-indent-rules + (typescript-ts-mode--indent-rules 'tsx)) ;; Font-lock. - (setq-local treesit-font-lock-settings typescript-ts-mode--font-lock-settings) + (setq-local treesit-font-lock-settings + (typescript-ts-mode--font-lock-settings 'tsx)) (setq-local treesit-font-lock-feature-list - '(( comment declaration) - ( keyword string) - ( constant expression identifier jsx number pattern property) - ( bracket delimiter))) - ;; Imenu. - (setq-local imenu-create-index-function #'js--treesit-imenu) - - ;; Which-func (use imenu). - (setq-local which-func-functions nil) + '((comment declaration) + (keyword string) + (constant expression identifier jsx number pattern property) + (bracket delimiter))) (treesit-major-mode-setup))) - (provide 'typescript-ts-mode) ;;; typescript-ts-mode.el ends here -- 2.34.1 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Thu Dec 01 02:45:36 2022 Received: (at 59691) by debbugs.gnu.org; 1 Dec 2022 07:45:36 +0000 Received: from localhost ([127.0.0.1]:38018 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p0eGG-0005w1-5c for submit@debbugs.gnu.org; Thu, 01 Dec 2022 02:45:36 -0500 Received: from eggs.gnu.org ([209.51.188.92]:56812) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p0eGD-0005vt-QP for 59691@debbugs.gnu.org; Thu, 01 Dec 2022 02:45:34 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p0eG5-00066e-Ts; Thu, 01 Dec 2022 02:45:25 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=BqVpaU9Ej7Ly30+5nJ6sOCju/0aZx2I2P6wUk10RgiU=; b=GePQGg5vKNZO xhX9BiuxARBkBgSy6jRrdT6WIR7PGLacGZYcxIR8xvpPn3VMoed5xN1ZbAMP7893s2FTzQJdiW3Oy ufDiEdwUie3Uify7wOX56ukvocecV3aMzE02+4n+U4zVOq8h+TqBZa2mC7+FuVAkjBSzTRckBYGkK U2dBkdz4PNj+FG4tSIGgKPefDfk+8zC2arnNt27b11HRHKEsMr2wUgSfQpOMj42UnVKDixuHzThjT ixt0wcMm0QHNyvQt/QARMknUzIza/Nr5lBhOhb7fQfCSbPgQHgo4yZ6DiY7rOPxlxi7Q4CDKosyyE mWX1J4L90QjW+7nadWp9rw==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p0eG2-0005dz-BJ; Thu, 01 Dec 2022 02:45:25 -0500 Date: Thu, 01 Dec 2022 09:44:49 +0200 Message-Id: <83fsdzin4e.fsf@gnu.org> From: Eli Zaretskii To: Theodor Thornhill In-Reply-To: <871qpj1x2k.fsf@thornhill.no> (message from Theodor Thornhill on Thu, 01 Dec 2022 07:01:55 +0100) Subject: Re: bug#59691: 29.0.60; typescript-ts-mode: any HTML-like elements causes fontification to become invalid and remaining parse-tree to become jsx-expression References: <831qpklejb.fsf@gnu.org> <83mt88jul4.fsf@gnu.org> <0A18F996-F3BB-4A7D-A0BE-76C8374DE517@thornhill.no> <8335a0jofb.fsf@gnu.org> <7BE15945-C463-448A-8593-E3B5D0E374FB@thornhill.no> <871qpj1x2k.fsf@thornhill.no> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 59691 Cc: 59691@debbugs.gnu.org, casouri@gmail.com, jostein@secure.kjonigsen.net, jostein@kjonigsen.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Theodor Thornhill > Cc: casouri@gmail.com, jostein@secure.kjonigsen.net, 59691@debbugs.gnu.org, > jostein@kjonigsen.net > Date: Thu, 01 Dec 2022 07:01:55 +0100 > > diff --git a/etc/NEWS b/etc/NEWS > index 4e091a5fed..439d20960b 100644 > --- a/etc/NEWS > +++ b/etc/NEWS > @@ -2972,7 +2972,12 @@ 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. > > -** New major mode 'c-ts-mode'. > +** New mode 'tsx-ts-mode'. > +A major mode based on the tree-sitter library for editing programs > +in the TypeScript language, with support for TSX. It includes > +support for font-locking, indentation, and navigation. > + > +** New mode 'c-ts-mode'. Looks like some "git merge" snafu? You are in fact reverting a change I made in NEWS yesterday. > diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el > index 6c926a4e3e..c1beaf3134 100644 > --- a/lisp/progmodes/typescript-ts-mode.el > +++ b/lisp/progmodes/typescript-ts-mode.el I don't see a change to auto-mode-alist to turn on each mode for the files it supports? I thought this was the idea? Or is this because we don't want tree-sitter based modes to be turned on by default? In that case, how do we explain to users that they should use each mode in the relevant cases? From debbugs-submit-bounces@debbugs.gnu.org Thu Dec 01 03:13:07 2022 Received: (at 59691) by debbugs.gnu.org; 1 Dec 2022 08:13:07 +0000 Received: from localhost ([127.0.0.1]:38176 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p0egs-0006Cp-QA for submit@debbugs.gnu.org; Thu, 01 Dec 2022 03:13:07 -0500 Received: from out2.migadu.com ([188.165.223.204]:40395) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p0egm-0006CS-UJ for 59691@debbugs.gnu.org; Thu, 01 Dec 2022 03:13:04 -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=1669882379; 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=kLIOUjvPlUtilSK67buIbATeQv8P/Rtg7ffUHu1lDdc=; b=Q9V85Xohe2B1ae3BvyCSW1m8+ZDggWfMZE6Kli8XLF3VlD2EWFTMHWvUaormnaluQOKVsz jvOa9zkUFRHoe8+jkLZUum3mMQHqHtAygmpu/6oWqhAz6xTv4lq/SBzTZvsqznFv7oY07N MoRNe6a1opnXIfiesJi2yJji+WH/p0P/nTtzd1pz/QAwW0imi+NMdEkoaS7+d4f3HgjCcM z9C9ROvm8tnRPjJ5ZLiqiDf0sANkK8Cm8vhV2U9AzfjpogcaVkLKzwZAczSOI6k4TLrNZW km9TKk5jq6RnDO5t5dW4shmzb+6tetF/UnsMWYbFpDvp4LyEwdP7ZbZbBiIN6g== From: Theodor Thornhill To: Eli Zaretskii Subject: Re: bug#59691: 29.0.60; typescript-ts-mode: any HTML-like elements causes fontification to become invalid and remaining parse-tree to become jsx-expression In-Reply-To: <83fsdzin4e.fsf@gnu.org> References: <831qpklejb.fsf@gnu.org> <83mt88jul4.fsf@gnu.org> <0A18F996-F3BB-4A7D-A0BE-76C8374DE517@thornhill.no> <8335a0jofb.fsf@gnu.org> <7BE15945-C463-448A-8593-E3B5D0E374FB@thornhill.no> <871qpj1x2k.fsf@thornhill.no> <83fsdzin4e.fsf@gnu.org> Date: Thu, 01 Dec 2022 09:12:58 +0100 Message-ID: <87v8mvzgmt.fsf@thornhill.no> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Migadu-Flow: FLOW_OUT X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 59691 Cc: 59691@debbugs.gnu.org, casouri@gmail.com, jostein@secure.kjonigsen.net, jostein@kjonigsen.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain Eli Zaretskii writes: >> From: Theodor Thornhill >> Cc: casouri@gmail.com, jostein@secure.kjonigsen.net, 59691@debbugs.gnu.org, >> jostein@kjonigsen.net >> Date: Thu, 01 Dec 2022 07:01:55 +0100 >> >> diff --git a/etc/NEWS b/etc/NEWS >> index 4e091a5fed..439d20960b 100644 >> --- a/etc/NEWS >> +++ b/etc/NEWS >> @@ -2972,7 +2972,12 @@ 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. >> >> -** New major mode 'c-ts-mode'. >> +** New mode 'tsx-ts-mode'. >> +A major mode based on the tree-sitter library for editing programs >> +in the TypeScript language, with support for TSX. It includes >> +support for font-locking, indentation, and navigation. >> + >> +** New mode 'c-ts-mode'. > > Looks like some "git merge" snafu? You are in fact reverting a change I > made in NEWS yesterday. > You're right - I think I fixed it now. >> diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el >> index 6c926a4e3e..c1beaf3134 100644 >> --- a/lisp/progmodes/typescript-ts-mode.el >> +++ b/lisp/progmodes/typescript-ts-mode.el > > I don't see a change to auto-mode-alist to turn on each mode for the files > it supports? I thought this was the idea? Or is this because we don't want > tree-sitter based modes to be turned on by default? In that case, how do we > explain to users that they should use each mode in the relevant cases? I think there should be ;;;###autoload (add-to-list 'auto-mode-alist '("\\.ts\\'" . typescript-ts-mode)) ;;;###autoload (add-to-list 'auto-mode-alist '("\\.tsx\\'" . tsx-ts-mode)) No? If not, then I'm confused. Theo --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Add-new-TypeScript-mode-tsx-ts-mode.patch >From 79c446694b36ccad56d09993f13e46052ba979d1 Mon Sep 17 00:00:00 2001 From: Theodor Thornhill Date: Tue, 29 Nov 2022 21:39:38 +0100 Subject: [PATCH] Add new TypeScript mode tsx-ts-mode There are in fact two languages supporting TypeScript for tree-sitter. Because TSX causes some ambiguities with types there are two grammars, one called typescript and one called tsx. To account for this and to be as correct as possible we enable using both. * lisp/progmodes/typescript-ts-mode.el (typescript-ts-mode--indent-rules): Change to a function to accomodate the two languages. (typescript-ts-mode--font-lock-settings): Change to a function to accomodate the two languages. (typescript-ts-mode--base-mode): Parent mode for typescript-ts-mode and tsx-ts-mode. (typescript-ts-mode): Derive from typescript-ts-mode--base-mode and extend with language specific settings (tsx-ts-mode): New major mode that derives from typescript-ts-mode--base-mode and extend it with language specific settings Add autoload cookies for the respective file type extensions: .ts and .tsx. * etc/NEWS: Mention the new mode. --- etc/NEWS | 5 + lisp/progmodes/typescript-ts-mode.el | 155 +++++++++++++++++---------- 2 files changed, 105 insertions(+), 55 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 4e091a5fed..1faf3bc097 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2972,6 +2972,11 @@ 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. +** New major mode 'tsx-ts-mode'. +A major mode based on the tree-sitter library for editing programs +in the TypeScript language, with support for TSX. It includes +support for font-locking, indentation, and navigation. + ** New major mode 'c-ts-mode'. A major mode based on the tree-sitter library for editing programs in the C language. It includes support for font-locking, diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el index 6c926a4e3e..c1beaf3134 100644 --- a/lisp/progmodes/typescript-ts-mode.el +++ b/lisp/progmodes/typescript-ts-mode.el @@ -22,6 +22,10 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program. If not, see . + +;;; Commentary: +;; + ;;; Code: (require 'treesit) @@ -56,8 +60,10 @@ typescript-ts-mode--syntax-table table) "Syntax table for `typescript-ts-mode'.") -(defvar typescript-ts-mode--indent-rules - `((tsx +(defun typescript-ts-mode--indent-rules (language) + "Rules used for indentation. +Argument LANGUAGE is either 'typescript' or 'tsx'." + `((,language ((parent-is "program") parent-bol 0) ((node-is "}") parent-bol 0) ((node-is ")") parent-bol 0) @@ -82,14 +88,13 @@ typescript-ts-mode--indent-rules ((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 typescript-ts-mode-indent-offset) - ((node-is "jsx_closing_element") parent 0) - ((parent-is "jsx_element") parent typescript-ts-mode-indent-offset) - ((node-is "/") parent 0) - ((parent-is "jsx_self_closing_element") parent typescript-ts-mode-indent-offset) - (no-node parent-bol 0))) - "Tree-sitter indent rules.") + ,@(when (eq language 'tsx) + `(((parent-is "jsx_opening_element") parent typescript-ts-mode-indent-offset) + ((node-is "jsx_closing_element") parent 0) + ((parent-is "jsx_element") parent typescript-ts-mode-indent-offset) + ((node-is "/") parent 0) + ((parent-is "jsx_self_closing_element") parent typescript-ts-mode-indent-offset))) + (no-node parent-bol 0)))) (defvar typescript-ts-mode--keywords '("!" "abstract" "as" "async" "await" "break" @@ -110,14 +115,16 @@ typescript-ts-mode--operators "&&" "||" "!" "?.") "TypeScript operators for tree-sitter font-locking.") -(defvar typescript-ts-mode--font-lock-settings +(defun typescript-ts-mode--font-lock-settings (language) + "Tree-sitter font-lock settings. +Argument LANGUAGE is either 'typescript' or 'tsx'." (treesit-font-lock-rules - :language 'tsx + :language language :override t :feature 'comment `((comment) @font-lock-comment-face) - :language 'tsx + :language language :override t :feature 'constant `(((identifier) @font-lock-constant-face @@ -125,13 +132,13 @@ typescript-ts-mode--font-lock-settings [(true) (false) (null)] @font-lock-constant-face) - :language 'tsx + :language language :override t :feature 'keyword `([,@typescript-ts-mode--keywords] @font-lock-keyword-face [(this) (super)] @font-lock-keyword-face) - :language 'tsx + :language language :override t :feature 'string `((regex pattern: (regex_pattern)) @font-lock-string-face @@ -139,7 +146,7 @@ typescript-ts-mode--font-lock-settings (template_string) @js--fontify-template-string (template_substitution ["${" "}"] @font-lock-builtin-face)) - :language 'tsx + :language language :override t :feature 'declaration `((function @@ -177,7 +184,7 @@ typescript-ts-mode--font-lock-settings (identifier) @font-lock-function-name-face) value: (array (number) (function)))) - :language 'tsx + :language language :override t :feature 'identifier `((nested_type_identifier @@ -208,7 +215,7 @@ typescript-ts-mode--font-lock-settings (_ (_ (identifier) @font-lock-variable-name-face)) (_ (_ (_ (identifier) @font-lock-variable-name-face)))])) - :language 'tsx + :language language :override t :feature 'expression '((assignment_expression @@ -223,7 +230,7 @@ typescript-ts-mode--font-lock-settings (member_expression property: (property_identifier) @font-lock-function-name-face)])) - :language 'tsx + :language language :override t :feature 'pattern `((pair_pattern @@ -231,7 +238,7 @@ typescript-ts-mode--font-lock-settings (array_pattern (identifier) @font-lock-variable-name-face)) - :language 'tsx + :language language :override t :feature 'jsx `((jsx_opening_element @@ -248,31 +255,31 @@ typescript-ts-mode--font-lock-settings (jsx_attribute (property_identifier) @font-lock-constant-face)) - :language 'tsx + :language language :feature 'number `((number) @font-lock-number-face ((identifier) @font-lock-number-face (:match "^\\(:?NaN\\|Infinity\\)$" @font-lock-number-face))) - :language 'tsx + :language language :feature 'operator `([,@typescript-ts-mode--operators] @font-lock-operator-face (ternary_expression ["?" ":"] @font-lock-operator-face)) - :language 'tsx + :language language :feature 'bracket '((["(" ")" "[" "]" "{" "}"]) @font-lock-bracket-face) - :language 'tsx + :language language :feature 'delimiter '((["," "." ";" ":"]) @font-lock-delimiter-face) - :language 'tsx + :language language :feature 'escape-sequence :override t '((escape_sequence) @font-lock-escape-face) - :language 'tsx + :language language :override t :feature 'property `((pair value: (identifier) @font-lock-variable-name-face) @@ -280,17 +287,71 @@ typescript-ts-mode--font-lock-settings ((shorthand_property_identifier) @font-lock-property-face) ((shorthand_property_identifier_pattern) - @font-lock-property-face))) - "Tree-sitter font-lock settings.") + @font-lock-property-face)))) ;;;###autoload (add-to-list 'auto-mode-alist '("\\.ts\\'" . typescript-ts-mode)) ;;;###autoload -(add-to-list 'auto-mode-alist '("\\.tsx\\'" . typescript-ts-mode)) +(add-to-list 'auto-mode-alist '("\\.tsx\\'" . tsx-ts-mode)) ;;;###autoload -(define-derived-mode typescript-ts-mode prog-mode "TypeScript" +(define-derived-mode typescript-ts-mode--base-mode prog-mode "TypeScript" + "Major mode for editing TypeScript." + :group 'typescript + :syntax-table typescript-ts-mode--syntax-table + + ;; Comments. + (setq-local comment-start "// ") + (setq-local comment-end "") + (setq-local comment-start-skip "\\(?://+\\|/\\*+\\)\\s *") + (setq-local comment-end-skip + (rx (* (syntax whitespace)) + (group (or (syntax comment-end) + (seq (+ "*") "/"))))) + + ;; Electric + (setq-local electric-indent-chars + (append "{}():;," electric-indent-chars)) + + ;; Navigation. + (setq-local treesit-defun-type-regexp + (rx (or "class_declaration" + "method_definition" + "function_declaration" + "lexical_declaration"))) + ;; Imenu. + (setq-local imenu-create-index-function #'js--treesit-imenu) + + ;; Which-func (use imenu). + (setq-local which-func-functions nil)) + +;;;###autoload +(define-derived-mode typescript-ts-mode typescript-ts-mode--base-mode "TypeScript" + "Major mode for editing TypeScript." + :group 'typescript + :syntax-table typescript-ts-mode--syntax-table + + (when (treesit-ready-p 'typescript) + (treesit-parser-create 'typescript) + + ;; Indent. + (setq-local treesit-simple-indent-rules + (typescript-ts-mode--indent-rules 'typescript)) + + ;; Font-lock. + (setq-local treesit-font-lock-settings + (typescript-ts-mode--font-lock-settings 'typescript)) + (setq-local treesit-font-lock-feature-list + '((comment declaration) + (keyword string) + (constant expression identifier number pattern property) + (bracket delimiter))) + + (treesit-major-mode-setup))) + +;;;###autoload +(define-derived-mode tsx-ts-mode typescript-ts-mode--base-mode "TypeScript[TSX]" "Major mode for editing TypeScript." :group 'typescript :syntax-table typescript-ts-mode--syntax-table @@ -301,43 +362,27 @@ typescript-ts-mode ;; Comments. (setq-local comment-start "// ") (setq-local comment-end "") - (setq-local comment-start-skip (rx (group "/" (or (+ "/") (+ "*"))) - (* (syntax whitespace)))) + (setq-local comment-start-skip "\\(?://+\\|/\\*+\\)\\s *") (setq-local comment-end-skip (rx (* (syntax whitespace)) (group (or (syntax comment-end) (seq (+ "*") "/"))))) - ;; Electric - (setq-local electric-indent-chars - (append "{}():;," electric-indent-chars)) - ;; Indent. - (setq-local treesit-simple-indent-rules typescript-ts-mode--indent-rules) - - ;; Navigation. - (setq-local treesit-defun-type-regexp - (rx (or "class_declaration" - "method_definition" - "function_declaration" - "lexical_declaration"))) + (setq-local treesit-simple-indent-rules + (typescript-ts-mode--indent-rules 'tsx)) ;; Font-lock. - (setq-local treesit-font-lock-settings typescript-ts-mode--font-lock-settings) + (setq-local treesit-font-lock-settings + (typescript-ts-mode--font-lock-settings 'tsx)) (setq-local treesit-font-lock-feature-list - '(( comment declaration) - ( keyword string) - ( constant expression identifier jsx number pattern property) - ( bracket delimiter))) - ;; Imenu. - (setq-local imenu-create-index-function #'js--treesit-imenu) - - ;; Which-func (use imenu). - (setq-local which-func-functions nil) + '((comment declaration) + (keyword string) + (constant expression identifier jsx number pattern property) + (bracket delimiter))) (treesit-major-mode-setup))) - (provide 'typescript-ts-mode) ;;; typescript-ts-mode.el ends here -- 2.34.1 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Thu Dec 01 05:05:45 2022 Received: (at 59691) by debbugs.gnu.org; 1 Dec 2022 10:05:45 +0000 Received: from localhost ([127.0.0.1]:38730 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p0gRs-0007I0-RR for submit@debbugs.gnu.org; Thu, 01 Dec 2022 05:05:45 -0500 Received: from eggs.gnu.org ([209.51.188.92]:54326) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p0gRo-0007Hr-30 for 59691@debbugs.gnu.org; Thu, 01 Dec 2022 05:05:43 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p0gRg-0007Im-3x; Thu, 01 Dec 2022 05:05:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=XNCuIHIIukvbCZATRgzhKVGkdmleiosjKooax0Ozs6M=; b=OTu33DahxDNP 8o14S91Vvf21m/1ktwNTO/jcWp4ysLKPXHReRK0QIQ4f6BjXi8qs6I0PAxI+dXIWAcy4uCIenIKCH LhCJxkq2z9bUXFEa6q7sJuOes4Tdi8sR4hLvbyzm3hyr8oSC2fwFHdcM2GFKg8dH6fEdRx4xQNdJj 0D/SsNvp1Hwfvn2ITl6ccat02haqaswo3vDkWsSDodp8D0B9WFgLDWMD6G0U+bGeOFldBXo7nGgnr O/XKqkt90NYSNA3xcpiflcKfPWGML3BEcEAveOGWG3iJHIUnoDHlSZyscoKWhRySkiM9DVinzIHFl 3bsv4wEOfo8d0uvt7Xd8qA==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p0gRe-0003f9-St; Thu, 01 Dec 2022 05:05:31 -0500 Date: Thu, 01 Dec 2022 12:05:01 +0200 Message-Id: <838rjrigmq.fsf@gnu.org> From: Eli Zaretskii To: Theodor Thornhill In-Reply-To: <87v8mvzgmt.fsf@thornhill.no> (message from Theodor Thornhill on Thu, 01 Dec 2022 09:12:58 +0100) Subject: Re: bug#59691: 29.0.60; typescript-ts-mode: any HTML-like elements causes fontification to become invalid and remaining parse-tree to become jsx-expression References: <831qpklejb.fsf@gnu.org> <83mt88jul4.fsf@gnu.org> <0A18F996-F3BB-4A7D-A0BE-76C8374DE517@thornhill.no> <8335a0jofb.fsf@gnu.org> <7BE15945-C463-448A-8593-E3B5D0E374FB@thornhill.no> <871qpj1x2k.fsf@thornhill.no> <83fsdzin4e.fsf@gnu.org> <87v8mvzgmt.fsf@thornhill.no> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 59691 Cc: 59691@debbugs.gnu.org, casouri@gmail.com, jostein@secure.kjonigsen.net, jostein@kjonigsen.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Theodor Thornhill > Cc: casouri@gmail.com, jostein@secure.kjonigsen.net, 59691@debbugs.gnu.org, > jostein@kjonigsen.net > Date: Thu, 01 Dec 2022 09:12:58 +0100 > > > Looks like some "git merge" snafu? You are in fact reverting a change I > > made in NEWS yesterday. > > > > You're right - I think I fixed it now. Yes, thanks. > > I don't see a change to auto-mode-alist to turn on each mode for the files > > it supports? I thought this was the idea? Or is this because we don't want > > tree-sitter based modes to be turned on by default? In that case, how do we > > explain to users that they should use each mode in the relevant cases? > > I think there should be > > > ;;;###autoload > (add-to-list 'auto-mode-alist '("\\.ts\\'" . typescript-ts-mode)) > > ;;;###autoload > (add-to-list 'auto-mode-alist '("\\.tsx\\'" . tsx-ts-mode)) Yes, I missed that, sorry. But the NEWS entry should clearly say that one mode is the default for *.ts files, the other for *.tsx files. From debbugs-submit-bounces@debbugs.gnu.org Thu Dec 01 05:52:06 2022 Received: (at 59691) by debbugs.gnu.org; 1 Dec 2022 10:52:06 +0000 Received: from localhost ([127.0.0.1]:38985 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p0hAj-0007id-So for submit@debbugs.gnu.org; Thu, 01 Dec 2022 05:52:06 -0500 Received: from out2.migadu.com ([188.165.223.204]:38997) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p0hAg-0007iN-Ox for 59691@debbugs.gnu.org; Thu, 01 Dec 2022 05:52:04 -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=1669891921; 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=Xv/t2+p4fEW7+P3xUrZVyqcczYPognDQY+xQqTZmbgE=; b=YzXTxw8+mmXCZCWzj31XiCXZ75ZtP6/t69hJiy77uUe0X4qJFhvNjzsONHRNQk30RHz03S VXxAx1faRX51C+G8hq27sBL7DQ78B1ucNMa3QlHfXIuUdnkjm3v8kQw7Qk+TifKFzYOYFp RaKCLcKVneCXrNOaBsH64rz/ZIH/UjYSmWxa6tcYmgzI0EFoeLJuFVvvzQi5tsbXezt9/y e+H8fwxbgDW3vOMuwpnVxi7kXbYlQG/ETyKjHAXzO/pFaDUOoM6e8QoDiATSTRx6GhadyG Peef0nsOYCLD/OJMC/XVdlx2Q3YHGPyu5V6Y/oYfmSb0Ulag5Y7nsQXkmsIuVA== From: Theodor Thornhill To: Eli Zaretskii Subject: Re: bug#59691: 29.0.60; typescript-ts-mode: any HTML-like elements causes fontification to become invalid and remaining parse-tree to become jsx-expression In-Reply-To: <838rjrigmq.fsf@gnu.org> References: <831qpklejb.fsf@gnu.org> <83mt88jul4.fsf@gnu.org> <0A18F996-F3BB-4A7D-A0BE-76C8374DE517@thornhill.no> <8335a0jofb.fsf@gnu.org> <7BE15945-C463-448A-8593-E3B5D0E374FB@thornhill.no> <871qpj1x2k.fsf@thornhill.no> <83fsdzin4e.fsf@gnu.org> <87v8mvzgmt.fsf@thornhill.no> <838rjrigmq.fsf@gnu.org> Date: Thu, 01 Dec 2022 11:52:00 +0100 Message-ID: <87k03bz99r.fsf@thornhill.no> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Migadu-Flow: FLOW_OUT X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 59691 Cc: 59691@debbugs.gnu.org, casouri@gmail.com, jostein@secure.kjonigsen.net, jostein@kjonigsen.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain Eli Zaretskii writes: >> From: Theodor Thornhill >> Cc: casouri@gmail.com, jostein@secure.kjonigsen.net, 59691@debbugs.gnu.org, >> jostein@kjonigsen.net >> Date: Thu, 01 Dec 2022 09:12:58 +0100 >> >> > Looks like some "git merge" snafu? You are in fact reverting a change I >> > made in NEWS yesterday. >> > >> >> You're right - I think I fixed it now. > > Yes, thanks. > >> > I don't see a change to auto-mode-alist to turn on each mode for the files >> > it supports? I thought this was the idea? Or is this because we don't want >> > tree-sitter based modes to be turned on by default? In that case, how do we >> > explain to users that they should use each mode in the relevant cases? >> >> I think there should be >> >> >> ;;;###autoload >> (add-to-list 'auto-mode-alist '("\\.ts\\'" . typescript-ts-mode)) >> >> ;;;###autoload >> (add-to-list 'auto-mode-alist '("\\.tsx\\'" . tsx-ts-mode)) > > Yes, I missed that, sorry. But the NEWS entry should clearly say that one > mode is the default for *.ts files, the other for *.tsx files. No worries :) Is this patch suitable? Theo --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Add-new-TypeScript-mode-tsx-ts-mode.patch >From bef31846598dfce861a32abdb8cc34c884ce12cc Mon Sep 17 00:00:00 2001 From: Theodor Thornhill Date: Tue, 29 Nov 2022 21:39:38 +0100 Subject: [PATCH] Add new TypeScript mode tsx-ts-mode There are in fact two languages supporting TypeScript for tree-sitter. Because TSX causes some ambiguities with types there are two grammars, one called typescript and one called tsx. To account for this and to be as correct as possible we enable using both. * lisp/progmodes/typescript-ts-mode.el (typescript-ts-mode--indent-rules): Change to a function to accomodate the two languages. (typescript-ts-mode--font-lock-settings): Change to a function to accomodate the two languages. (typescript-ts-mode--base-mode): Parent mode for typescript-ts-mode and tsx-ts-mode. (typescript-ts-mode): Derive from typescript-ts-mode--base-mode and extend with language specific settings (tsx-ts-mode): New major mode that derives from typescript-ts-mode--base-mode and extend it with language specific settings Add autoload cookies for the respective file type extensions: .ts and .tsx. * etc/NEWS: Mention the new mode. --- etc/NEWS | 9 +- lisp/progmodes/typescript-ts-mode.el | 155 +++++++++++++++++---------- 2 files changed, 108 insertions(+), 56 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 4e091a5fed..2c1c220f51 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2970,7 +2970,14 @@ when visiting JSON files. ** New major 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. +indentation, and navigation. This mode will be auto-enabled for +files with the '.ts' extension. + +** New major mode 'tsx-ts-mode'. +A major mode based on the tree-sitter library for editing programs +in the TypeScript language, with support for TSX. It includes +support for font-locking, indentation, and navigation. This mode +will be auto-enabled for files with the '.tsx' extension. ** New major mode 'c-ts-mode'. A major mode based on the tree-sitter library for editing programs diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el index 6c926a4e3e..c1beaf3134 100644 --- a/lisp/progmodes/typescript-ts-mode.el +++ b/lisp/progmodes/typescript-ts-mode.el @@ -22,6 +22,10 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program. If not, see . + +;;; Commentary: +;; + ;;; Code: (require 'treesit) @@ -56,8 +60,10 @@ typescript-ts-mode--syntax-table table) "Syntax table for `typescript-ts-mode'.") -(defvar typescript-ts-mode--indent-rules - `((tsx +(defun typescript-ts-mode--indent-rules (language) + "Rules used for indentation. +Argument LANGUAGE is either 'typescript' or 'tsx'." + `((,language ((parent-is "program") parent-bol 0) ((node-is "}") parent-bol 0) ((node-is ")") parent-bol 0) @@ -82,14 +88,13 @@ typescript-ts-mode--indent-rules ((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 typescript-ts-mode-indent-offset) - ((node-is "jsx_closing_element") parent 0) - ((parent-is "jsx_element") parent typescript-ts-mode-indent-offset) - ((node-is "/") parent 0) - ((parent-is "jsx_self_closing_element") parent typescript-ts-mode-indent-offset) - (no-node parent-bol 0))) - "Tree-sitter indent rules.") + ,@(when (eq language 'tsx) + `(((parent-is "jsx_opening_element") parent typescript-ts-mode-indent-offset) + ((node-is "jsx_closing_element") parent 0) + ((parent-is "jsx_element") parent typescript-ts-mode-indent-offset) + ((node-is "/") parent 0) + ((parent-is "jsx_self_closing_element") parent typescript-ts-mode-indent-offset))) + (no-node parent-bol 0)))) (defvar typescript-ts-mode--keywords '("!" "abstract" "as" "async" "await" "break" @@ -110,14 +115,16 @@ typescript-ts-mode--operators "&&" "||" "!" "?.") "TypeScript operators for tree-sitter font-locking.") -(defvar typescript-ts-mode--font-lock-settings +(defun typescript-ts-mode--font-lock-settings (language) + "Tree-sitter font-lock settings. +Argument LANGUAGE is either 'typescript' or 'tsx'." (treesit-font-lock-rules - :language 'tsx + :language language :override t :feature 'comment `((comment) @font-lock-comment-face) - :language 'tsx + :language language :override t :feature 'constant `(((identifier) @font-lock-constant-face @@ -125,13 +132,13 @@ typescript-ts-mode--font-lock-settings [(true) (false) (null)] @font-lock-constant-face) - :language 'tsx + :language language :override t :feature 'keyword `([,@typescript-ts-mode--keywords] @font-lock-keyword-face [(this) (super)] @font-lock-keyword-face) - :language 'tsx + :language language :override t :feature 'string `((regex pattern: (regex_pattern)) @font-lock-string-face @@ -139,7 +146,7 @@ typescript-ts-mode--font-lock-settings (template_string) @js--fontify-template-string (template_substitution ["${" "}"] @font-lock-builtin-face)) - :language 'tsx + :language language :override t :feature 'declaration `((function @@ -177,7 +184,7 @@ typescript-ts-mode--font-lock-settings (identifier) @font-lock-function-name-face) value: (array (number) (function)))) - :language 'tsx + :language language :override t :feature 'identifier `((nested_type_identifier @@ -208,7 +215,7 @@ typescript-ts-mode--font-lock-settings (_ (_ (identifier) @font-lock-variable-name-face)) (_ (_ (_ (identifier) @font-lock-variable-name-face)))])) - :language 'tsx + :language language :override t :feature 'expression '((assignment_expression @@ -223,7 +230,7 @@ typescript-ts-mode--font-lock-settings (member_expression property: (property_identifier) @font-lock-function-name-face)])) - :language 'tsx + :language language :override t :feature 'pattern `((pair_pattern @@ -231,7 +238,7 @@ typescript-ts-mode--font-lock-settings (array_pattern (identifier) @font-lock-variable-name-face)) - :language 'tsx + :language language :override t :feature 'jsx `((jsx_opening_element @@ -248,31 +255,31 @@ typescript-ts-mode--font-lock-settings (jsx_attribute (property_identifier) @font-lock-constant-face)) - :language 'tsx + :language language :feature 'number `((number) @font-lock-number-face ((identifier) @font-lock-number-face (:match "^\\(:?NaN\\|Infinity\\)$" @font-lock-number-face))) - :language 'tsx + :language language :feature 'operator `([,@typescript-ts-mode--operators] @font-lock-operator-face (ternary_expression ["?" ":"] @font-lock-operator-face)) - :language 'tsx + :language language :feature 'bracket '((["(" ")" "[" "]" "{" "}"]) @font-lock-bracket-face) - :language 'tsx + :language language :feature 'delimiter '((["," "." ";" ":"]) @font-lock-delimiter-face) - :language 'tsx + :language language :feature 'escape-sequence :override t '((escape_sequence) @font-lock-escape-face) - :language 'tsx + :language language :override t :feature 'property `((pair value: (identifier) @font-lock-variable-name-face) @@ -280,17 +287,71 @@ typescript-ts-mode--font-lock-settings ((shorthand_property_identifier) @font-lock-property-face) ((shorthand_property_identifier_pattern) - @font-lock-property-face))) - "Tree-sitter font-lock settings.") + @font-lock-property-face)))) ;;;###autoload (add-to-list 'auto-mode-alist '("\\.ts\\'" . typescript-ts-mode)) ;;;###autoload -(add-to-list 'auto-mode-alist '("\\.tsx\\'" . typescript-ts-mode)) +(add-to-list 'auto-mode-alist '("\\.tsx\\'" . tsx-ts-mode)) ;;;###autoload -(define-derived-mode typescript-ts-mode prog-mode "TypeScript" +(define-derived-mode typescript-ts-mode--base-mode prog-mode "TypeScript" + "Major mode for editing TypeScript." + :group 'typescript + :syntax-table typescript-ts-mode--syntax-table + + ;; Comments. + (setq-local comment-start "// ") + (setq-local comment-end "") + (setq-local comment-start-skip "\\(?://+\\|/\\*+\\)\\s *") + (setq-local comment-end-skip + (rx (* (syntax whitespace)) + (group (or (syntax comment-end) + (seq (+ "*") "/"))))) + + ;; Electric + (setq-local electric-indent-chars + (append "{}():;," electric-indent-chars)) + + ;; Navigation. + (setq-local treesit-defun-type-regexp + (rx (or "class_declaration" + "method_definition" + "function_declaration" + "lexical_declaration"))) + ;; Imenu. + (setq-local imenu-create-index-function #'js--treesit-imenu) + + ;; Which-func (use imenu). + (setq-local which-func-functions nil)) + +;;;###autoload +(define-derived-mode typescript-ts-mode typescript-ts-mode--base-mode "TypeScript" + "Major mode for editing TypeScript." + :group 'typescript + :syntax-table typescript-ts-mode--syntax-table + + (when (treesit-ready-p 'typescript) + (treesit-parser-create 'typescript) + + ;; Indent. + (setq-local treesit-simple-indent-rules + (typescript-ts-mode--indent-rules 'typescript)) + + ;; Font-lock. + (setq-local treesit-font-lock-settings + (typescript-ts-mode--font-lock-settings 'typescript)) + (setq-local treesit-font-lock-feature-list + '((comment declaration) + (keyword string) + (constant expression identifier number pattern property) + (bracket delimiter))) + + (treesit-major-mode-setup))) + +;;;###autoload +(define-derived-mode tsx-ts-mode typescript-ts-mode--base-mode "TypeScript[TSX]" "Major mode for editing TypeScript." :group 'typescript :syntax-table typescript-ts-mode--syntax-table @@ -301,43 +362,27 @@ typescript-ts-mode ;; Comments. (setq-local comment-start "// ") (setq-local comment-end "") - (setq-local comment-start-skip (rx (group "/" (or (+ "/") (+ "*"))) - (* (syntax whitespace)))) + (setq-local comment-start-skip "\\(?://+\\|/\\*+\\)\\s *") (setq-local comment-end-skip (rx (* (syntax whitespace)) (group (or (syntax comment-end) (seq (+ "*") "/"))))) - ;; Electric - (setq-local electric-indent-chars - (append "{}():;," electric-indent-chars)) - ;; Indent. - (setq-local treesit-simple-indent-rules typescript-ts-mode--indent-rules) - - ;; Navigation. - (setq-local treesit-defun-type-regexp - (rx (or "class_declaration" - "method_definition" - "function_declaration" - "lexical_declaration"))) + (setq-local treesit-simple-indent-rules + (typescript-ts-mode--indent-rules 'tsx)) ;; Font-lock. - (setq-local treesit-font-lock-settings typescript-ts-mode--font-lock-settings) + (setq-local treesit-font-lock-settings + (typescript-ts-mode--font-lock-settings 'tsx)) (setq-local treesit-font-lock-feature-list - '(( comment declaration) - ( keyword string) - ( constant expression identifier jsx number pattern property) - ( bracket delimiter))) - ;; Imenu. - (setq-local imenu-create-index-function #'js--treesit-imenu) - - ;; Which-func (use imenu). - (setq-local which-func-functions nil) + '((comment declaration) + (keyword string) + (constant expression identifier jsx number pattern property) + (bracket delimiter))) (treesit-major-mode-setup))) - (provide 'typescript-ts-mode) ;;; typescript-ts-mode.el ends here -- 2.34.1 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Thu Dec 01 07:10:59 2022 Received: (at 59691) by debbugs.gnu.org; 1 Dec 2022 12:10:59 +0000 Received: from localhost ([127.0.0.1]:39350 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p0iP5-0008VA-6I for submit@debbugs.gnu.org; Thu, 01 Dec 2022 07:10:59 -0500 Received: from eggs.gnu.org ([209.51.188.92]:37270) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p0iP3-0008Uo-PX for 59691@debbugs.gnu.org; Thu, 01 Dec 2022 07:10:58 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p0iOx-0007ut-CN; Thu, 01 Dec 2022 07:10:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=nhCxrdZS/+r7gHgQSj4KQJC1B8tvY5BNxzqrpWI3rN0=; b=gtzl5Olq1Akf eFSPnTo1pzPEV1Ai8I/nsK8tVOe81In8JvTQ9yFp8y+D/0Z7NdZuIljR+dE2QmBaHIkkDBmAFeBaA 6bo0nu5hDsR0aiM0lBkGtHbpoaimHIHMpJ8MlPz/5ng6oEoJ56VtqvsJLOiHmxFGHT6D87o29w1eG coN0TirMLr/WtDB+oQkdauZpMC8VqsAuBLF1QwjZGg9lBmO/O5Y51sdYKQ9XK/oPR+yPNaCNKTPak odsMn6ikBLEyJ1oTjCmdliF+MLMMWycXhbEso0pjj4h9TF9C0iWtaM5HmkXfBNxGYw30E1eLKNPtD mHqfwiXzShtxyQ8CG/5Xwg==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p0iOw-0003E9-QY; Thu, 01 Dec 2022 07:10:51 -0500 Date: Thu, 01 Dec 2022 14:10:23 +0200 Message-Id: <835yeviats.fsf@gnu.org> From: Eli Zaretskii To: Theodor Thornhill In-Reply-To: <87k03bz99r.fsf@thornhill.no> (message from Theodor Thornhill on Thu, 01 Dec 2022 11:52:00 +0100) Subject: Re: bug#59691: 29.0.60; typescript-ts-mode: any HTML-like elements causes fontification to become invalid and remaining parse-tree to become jsx-expression References: <831qpklejb.fsf@gnu.org> <83mt88jul4.fsf@gnu.org> <0A18F996-F3BB-4A7D-A0BE-76C8374DE517@thornhill.no> <8335a0jofb.fsf@gnu.org> <7BE15945-C463-448A-8593-E3B5D0E374FB@thornhill.no> <871qpj1x2k.fsf@thornhill.no> <83fsdzin4e.fsf@gnu.org> <87v8mvzgmt.fsf@thornhill.no> <838rjrigmq.fsf@gnu.org> <87k03bz99r.fsf@thornhill.no> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 59691 Cc: 59691@debbugs.gnu.org, casouri@gmail.com, jostein@secure.kjonigsen.net, jostein@kjonigsen.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Theodor Thornhill > Cc: casouri@gmail.com, jostein@secure.kjonigsen.net, 59691@debbugs.gnu.org, > jostein@kjonigsen.net > Date: Thu, 01 Dec 2022 11:52:00 +0100 > > > Yes, I missed that, sorry. But the NEWS entry should clearly say that one > > mode is the default for *.ts files, the other for *.tsx files. > > No worries :) > > Is this patch suitable? LGTM, thanks. Yuan, if you are okay with this, please install. From debbugs-submit-bounces@debbugs.gnu.org Thu Dec 01 23:45:14 2022 Received: (at 59691) by debbugs.gnu.org; 2 Dec 2022 04:45:14 +0000 Received: from localhost ([127.0.0.1]:43990 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p0xvG-0007Ev-9j for submit@debbugs.gnu.org; Thu, 01 Dec 2022 23:45:14 -0500 Received: from mail-pj1-f47.google.com ([209.85.216.47]:38793) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p0xvA-0007Eh-T2 for 59691@debbugs.gnu.org; Thu, 01 Dec 2022 23:45:11 -0500 Received: by mail-pj1-f47.google.com with SMTP id l22-20020a17090a3f1600b00212fbbcfb78so7224697pjc.3 for <59691@debbugs.gnu.org>; Thu, 01 Dec 2022 20:45:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=uCMv1YNjGgyXGXAV5leILfMD9/i1rf+8aUhxKILeXls=; b=XGkLecPWficCE4+wTPeZfll2UIvYmaGtKwfSqzxs9TeUM3jYyOgYUv0i3iy+0weLjk hUrvpBoFguZsr3YDWXP4zIcjPiLNxg4o40G3W0M4ExKKUSGBC44/p8JKEvn77csVl59D F72AbJytRPlUXlU8cP5Ko2pi4D3UTxU4f1Nhx7SSomVWqzqI6TGQ1ObwIsJ0MkUtjGg5 Rhlrhmu19bFUv+jGzsfDSmnmXcif66if1ltaSAqAUeLrPhmzar4keSIERxrr+hIhUjKP ZEZ0hgjJSDR+mgyT7M+HZ/LsqR4wOrVHMv6x0mFKUYEsC+aPH8YEcfR37p83RPjOGa96 /ufw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uCMv1YNjGgyXGXAV5leILfMD9/i1rf+8aUhxKILeXls=; b=51lOdFNFFFxRNohyRWbgWW/MluQ9VG6/YoLzQhu4nZLnvv2pmn4gweVbuI7EP7SgcI i0PbUv0TMGCoNpYVkDvH7G8QVeKMzxGH3Vt006qvW0zFYGmZV5MK4Mj5ldTz0+k7TG5d 2H14IRjG953xJV0LOLhwPX8Ao+sHoQ54RBvWTIdIO2Wuux/YkCBtERssK6QylEu2Ksfp 6Qx5VyuUlzEWL0N1ftzU5aQiIebvxwL5yrlUFiBlMxZAVlm9GGanOqQEMRTh1SpFM0xH 4sIMi0/is41HUx/7uP4o4zd32mkCBPr28+kIc12kOLELjX+bK9TGfP20dki92QzqPizX Xrzw== X-Gm-Message-State: ANoB5pnEFnKHCF5sdjpxpe/Ce+XUQ5POL5zeZWMyB973idoGtA6EtqIV hB6+NUQyZjui8v+PBiDRAro= X-Google-Smtp-Source: AA0mqf41eBcP06QZ6uBT9nVlL/W3RJslQwMXOGp8BtBx4c1O7TUaG1xo4slHKMdfvh5MXJtsdDA2bw== X-Received: by 2002:a17:902:c085:b0:186:ff42:704d with SMTP id j5-20020a170902c08500b00186ff42704dmr53925381pld.153.1669956302925; Thu, 01 Dec 2022 20:45:02 -0800 (PST) Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id w10-20020a170902e88a00b00183e2a96414sm4527123plg.121.2022.12.01.20.45.00 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Dec 2022 20:45:01 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\)) Subject: Re: bug#59691: 29.0.60; typescript-ts-mode: any HTML-like elements causes fontification to become invalid and remaining parse-tree to become jsx-expression From: Yuan Fu In-Reply-To: <835yeviats.fsf@gnu.org> Date: Thu, 1 Dec 2022 20:44:59 -0800 Content-Transfer-Encoding: quoted-printable Message-Id: References: <831qpklejb.fsf@gnu.org> <83mt88jul4.fsf@gnu.org> <0A18F996-F3BB-4A7D-A0BE-76C8374DE517@thornhill.no> <8335a0jofb.fsf@gnu.org> <7BE15945-C463-448A-8593-E3B5D0E374FB@thornhill.no> <871qpj1x2k.fsf@thornhill.no> <83fsdzin4e.fsf@gnu.org> <87v8mvzgmt.fsf@thornhill.no> <838rjrigmq.fsf@gnu.org> <87k03bz99r.fsf@thornhill.no> <835yeviats.fsf@gnu.org> To: Eli Zaretskii X-Mailer: Apple Mail (2.3696.120.41.1.1) X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 59691 Cc: =?utf-8?Q?Jostein_Kj=C3=B8nigsen?= , Theodor Thornhill , jostein@kjonigsen.net, 59691@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) > On Dec 1, 2022, at 4:10 AM, Eli Zaretskii wrote: >=20 >> From: Theodor Thornhill >> Cc: casouri@gmail.com, jostein@secure.kjonigsen.net, = 59691@debbugs.gnu.org, >> jostein@kjonigsen.net >> Date: Thu, 01 Dec 2022 11:52:00 +0100 >>=20 >>> Yes, I missed that, sorry. But the NEWS entry should clearly say = that one >>> mode is the default for *.ts files, the other for *.tsx files. >>=20 >> No worries :) >>=20 >> Is this patch suitable? >=20 > LGTM, thanks. >=20 > Yuan, if you are okay with this, please install. Cool. I applied the patch, thanks Theo! I changed = typescript-ts-mode=E2=80=94base-mode to typescript-ts-base-mode, since I = don=E2=80=99t think anyone has strong opinions about its naming, and = typescript-ts-base-mode is more consistent with other tree-sitter base = modes. Yuan= From debbugs-submit-bounces@debbugs.gnu.org Fri Dec 02 15:29:33 2022 Received: (at 59691) by debbugs.gnu.org; 2 Dec 2022 20:29:34 +0000 Received: from localhost ([127.0.0.1]:48703 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p1Cf7-0000xf-K4 for submit@debbugs.gnu.org; Fri, 02 Dec 2022 15:29:33 -0500 Received: from out-96.mta0.migadu.com ([91.218.175.96]:34362) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p1Cf5-0000xZ-TO for 59691@debbugs.gnu.org; Fri, 02 Dec 2022 15:29:33 -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=1670012970; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0ppev3Ik8BW5EdaG76Ococjw7l93y5HY0b+R3eC4xFM=; b=bD87Sg4J4fkha45ollJo24iNzfYTc7ib6N+W21LZVpxFucds8mHY1FZOdzoihlkshK/LGq I5UzI8Fi13SJ9acnfxJ7MBOcf7ffe1Gu++xUdLT5E4YaZmhiewMAzv+JlvCpsoXd5VPpF2 shMGAF6jWzj8NE654hjQdh+p7kxC3HQcIqJGuzcozD9IjD5FtshyL2AaS+dTy6nPHQM6ni p6ih2h1Rs1KMVUqtcJj4zkebqnFiyu5NhvRvyIn+HHsp+Lad+mnBI3GRGATTst9k6ezp4P cIsgMvI/qKVBr4M7275Sgbyb1f3Uemi9qZ2byOrwkBf82v5wqERcyV9hKHU1kQ== From: Theodor Thornhill To: Yuan Fu , Eli Zaretskii Subject: Re: bug#59691: 29.0.60; typescript-ts-mode: any HTML-like elements causes fontification to become invalid and remaining parse-tree to become jsx-expression In-Reply-To: References: <831qpklejb.fsf@gnu.org> <83mt88jul4.fsf@gnu.org> <0A18F996-F3BB-4A7D-A0BE-76C8374DE517@thornhill.no> <8335a0jofb.fsf@gnu.org> <7BE15945-C463-448A-8593-E3B5D0E374FB@thornhill.no> <871qpj1x2k.fsf@thornhill.no> <83fsdzin4e.fsf@gnu.org> <87v8mvzgmt.fsf@thornhill.no> <838rjrigmq.fsf@gnu.org> <87k03bz99r.fsf@thornhill.no> <835yeviats.fsf@gnu.org> Date: Fri, 02 Dec 2022 21:29:28 +0100 Message-ID: <87v8mt7dnb.fsf@thornhill.no> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 59691 Cc: 59691@debbugs.gnu.org, Jostein =?utf-8?Q?Kj=C3=B8nigsen?= , jostein@kjonigsen.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Yuan Fu writes: >> On Dec 1, 2022, at 4:10 AM, Eli Zaretskii wrote: >>=20 >>> From: Theodor Thornhill >>> Cc: casouri@gmail.com, jostein@secure.kjonigsen.net, 59691@debbugs.gnu.= org, >>> jostein@kjonigsen.net >>> Date: Thu, 01 Dec 2022 11:52:00 +0100 >>>=20 >>>> Yes, I missed that, sorry. But the NEWS entry should clearly say that= one >>>> mode is the default for *.ts files, the other for *.tsx files. >>>=20 >>> No worries :) >>>=20 >>> Is this patch suitable? >>=20 >> LGTM, thanks. >>=20 >> Yuan, if you are okay with this, please install. > > Cool. I applied the patch, thanks Theo! I changed typescript-ts-mode=E2= =80=94base-mode to typescript-ts-base-mode, since I don=E2=80=99t think any= one has strong opinions about its naming, and typescript-ts-base-mode is mo= re consistent with other tree-sitter base modes. > > Yuan Thanks! I believe this can be closed. What do you think, Jostein? Theo From debbugs-submit-bounces@debbugs.gnu.org Fri Dec 02 16:28:49 2022 Received: (at 59691) by debbugs.gnu.org; 2 Dec 2022 21:28:49 +0000 Received: from localhost ([127.0.0.1]:48991 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p1DaT-0001W6-3u for submit@debbugs.gnu.org; Fri, 02 Dec 2022 16:28:49 -0500 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:40917) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p1DaO-0001W0-TK for 59691@debbugs.gnu.org; Fri, 02 Dec 2022 16:28:47 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id B9F135C00B5; Fri, 2 Dec 2022 16:28:39 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Fri, 02 Dec 2022 16:28:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= secure.kjonigsen.net; h=cc:cc:content-transfer-encoding :content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:reply-to:sender :subject:subject:to:to; s=fm3; t=1670016519; x=1670102919; bh=w+ ZdXaw0qz7IYiIg3NTSJWXrM5sR0AqZQmCxeAWn/Y0=; b=K0wOxLm79CsN0VaJZU oG46PzzozFiyKY4Vo+nx2/MC7Rw/KzujPdVX85rZEoy/N2eG6fDYLfubDt+Wjt14 6gUApWzZuPOjM1cxMLPojaeJpNvwWJPM0hSywpT73Er1a5bsXWEan7WUPRL+ixOp Zf4OcM0A635dcrJy6jQwtj2dqjaad3iSnKw6z6KSCQjjIRcwJlwPxfd53ZR4iw/d CeUR13AvdrN6/Q94LaaDNhtt/TIQ7O+A0X9WOfkESmgvgIW64axtGeD5Wb8Ror0D +FP09JCrzgF22RxVBTaYnTRvle42kjz484pLroCLoC6PwRCACycUf1V3EUu2KmLg hruw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1670016519; x=1670102919; bh=w+ZdXaw0qz7IYiIg3NTSJWXrM5sR0AqZQmC xeAWn/Y0=; b=mGgIqoWaWM/gfE91jVL7CakrCdiQuWoI5vJbK95356zXVzLiy+M m1IFfRQcUw8SRxSQe7+IABdPqp+xUIjo0yjqOi/JEwWp+6XdKxppRkfQYrXJM2+3 cEFgrnwetyhLV13//6O1daboCIMdbget5Uj95Lw7be/X+iJRUVy4KL8rGPVcDcwI Ygp4OodlUS3K/nXEfJ4UnfO3P8VefgiTP5cXrhIUSNpAa9+ZOP3xBxvabwGEXAK2 xj2gW2jUugxceqBWBvjFLotr5FHnvLfOHrESPE1bHmu3E6lr5PCoVk93XvfYMJeF fHg7E+zuuoi2aJdONXXur7Ehvu5KsuxFjkQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrtdekgdduvdehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfrhfuvfevfhfhjggtgfesthekredttdefjeenucfhrhhomheplfho shhtvghinhcumfhjpphnihhgshgvnhcuoehjohhsthgvihhnsehsvggtuhhrvgdrkhhjoh hnihhgshgvnhdrnhgvtheqnecuggftrfgrthhtvghrnheptdeftdektdffueekvddvvdek ueevuddviedtffffgffggeeltdekhefgtdejkeevnecuvehluhhsthgvrhfuihiivgeptd enucfrrghrrghmpehmrghilhhfrhhomhepjhhoshhtvghinhesshgvtghurhgvrdhkjhho nhhighhsvghnrdhnvght X-ME-Proxy: Feedback-ID: ib2f84088:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 2 Dec 2022 16:28:38 -0500 (EST) Message-ID: <7ac55edd-3887-7e38-7d89-4902f0b61416@secure.kjonigsen.net> Date: Fri, 2 Dec 2022 22:28:36 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.1 Subject: Re: bug#59691: 29.0.60; typescript-ts-mode: any HTML-like elements causes fontification to become invalid and remaining parse-tree to become jsx-expression To: Theodor Thornhill , Yuan Fu , Eli Zaretskii References: <831qpklejb.fsf@gnu.org> <83mt88jul4.fsf@gnu.org> <0A18F996-F3BB-4A7D-A0BE-76C8374DE517@thornhill.no> <8335a0jofb.fsf@gnu.org> <7BE15945-C463-448A-8593-E3B5D0E374FB@thornhill.no> <871qpj1x2k.fsf@thornhill.no> <83fsdzin4e.fsf@gnu.org> <87v8mvzgmt.fsf@thornhill.no> <838rjrigmq.fsf@gnu.org> <87k03bz99r.fsf@thornhill.no> <835yeviats.fsf@gnu.org> <87v8mt7dnb.fsf@thornhill.no> Content-Language: nb-NO, en-GB From: =?UTF-8?Q?Jostein_Kj=c3=b8nigsen?= In-Reply-To: <87v8mt7dnb.fsf@thornhill.no> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 59691 Cc: 59691@debbugs.gnu.org, jostein@kjonigsen.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: jostein@kjonigsen.net Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) >> Cool. I applied the patch, thanks Theo! I changed >> typescript-ts-mode—base-mode to typescript-ts-base-mode, since I >> don’t think anyone has strong opinions about its naming, and >> typescript-ts-base-mode is more consistent with other tree-sitter >> base modes. >> Yuan > Thanks! I believe this can be closed. What do you think, Jostein? > > Theo Hey guys. Amazing work! Sorry for being somewhat slow wrt to testing. I had to rebuild some tree-sitter libraries, and the build-code in admin/notes/tree-sitter/ seemingly didn't work out of the box for both plain typescript and tsx. Yadda, yadda, yadda. I've modified the scripts to also build for typescript/tsx. Do you wan't me to send in a patch for that, Yuan? Back to the point: Either way, I've tested both TS-code and TSX-code now, and it seems to work much better. I still see some errors in TSX-code I can't recall seing in the old mode (and I might report those issues, once I have time to collect more accurate data on them), but for now I definitely think what we have here warrants marking this particular bug as closed. :) -- Jostein From debbugs-submit-bounces@debbugs.gnu.org Fri Dec 02 17:55:51 2022 Received: (at 59691) by debbugs.gnu.org; 2 Dec 2022 22:55:51 +0000 Received: from localhost ([127.0.0.1]:49347 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p1Ewg-0002PZ-Ty for submit@debbugs.gnu.org; Fri, 02 Dec 2022 17:55:51 -0500 Received: from out-176.mta0.migadu.com ([91.218.175.176]:19358) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p1Ewb-0002PS-Vg for 59691@debbugs.gnu.org; Fri, 02 Dec 2022 17:55:49 -0500 Date: Fri, 02 Dec 2022 23:54:40 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1670021743; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+PvG/xMGSu+d+43joy56dTsC+NJFHAAwBEnmWqG6QRY=; b=fiSp7nOKWkUIUE38ORR7c62Il57G028oOySl2uGjJSg0Q6fXz5R+BkeEeLoJkvd0W8cina L7fSpy2qokqwzwBNk5O7WPT4V28oLKYRXsQ3BoxXkd0nApPYLTEuybhTPt8jd5MGtWvdTy mVEhfmgkSAxuUHJ/mjc6wuqGbY7v4RNyE/7zEOzFTJmE8Z9siyD+xd5IYnRAqH+EkKH/TY yrR7VA70XOWp0LxVSEAmxQDOhJFzOLptUCaMvtUEZtZ7B7SKaEUoUDeT+4/sNvmeX6VMkn JuKkz8HOUkE2MPbmtx6QuxDsE7TsauAo66knbOrSDJ+QHve9e622vKMPoxHNFg== X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Theodor Thornhill To: jostein@kjonigsen.net, =?ISO-8859-1?Q?Jostein_Kj=F8nigsen?= , Yuan Fu , Eli Zaretskii Subject: =?US-ASCII?Q?Re=3A_bug=2359691=3A_29=2E0=2E60=3B_typescript-ts-?= =?US-ASCII?Q?mode=3A_any_HTML-like_elements_causes_fon?= =?US-ASCII?Q?tification_to_become_invalid_and_remain?= =?US-ASCII?Q?ing_parse-tree_to_become_jsx-expression?= In-Reply-To: <7ac55edd-3887-7e38-7d89-4902f0b61416@secure.kjonigsen.net> References: <831qpklejb.fsf@gnu.org> <83mt88jul4.fsf@gnu.org> <0A18F996-F3BB-4A7D-A0BE-76C8374DE517@thornhill.no> <8335a0jofb.fsf@gnu.org> <7BE15945-C463-448A-8593-E3B5D0E374FB@thornhill.no> <871qpj1x2k.fsf@thornhill.no> <83fsdzin4e.fsf@gnu.org> <87v8mvzgmt.fsf@thornhill.no> <838rjrigmq.fsf@gnu.org> <87k03bz99r.fsf@thornhill.no> <835yeviats.fsf@gnu.org> <87v8mt7dnb.fsf@thornhill.no> <7ac55edd-3887-7e38-7d89-4902f0b61416@secure.kjonigsen.net> Message-ID: <52242BB9-FE06-4DEE-AF54-8456BD1F9F07@thornhill.no> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 59691 Cc: 59691@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On 2 December 2022 22:28:36 CET, "Jostein Kj=C3=B8nigsen" wrote: > >>> Cool=2E I applied the patch, thanks Theo! I changed typescript-ts-mode= =E2=80=94base-mode to typescript-ts-base-mode, since I don=E2=80=99t think = anyone has strong opinions about its naming, and typescript-ts-base-mode is= more consistent with other tree-sitter base modes=2E >>> Yuan >> Thanks! I believe this can be closed=2E What do you think, Jostein? >>=20 >> Theo > >Hey guys=2E > >Amazing work! Sorry for being somewhat slow wrt to testing=2E > >I had to rebuild some tree-sitter libraries, and the build-code in admin/= notes/tree-sitter/ seemingly didn't work out of the box for both plain type= script and tsx=2E Yadda, yadda, yadda=2E I've modified the scripts to also = build for typescript/tsx=2E Do you wan't me to send in a patch for that, Yu= an? > I've already sent a patch for that :) >Back to the point: Either way, I've tested both TS-code and TSX-code now,= and it seems to work much better=2E > Yay! >I still see some errors in TSX-code I can't recall seing in the old mode = (and I might report those issues, once I have time to collect more accurate= data on them), but for now I definitely think what we have here warrants m= arking this particular bug as closed=2E :) Great news! We'll get to the other stuff in due time :) Theo From debbugs-submit-bounces@debbugs.gnu.org Sat Dec 03 01:38:53 2022 Received: (at 59691-done) by debbugs.gnu.org; 3 Dec 2022 06:38:53 +0000 Received: from localhost ([127.0.0.1]:51265 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p1MAn-0005Pc-9g for submit@debbugs.gnu.org; Sat, 03 Dec 2022 01:38:53 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34218) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p1MAk-0005PW-HW for 59691-done@debbugs.gnu.org; Sat, 03 Dec 2022 01:38:51 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p1MAe-0006EP-QX; Sat, 03 Dec 2022 01:38:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=ccKxmqWO0eVQq5AAmmEbEhOpRG97Jg12QV14j0vINZ0=; b=dTenoRkUiY5lajfCcQts 3QMsdjqhmBzBVq7iUdeNKz2s39t36U+IoDCGEt2OlCyWkYOFN7NJOq4rXhsTrf8NtiqFnOoXy4bZu 9cxpKSNXVq28khxYcUykF/w+UPo66uwR9pYKLq00dzomkd/ZOgQx+pk6EG4cMkg9A5sNBku7ai0ye uo3HDPn2CoEWrxarJIbb3TCMGxk+0wPcoGxyT6RmmKJsCzi2ILyp07BhS9H/pZMrr9TRc9+0LVSpa uySCBhJdkQ+4jTF9ceokENdn4k1AblEBcIWTBW4wFCUbMIuQT9SiqLHDuTSE4MifwRmlcxZspHSVo 9NDAN9Fysgtd1g==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p1MAd-0000jH-NE; Sat, 03 Dec 2022 01:38:44 -0500 Date: Sat, 03 Dec 2022 08:38:21 +0200 Message-Id: <83sfhxdmaq.fsf@gnu.org> From: Eli Zaretskii To: jostein@kjonigsen.net In-Reply-To: <7ac55edd-3887-7e38-7d89-4902f0b61416@secure.kjonigsen.net> (message from Jostein =?utf-8?Q?Kj=C3=B8nigsen?= on Fri, 2 Dec 2022 22:28:36 +0100) Subject: Re: bug#59691: 29.0.60; typescript-ts-mode: any HTML-like elements causes fontification to become invalid and remaining parse-tree to become jsx-expression References: <831qpklejb.fsf@gnu.org> <83mt88jul4.fsf@gnu.org> <0A18F996-F3BB-4A7D-A0BE-76C8374DE517@thornhill.no> <8335a0jofb.fsf@gnu.org> <7BE15945-C463-448A-8593-E3B5D0E374FB@thornhill.no> <871qpj1x2k.fsf@thornhill.no> <83fsdzin4e.fsf@gnu.org> <87v8mvzgmt.fsf@thornhill.no> <838rjrigmq.fsf@gnu.org> <87k03bz99r.fsf@thornhill.no> <835yeviats.fsf@gnu.org> <87v8mt7dnb.fsf@thornhill.no> <7ac55edd-3887-7e38-7d89-4902f0b61416@secure.kjonigsen.net> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 59691-done Cc: casouri@gmail.com, 59691-done@debbugs.gnu.org, theo@thornhill.no X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Fri, 2 Dec 2022 22:28:36 +0100 > Cc: 59691@debbugs.gnu.org, jostein@kjonigsen.net > From: Jostein Kjønigsen > > I still see some errors in TSX-code I can't recall seing in the old mode > (and I might report those issues, once I have time to collect more > accurate data on them), but for now I definitely think what we have here > warrants marking this particular bug as closed. :) Closing. Btw, you can always close yourself, by sending to the NNN-done address, as I did here. From unknown Sun Aug 17 04:19:25 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sat, 31 Dec 2022 12:24:10 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator