Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Indentation of a block nested in a function call chain

Aperta
#420 3 commenti 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
38/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
emacs-lisp, php
Ambito
tooling

Direzione di ricerca

Esamina l’issue #251 e riproduci gli esempi PHP in php-mode per verificare il comportamento attuale dell'indentazione. La modifica è completa quando i blocchi di funzioni anonime all'interno di catene di chiamate annidate non ricevono più un'indentazione aggiuntiva per ogni livello di chiamata e i casi mostrati si comportano in modo coerente.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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

Lingua principale
Emacs Lisp
Stelle
604
Fork
117
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di emacs-php/php-mode

Tutte le issue di emacs-php/php-mode

Issue simili

Altre issue su DevTools

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.