Php autocomplete in same function

Hello,

I am new at Komodo and I test it for php now.
But I have a problem now with the autocomplete. Komodo suggests some Variables but not the one in the same function.

E.g. here:

            $sub_categories = array();
	
	foreach($post_types as $post_type) {
		$groups = get_terms( array(
				'taxonomy' => 'vips_groups_'. $post_type,
				'hide_empty' => false,
		) );
		$sub
	}

At $sub I want to have the suggestion of $sub_categories. But I does not come.

Can you please help me.

Thanks

Hi @frischka,

Your code sample appears to work for me in a PHP file so lets see what might be wrong with your setup.

Can you confirm that:

  • you’re working in a PHP file
    • use Ctrl + Shift + N and open a PHP template
  • Code Intel is enabled: Edit menu > Preference > Code intel

Ok, Code Intel is enabled.
And the filename ends with “.php”. So I think it is a php file.

And there are many suggestions of variable names, but not of the variables in this same function.

Here is the complete function:

public function vips_get_app_categories_cb(WP_REST_Request $request) {
$post_types = array(VIPS_ORGANISATION_CPT, VIPS_LOCATION_CPT, VIPS_EVENTS_CPT);
$response = array();

	$global_taxonomies = get_terms( array(
			'taxonomy' => 'vips_global_taxonomy',
			'hide_empty' => false,
	) );
	$sub_taxonomies = array();
	$global_taxonomies_id_index = array();
	$sub_taxonomies_id_index = array();
	
	foreach($post_types as $post_type) {
		$groups = get_terms( array(
				'taxonomy' => 'vips_groups_'. $post_type,
				'hide_empty' => false,
		) );
		$sub_taxonomies[$post_type] = $groups;
	}
	
	foreach($global_taxonomies as $global_taxonomy) {
		$global_taxonomies_id_index[$global_taxonomy->term_id] = $global_taxonomy;
	}
	
	foreach($sub_taxonomies as $key => $sub_taxonomies_by_type) {
		foreach($sub_taxonomies_by_type as $taxonomy) {
			$sub_taxonomies_id_index[$key][$taxonomy->term_id] = $taxonomy;
		}
	}
	
	$taxonomies = array();
	$taxonomies['global_taxonomies'] = $global_taxonomies_id_index;
	$taxonomies['sub_taxonomies'] = $sub_taxonomies_id_index;
	
		
	
	if (isset($global_taxonomies) && count($sub_taxonomies)) {
		$response = array(
				'status' => 'success',
				'posts_data' => $taxonomies,
		);
		
	} else {
		$response = array(
				'status' => 'error',
				'posts_data' => NULL,
		);
	}
	
	return rest_ensure_response( $response );
	
}