Community
    • Login

    Custom static function with parameter hints.

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    3 Posts 2 Posters 600 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Martijn WieringaM
      Martijn Wieringa
      last edited by

      I’m trying to add some custom functions to the php.xml file so parameter hints can be available.
      With normal functions it works fine:

      <KeyWord name=“myFunction” func=“yes”>
      <Overload retVal=“string”>
      <Param name=“string sValue”/>
      <Param name=“bool bValue”/>
      </Overload>
      </KeyWord>

      if i type “myFunction(” in a php file, the parameter hints show up perfectly.

      But when i add a static function:

      <KeyWord name=“myClass::myStaticFunction” func=“yes”>
      <Overload retVal=“string”>
      <Param name=“string sValue”/>
      <Param name=“bool bValue”/>
      </Overload>
      </KeyWord>

      It doesnt seem to work. I expected when i type “myClass::myStaticFunction(” parameter hints would show up… but they dont. Howcome?

      1 Reply Last reply Reply Quote 0
      • PeterJonesP
        PeterJones
        last edited by

        @Martijn-Wieringa said:

        they don’t. How come?

        I believe it’s because :: are not “word characters”. The Settings > Preferences > Delimiters is supposed to allow you to specify extra characters, but it doesn’t always work right. (I just tried in this case, but couldn’t get it to work.)

        It also might mess up the sorting: I know that when I was looking at the new copy of the auto-completion documentation, I learned that you must properly sort the <KeyWord> tags, otherwise they will not be recognized. But even when sorted correctly (as far as I could tell), I couldn’t get it to work with :: in it.

        Not tested, but you might want to try having a non-function auto-complete entry for the full <KeyWord name="myClass::myStaticFunction" />, and then a yes-function entry for the name="myStaticFunction" with the complete overload/param definition. I don’t know if it will work, but it’s worth a try. Or just not include the myClass:: prefix at all (or make the non-function entry just be myClass::, and the full definition the yes-function version. (If your reason for not wanting to do that was that different classes uses different parameter lists for the same function, you may be able to use multiple <Overload> tags for the same function.

        1 Reply Last reply Reply Quote 2
        • Martijn WieringaM
          Martijn Wieringa
          last edited by

          @PeterJones

          I thought it had something to do with ::
          Based on your info, i now use this workaround:

          <KeyWord name=“myStaticFunction” func=“yes”>
          <Overload retVal=“myClass | string”>
          <Param name=“string sValue”/>
          <Param name=“bool bSort”/>
          </Overload>
          <Overload retVal=“myClass2 | string”>
          <Param name=“string sValue”/>
          <Param name=“bool bSort”/>
          </Overload>
          <Overload retVal=“myClass3 | array”>
          <Param name=“string sValue”/>
          <Param name=“bool bSort”/>
          </Overload>
          </KeyWord>

          I’ve added "myClassName | " before each return value so i can easily find the parameter list i need for given class…
          it’s not as perfect as it could/should be, but it will work for now. Hopefully they’ll make a fix in the future ;)

          Thanks for your help!

          1 Reply Last reply Reply Quote 2
          • First post
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors