Community
    • Login

    Autocompletion and spaces

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    7 Posts 5 Posters 1.6k 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.
    • RaphaelR
      Raphael
      last edited by

      Hello,
      I’m writing an autocompletion xml file for a User Defined Language and I have an issue with multiple words keywords.
      For instance “Pointer on integer” -> the autocompletion shows “Pointer”, “on”, “integer”.
      How can I use it as one and only keyword ?

      thanks a lot !

      1 Reply Last reply Reply Quote 2
      • AZJIO AZJIOA
        AZJIO AZJIO
        last edited by

        I could not achieve this. I went another way. Use non-breaking space 160. Make a macro that replaces the non-breaking space with a regular space (160 by 32). Among other things, you can use line breaks, that is, insert multi-line text using mnemonic.
        “If&# xa0;$Trg&# xa0;Then&# x0d;&# x0a;&# x09;&# x0d;&# x0a;EndIf”
        Remove the spaces, I added them to show the code as is

        Add a hot key to the macro and after inserting auto-completion, press the hotkey.
        There is another option - use version 6.5.3. The last, which allowed the space.

        1 Reply Last reply Reply Quote 3
        • RaphaelR
          Raphael
          last edited by

          Hey, thanks for answering. I cannot find-out how ti insert the non-breaking space in the xml file.
          If I do <KeyWord name=“pointer&nbsp;on” /> , the autocompletion returns “pointer&#160;on”

          However, it works if I insert &quot , why it doesn’t work for the &nbsp or &#160 ?

          1 Reply Last reply Reply Quote 0
          • Adriano ElleroA
            Adriano Ellero
            last edited by

            hi can you also complete an entire string like this? <KeyWord name="rect x=“0” y=“0” "/ >

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

              Not that @Raphael is around any more, but since @Adriano-Ellero re-vivified this thread:

              @Adriano-Ellero’s question, which is a duplicate of the OP here, was asked again in a new thread, and I answered that specific one there – with an answer that contained the essentials from @AZJIO-AZJIO’s answer in this thread.

              @Raphael’s question, as to why &quot worked but &nbsp didn’t: As I’ve seen before (and confirmed on Wikipedia), XML only has a limited subset of named entities, including quot, amp, apos, lt, gt; in XML, anything else needs to be entified in either numeric &#nnnn; or hexadecimal &#xhhhh; entity-notation, or needs the entity name defined in the DTD. HTML, on the other hand, has hundreds of named entities, including nbsp. Since the autoCompletion XML files are written in XML, they are limited to XML syntax for entities.

              However, as @Raphael pointed out, &#160; appears to not work in the autoCompletion file – if my autoCompletion file has

                      <KeyWord name="rect&#xa0;x=0&#xa0;y=0" />
                      <KeyWord name="rect160&#160;x=0&#160;y=0" />
              

              … then the first properly auto-expands to rect x=0 y=0, where the space-like characters are non-breaking spaces (NBSP). But the second expands to rect160&#160;x=0&#160;y=0. That seems to be a bug in the way that Notepad++'s autoCompletion parses the XML (either that, or the Wiki article is wrong that XML can handle &#nnnn; entity notation; I am not an XML expert, so do not know).

              1 Reply Last reply Reply Quote 2
              • Adriano ElleroA
                Adriano Ellero
                last edited by

                wow   it worked even with quoted text i.e. <rect x=‘0’ y=‘0’ />

                thanks @PeterJones
                thenks @Raphael

                Unfortunately the final result is that a special character ( ) that is invisible and seems to be an empty space is transferred into my code file and the html style is not able to recognize the entire string as a tag.

                To solve this in the end i have to cancel by hand the invisible   and replace it with a “Normal” empty space.

                Still not ideal solution.

                Once again thanks for the huge effort. Really appreciated. Great community.

                Alan KilbornA 1 Reply Last reply Reply Quote 0
                • Alan KilbornA
                  Alan Kilborn @Adriano Ellero
                  last edited by

                  @Adriano-Ellero said:

                  To solve this in the end i have to cancel by hand the invisible   and replace it with a “Normal” empty space.

                  Seems like you could make that part as painless as possible by recording a macro of the replacement and tying that macro’s execution to a convenient keycombination.

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