Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 174987

Summary: Auto activation triggers for PHPDoc is not working
Product: z_Archived Reporter: Gadi Goldbarg <gadi>
Component: PDTAssignee: Michael Spector <spektom>
Status: CLOSED FIXED QA Contact: Yossi Luson <yossi.l>
Severity: normal    
Priority: P3 CC: spektom
Version: unspecifiedKeywords: plan
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Gadi Goldbarg CLA 2007-02-21 11:50:21 EST
go to Window-> Prefrences -> Editor -> Code Assist -> Auto-Activation
change the Auto activation triggers for PHPDoc value from '@' to '#' or any 
other char 
go to editor and add phpdoc 
within the phpdoc add # char and hit Ctrl+Space for code complition 

no code complition/ list of values are aviliable 

code for testing:
<?php
/***************************************************************************
 *                               functions.php
 *                            -------------------
 *   begin                : Saturday, Feb 13, 2001
 *   copyright            : (C) 2001 The phpBB Group
 *   email                : support@phpbb.com
 *
 *   $Id: functions.php,v 1.133.2.34 2005/02/21 18:37:33 acydburn Exp $
 *
 *
 ***************************************************************************/

/***************************************************************************
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 *
 ***************************************************************************/

function get_db_stat($mode)
{
	global $db;

	switch( $mode )
	{
		case 'usercount':
			$sql = "SELECT COUNT(user_id) AS total
				FROM " . USERS_TABLE . "
				WHERE user_id <> " . ANONYMOUS;
			break;

		case 'newestuser':
			$sql = "SELECT user_id, username
				FROM " . USERS_TABLE . "
				WHERE user_id <> " . ANONYMOUS . "
				ORDER BY user_id DESC
				LIMIT 1";
			break;

		case 'postcount':
		case 'topiccount':
			$sql = "SELECT SUM(forum_topics) AS topic_total, SUM(forum_posts) AS 
post_total
				FROM " . FORUMS_TABLE;
			break;
	}

	if ( !($result = $db->sql_query($sql)) )
	{
		return false;
	}

	$row = $db->sql_fetchrow($result);

	switch ( $mode )
	{
		case 'usercount':
			return $row['total'];
			break;
		case 'newestuser':
			return $row;
			break;
		case 'postcount':
			return $row['post_total'];
			break;
		case 'topiccount':
			return $row['topic_total'];
			break;
	}

	return false;
}

// added at phpBB 2.0.11 to properly format the username
function phpbb_clean_username($username)
{
	$username = substr(htmlspecialchars(str_replace("\'", "'", trim($username))), 
0, 25);
	$username = phpbb_rtrim($username, "\\");	
	$username = str_replace("'", "\'", $username);

	return $username;
}

// added at phpBB 2.0.12 to fix a bug in PHP 4.3.10 (only supporting charlist 
in php >= 4.1.0)
function phpbb_rtrim($str, $charlist = false)
{
	if ($charlist === false)
	{
		return rtrim($str);
	}
	
	$php_version = explode('.', PHP_VERSION);

	// php version < 4.1.0
	if ((int) $php_version[0] < 4 || ((int) $php_version[0] == 4 && (int) 
$php_version[1] < 1))
	{
		while ($str{strlen($str)-1} == $charlist)
		{
			$str = substr($str, 0, strlen($str)-1);
		}
	}
	else
	{
		$str = rtrim($str, $charlist);
	}

	return $str;
}

//
// Get Userdata, $user can be username or user_id. If force_str is true, the 
username will be forced.
//
function get_userdata($user, $force_str = false)
{
	global $db;

	if (intval($user) == 0 || $force_str)
	{
		$user = phpbb_clean_username($user);
	}
	else
	{
		$user = intval($user);
	}

	$sql = "SELECT *
		FROM " . USERS_TABLE . " 
		WHERE ";
	$sql .= ( ( is_integer($user) ) ? "user_id = $user" : "username = '" .  $user 
. "'" ) . " AND user_id <> " . ANONYMOUS;
	if ( !($result = $db->sql_query($sql)) )
	{
		message_die(GENERAL_ERROR, 'Tried obtaining data for a non-existent user', 
'', __LINE__, __FILE__, $sql);
	}

	return ( $row = $db->sql_fetchrow($result) ) ? $row : false;
}

?>
Comment 1 Michael Spector CLA 2007-02-28 15:41:49 EST
(In reply to comment #0)

What completion suggestions do you expect to receive, when you press '#' in a PHPdoc section?
Comment 2 Gadi Goldbarg CLA 2007-04-30 07:22:36 EDT
use the following code
in the PHPDoc section set focus next to the '#' and do a Ctrl+spcae ( nothing 
happens)

/**
 * Enter description here...
 *#
 */
function ArrayObject()
{
	echo "nothing";
}
Comment 3 Gadi Goldbarg CLA 2007-04-30 07:27:24 EDT
Yossi, can you advise here..
why are we allowing changes to Auto activation for PHPDoc if @ is the only char 
that has related elements 
for example changing the Auto activation char to # will not trigger any auto 
completion
Comment 4 Michael Spector CLA 2007-07-01 09:23:48 EDT
Auto-activation characters are not relevant anymore.
Comment 5 Gadi Goldbarg CLA 2007-07-10 06:58:18 EDT
Looks like its still relevant for PDT
Comment 6 Michael Spector CLA 2007-07-23 07:27:25 EDT
Auto activation characters is a directive for code assistant to show completion suitable to the CURRENT CONTEXT when specific character is typed.

For example, if you have a '>' character in auto-activation characters set, AND you are typing this character, while the cursor is standing after the "$obj-", AND!!! $obj refers to the object which has something (methods, fields, etc...) - you'll get completion. Trying to get a completion from "#" while standing in a PHPDoc section is not a good idea - there's nothing to show! PHPDoc tags are starting only from "@" character.

Since there's only one character that can be used as an activation trigger in PHPDoc (@) - this field will be disabled in the preference page.
Comment 7 Gadi Goldbarg CLA 2007-07-25 11:54:07 EDT
closed