bmewburn / vscode-intelephense

PHP intellisense for Visual Studio Code
https://intelephense.com
Other
1.63k stars 94 forks source link

Implement HTML class/IDs completions in $() or functions like document.getElementById() #2292

Open Dima-369 opened 2 years ago

Dima-369 commented 2 years ago

[PhpStorm] (https://www.jetbrains.com/phpstorm/) has this nice feature where if you are inside a jQuery function or in other functions where you expect HTML selectors, that completions are offered as shown:

image

image

Would it be possible to implement something like that here?

kanlukasz commented 2 years ago

I am afraid this may be out of scope because this is a JS/CSS case, not PHP.

Maybe the native VSCode option like "editor.wordBasedSuggestionsMode": "allDocuments" could be useful? Have you tried this? Or maybe add-on like SCSS Everywhere or CSS Navigation ?

I'm not sure what your workflow looks like, but in general when working with a JS environment, you shouldn't do it in a PHP file.

Dima-369 commented 2 years ago

I am afraid this may be out of scope because this is a JS/CSS case, not PHP.

Hmm, I thought this is definitely in the scope because the features state: Embedded HTML/JS/CSS code intelligence.. So I thought that all of the CSS constructs (both .css files and inline <style> tags in the workspace) are indexed.

But I am just guessing because there is no access to the source code of the server ;)

So is intelephense only indexing .php files? I thought that it would work like PhpStorm where HTML/JSS/CSS/PHP files are all indexed as well.

Maybe the native VSCode option like "editor.wordBasedSuggestionsMode": "allDocuments" could be useful? Have you tried this? Or maybe add-on like SCSS Everywhere or CSS Navigation ?

That sounds useful, thanks! But I don't use VSCode, I use Emacs, so dabbrev would be the way for me to connect this.

I'm not sure what your workflow looks like, but in general when working with a JS environment, you shouldn't do it in a PHP file.

Well, depending on the PHP framework or certain features, it is vital to use PHP directly inside <script> tags.