vscode icon indicating copy to clipboard operation
vscode copied to clipboard

[php] Provide html intellisense

Open ghost opened this issue 11 years ago • 234 comments

In PHP files there is no html tags auto completion, please add.


EDIT 9/13/2018 @egamma: VS Code provides only basic support for PHP, but there are powerful PHP extensions available in the market place:

This feature should be provided by these extensions (Intelephence actually already does support it). Please give these extensions a try and help to make them better by filing issues and pull requests.

This issue has lost focus and turned into a discussion whether VS Code should provide PHP support out of box. However, as with many other language like C#, C++, Go, Python, Rust we do not want to bundle PHP with VS Code but rather rely on our great extension ecosystem. I´m therefore closing this issue.

ghost avatar Nov 25 '15 22:11 ghost

Sounds reasonable. The HTML tag intellisense providers are located here, it might just be a matter of hooking that module up to the PHP code. Also insuring they are only available when outside <?php tags, if I remember how PHP works correctly.

Tyriar avatar Nov 26 '15 01:11 Tyriar

@Tyriar outside <?php tags means what? Are they availabe when outside <?php ?> tags in PHP files?

ghost avatar Nov 26 '15 08:11 ghost

Outside <?php ?> is HTML, inside is PHP. So the HTML auto complete should only be available outside the <?php ?> tags.

Tyriar avatar Nov 26 '15 09:11 Tyriar

@Tyriar But now they are not available outside the <?php ?> tags in .php files, maybe they are only available in .html files.

ghost avatar Nov 26 '15 09:11 ghost

Please add this feature quickly, I think it's a basic feature, thank you guys.

osjn avatar Dec 07 '15 23:12 osjn

@osjn thanks for helping us with the prioritization by commenting. An even better way to help us would be a Pull Request with an implementation.

egamma avatar Dec 08 '15 11:12 egamma

Maybe it is just me, but I think it would be cool if intellisense was available inside of php strings as well.

TheColorRed avatar Mar 04 '16 17:03 TheColorRed

An upvote from me too. This feature is needed, please.

frankmuts avatar Mar 09 '16 13:03 frankmuts

Almost every PHP developer will need this feature in order to pick VSCode as their primary editor.

We need this issue to be fixed in order to target more developers.

Yesterday I tried bumping my head against this problem but unfortunately my lack of TypeScript skills are holding me back to help you on this issue.

ghost avatar Apr 19 '16 06:04 ghost

I need this!

KngHawkon avatar Apr 29 '16 23:04 KngHawkon

Same. Simply +1000

Cocotteseb avatar Apr 29 '16 23:04 Cocotteseb

I'm unable to help, but another +1000 from me. HTML/CSS/JS in PHP is common as a mixed file. I've tried full Visual Studio + VS.php - also not supported. I keep wondering why is this overlooked in every Microsoft development tool that supposedly supports PHP. Yes, PHP support is there, but is useless if we don't have IntelliSense (code completition & code suggestions) for HTML/CSS/JS as well.

Same goes for JS blocks & inline CSS in HTML. If I define in settings.json: "files.associations": {"*.php": "html"}, ... than PHP IntelliSense (obviously) does not work, and HTML kicks in. But inline-CSS by using style=" ...something... "; does not offer any CSS properties when writing in between quotes of style attribute. Likewise, if I start a <script> block, you won't get IntelliSense for JS, while opening .js file reacts normally.

I do support suggestion that (if it's easier):

  • <?php ... ?> should start the PHP IntelliSense
  • outside <?php ... ?> should start HTML IntelliSense but also
  • inside <style> ... </style> and style=" .... " should start CSS IntelliSense
  • inside <script ... > and <script> ... </script> should start JS IntelliSense

Also, if possible, a suggestion by @TheColorRed should be considered, meaning if you are inside <?php ... ?> but are writing a string eg $string="..." than it should consider turning HTML IntelliSense as well. Thing is, PHP devs often use something like: <?php $something="test"; echo "<div><a href="http://sample.com">This is a ".$something."</a></div>"; $continue = "coding here ... etc"; ?> .. to avoid doing blocks with opening/closing php tags all the time, like: <?php $something="test"; ?> <div> <a href="http://sample.com">This is a <?php echo $something; ?></a> </div> <?php $continue = "coding here ... etc"; ?>

Also @egamma , while we don't mean to sound ungrateful or lazy, smug comments don't do much help either, if one of us was competent and knowledgeable enough to code it ourselves - I'm sure we'd do it. Unfortunately - I am not :-/ But if I can help in any other way I'd be glad to (not just by commenting with suggestions, but testing, or whatever).

I hope that there IS a consensus that this feature should exist, and that current PHP support without it is only a partial support for the most PHP devs.

P.S. And again, not to sound as a critic - I really like VS Code so far, and am most thankful to everyone that contributed and keep contributing to this wonderful project!

EDIT: Would simply including/referencing one .ts file to another work? E.g. in /languages/php/common/php.ts include: /languages/html/common/html.ts include: /languages/css/common/css.ts include: ...

While there could be some overlap with the tag/attribute/function names nothing comes to my mind at the moment... And for IntelliSense it's non-issue I think as each would have different icon, only color coding could be messed in such cases... Am I missing something else?

luxzg avatar May 05 '16 09:05 luxzg

if this is not getting added, then i have to switch editor, right now i use 2 editors...

Zeanix avatar May 17 '16 06:05 Zeanix

Please, how can I deactivate de HTML IntelliSense when I'm working with a PHP?

This option is a nightmare, because I can't tab in a variable because automatically create a XML/HTML tag.

I don't mix my PHP code with the HTML, and I will not make this error ever, please, at least add the option to deactivate it in PHP "mode".

mrqtsfr avatar May 17 '16 09:05 mrqtsfr

For PHP you should try crane intellisense https://marketplace.visualstudio.com/items?itemName=HvyIndustries.crane

TheColorRed avatar May 17 '16 13:05 TheColorRed

@TheColorRed Crane Intellisense has the problem. It's by far the most popular VS Code PHP extension, so I guess this is what most people are reporting their problem with.

FieldMarshallVague avatar Jun 14 '16 17:06 FieldMarshallVague

I've just tried vscode but lacking of this feature just stop me using this IDE. Please provide this feature as it a must have feature for every IDE. Thank you in advanced.

thanhhungtn1 avatar Jul 17 '16 11:07 thanhhungtn1

This is very needed. It's incredibly annoying not getting proper intellisense when putting either php code inside a html file, or putting html in a php file.

stevemk14ebr avatar Aug 04 '16 00:08 stevemk14ebr

One big feature i'm missing and its preventing me and colleagues to use vsCode as out main editor.

Egahras avatar Aug 25 '16 12:08 Egahras

This is a deal killer for me without this very common feature. Shame though...I REALLY, REALLY, REALLY love this IDE. If this is added, I will be so happy.

sabuzard avatar Aug 31 '16 22:08 sabuzard