This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 120477 - Code completion list should contain php tags <?php <?
Summary: Code completion list should contain php tags <?php <?
Status: RESOLVED FIXED
Alias: None
Product: php
Classification: Unclassified
Component: Editor (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: Victor Vasilyev
URL:
Keywords:
: 122307 (view as bug list)
Depends on:
Blocks: 123437
  Show dependency tree
 
Reported: 2007-10-30 14:53 UTC by kozlov
Modified: 2008-02-04 18:24 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description kozlov 2007-10-30 14:53:36 UTC
Code completion list should contain all supported php tags <?php <? as well as html tags.
Comment 1 Victor Vasilyev 2007-11-14 18:57:10 UTC
Clarification:
--------------

A code completion list should contain proposal(s) for the PHP Opening Tag(s) *only if* it is generated for the scope of
the preprocessed text, i.e. it should be provided for the "foreign scope" that is located outside of any PHP block. 

The PHP module can't serve foreign scopes and its functionality must not have any influences on code completion outside
of the PHP scopes.

Therefore, this issue should be readdressed and propagated to all NB modules that support languages which can be
integrated with PHP, including (but not limited!) SGML family (HTML, XHTML, XML, ...) and so on.

Nevertheless, if it is need then the PHP module might provide some support to create such proposals that can be used by
other modules.

Investigation:
--------------

See http://www.php.net/manual/en/language.basic-syntax.php for more information about tags used to escaping PHP scope.

A set of the tags may depends on both the language of the preprocessed text and the PHP interpreter configuration:

a) the <?php tag can be proposed if the PHP interpreter will be able to recognize it as a start of the PHP code block in
the context of the processed language, otherwise the language can't be used in conjunction with the PHP language.

b) the <script language="php"> tag has the same limitation as a). This tag is not recommended in the PHP Manual.

c) both the <? tag and the <?= tag are only available when they are enabled via the short_open_tag php.ini configuration
file directive, or if php was configured with the --enable-short-tags option.

d) both the <% tag and the <%= tag (i.e. ASP style tags) are only available when they are enabled via the asp_tags
php.ini  configuration file directive.

Therefore, only the <?php tag can be recommended as an universal independent proposal for many of the hypertext related
languages. 
Comment 2 Alexei Mokeev 2007-11-15 14:12:37 UTC
Pavel, you mentioned that we can somehow insert things like <?php into html code completion.
Could you please point us to the how-to or just to the right person ?
Comment 3 Petr Pisl 2008-01-14 10:31:54 UTC
This should be very easy through a code completion provider (from editor api) returns the appropriate items. 
Comment 4 Victor Vasilyev 2008-01-16 19:14:47 UTC
Fixed.

Adding the PHP code block (i.e. "<?php ?>") is enabled at any position inside of any file that is registered in the
NetBeans IDE with the MIME type "text/x-php5". Of course, nesting of the PHP code blocks has been excepted.

Note, the current version of the Plugin for PHP assumes that associations of the file name extensions with the MIME type
"text/x-php5" is recorded in the file <CVSWorkingDir>\php\editing\src\org\netbeans\modules\languages\php\resources\PHP.xml
A user can also change these associations through UI via the Advanced Option dialog (see the item Options/IDE
Configuration/System/File Types/PHP.xml).
Comment 5 Victor Vasilyev 2008-01-22 18:05:26 UTC
*** Issue 122307 has been marked as a duplicate of this issue. ***
Comment 6 Petr Pisl 2008-02-04 09:50:30 UTC
I'm sorry, but I can not see any php delimiter in the html code completion for .php files. I have todays build (20080204).
Comment 7 Victor Vasilyev 2008-02-04 14:49:13 UTC
It was checked again.
Bild: http://bits.netbeans.org/download/trunk/nightly/2008-02-04_01-01-52/
NetBeans Pack All Free, 187 MB
Selected Packs and Runtimes to install: Base IDE, Ruby, PHP
JDK: jdk1.5.0_14
Platform: Windows XP

Resolution:
There is expected behavior for all files associated with with the MIME type "text/x-php5". 

Note, only the following file name extensions are registered for the MIME type "text/x-php5" by default:
<ext name="php"/>
<ext name="php5"/>
<ext name="phtml"/>
<ext name="inc"/>

Therefore, you can't expect CC in html file until association of it with the MIME type "text/x-php5".
Comment 8 Pavel Buzek 2008-02-04 15:51:49 UTC
BTW, Petre, once you are at it do not forget ?> inside php block. Last I checked it was not there either. Thanks.
Comment 9 Victor Vasilyev 2008-02-04 18:24:03 UTC
Pavel, 

there are no any reasons to always(!) see the closing tag inside of PHP blocks. 
It will be visible as noise in the list of proposals.
Moreover, such proposal will generate illegal code, e.g.
<?php
   // inserted tag 
   ?> 
?>

I'll close the issue, because implementation is completely matched with reached agreements.