php-mode icon indicating copy to clipboard operation
php-mode copied to clipboard

Lineup Cascaded Calls doesn't work properly

Open gjm opened this issue 4 years ago • 5 comments

This is the same as #563 because it still doesn't work properly.

gjm avatar Jan 21 '20 16:01 gjm

@gjm Can you submit the minimal code that reproduces the problem and M-x php-mode-debug output?

zonuexe avatar Jan 21 '20 16:01 zonuexe

So here's the exact same code that I submitted for #563:

public function foo()
{
    return $this->someMethod($parameter)
        ->otherMethod()
        ->finalMethod($otherParameter);
}

and here's the output of M-x php-mode-debug:

--- PHP-MODE DEBUG BEGIN ---
versions: GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.12, cairo version 1.16.0)
 of 2020-01-19; PHP Mode 1.22.2
package-version: 20200104.21
major-mode: php-mode
minor-modes: (flycheck-pos-tip-mode flycheck-mode ggtags-mode subword-mode ethan-wspace-mode ethan-wspace-clean-many-nls-eof-mode ethan-wspace-clean-no-nl-eof-mode ethan-wspace-clean-eol-mode ethan-wspace-clean-tabs-mode smart-newline-mode lsp-origami-mode origami-mode doom-modeline-mode dap-ui-mode treemacs-icons-dired-mode magit-todos-mode async-bytecomp-package-mode shell-dirtrack-mode treemacs-follow-mode treemacs-git-mode treemacs-fringe-indicator-mode dap-mode yas-minor-mode diff-hl-flydiff-mode which-key-mode show-smartparens-mode smartparens-mode ivy-rich-mode counsel-projectile-mode projectile-mode ivy-mode winner-mode balanced-windows-mode hl-todo-mode recentf-mode display-line-numbers-mode desktop-save-mode tooltip-mode eldoc-mode electric-indent-mode mouse-wheel-mode file-name-shadow-mode font-lock-mode auto-composition-mode auto-encryption-mode auto-compression-mode column-number-mode line-number-mode transient-mark-mode abbrev-mode)
variables: ((indent-tabs-mode nil) (tab-width 4))
custom variables: ((php-executable /usr/bin/php) (php-site-url https://php.net/) (php-manual-url en) (php-search-url nil) (php-class-suffix-when-insert ::) (php-namespace-suffix-when-insert \) (php-default-major-mode php-mode) (php-html-template-major-mode web-mode) (php-blade-template-major-mode web-mode) (php-template-mode-alist ((\.blade . web-mode) (\.phpt\' . php-mode) (\.phtml\' . web-mode))) (php-mode-maybe-hook nil) (php-default-builtin-web-server-port 3939) (php-re-detect-html-tag php-re-detect-html-tag-default) (php-search-documentation-browser-function nil))
c-indentation-style: psr2
c-style-variables: ((c-basic-offset 4) (c-comment-only-line-offset 0) (c-indent-comment-alist ((anchored-comment column . 0) (end-block space . 1) (cpp-end-block space . 2))) (c-indent-comments-syntactically-p t) (c-block-comment-prefix * ) (c-comment-prefix-regexp ((pike-mode . //+!?\|\**) (awk-mode . #+) (other . //+\|\**))) (c-cleanup-list (scope-operator)) (c-hanging-braces-alist ((brace-list-open) (brace-entry-open) (statement-cont) (substatement-open after) (block-close . c-snug-do-while) (extern-lang-open after) (namespace-open after) (module-open after) (composition-open after) (inexpr-class-open after) (inexpr-class-close before) (arglist-cont-nonempty))) (c-hanging-colons-alist nil) (c-hanging-semi&comma-criteria (c-semi&comma-inside-parenlist)) (c-backslash-column 48) (c-backslash-max-column 72) (c-special-indent-hook nil) (c-label-minimum-indentation 1))
c-doc-comment-style: ((java-mode . javadoc) (pike-mode . autodoc) (c-mode . gtkdoc) (c++-mode . gtkdoc))
c-offsets-alist: ((inexpr-class . 0) (inexpr-statement . +) (lambda-intro-cont . +) (inlambda . 0) (template-args-cont c-lineup-template-args +) (incomposition . +) (inmodule . +) (innamespace . +) (inextern-lang . +) (composition-close . 0) (module-close . 0) (namespace-close . 0) (extern-lang-close . 0) (composition-open . 0) (module-open . 0) (namespace-open . 0) (extern-lang-open . 0) (objc-method-call-cont c-lineup-ObjC-method-call-colons c-lineup-ObjC-method-call +) (objc-method-args-cont . c-lineup-ObjC-method-args) (objc-method-intro . [0]) (friend . 0) (cpp-define-intro c-lineup-cpp-define +) (cpp-macro-cont . +) (cpp-macro . [0]) (inclass . +) (stream-op . c-lineup-streamop) (arglist-cont-nonempty first php-lineup-cascaded-calls php-c-lineup-arglist) (arglist-cont first php-lineup-cascaded-calls 0) (comment-intro . 0) (catch-clause . 0) (else-clause . 0) (do-while-closure . 0) (access-label . -) (case-label . +) (substatement . +) (statement-case-intro . +) (statement . 0) (brace-entry-open . 0) (brace-list-entry . 0) (brace-list-close . 0) (block-close . 0) (block-open . 0) (inher-cont . c-lineup-multi-inher) (inher-intro . +) (member-init-cont . c-lineup-multi-inher) (member-init-intro . +) (annotation-var-cont . +) (annotation-top-cont . 0) (topmost-intro . 0) (knr-argdecl . 0) (func-decl-cont . +) (inline-close . 0) (class-close . 0) (class-open . 0) (defun-block-intro . +) (defun-close . 0) (defun-open . 0) (c . c-lineup-C-comments) (string . c-lineup-dont-change) (topmost-intro-cont first php-lineup-cascaded-calls +) (brace-list-intro . +) (brace-list-open . 0) (inline-open . 0) (arglist-close . php-lineup-arglist-close) (arglist-intro . php-lineup-arglist-intro) (statement-cont . +) (statement-case-open . 0) (label . +) (substatement-label . 2) (substatement-open . 0) (knr-argdecl-intro . +) (statement-block-intro . +))
buffer: (:length 232)
--- PHP-MODE DEBUG END ---

gjm avatar Jan 21 '20 17:01 gjm

@gjm Thank you for reporting!

I haven't investigated it yet, but I suspect an incompatible change in Cc Mode of Emacs master branch.

zonuexe avatar Jan 22 '20 06:01 zonuexe

@gjm I have tested with the HEAD of Emacs 28, but there is no problem.

If explicitly execute M-x php-set-style psr2 instead of a variable doesn't solve the problem, you may be in conflict with another minor mode

zonuexe avatar Jan 25 '20 17:01 zonuexe

I had already set the style to psr2 but I tried manually with the same result...

If you M-x indent-region the example code I posted earlier what do you get? Is there anything I can do to try and find out why I'm not getting the correct indentation?

gjm avatar Jan 27 '20 09:01 gjm