Community
    • Login

    Does Autocompletion require a formal lexer?

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    20 Posts 3 Posters 980 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.
    • Lycan ThropeL
      Lycan Thrope @PeterJones
      last edited by

      @peterjones
      To head off a possible question here’s my debug along with screenshot of the version I’m using to do this.

      Debug:
      Notepad++ v8.1.9.2 (64-bit)
      Build time : Nov 21 2021 - 04:30:20
      Path : C:\Program Files (x86)\Notepad++_8_1_9_2_64bit\notepad++.exe
      Command Line :
      Admin mode : ON
      Local Conf mode : OFF
      Cloud Config : OFF
      OS Name : Windows 10 Home (64-bit)
      OS Version : 2009
      OS Build : 19043.1348
      Current ANSI codepage : 1252
      Plugins : mimeTools.dll NppConverter.dll NppExport.dll

      Screenshot:
      Autoversion.PNG

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

        @lycan-thrope ,

        On a 64bit OS, it is generally set up so that 64-bit applications go in the C:\Program Files\ , and 32-bit applications install into C:\Program Files (x86)\ . I don’t know how you confused things so much – other than when installing programs, you can usually choose a different location to install into, and maybe you chose the wrong one when installing each.

        If I were the one doing it, I would uninstall both; install 64-bit Notepad++ in the right location, and just use a portable unzip on the rare occasions that I wanted to use 32-bit. It seems to me that having two installations using the same %AppData%\Notepad++ configuration would be confusing (and possibly causing problems) – especially if you are running both simultaneously.

        On my home computer, I have a recent 64bit installed, and I have portable zips available for most historic versions in both 32bit and 64bit since v7.6.3 to be able to help people in the Forum, starting from an out-of-the-box, so that my customizations don’t interfere with answering questions. At work, I have my primary NPP as a highly-configured portable unzip in one location (I was having to ask IT for Program Files write permission every time I upgraded NPP or tried a new plugin, so moved to a portable in a non-controlled folder, and just use user-level file associations to point to the portable version – thus not requiring elevated permissions.

        Lycan ThropeL 1 Reply Last reply Reply Quote 2
        • Lycan ThropeL
          Lycan Thrope @PeterJones
          last edited by

          @peterjones
          Okay, so I’m not confused what’s supposed to go where, but obviously, I did something that’s not supposed to happen…because yeah, I was selecting where to install and probably never noticed the start of the path because I was just naming the new one to the version it was. Figuring theye were new and may screw something up, I probably started keeping them in named versions. Obviously, that’s on me then, but mind you, this is after years of using them, so I tend to keep version separate until I was sure there wasn’t anything buggy going on, and just never cleaned house…until starting this project. I’ll save my files and do the uninstall and normalize my setup.

          I kind of remember why now, I still didn’t plan to upgrade Windows past my last purchased verions, which was Win 2000, and then I got I think XP for a puter for my wife, so that was my last purchased version. Everything now has been on my laptop which came with 8.0 on it and then 8.1, which I’d have erased if they hadn’t updated it for free because of the phone UI they were trying to implement on the desktop. If it wasn’t “free” on the puter, I’d have been well in to Linux on it by now. :)

          Anyway, sage advice if I want to keep both versions So thanks for the advice, the confirmation of my working mods, and the advice and help trying to implement this dBASEPlus package, which, is way overdue.

          Lee

          Lycan ThropeL 1 Reply Last reply Reply Quote 1
          • Lycan ThropeL
            Lycan Thrope @Lycan Thrope
            last edited by

            @lycan-thrope
            I’ve got a question about possibly handling duplicates in the Autocompletion file, if they’re allowed and/or how to handle them if they are.

            dBASE, for those that don’t know, is one of the original big 3 of PC desktop applications in the early days. Since then, a lot of updating has been done, and one of the early changes was making a small SQL variant in the langage called LocalSQL, that allows dBASE’s tables and other database variants tables to be used inside dBASE with that LocalSQL. Unfortunately, there are a couple of actual Functions that are identically named, but handled differently. The dBASE editor handles them appropriately in the IDE and programs. I’d like to be able to provide the identical word, to be used by both, but the hints on completion would be different.

            I’m asking if that is possible and if not, cie la vie.

            Thanks in advance for any insight,

            Lee

            Lycan ThropeL PeterJonesP 2 Replies Last reply Reply Quote 0
            • Lycan ThropeL
              Lycan Thrope @Lycan Thrope
              last edited by

              @lycan-thrope
              Well, I guess I answered my own question. I put both in with different descriptions and parameter number and the result it, it went with the first one in the list, meaning, it’ll never reach the second.

              I guess a work around could be just putting the Function attribute in, but putting a text with advice on the two options, if the text hint can be big enough, so they can look at it, while they type it, but not putting any parameters in so it will stay up instead of jumping to the variable as it’s being filled in. Got to go try it.

              Lee

              Lycan ThropeL 1 Reply Last reply Reply Quote 0
              • PeterJonesP
                PeterJones @Lycan Thrope
                last edited by

                @lycan-thrope said in Does Autocompletion require a formal lexer?:

                handling duplicates in the Autocompletion file, if they’re allowed and/or how to handle them if they are.

                If I understand correctly. the same name has different parameter lists: am I correct?

                If so, you can look at the Perl autocompletion that ships with NPP – for example, the eval has multiple option lists, which are implemented by multiple <Overload> entries in the same <KeyWord>:

                <KeyWord name="eval" func="yes">
                    <Overload retVal="" descr="catch exceptions or compile and run code">
                        <Param name="BLOCK" />
                    </Overload>
                    <Overload retVal="" descr="catch exceptions or compile and run code">
                        <Param name="EXPR" />
                    </Overload>
                    <Overload retVal="" descr="catch exceptions or compile and run code">
                        <Param name="" />
                    </Overload>
                </KeyWord>
                

                You’ll see a little 1 of 3 with arrows for choosing between them
                13dfb51a-f865-4d2f-9d96-9003bb0abdf0-image.png
                63dfd4e5-5be9-49a5-ab14-8b3fdd5554ab-image.png
                38639fc9-5f83-46f2-b380-df18cba64be0-image.png

                And if it does something different with each argument list, you can even have a different Description for each.

                This is described in the Overload section of the autocompletion docs

                Lycan ThropeL 3 Replies Last reply Reply Quote 2
                • Lycan ThropeL
                  Lycan Thrope @Lycan Thrope
                  last edited by

                  @lycan-thrope
                  That did the trick. Still comes up with a hint, but stays up while typing and I was able to basically document the two differences in the description. Problem solved. :) If there are any other tricks I don’t know about that can make it work otherwise, any help would be appreciated.

                  Lee

                  1 Reply Last reply Reply Quote 0
                  • Lycan ThropeL
                    Lycan Thrope @PeterJones
                    last edited by

                    @peterjones ,
                    Thanks…I just saw it when my own response was loading. LOL Thanks that looks a lot more effective.

                    Lee

                    1 Reply Last reply Reply Quote 0
                    • Lycan ThropeL
                      Lycan Thrope @PeterJones
                      last edited by

                      @peterjones ,
                      Thank you again, that worked perfectly. I guess I didn’t catch that in the Overload section as I thought that it meant for each of the Overload sections…not realizing it meant for each keyword. Thanks again for catching my lack of understanding what I’m reading. :-) I did call you a genius, now you’re a mind reader. Heheh.

                      Lee

                      1 Reply Last reply Reply Quote 0
                      • Lycan ThropeL
                        Lycan Thrope @PeterJones
                        last edited by

                        @peterjones,

                        Here’s what I went with, adding the reason for each version, so there would be no mistakenly taking the one without knowing which it applied to.

                        	    <KeyWord name="MAX" func="yes">
                                   <Overload retVal="{Greater value}" descr="dBASE - Compares two numbers (or two date, character, or logical expressions) and returns the greater value.">
                        				<Param name="value exp1" />
                        				<Param name="value exp2" />
                                    </Overload>
                        		<Overload retVal="{Greater value}" descr="SQL - Compares provided expression and returns the greater value">
                        				<Param name="value exp1" />
                        		</Overload>
                                </KeyWord>
                        

                        There is duplicates for at least each SQL function used as well as equivalents in dBASE. For instance, the Upper() and Lower() are identical, so I didn’t see any need to worry about those, since they take the same kind and number of parameters, but as you can see, Min() and Max() take different numbers of parameters and perhaps types.

                        Thanks again.

                        Lee

                        Lycan ThropeL 1 Reply Last reply Reply Quote 1
                        • Lycan ThropeL
                          Lycan Thrope @Lycan Thrope
                          last edited by

                          @lycan-thrope
                          I have a little problem. I filled in a keyword function here:

                          		<KeyWord name="ACOPY" func="yes">
                          			<Overload retVal="{nVal}" descrip="Copies elements from one array to another. Returns the number of elements copied.">
                          				<Param name="<source array>"/>
                          				<Param name="<target array>"/>
                          				<Param name="[<startingelement expN>]"/>
                          				<Param name="[<elements expN>]"/>
                          				<Param name="[<targetelemnt expN>]]]"/>
                          			</Overload>
                          		</KeyWord>
                          

                          But this is all that shows:
                          AutoAcopyShow.PNG

                          I’m missing some text and not quite sure why. Any ideas? I don’t see any out of place syntax highlighting in the text, even though it is long. Is there a limit to length before it’s ignored?

                          Thanks in advance.

                          Lee

                          Lycan ThropeL 1 Reply Last reply Reply Quote 0
                          • Lycan ThropeL
                            Lycan Thrope @Lycan Thrope
                            last edited by

                            @lycan-thrope
                            On a hunch, just in case, I need to disclose that the keyword just before it doesn’t have a “Parameter” section in the “Overload” section, like so:

                            		<KeyWord name="ACCESS" func="yes">
                            			<Overload retVal="{accessLevelN}" descrip="Returns the access level of the current user for DBF table security.">
                            			</Overload>
                            		</KeyWord>
                            

                            Just in case that may have something to do with it. As I read the Autocompletion section, the parameter was an option, as is the description, but in this case, this function returns a security level of the user, and takes no parameters, as far as I know, but it does return an access level number for the users access priveledges. Hence, no parameter supplied…unless it needs to have a Null parameter there. Just an FYI for full disclosure. I also can’t get the description for this function which is why I bring it up. The other desciptions past these two work, but these two don’t so I have reason to believe ther’s something there that’s wrong, but I’m just not seeing it, especially since I don’t see any syntax highlighting goofs.

                            Lee

                            1 Reply Last reply Reply Quote 0
                            • guy038G
                              guy038
                              last edited by guy038

                              Hello, @lycan-thrope, @peterjones and All,

                              @lycan-thrope, why do you use :

                              			<Overload retVal="{nVal}" descrip="Copies elements from one array to another. Returns the number of elements copied.">
                              

                              And not :

                              			<Overload retVal="{nVal}" descr="Copies elements from one array to another. Returns the number of elements copied.">
                              

                              Maybe, this syntax explains the problem ? ( not tested ! )

                              BR

                              guy038

                              Lycan ThropeL 1 Reply Last reply Reply Quote 3
                              • Lycan ThropeL
                                Lycan Thrope @guy038
                                last edited by

                                @guy038

                                Argh… Thanks.

                                I had made my self some skeletons to copy/paste to test some of the functions and parameters that I thought might give me problems before trying to do the file enmasse with the wonderfully written hints about how to mass format a keyword list…and apparently my hand typed abbreviations deviated from the proper abbreviations. :-(

                                Thanks… in my defense, it was another all-nighter and blurry eyes were present. :-)

                                Lee

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