Gert-dev / php-ide-serenata

Atom IDE package that integrates the Serenata server to provide PHP code assistance
https://serenata.gitlab.io/
Other
275 stars 22 forks source link

Refactoring actions don't work when not using explicit project configuration #492

Open hultberg opened 4 years ago

hultberg commented 4 years ago

I noticed that the intentions package is not working correctly anymore. The keybinding resolver successfully indicate that the intention package was triggered but the menu do not show. I have used the debugger and it stops at https://github.com/steelbrain/intentions/blob/v1.1.5/lib/commands.js#L127 which emits an event to see if the list should open. I'm not saying that this issue has been caused by serenata but the intentions package has not been updated for years and I just wanted to bring attention to this issue.

The following is confirmed from my side:

  1. intentions:show is triggered but stops at the referenced line (see link)
  2. serenata provideIntentions is called and has 11 items on startup.

Can you provide any more hints and tips to debug this issue. The refactoring bit is an important functionality.

$ atom --version
Atom    : 1.41.0
Electron: 4.2.12
Chrome  : 69.0.3497.128
Node    : 10.11.0

$ apm --version
apm  2.4.3
npm  6.12.0
node 12.13.0 x64
atom 1.41.0
python 2.7.17
git 2.23.0
Gert-dev commented 4 years ago

Not to say that there is no problem, but for what it's worth intentions and refactoring functionality is still working here (also Atom 1.41.0). The fact that 11 items are returned sounds promising though.

Have you tried putting a breakpoint inside shouldListShow? Because it's async (promise-based), the debugger may be doing weird things when stepping.

Could it also be some sort of styling issue? You can try opening the developer tools, opening the intentions list, then clicking the developer tools with the mouse (if you touch the keyboard before it, the intentions list will close and disappear), and then search for something like Generate Getter And Setter Pair(s).

hultberg commented 4 years ago

@Gert-dev I have pinned it down to this.getCurrentProjectPhpVersion() returning null which will not activate any intentions from serenata. Turns out my projects .serenata/config.json do not exists, but indexing and navigation still work as intended which is why I suspected the intentions part of serenata was at fault.

Gert-dev commented 4 years ago

That explains why I am not receiving it: I'm using explicit configurations everywhere. If you don't, and since 5.0, no configuration will be passed to Serenata and it will automatically try to configure itself for you to ease starting out, but then the client won't know what PHP version the server guessed.

In other words: this is a bug; if the client doesn't know the configuration, a solution is to just assume the lowest supported PHP version.

A better solution may be to request the determined version from the server, but since refactoring here is eventually going to be replaced by server-side refactoring actions (so other clients can profit from it, too), the former is the least amount of work until that happens.

Thanks for taking the time to track the bug down.