Closed polaris64 closed 1 year ago
Apologies: I've just gone back to php-mode
temporarily and I noticed that the Eglot/Flymake/Phpactor issue seems to be present there too. I'm quite surprised because I'm sure I tested that before, but it indeed does not work correctly. It only shows up after opening a second project file though so perhaps that's why I missed it at first!
So it looks like issue 1 above is not related to phps-mode
after all, but item 2 is still an issue.
Thanks for reporting that issue, I think I stumbled upon it sometime as well but forgot to document it. Should be fixed now in version 0.4.36
The automated test passes but when I test manually it doesn't work, back to the drawing-board
Ok now in 0.4.37 the issue should really be fixed
Hi @cjohansson, thanks for looking into this!
I've just tried again from the latest commit (a32f68a0d490555fc692f58a780fbdaec0df08b4) and this still doesn't appear to work for me.
In an example buffer with the following contents: -
<?php
// Before function
function test($a) {
return $a + 1;
}
// After function
Placing the point somewhere inside the test
function body and then running narrow-to-defun
seems to do nothing. I would expect the buffer to be narrowed to the following: -
function test($a) {
return $a + 1;
}
Try to use narrow-to-region
instead, I think the issue rather is the structure of the imenu-index now, not sure what a defun
is in the context of PHP? Like is it a namespace, class, interface, trait, enum, method, etc ?
I'm not sure exactly how php-mode
defines it but it usually "just works"™ when I try to narrow to a particular function or method definition. Saying that though there are times when this fails so perhaps it's just a coincidence that it happens to work in php-mode
?
I think ideally it would narrow to the innermost "thing" at point. If that's a class method then narrow to the method. If the point is within a class but outside a method then narrow to the class, etc.
Yeah I investigated this a bit and it should be pretty easy to add support for it in phps-mode
Hey - it should work now in version 0.4.38
First of all, thanks for creating this package! I've always found
php-mode
to be problematic so I'm glad to see that there's work being done on an improved version!I've encountered a couple of issues so far: -
phps-mode
with Eglot (in Emacs 29) andphpactor
I see Flymake errors from all files in the project, not just the current file.narrow-to-defun
to narrow a PHP source buffer to a single function or method. This does not seem to work inphps-mode
.For reference, I'm using this following to load
phps-mode
: -Here's a screenshot showing the Flymake issue. Note that the referenced issue is from another file and the underlining is specific to that file, not the file loaded into the current buffer.