• Login
Community
  • Login

Custom AutoComplete file for XML language

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
13 Posts 5 Posters 11.3k 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.
  • D
    David Teruel Ledesma
    last edited by Dec 1, 2016, 2:15 PM

    The APIs xml files are very useful for create your custom keywords in any language.

    The problem I see is with the XML language. I cannot find the way to define which parameters can have an specific tag.

    Anyone knows if this is possible?

    Thanks!

    i.e:
    <my_function param1=“” param2=“” />

    I expect have something like this in the xml.xml file:

    	<KeyWord name="my_function" func="yes">
           <Overload>
               <Param name="param1" />
               <Param name="param" />
           </Overload>
    	</KeyWord>
    
    1 Reply Last reply Reply Quote 0
    • J
      Jim Dailey
      last edited by Dec 1, 2016, 4:18 PM

      The APIs XML files only describe functions in general terms. There is no ability to force or error check values as you enter text.

      You can always use the descr part of the overload to describe anything about the function you want, for example that Param1 can only have certain values. Here is an example:

      <KeyWord name="ARShiftU64" func="yes">
      <Overload retVal="UINT64" descr="
      INCLUDE: MdePkg/Include/Library/BaseLib.h
      
      Shifts a 64-bit integer right between 0 and 63 bits. The high bits are filled
      with original integer's bit 63. The shifted value is returned.
      
      This function shifts the 64-bit value Operand to the right by Count bits. The
      high Count bits are set to bit 63 of Operand.  The shifted value is returned.
      
      RETURNS:
      Operand >> Count
      
      PARAMETERS:
      Operand - The 64-bit operand to shift right.
      Count   - The number of bits to shift right.
      ">
      <Param name="IN UINT64 Operand" />
      <Param name="IN UINTN Count" />
      </Overload>
      </KeyWord>
      
      1 Reply Last reply Reply Quote 0
      • C
        Cronos Umbra
        last edited by Jan 9, 2017, 2:40 PM

        Sorry, I do not speak English. I’m having trouble modifying / creating my.xml in the APIs folder. It does not load and does absolutely nothing, even copying the site’s exeplo.

        Can anyone help me with this, I’m almost giving up using notepad ++, a tutorial on how to make it work …

        http://docs.notepad-plus-plus.org/index.php/Auto_Completion

        C:\Program Files (x86)\Notepad++\plugins\APIs\my.xml

        <?xml version=“1.0” encoding=“Windows-1252” ?>
        <NotepadPlus>
        <AutoComplete language=“C++”>
        <Environment ignoreCase=“no” startFunc=“(” stopFunc=“)” paramSeparator=“,” terminal=“;” additionalWordChar = “.”/>
        <KeyWord name=“abs” func=“yes”>
        <Overload retVal=“int” descr=“Returns absolute value of given integer”>
        <Param name=“int number” />
        </Overload>
        </KeyWord>
        </AutoComplete>
        </NotepadPlus>

        The program does not carry this, it does not indicate, it does not show, absolutely nothing.

        1 Reply Last reply Reply Quote 0
        • J
          Jim Dailey
          last edited by Jan 9, 2017, 4:44 PM

          @Cronos-Umbra
          You post looks like it includes some double quotation marks that are not in the ASCII character set. That may be the problem. Try this instead:

          <?xml version="1.0" encoding="Windows-1252" ?>
          <NotepadPlus>
          <AutoComplete language="C++">
          <Environment ignoreCase="no" startFunc="(" stopFunc=")" paramSeparator="," terminal=";" additionalWordChar = "."/>
          <KeyWord name="abs" func="yes">
          <Overload retVal="int" descr="Returns absolute value of given integer">
          <Param name="int number" />
          </Overload>
          </KeyWord>
          </AutoComplete>
          </NotepadPlus>
          
          1 Reply Last reply Reply Quote 0
          • C
            Cronos Umbra
            last edited by Cronos Umbra Jan 9, 2017, 5:48 PM Jan 9, 2017, 5:46 PM

            Did not work.

            I add a new XML with this content.
            C:\Program Files (x86)\Notepad++\plugins\APIs\my.xml

            The tool does not display in the list of languages.

            Can someone help me?

            I’m wanting to stop using noteped ++
            Is there a plugin that will help me with autocomplete?

            C 1 Reply Last reply Jan 9, 2017, 6:39 PM Reply Quote 0
            • C
              Claudia Frank @Cronos Umbra
              last edited by Jan 9, 2017, 6:39 PM

              @Cronos-Umbra

              do yu really have a language called my?
              C:\Program Files (x86)\Notepad++\plugins\APIs\ my.xml

              The xml name needs to match the language otherwise npp can’t know which xml needs to be loaded.

              Cheers
              Claudia

              1 Reply Last reply Reply Quote 0
              • C
                Cronos Umbra
                last edited by Jan 9, 2017, 7:01 PM

                @Claudia-Frank said:

                O nome xml precisa corresponder ao idioma, caso contrário o npp não pode saber qual xml precisa ser carregado.

                I want to create an XML to be able to configure any format.

                That would be the content.

                https://docs.polserver.com/pol099/index.php

                C 1 Reply Last reply Jan 9, 2017, 7:27 PM Reply Quote 0
                • C
                  Claudia Frank @Cronos Umbra
                  last edited by Jan 9, 2017, 7:27 PM

                  @Cronos-Umbra

                  I don’t understand you (Eu não entendo você).
                  One xml which can be used by any language(Um XML que pode ser utilizado por qualquer linguagem)?
                  If so, this doesn’t work (Se assim for, isso não funciona).

                  Cheers
                  Claudia

                  1 Reply Last reply Reply Quote 0
                  • C
                    Cronos Umbra
                    last edited by Jan 9, 2017, 8:03 PM

                    I noticed that does not work, thank you for your help.
                    I created a fortran.xml and I will test it when I can, modified for my language.

                    Do you know if there is any way to change the colors of keywords that exist in the text to a fortran.xml format for example?

                    If you have some plugin I would like it.

                    1 Reply Last reply Reply Quote 0
                    • C
                      Cronos Umbra
                      last edited by Jan 9, 2017, 9:13 PM

                      Can someone explain to me how to put a file userDefineLang.xml?

                      Someone could tell me step by step, what should I do to make it work?

                      Or send me some files ready, and show me the steps of how it should work?

                      C 1 Reply Last reply Jan 9, 2017, 11:26 PM Reply Quote 0
                      • C
                        Claudia Frank @Cronos Umbra
                        last edited by Jan 9, 2017, 11:26 PM

                        @Cronos-Umbra

                        Step 1: define the new language
                        Menu Language->Define your language…
                        open tab Keywords Lists
                        press Styker in 1st group
                        choose a foreground and background color if needed
                        put the word “testkeyword” (without quotes) into the textbox of 1st group
                        press Save As… button
                        put the name “test” in (without quotes)
                        check menu Language, you should see the language now

                        Step 2: define API file
                        Open a new file - menu File->New
                        Put the following content into the file

                        <?xml version="1.0" encoding="Windows-1252" ?>
                        <NotepadPlus>
                            <AutoComplete language="test">
                                <Environment ignoreCase="yes" startFunc="(" stopFunc=")" paramSeparator="," terminal=";" />
                                <KeyWord name="testkeyword" func="yes">
                                    <Overload retVal="int" >
                                        <Param name="int i" />
                                        <Param name="int j" />
                                    </Overload>
                                </KeyWord>
                            </AutoComplete>
                        </NotepadPlus>
                        

                        save it as C:\Program Files\Notepad++\plugins\APIs\test.xml

                        Step 3: Check Settings->Preferences->Atuo-Completion it should look like this

                        Step 4: use it
                        open a new file - menu File->New
                        check language - menu Language->test
                        type the word “testkeyword” (without quotes)
                        you should see the word in a list, use tab key to complete
                        press key “(” (without quotes) and you should see the hints

                        Cheers
                        Claudia

                        Emanuele AtzaE 1 Reply Last reply Mar 23, 2019, 12:03 PM Reply Quote 2
                        • C
                          Cronos Umbra
                          last edited by Jan 10, 2017, 12:05 AM

                          @Claudia-Frank said:

                          Claudia

                          Claudia :********************************** S2

                          1 Reply Last reply Reply Quote 0
                          • Emanuele AtzaE
                            Emanuele Atza @Claudia Frank
                            last edited by Mar 23, 2019, 12:03 PM

                            @Claudia-Frank

                            Sorry forthe really late post

                            I follow what you have done but doesn’t work…
                            N++ doesn’t recognize the fuction and doesn’t show the hints

                            this is the fuction definition

                            <KeyWord name=“TestFuctionWord” func=“yes” />
                            <Overload retVal=“int” >
                            <Param name=“int Input” />
                            </Overload>
                            </KeyWord>

                            it recognize enerything else like number, operator, keyword, comment

                            and for Autocompleting the nameFuction?

                            Sorry for the bad english

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