Community
    • Login

    Parameter hints on userDefinedLang

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    5 Posts 2 Posters 780 Views 2 Watching
    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.
    • Vincent Van HumbeeckV Offline
      Vincent Van Humbeeck
      last edited by

      Hello,

      I have defined a userDefinedLang, and it is saved within userDefinedLang.xml file in the main directory. However, there are several langages inside that file. I would like to have parameters hints for functions on my langage.

      I have understood that you need to create an xml file in the AutoCompletion subdirectory in order to do that, but what name do I give to that file ?

      userDefinedLang.xml or myLang.xml ?

      I’ve tried both, and it’s not working.

      Thanks.

      PeterJonesP 1 Reply Last reply Reply Quote 0
      • PeterJonesP Offline
        PeterJones @Vincent Van Humbeeck
        last edited by

        @Vincent-Van-Humbeeck ,

        Your setup sounds right. So some things to double-check:

        Per https://npp-user-manual.org/docs/config-files/#other-configuration-files, the autoCompletion files must go in the Notepad++ installation folder, not in %AppData%\Notepad++\autoCompletion\ or a cloud folder.

        The official auto-completion docs at https://npp-user-manual.org/docs/auto-completion/#auto-completion-file-format do confirm that you need to name the file after the UDL language name: <Language name>.xml. So, for example, I just created a new UDL called Language With Space, with a couple keywords and the extension lws. I then created <installdir>\autoCompletion\Language With Space.xml (yes, spaces in the name), which contained

        <?xml version="1.0" encoding="UTF-8" ?>
        <NotepadPlus>
        	<AutoComplete language="Language With Space">
        		<Environment ignoreCase="no" startFunc="(" stopFunc=")" paramSeparator="," terminal=";" />
        		<KeyWord name="keyOne" />
        		<KeyWord name="keyThree" />
        		<KeyWord name="keyTwo" />
        	</AutoComplete>
        </NotepadPlus>
        

        … making sure the language="..." matched the filename and UDL language name.

        Please also note that as per https://npp-user-manual.org/docs/auto-completion/#sorting, the <KeyWord> tags must be sorted by name order, and “Failure to do so will result in a non working file, without a warning.”

        But when all of those are properly followed, I got the KeyWord entries to auto-complete in my User Defined Language

        Vincent Van HumbeeckV 1 Reply Last reply Reply Quote 1
        • Vincent Van HumbeeckV Offline
          Vincent Van Humbeeck @PeterJones
          last edited by Vincent Van Humbeeck

          @PeterJones
          Thanks a lot for the explanations !

          How could the autocompletion file go into the installation folder ?
          There’s already the userDefinedLang.xml file there.
          You cannot have the same file name twice there …

          There’s really something I do not understand : when you create a user defined langage, it’s being added into the userDefinedLang.xml file. It is not created into its own xml file. I can export it to a single xml file, but then how do I select it ?

          I’m really not sure on how to create a new langage file that will stand on its own in a separate xml file. It seems to me that the standard way for NP++ will be to add it to the userDefinedLang.xml file.

          PeterJonesP 1 Reply Last reply Reply Quote 0
          • PeterJonesP Offline
            PeterJones @Vincent Van Humbeeck
            last edited by

            @Vincent-Van-Humbeeck ,

            How could the autocompletion file go into the installation folder ?

            Sorry, I should have been more clear: " the autoCompletion files must go in the autoCompletion subdirectory of the Notepad++ installation folder". In my defense, my example slightly further in the post was quite explicit, that the auto-completion file for “Lanuage With Space” would be saved as <installdir>\autoCompletion\Language With Space.xml

            There’s already the userDefinedLang.xml file there.

            But I didn’t say to call it userDefinedLang.xml, so there would have been no conflict.

            There’s really something I do not understand : when you create a user defined langage, it’s being added into the userDefinedLang.xml file. It is not created into its own xml file. I can export it to a single xml file, but then how do I select it ?

            That’s confusing because of a change of mentality that Notepad++ made some versions back: it originally always kept all user defined languages in the one file; the more recent versions allow splitting those out into separate files in %AppData%\Notepad++\userDefineLangs\ directory (to make for easy import of a new language: just copy the file to that folder and restart Notepad++), but when you initially create a UDL, it will still be created in the combined %AppData%\Notepad++\userDefinedLang.xml file.

            not sure on how to create a new langage file that will stand on its own in a separate xml file

            If you want it in a separate file for one you create: you can use the UDL dialog’s “Export” button to export it and save it in the %AppData%\Notepad++\userDefineLangs\, then use the Remove button to remove the copy in the main userDefinedLang.xml file. Then exit Notepad++ and restart, and it will see the copy in the folder, and recognize that UDL again.

            Vincent Van HumbeeckV 1 Reply Last reply Reply Quote 1
            • Vincent Van HumbeeckV Offline
              Vincent Van Humbeeck @PeterJones
              last edited by

              @PeterJones

              Thank you very much.
              It worked!

              1 Reply Last reply Reply Quote 0

              Hello! It looks like you're interested in this conversation, but you don't have an account yet.

              Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

              With your input, this post could be even better 💗

              Register Login
              • First post
                Last post
              The Community of users of the Notepad++ text editor.
              Powered by NodeBB | Contributors