unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#62109: 29.0.60; rust-ts-mode missing indentation for patterns
@ 2023-03-10 22:32 Yuan Fu
  2023-03-11  2:03 ` Randy Taylor
  0 siblings, 1 reply; 4+ messages in thread
From: Yuan Fu @ 2023-03-10 22:32 UTC (permalink / raw)
  To: 62109; +Cc: dev

X-Debbugs-CC: dev@rjt.dev

Try this snippet:

fn main() {
    match &cli.command {
        Commands::Run {
a,
b,
c,
d,
        } => todo!(),
    }
}


The a, b, c, d don’t have corresponding indentation rules. I can add
some myself, but I’m not sure where to add and what’s the best rule to
add.

Yuan






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

* bug#62109: 29.0.60; rust-ts-mode missing indentation for patterns
  2023-03-10 22:32 bug#62109: 29.0.60; rust-ts-mode missing indentation for patterns Yuan Fu
@ 2023-03-11  2:03 ` Randy Taylor
  2023-03-11  2:04   ` Randy Taylor
  0 siblings, 1 reply; 4+ messages in thread
From: Randy Taylor @ 2023-03-11  2:03 UTC (permalink / raw)
  To: Yuan Fu; +Cc: 62109

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

On Friday, March 10th, 2023 at 17:32, Yuan Fu <casouri@gmail.com> wrote:
> 
> X-Debbugs-CC: dev@rjt.dev
> 
> Try this snippet:
> 
> fn main() {
> match &cli.command {
> Commands::Run {
> a,
> b,
> c,
> d,
> } => todo!(),
> 
> }
> }
> 
> 
> The a, b, c, d don’t have corresponding indentation rules. I can add
> some myself, but I’m not sure where to add and what’s the best rule to
> add.
> 
> Yuan
> 

Thanks for the report, I've attached a patch fixing it.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Add-missing-indentation-rule-for-rust-ts-mode.patch --]
[-- Type: text/x-patch; name=0001-Add-missing-indentation-rule-for-rust-ts-mode.patch, Size: 1100 bytes --]

From 419ea4dad329cb464c19ef071d326cc6420888ac Mon Sep 17 00:00:00 2001
From: Randy Taylor <dev@rjt.dev>
Date: Fri, 10 Mar 2023 20:56:04 -0500
Subject: [PATCH] Add missing indentation rule for rust-ts-mode

* lisp/progmodes/rust-ts-mode.el (rust-ts-mode--indent-rules): Add
missing rule.
---
 lisp/progmodes/rust-ts-mode.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lisp/progmodes/rust-ts-mode.el b/lisp/progmodes/rust-ts-mode.el
index 696c2633231..a07a6649dc2 100644
--- a/lisp/progmodes/rust-ts-mode.el
+++ b/lisp/progmodes/rust-ts-mode.el
@@ -91,6 +91,7 @@ rust-ts-mode--indent-rules
      ((parent-is "let_declaration") parent-bol rust-ts-mode-indent-offset)
      ((parent-is "macro_definition") parent-bol rust-ts-mode-indent-offset)
      ((parent-is "parameters") parent-bol rust-ts-mode-indent-offset)
+     ((parent-is "struct_pattern") parent-bol rust-ts-mode-indent-offset)
      ((parent-is "token_tree") parent-bol rust-ts-mode-indent-offset)
      ((parent-is "use_list") parent-bol rust-ts-mode-indent-offset)))
   "Tree-sitter indent rules for `rust-ts-mode'.")
-- 
2.39.2


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

* bug#62109: 29.0.60; rust-ts-mode missing indentation for patterns
  2023-03-11  2:03 ` Randy Taylor
@ 2023-03-11  2:04   ` Randy Taylor
  2023-03-11 23:53     ` Yuan Fu
  0 siblings, 1 reply; 4+ messages in thread
From: Randy Taylor @ 2023-03-11  2:04 UTC (permalink / raw)
  To: Yuan Fu; +Cc: 62109

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

On Friday, March 10th, 2023 at 21:03, Randy Taylor <dev@rjt.dev> wrote:
> 
> On Friday, March 10th, 2023 at 17:32, Yuan Fu casouri@gmail.com wrote:
> 
> > X-Debbugs-CC: dev@rjt.dev
> > 
> > Try this snippet:
> > 
> > fn main() {
> > match &cli.command {
> > Commands::Run {
> > a,
> > b,
> > c,
> > d,
> > } => todo!(),
> > 
> > }
> > }
> > 
> > The a, b, c, d don’t have corresponding indentation rules. I can add
> > some myself, but I’m not sure where to add and what’s the best rule to
> > add.
> > 
> > Yuan
> 
> 
> Thanks for the report, I've attached a patch fixing it.

Sorry, forgot to include the bug #. Same patch with the bug # this time!


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Add-missing-indentation-rule-for-rust-ts-mode-Bug-62.patch --]
[-- Type: text/x-patch; name=0001-Add-missing-indentation-rule-for-rust-ts-mode-Bug-62.patch, Size: 1112 bytes --]

From 16522d2626d3ec5d9de70d3a90ecd137258ed98f Mon Sep 17 00:00:00 2001
From: Randy Taylor <dev@rjt.dev>
Date: Fri, 10 Mar 2023 20:56:04 -0500
Subject: [PATCH] Add missing indentation rule for rust-ts-mode (Bug#62109)

* lisp/progmodes/rust-ts-mode.el (rust-ts-mode--indent-rules): Add
missing rule.
---
 lisp/progmodes/rust-ts-mode.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lisp/progmodes/rust-ts-mode.el b/lisp/progmodes/rust-ts-mode.el
index 696c2633231..a07a6649dc2 100644
--- a/lisp/progmodes/rust-ts-mode.el
+++ b/lisp/progmodes/rust-ts-mode.el
@@ -91,6 +91,7 @@ rust-ts-mode--indent-rules
      ((parent-is "let_declaration") parent-bol rust-ts-mode-indent-offset)
      ((parent-is "macro_definition") parent-bol rust-ts-mode-indent-offset)
      ((parent-is "parameters") parent-bol rust-ts-mode-indent-offset)
+     ((parent-is "struct_pattern") parent-bol rust-ts-mode-indent-offset)
      ((parent-is "token_tree") parent-bol rust-ts-mode-indent-offset)
      ((parent-is "use_list") parent-bol rust-ts-mode-indent-offset)))
   "Tree-sitter indent rules for `rust-ts-mode'.")
-- 
2.39.2


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

* bug#62109: 29.0.60; rust-ts-mode missing indentation for patterns
  2023-03-11  2:04   ` Randy Taylor
@ 2023-03-11 23:53     ` Yuan Fu
  0 siblings, 0 replies; 4+ messages in thread
From: Yuan Fu @ 2023-03-11 23:53 UTC (permalink / raw)
  To: Randy Taylor; +Cc: 62109-done

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



> On Mar 10, 2023, at 6:04 PM, Randy Taylor <dev@rjt.dev> wrote:
> 
> On Friday, March 10th, 2023 at 21:03, Randy Taylor <dev@rjt.dev> wrote:
>> 
>> On Friday, March 10th, 2023 at 17:32, Yuan Fu casouri@gmail.com wrote:
>> 
>>> X-Debbugs-CC: dev@rjt.dev
>>> 
>>> Try this snippet:
>>> 
>>> fn main() {
>>> match &cli.command {
>>> Commands::Run {
>>> a,
>>> b,
>>> c,
>>> d,
>>> } => todo!(),
>>> 
>>> }
>>> }
>>> 
>>> The a, b, c, d don’t have corresponding indentation rules. I can add
>>> some myself, but I’m not sure where to add and what’s the best rule to
>>> add.
>>> 
>>> Yuan
>> 
>> 
>> Thanks for the report, I've attached a patch fixing it.
> 
> Sorry, forgot to include the bug #. Same patch with the bug # this time!
> 

[-- Attachment #2: 0001-Add-missing-indentation-rule-for-rust-ts-mode-Bug-62.patch --]
[-- Type: application/octet-stream, Size: 1138 bytes --]

From 16522d2626d3ec5d9de70d3a90ecd137258ed98f Mon Sep 17 00:00:00 2001
From: Randy Taylor <dev@rjt.dev>
Date: Fri, 10 Mar 2023 20:56:04 -0500
Subject: [PATCH] Add missing indentation rule for rust-ts-mode (Bug#62109)

* lisp/progmodes/rust-ts-mode.el (rust-ts-mode--indent-rules): Add
missing rule.
---
 lisp/progmodes/rust-ts-mode.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lisp/progmodes/rust-ts-mode.el b/lisp/progmodes/rust-ts-mode.el
index 696c2633231..a07a6649dc2 100644
--- a/lisp/progmodes/rust-ts-mode.el
+++ b/lisp/progmodes/rust-ts-mode.el
@@ -91,6 +91,7 @@ rust-ts-mode--indent-rules
      ((parent-is "let_declaration") parent-bol rust-ts-mode-indent-offset)
      ((parent-is "macro_definition") parent-bol rust-ts-mode-indent-offset)
      ((parent-is "parameters") parent-bol rust-ts-mode-indent-offset)
+     ((parent-is "struct_pattern") parent-bol rust-ts-mode-indent-offset)
      ((parent-is "token_tree") parent-bol rust-ts-mode-indent-offset)
      ((parent-is "use_list") parent-bol rust-ts-mode-indent-offset)))
   "Tree-sitter indent rules for `rust-ts-mode'.")
-- 
2.39.2


[-- Attachment #3: Type: text/plain, Size: 40 bytes --]



Brilliant, thanks! I applied it.

Yuan

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

end of thread, other threads:[~2023-03-11 23:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-10 22:32 bug#62109: 29.0.60; rust-ts-mode missing indentation for patterns Yuan Fu
2023-03-11  2:03 ` Randy Taylor
2023-03-11  2:04   ` Randy Taylor
2023-03-11 23:53     ` Yuan Fu

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

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

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