Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Indentation of a block nested in a function call chain

オープン
#420 コメント 3 件 リアクション 1 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
38/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
emacs-lisp, php
領域
tooling

調査の方向性

issue #251を確認し、現在のインデント動作を調べるためにphp-modeでPHPの例を再現します。ネストした呼び出しチェーン内の無名関数ブロックが、呼び出しの深さごとにインデントを増やさなくなり、示されているケースが一貫して動作すれば、変更は完了です。

索引モデルが issue の本文から書いたものです。

説明

Bug

This is maybe not so much an issue or a bug report as a request for help. Currently when we nest function calls and then put a block inside, for example an anonymous function it indents it "that many times" as there are function calls.

I also present some other modes and how they handle it so it might be worth to behave similarly.

<?php

function() {
    foo(bar(function () {
                return 1;
            }));

    foo(bar(fux(function () {
                    return 2;
                })));
}

What I would like to have is something like

<?php

function() {
    foo(bar(function () {
        return 1;
    }));

    foo(bar(fux(function () {
        return 2;
    })));
}

This is also "compatible" with how js2-mode works

function foo() {
    foo(bar(function () {
        return 1;
    }));

    foo(bar(fux(function () {
        return 2;
    })));
}

java-mode works similarly but always indents "one step" further

class Test
{
    string foo() {
        foo(bar(new Interface () {
                return 1;
            }));

        foo(bar(fux(new Interface () {
                return 2;
            })));
    }
}

I think being consistent and not depending on the depth is a more natural way to handle the indentation even by default.

Edit: seems to be related to #251

主要言語
Emacs Lisp
スター
606
フォーク
117
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

emacs-php/php-mode のほかの issue

emacs-php/php-mode の issue をすべて見る

似ている issue

DevTools の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。