NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
func-own.rel - duplicated in completion list


Joined: 16 Jun 2011
Posts: 31
Reply with quote
Hi all,

i have a problem with this own completion list feature for functions.
I would like to add full sqlsrv_* support to my completion list.
I spent some time to figure out how can i do this and i found this solution (some more documentation about this helpful feature would not be bad, like syntax or so...)
Anyway, i wrote my own func-sqlsrv.rel file and saved it into %appdata%/phped/config/func-sqlsrv.rel
The file loaded correctly when i restart phped - the code completion works and my sqlsrv_* functions and constants now listed,
BUT, every function is double listed, first as constant and secondly as the correct function.
I tried to add the functions directly to the func.rel file but always the same "bug" occurs.

Did i anything wrong? False syntax or so? Or is this a bug?

Here is my file content from func-sqlsrv.rel and a screen of the completion list
Screen: http://postimage.org/image/35uicx0qs
Code:
<?xml version = "1.0" encoding="utf-8" standalone="yes"?>
<root version="1.0">
  <php53>
    <sqlsrv _n="sqlsrvfnc" d="SQLSRV Functions and Constants">
      <fafnc>      
        <sqlsrv_begin_transaction _n="sqlsrv_begin_transaction" d="Begins a database transaction" _vr="bool" _al="resource $conn"/>
        <sqlsrv_cancel _n="sqlsrv_cancel" d="Cancels a statement" _vr="bool" _al="resource $stmt"/>
      </fafnc>
      <fadef>
        <SQLSRV_FETCH_ASSOC _n="SQLSRV_FETCH_ASSOC" _vr="integer" d="Forces sqlsrv_fetch_array() to return an associative array when passed as a parameter."/>       
      </fadef>
    </sqlsrv>   
  </php53>
</root>
View user's profileFind all posts by brainSend private message
Guru master

Joined: 24 Jul 2009
Posts: 737
Reply with quote
Another way of doing this might be to add a PHP file somewhere to your workspace (maybe even a separate project?) which contains stub sqlsrv functions:

Code:
/**
 * Begins a database transaction
 *
 * @param resource $conn
 * @return bool
 */
function sqlsrv_begin_transaction($conn) {
// stub function
}

/**
 * Cancels a statement
 *
 * @param resource $stmt
 * @return bool
 */
function sqlsrv_cancel($stmt) {
// stub function
}


PhpED will then pick that up and use it for code completion, even though your application must not subsequently load that stub file. Might be easier than mucking around with that XML and you may even find a ready-to-go stub file somewhere.
View user's profileFind all posts by plugnplaySend private message


Joined: 16 Jun 2011
Posts: 31
Reply with quote
Thanks for the idea. I know that sort of workspace/project auto completion.
But especially in this case its better to add it directly to the php ed "core" without having extra php files only for auto completion.
Cause this are PHP extension classes/functions/constants like sqlite and so (for example sqlite is in the func.rel) for which completion works perfectly.

I filled my func-sqlsrv.rel now with all existing functions and constants. It works but the duplicate listing slow down my workflow.
I only want to know if that is a bug or a problem in my xml structure.

I write now a support ticket too to get a answer from dev's.
I will write my further experience about that feature in the post.

Greetz
View user's profileFind all posts by brainSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8334
Reply with quote
<sqlsrv _n="sqlsrvfnc" d="SQLSRV Functions and Constants">
^^^^^^
Node names in this file are meaningfull. You can't pick arbitrary ones.
I'd recommend you to create an empty project, add this "stub" file named sqlsrvfnc.php, then quit the IDE, find <project name>.ppx file, open it in an xml editor, find node with full file name listed in _n attribute, then grab the content of this node for your func-sqlsrv.rel file.

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website
func-own.rel - duplicated in completion list
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic