• Login
Community
  • Login

How Notepad++ selects autocomplete?

Scheduled Pinned Locked Moved Notepad++ & Plugin Development
17 Posts 3 Posters 3.4k 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.
  • G
    gusztavj @PeterJones
    last edited by May 28, 2021, 5:54 PM

    @PeterJones, this is what I found: autocomplete does not work if the language, as defined in the UDL file, contains keywords with a hyphen in it. The actually weird language for what I wanted to create an autocomplete file includes lot of keywords of this kind, such as “category-keyword”. For these, no autocomplete tip will pop up. Even worse, the values of these so-called tags are followed by a space, so a line of the file looks like this:

    category-keyword “value”
    or
    position 0, 1, 0

    Now it would be okay to type a ( character after a tag name to display the hint, but the hyphen makes this language incompatible with the auto-complete logic. :(

    Anyway, thanks a lot for your efforts in explaining this whole situation.

    M 1 Reply Last reply May 28, 2021, 5:58 PM Reply Quote 1
    • M
      Michael Vincent @gusztavj
      last edited by May 28, 2021, 5:58 PM

      @gusztavj said in How Notepad++ selects autocomplete?:

      autocomplete does not work if the language, as defined in the UDL file, contains keywords with a hyphen in it.

      That should be an easy fix. In the autoCompletion\weirdAl.xml file, add the additionalWordChars="-" parameter like so:

      <?xml version="1.0" encoding="UTF-8" ?>
      <NotepadPlus>
              <AutoComplete language="weirdAl">
                      <Environment ignoreCase="no" .....   additionalWordChars="-"/>
                      <KeyWord name=" ...
      

      I have an autoCompletion file for Powerwhell and most Powershell commands are Verb-Thing (e.g., Write-Host, Get-Item) so I include the additionalWordChars="-" and it works for me.

      Cheers.

      G 1 Reply Last reply May 29, 2021, 11:13 AM Reply Quote 4
      • G
        gusztavj @Michael Vincent
        last edited by May 29, 2021, 11:13 AM

        @Michael-Vincent said in How Notepad++ selects autocomplete?:

        That should be an easy fix.

        I wish it were! :) First, thanks for mentioning this attribute. I took a look at the source code, but did not recognized it. But unfortunately it still does not work for me. Here is my piece of code, the AC file:

        <?xml version="1.0" encoding="UTF-8" ?>
        <NotepadPlus>
            <AutoComplete language="weirdAl">
                <Environment ignoreCase="yes" startFunc="(" stopFunc=")" paramSeparator="," terminal=";" additionalWordChars="-"/>
        	<KeyWord name="grapefruit-diet" func="yes">
                  <Overload retVal="" descr="drink grapefruit juice only">
                    <Param name="SeedlessStuff" />
                  </Overload>
                  <Overload retVal="" descr="drink grapefruit only">
        	    <Param name="Shapes" />
        	    <Param name="Seasons" />
                  </Overload>
        	</KeyWord>
        	<KeyWord name="position" func="yes">
                  <Overload retVal="" descr="elements's position">
                    <Param name="on x axis" />
                    <Param name="on y axis" />
                    <Param name="on z axis" />
                  </Overload>
        	</KeyWord>		
        	<KeyWord name="grapefruitDiet" func="yes">
        	  <Overload retVal="" descr="eat grapefruit only">
        	    <Param name="Seedless" />
        	  </Overload>
        	  <Overload retVal="" descr="eat grapefruit only">
        	    <Param name="Shape" />
        	    <Param name="Season" />
        	  </Overload>
        	</KeyWord>
            </AutoComplete>
        </NotepadPlus>
        

        It works for grapefruitDiet and position, but doesn’t offer anything for grapefruit-diet.

        Am I overlooking something?

        Cheers.
        Gus

        M 1 Reply Last reply May 29, 2021, 11:29 AM Reply Quote 0
        • G
          gusztavj
          last edited by May 29, 2021, 11:18 AM

          A small clarification: it offers the name grapefruit-diet, but does not show the overloads, so nothing appears after typing the bracket, pressing CTRL+SPACE or CTRL+SHIFT+SPACE.

          1 Reply Last reply Reply Quote 0
          • M
            Michael Vincent @gusztavj
            last edited by May 29, 2021, 11:29 AM

            @gusztavj said in How Notepad++ selects autocomplete?:

            Am I overlooking something?

            Looks good, but I thought keywords needed to be in alphabetical order?

            Cheers.

            G 1 Reply Last reply May 29, 2021, 12:09 PM Reply Quote 0
            • G
              gusztavj @Michael Vincent
              last edited by May 29, 2021, 12:09 PM

              @Michael-Vincent , tried to move them around, to place grapefruitDiet before grapefruit-diet and the other way around, but with no effect. grapefruitDiet is always recognized, the other is never recognized. :( Became clueless again. Yet, thanks for your help and tips.

              1 Reply Last reply Reply Quote 1
              • G
                gusztavj
                last edited by May 29, 2021, 3:44 PM

                And finally… I did not find the documentation page at https://npp-user-manual.org/docs/auto-completion/ , only a link to a non-existing page. Now that I know the AC file needs to be named after the language name, life is much happier… :D

                Thanks for all your great help!

                P 1 Reply Last reply May 29, 2021, 4:58 PM Reply Quote 0
                • P
                  PeterJones @gusztavj
                  last edited by May 29, 2021, 4:58 PM

                  @gusztavj said in How Notepad++ selects autocomplete?:

                  And finally… I did not find the documentation page at https://npp-user-manual.org/docs/auto-completion/ , only a link to a non-existing page.

                  That page exists (I even just checked using your exact link). Maybe you encountered a brief time when there was a server problem…

                  G 1 Reply Last reply May 29, 2021, 5:52 PM Reply Quote 0
                  • G
                    gusztavj @PeterJones
                    last edited by May 29, 2021, 5:52 PM

                    @PeterJones Yes, it works, but beforehand I found a different link that was not working. :)

                    1 Reply Last reply Reply Quote 0
                    • G
                      gusztavj
                      last edited by May 29, 2021, 6:01 PM

                      @PeterJones and @Michael-Vincent, would you mind if I summon you to see a new post of mine to see if you have an idea for another autocomplete issue? It’s different from this one and I did not want to mess up this thread with a different issue.

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