mirror of
https://github.com/doomemacs/doomemacs.git
synced 2025-12-06 02:30:33 -08:00
fix(php): treesit: PSR-2 indentation for chained methods
Before:
public function someMethod()
{
return $this->doSomething()
->doSomethingElse()
->andDoOneLastThing();
}
After:
public function someMethod()
{
return $this->doSomething()
->doSomethingElse()
->andDoOneLastThing();
}
Fix: doomemacs/community#36
This commit is contained in:
parent
9debe1b3fc
commit
a9e08e15d7
1 changed files with 17 additions and 1 deletions
|
|
@ -82,7 +82,23 @@
|
|||
html css ; requires :lang (web +tree-sitter)
|
||||
javascript jsdoc)) ; requires :lang (javascript +tree-sitter)
|
||||
:config
|
||||
(+php-common-config 'php-ts-mode))
|
||||
(+php-common-config 'php-ts-mode)
|
||||
|
||||
;; HACK: This advice fixes PSR-2/12 indentation of chained methods and makes
|
||||
;; room for any future corrections.
|
||||
;; REVIEW: PR these corrections upstream.
|
||||
(defadvice! +php--correct-indent-styles-a (fn &rest args)
|
||||
:around #'php-ts-mode--get-indent-style
|
||||
(let ((rules (apply fn args)))
|
||||
(if (functionp php-ts-mode-indent-style)
|
||||
rules
|
||||
`((php
|
||||
,@(pcase php-ts-mode-indent-style
|
||||
(`psr2
|
||||
`(((parent-is "member_call_expression") parent-bol php-ts-mode-indent-offset)))
|
||||
;; Room for other corrections
|
||||
)
|
||||
,@(cadr rules)))))))
|
||||
|
||||
|
||||
(use-package! php-refactor-mode
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue