all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Noah Peart <noah.v.peart@gmail.com>
To: 70023@debbugs.gnu.org
Subject: bug#70023: [PATCH] Add typescript-ts-mode indentation for interface bodies
Date: Tue, 26 Mar 2024 23:20:18 -0700	[thread overview]
Message-ID: <CAPVBTSfqhXbgGGa4M55DH1FL7ne0Yorvj+KhD03uV9=M53u5qg@mail.gmail.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 1189 bytes --]

Tags: patch


Adds missing indentation for typescript interfaces.

Currently, there is no indentation for property signatures in typescript
interfaces.

To reproduce, call `M-x (my-test-typescript-indent)`

    (defun my-test-typescript-indent ()
      (interactive)
      (typescript-ts-mode)
      (setq-local typescript-ts-mode-indent-offset 4)
      (indent-region (point-min) (point-max)))


in buffer with the following typescript code:

    interface Foo {
    foo: string;   // no matching indent rule
    bar?: boolean; // no matching indent rule
    }


In GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.33, cairo version 1.16.0) of 2024-03-24 built on noah-X580VD
Repository revision: c5de73a95a6ecefe46fe1ac07da8e83032be7f5b
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101004
System Description: Ubuntu 22.04.4 LTS

Configured using:
 'configure --prefix=/usr/local --with-modules --with-tree-sitter
--with-threads --with-x-toolkit=gtk3 --with-xwidgets --with-gnutls
--with-json --with-mailutils --with-jpeg --with-png --with-rsvg
--with-tiff --with-xml2 --with-xpm --with-imagemagick CC=gcc-12
CXX=gcc-12'

[-- Attachment #1.2: Type: text/html, Size: 1366 bytes --]

[-- Attachment #2: 0001-Add-typescript-ts-mode-indentation-for-interface-bod.patch --]
[-- Type: text/x-patch, Size: 1270 bytes --]

From a39f2364973998318b56d91cb2801a06b237b88a Mon Sep 17 00:00:00 2001
From: Noah Peart <noah.v.peart@gmail.com>
Date: Tue, 26 Mar 2024 22:44:48 -0700
Subject: [PATCH] Add typescript-ts-mode indentation for interface bodies

* lisp/progmodes/typescript-ts-mode.el
(typescript-ts-mode--indent-rules): Add indentation rule for
interface bodies.
---
 lisp/progmodes/typescript-ts-mode.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el
index ea4f6417c5a..ab1d76ab20e 100644
--- a/lisp/progmodes/typescript-ts-mode.el
+++ b/lisp/progmodes/typescript-ts-mode.el
@@ -124,6 +124,7 @@ typescript-ts-mode--indent-rules
      ((parent-is "object_type") parent-bol typescript-ts-mode-indent-offset)
      ((parent-is "enum_body") parent-bol typescript-ts-mode-indent-offset)
      ((parent-is "class_body") parent-bol typescript-ts-mode-indent-offset)
+     ((parent-is "interface_body") parent-bol typescript-ts-mode-indent-offset)
      ((parent-is "arrow_function") parent-bol typescript-ts-mode-indent-offset)
      ((parent-is "parenthesized_expression") parent-bol typescript-ts-mode-indent-offset)
      ((parent-is "binary_expression") parent-bol typescript-ts-mode-indent-offset)
-- 
2.34.1


             reply	other threads:[~2024-03-27  6:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-27  6:20 Noah Peart [this message]
2024-03-28 13:11 ` bug#70023: [PATCH] Add typescript-ts-mode indentation for interface bodies Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-28 14:31   ` Eli Zaretskii
2024-03-28 18:10 ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-30  5:55   ` Stefan Kangas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAPVBTSfqhXbgGGa4M55DH1FL7ne0Yorvj+KhD03uV9=M53u5qg@mail.gmail.com' \
    --to=noah.v.peart@gmail.com \
    --cc=70023@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.