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 19 forks source link

Many diagnostic messages disappeared #481

Closed ameenross closed 4 years ago

ameenross commented 4 years ago

After the upgrade to 5.0.0 I noticed that missing/incomplete docblocks are no longer highlighted, unused classes idem, possibly other things... Do I need to add something to the config.json to get this back? Is it a bug? Or was the functionality simply removed? It wasn't mentioned in the changelog, so I have to ask.

Gert-dev commented 4 years ago

It was indeed removed. You may have been looking at the wrong changelog, as this package doesn't do any linting of its own; it's handled by the Serenata server instead.

Semantic linting in Serenata has been deprecated since 4.3 about a year ago (it was mentioned in the release notes of 4.3 and again in the release notes of 5.0.0-RC). The reasoning is explained here.

To summarize, look towards using tools such as PHPStan, Phan, Psalm or others, as they do a much better job than Serenata ever did.

ameenross commented 4 years ago

Well, since this package provides functionality that happens to be provided technically by the Serenata server, and I probably won't be the only person to run into it, I figured it made sense to ask the question here. I had a look at Serenata server but couldn't find it fast enough - I didn't even realize that php-ide-serenata 5.0 required a new major version of Serenata server.

I had a look at PHPStan, and while it's great to add to your toolchain and builds, I'm still losing the functionality that I had in Atom directly. To try and compensate, I installed atom-linter-phpstan, but it requires linter which conflicts with atom-ide-diagnostics, and it has more issues that prevent it from being used effectively.

ameenross commented 4 years ago

Is the following also broken? I was expecting autocomplete results, but nothing happens.

/** @var Some\Service $service */
$service = $container->get('some.service');

Also, class name autocompletion is not working.

Gert-dev commented 4 years ago

Regarding the linter requirement, you can just ignore it - the API provided by atom-ide-diagnostics is the same. Packages that require linter should also work with atom-ide-ui and the other way around.

Some packages put a hard dependency on linter, though, so they may not run if you don't install it; you can always disable it afterwards, if you don't want it. (This is not ideal, there is a need for a way to require services in packages, but there currently isn't a solution for that in Atom yet. Steelbrain provided a decent stopgap by allowing dependencies on other packages.)

Once you get past that, you should be able to enjoy PHPStan. It has pretty much everything Serenata linted and much more, so I think (hope) you will be most satisfied with it :smile: .

For your last post, this should be working as before. There is a bug in 5.0.0 in that it does not index built-in classes anymore (it does index your codebase's classes though). This is already fixed upstream and is scheduled to be fixed in 5.0.1.

ameenross commented 4 years ago

Thanks for the advice. Seems like the situation for phpstan is unsalvageable though. It crashes when a file doesn't lint (php -l), which makes it too fragile for using while editing. Phan seems to be a great option though, but linter-phan is outdated and requires Phan 1.x.x and linter 1.x.x. Also, I'm not sure if I should disable the messages from php-ide-serenata, but some messages are of course duplicated (2 packages reporting the same problem). Another possibility is disabling certain messages from Phan manually via config, however that sounds like it can be a lot of work.

For now, this is costing me too much time to keep my production environment up to standard. I'll downgrade and see how I can resolve the situation later.

Gert-dev commented 4 years ago

Alright.

I don't experience a lot of problems with PHPStan being fragile whilst editing, but I think it may indeed be the case that it's mainly intended to work with syntactically valid code. I think it's set to work on save only here, currently. As I save often, I continuously see the errors (but it's of course still noticeable that it isn't on-the-fly).

The only messages that Serenata still sends are currently syntax-related issues that are the result of php-parser problems. If you are already using a linter showing errors from php -l, you're pretty much already covered.