Custom AutoComplete file for XML language



  • 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>


  • 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>


  • 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.



  • @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>


  • 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?



  • @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



  • @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



  • @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



  • 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.



  • 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?



  • @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



  • @Claudia-Frank said:

    Claudia

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



  • @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


Log in to reply