More IDE-like features for PHP #351
Replies: 4 comments 4 replies
|
EDIT: I ended up publishing So this sort of thing is the purview of a language server. Any package that starts with I have not yet made a The best language server for PHP — the one that is used most often by VS Code users — is Intelephense. Somewhat unusually for language servers, it has a “freemium” model: about half the features you get for free and the other half you have to pay a one-time fee to use. I could wire up this language server into a package, but the feature you're asking for might cost you $35 USD. Here's why: A language server will not edit your document without some sort of invoking action. It won't simply happen as you type. The feature you want exists in theory, but it is typically triggered one of two ways:
I say might because it's hard to tell just from the feature matrix whether this specific feature exists — and, if so, which category it falls under. They say you get “autocompletion” and “diagnostics” for free… but then an add-this-import action could also fall under “code actions,” which are a premium feature. Whether you pay the $35 or not, Intelephense is probably worth having; best of all, it's not actually written in PHP (which — no disrespect — is not really optimized for this task). I don't remember which PHP language server I tried to integrate last time… except I remember it was written in PHP, so it must not have been Intelephense. I'll see about turning this into a |
|
I'm... almost speechless. I post a question about a possible "nice to have" and less than a day later there's a brand new package waiting for me to try. Seems I prompted you to create something you've been meaning to for a while, but even so. I had Intelephense on Zed but it was presumably the free version so I didn't connect the dots about this specific functionality (I wasn't aware there was a premium version). Sincere thanks for this. I will review the package documentation page, install and use the free version, and once I'm used to how it works, I'll probably pay the $35, seeing as it's a one-off (within current major version) and could be a big quality-of-life improvement. I'll come back with issues if I find any. Thanks again 😎 (and well done on the new terminal integration by the way - it sealed the deal for Pulsar becoming my daily driver) |
|
Unfortunately I can't get it to activate... here's the link to the issue I've raised. |
|
It's all now working very well as far as I can see. I'll consider the Intelephense license to get the extras but it's already good, and I can now finally uninstall Zed. Thanks again. |
Uh oh!
There was an error while loading. Please reload this page.
I believe that some IDEs (e.g. Eclipse) have a feature (sorry, I don't know what it's called), whereby if you add a class method call in your code, the IDE will check your project and add the correct "use" statements at the top of your file, so that you can use the method without namespacing it each time.
Is this something Pulsar would consider to be within its remit, or maybe there's a package that does this? I'm thinking mainly about PHP since that's my main language.
As a very simple example, let's say I have a WordPress site open in Pulsar because I'm developing a custom plugin. In my plugin folder I have my composer files and vendor folder, and I'm using the "directorytree/imapengine" composer package.
If I add something like
$mailbox = new Mailbox($imap_credentials);it would be great if a Pulsar package (having indexed my project's code) could add to the top of my file:
use DirectoryTree\ImapEngine\Mailbox;And if I then add this code:
it would also add:
I think that illustrates what I'm after.
This may be way beyond what an editor like Pulsar can or should be doing. Alternatively, someone may have built a package to do it and I just need to know what it's called!
All reactions