From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Vincenzo Pupillo Newsgroups: gmane.emacs.bugs Subject: bug#71380: 30.0.50; Submitting php-ts-mode, new major mode for php Date: Fri, 07 Jun 2024 14:50:24 +0200 Message-ID: <21747651.4csPzL39Zc@3-191.divsi.unimi.it> References: <3686989.dWV9SEqChM@3-191.divsi.unimi.it> <2137654.9o76ZdvQCi@3-191.divsi.unimi.it> <86ed99f1ly.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37795"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 71380@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jun 07 14:52:09 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sFZ4j-0009Y7-7T for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 07 Jun 2024 14:52:09 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sFZ4P-0006bC-OL; Fri, 07 Jun 2024 08:51:49 -0400 Original-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 1sFZ4N-0006ax-Ie for bug-gnu-emacs@gnu.org; Fri, 07 Jun 2024 08:51:47 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sFZ4M-0003Tc-UF for bug-gnu-emacs@gnu.org; Fri, 07 Jun 2024 08:51:47 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sFZ4b-0004sB-QO for bug-gnu-emacs@gnu.org; Fri, 07 Jun 2024 08:52:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Vincenzo Pupillo Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 07 Jun 2024 12:52:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71380 X-GNU-PR-Package: emacs Original-Received: via spool by 71380-submit@debbugs.gnu.org id=B71380.171776470918695 (code B ref 71380); Fri, 07 Jun 2024 12:52:01 +0000 Original-Received: (at 71380) by debbugs.gnu.org; 7 Jun 2024 12:51:49 +0000 Original-Received: from localhost ([127.0.0.1]:54729 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sFZ4O-0004rR-OW for submit@debbugs.gnu.org; Fri, 07 Jun 2024 08:51:49 -0400 Original-Received: from mail-ej1-f42.google.com ([209.85.218.42]:44205) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sFZ4M-0004r4-Le for 71380@debbugs.gnu.org; Fri, 07 Jun 2024 08:51:47 -0400 Original-Received: by mail-ej1-f42.google.com with SMTP id a640c23a62f3a-a68e7538cfaso264742466b.0 for <71380@debbugs.gnu.org>; Fri, 07 Jun 2024 05:51:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717764625; x=1718369425; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=nHPKOl3KECmKTRr7iO+RNU0fUY7ReaM3TFhDWfLYv2o=; b=UQ9kg3ednLKDwrh4SACtXH1hFH97jfSALQwQOMYxQyTsm+cqLi1GVzGjThKM7ef47Q cYqYYUDQOP1JF0urAqj7sQLWK+ULTvMO9nMBnpIZIIQgx1+0aby2nw07EgQDcNtmEDRo YuPO/LPTEB73i9dMRvGJSbKTjJhM0LN3pL0W4JnkmittWBsuZFQbbTYJ5ALnYpQaug4b TaL2eLxPJrs5ueYXTgtsxui+pTl5melypO35aPdP5AcTRw20xCZQdKi7b+NIBUeg/A0k fW8ouWR9vzXPfTGEsLx6GKCIc8FkvrC9W0THaM8AEJS39h2ig+SYrjisOQXAQ3Y4lzf8 jGLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717764625; x=1718369425; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nHPKOl3KECmKTRr7iO+RNU0fUY7ReaM3TFhDWfLYv2o=; b=lFuzfsvSyqnLltH8KLlo7ocCFc8qrWVs/o/Y5YBy/PxGgbpzngjhJypYAqjrM4Uk52 SZYPg15h86W3DRlp/w5LhkDE9JG0rA/Ogqx0x6Cv7FmmrABD8NLaFz7Tfpx1hh+CjDiN xu+FcDEv7Be4Te2fcyRLrVj0egU83MDwPGStZBEfIhJwpgxUU8ltOVuWqe3OnKUNMAw5 099GsoRknj+48MZk2A4V68ZXXkK8sH6pacX9sWBQxcsOhamkVqYof3ACR+ieiZTgqh50 BmmMqsi5qxyuR1e74VOt4p0HGJTokgnv904W2kY3Z/Q3r8DxYtSA82olET4QS/TH5oSz M2UA== X-Gm-Message-State: AOJu0Yzi/PPA/IKC+IEGiz5mhta6AMIHVlBLAl7qY2J0BzefIDRmKVmR qbEaSFw67JbZDIABZmfj0Fi6e2IBB4Pm05I2oTfQEGnSVKKRJf9loYzNXLm9 X-Google-Smtp-Source: AGHT+IHaW7D2YfHA9lGcE5fh9oVzfX7kpaJgvEdr/pdchhC2stPxQf0D4nugurhHtPS7WYnj6rJ2Yg== X-Received: by 2002:a17:906:8316:b0:a6b:285a:e65c with SMTP id a640c23a62f3a-a6cdc0e1182mr170191366b.74.1717764625275; Fri, 07 Jun 2024 05:50:25 -0700 (PDT) Original-Received: from 3-191.divsi.unimi.it (3-191.divsi.unimi.it. [159.149.3.191]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a6c805cc38csm243565066b.71.2024.06.07.05.50.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jun 2024 05:50:25 -0700 (PDT) In-Reply-To: <86ed99f1ly.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:286765 Archived-At: In data venerd=C3=AC 7 giugno 2024 13:12:25 CEST, Eli Zaretskii ha scritto: > > From: Vincenzo Pupillo > > Cc: 71380@debbugs.gnu.org > > Date: Fri, 07 Jun 2024 12:45:05 +0200 > >=20 > > > > +(defun php-ts-mode--array-element-heuristic (node parent bol &rest= _) > > > > + "Return of the position of the first element of the array. > > >=20 > > > The "of" part should be deleted here, I think. > > > > > I'm not sure how to explain it. Different indentation styles indent the= =20 > > elements of an array differently when written on multiple rows. For exa= mple. > > in PSR2 it is like this: > > $a =3D array("a" =3D> 1, > > "b" =3D> 2, > > "c" =3D> 3); > > while with Zend it is like this: > > $a =3D array("a" =3D> 1, > > "b" =3D> 2, > > "c" =3D> 3); > > What do you suggest? >=20 > What does the function return in each of these two cases? >=20 If '$a =3D array(' is on the same line as '=E2=80=9Ca=E2=80=9D =3D> 1,' it = returns the initial position of '=E2=80=9Ca=E2=80=9D,=20 otherwise the starting position of 'array(', like PSR2.=20 In terms of tree-sitter-php the first case is: (treesit-node-start (treesit-node-child parent 2)) while the second is: parent indentation + offset. Intricate, but can handle nested array declarations in styles like Zend.=20 It is currently used only for Zend but I am starting to look at another sty= le named PER (https://www.php-fig.org/per/coding-style/).=20 Thank you. Vincenzo