• Login
Community
  • Login

autoCompletion Issue

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
28 Posts 6 Posters 2.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.
  • L
    Lycan Thrope @PeterJones
    last edited by Lycan Thrope Oct 31, 2022, 6:08 AM Oct 31, 2022, 5:24 AM

    @PeterJones ,

    To be fair, I believe I was creating that UDL before the 8.0 versions, and the problem was existent then to me, as dBASE, FoxPro, the one the OP mention, all use caps for command words, if you follow the language’s typographic style. Many of the commands were from when dBASE was simply a procedural language, but when it became OOP, it became a bit more nuanced as the following snippet shows:

    DELETE is a command
    delete is a property
    DELETED( ) is a function
    delete( ) is a method
    
    

    The language itself is NOT case sensitive, so my attempt was to make the UDL not work counter to the programmer’s style. Some kept the typographical style, others didn’t and I didn’t want to force a change of it, since dBASE Plus the OOP version, can still be used with some of the older langauge commands and such. Though internally many have been made OOP, they allow programmers of the language to still use the “procedural” commands in the environment.

    In light of your showing the camelHump style, I may have to revisit this issue later, but when I finished, it was done that way to not interfere with the programmer’s choice of how the UDL should respect their choice of case, upper or lower.

    When I was doing the UDL, the multi word commands also had to be done lexicographically and in case order, at the beginning of the file, because of the included hex codes to enable it to be sorted properly using the required separation of   between words and have them sorted and chosen.

    When I did the UDL, that’s the way I ended up having to arrange things with the ignoreCase=“no”

    This is the command section at the top of the file, where that sequence is used for multi-word commands and switches from the upper case to the lower case versions. After the special characters were done, then the continuation of the alphabetical upper and then lower case were done for the single word commands and function from there also.

    <KeyWord name="SET&#xa0;SKIP"/>
    <KeyWord name="SET&#xa0;SPACE"/>
    <KeyWord name="SET&#xa0;TIME"/>
    <KeyWord name="SET&#xa0;UNIQUE"/>
    <KeyWord name="SET&#xa0;VIEW"/>
    <KeyWord name="STORE&#xa0;AUTOMEM"/>
    <KeyWord name="UPDATE&#xa0;ON"/>
    <KeyWord name="alter&#xa0;table"/>
    <KeyWord name="append&#xa0;automem"/>
    <KeyWord name="append&#xa0;from"/>
    <KeyWord name="append&#xa0;from&#xa0;array"/>
    <KeyWord name="append&#xa0;memo"/>
    <KeyWord name="clear&#xa0;all"/>
    

    Like said, I did the dual list in order so as not to change the way the programmer chose to type his case style.

    J 1 Reply Last reply Nov 3, 2022, 1:02 PM Reply Quote 0
    • L
      Lycan Thrope @José Luis Montero Castellanos
      last edited by Oct 31, 2022, 6:03 AM

      @José-Luis-Montero-Castellanos ,

      As I mention in my response to Peter, besides the base language of the procedural elements, I also had to work with the aspects of dBASE Plus being an OOP language but still being able to use the older commands in programs also. My problem, however, was that I did not want to force the typographical style on the programmers, because the language as you know is NOT case sensitive…at least dBASE wasn’t, so since the language has expanded it didn’t make sense to try and force a case insensitive language to act like a case sensitive language enforced editor. So to keep the choice with the programmer, I duplicated the keyword and function completion list with the ignorecase = no setting, and left the choice of case typing to the programmer while also making them available in either typed format.

      I’m glad Peter’s help has perhaps solved your problem, for you. God luck.

      P 1 Reply Last reply Oct 31, 2022, 1:13 PM Reply Quote 0
      • P
        PeterJones @Lycan Thrope
        last edited by Oct 31, 2022, 1:13 PM

        @Lycan-Thrope ,

        To be fair, I believe I was creating that UDL before the 8.0 versions

        Glad you were able to work around the bugs that were present before v8.0.

        If you need to use older N++ for unknown reasons, or if ignoreCase="yes" gives you more flexibility in some dimension even though it requires you to duplicate keywords in various cases, then feel free to keep doing it in that way, even in v8.0 and beyond.

        My only intention with my brief assessment was to explain that indeed, there was a bug related to ignoreCase="yes" prior to v8.0, and that if anyone wants the proper ignoreCase="yes" behavior in Notepad++ auto-completion, they need to use v8.0 or newer.

        1 Reply Last reply Reply Quote 2
        • J
          José Luis Montero Castellanos @Lycan Thrope
          last edited by Nov 3, 2022, 1:02 PM

          Thanks again.
          Although I was able to solve the problem, your last suggestions still work for me, for example, I didn’t know how to insert spaces where I needed them in commands like “SET ALTERNATE TO” - I had replaced it with the underscore _ (SET_ALTERNATE_TO) which would later remove. I’ll try with &#xa0; and then I’ll tell you :)

          P L 3 Replies Last reply Nov 3, 2022, 1:07 PM Reply Quote 0
          • P
            PeterJones @José Luis Montero Castellanos
            last edited by PeterJones Nov 3, 2022, 1:08 PM Nov 3, 2022, 1:07 PM

            @José-Luis-Montero-Castellanos said in autoCompletion Issue:

            I had replaced it with the underscore _ (SET_ALTERNATE_TO) which would later remove. I’ll try with &#xa0;

            That will just mean instead of having to later remove the _ after auto-completion is done, you would have to later remove the non-breaking-space (U+00A0) – maybe with FIND = \xA0 and REPLACE = \x20 and mode = regular-expression (or type a space in the replace string, but that cannot be copy/pasted from the forum). Well, unless your language happens to treat the non-breaking-space character the same as other whitespace (like space or tab) between code tokens. I haven’t seen a language that accepts nbsp as a token-separator, but that doesn’t mean it doesn’t exist.

            J 1 Reply Last reply Nov 3, 2022, 1:35 PM Reply Quote 0
            • J
              José Luis Montero Castellanos @PeterJones
              last edited by Nov 3, 2022, 1:35 PM

              Good morning.
              What I understand is that I have to do the manual work of search and replace in the same way, since the space is understood to be visible, but different from \x20. I have to try compiling with \xA0 to see what happens or find another solution. Or make a request to the Npp programmer to see if it’s possible or keep it in mind, Which would also work for SQL and derivatives.

              I was surprised by your quick response :) Thank you…

              A 1 Reply Last reply Nov 3, 2022, 2:08 PM Reply Quote 0
              • A
                Alan Kilborn @José Luis Montero Castellanos
                last edited by Nov 3, 2022, 2:08 PM

                @José-Luis-Montero-Castellanos

                I suppose that a script that converted \xA0 characters to \x20 on every user save might be handy?

                J 1 Reply Last reply Nov 3, 2022, 2:41 PM Reply Quote 0
                • J
                  José Luis Montero Castellanos @Alan Kilborn
                  last edited by Nov 3, 2022, 2:41 PM

                  @Alan-Kilborn , Hi :)
                  I guess so, I was thinking of an Npp macro, good use of RegEx, a keyboard shortcut, and leave the manual work for writing the code.

                  A 1 Reply Last reply Nov 3, 2022, 2:51 PM Reply Quote 0
                  • A
                    Alan Kilborn @José Luis Montero Castellanos
                    last edited by Nov 3, 2022, 2:51 PM

                    @José-Luis-Montero-Castellanos said in autoCompletion Issue:

                    I was thinking of an Npp macro, good use of RegEx, a keyboard shortcut

                    True, but then you have to remember to run it.
                    With a script it becomes just something that tags along when you save.
                    But also, you could include “save” as the final action in your macro, and just replace the default Ctrl+s save functionality with the running of your macro (to make it no-brainer automatic).

                    1 Reply Last reply Reply Quote 0
                    • L
                      Lycan Thrope @José Luis Montero Castellanos
                      last edited by Lycan Thrope Nov 3, 2022, 7:17 PM Nov 3, 2022, 7:12 PM

                      @José-Luis-Montero-Castellanos ,
                      You’re welcome. I mentioned that particular aspect because that was maddening to me when I was building the autoCompletion list, and trying to keep them sorted and in some kind of consistent order, because when I was building it, one sequence out of order and the list would refuse to run. :(

                      Here’s a screenshot of that part of “Set” keywords in the autoCompletion dropdown list so it shows and inserts what you see, without any additional cleanup code:

                      SpaceSortingInXbaseLang.PNG

                      It took a lot of work with @PeterJones, @guy038 , @Alan-Kilborn , @Ekopalypse and others to learn all the nuances at the time that had to be overcome to make the language work with many of the features available in NPP for a UDL, short of building a lexer for it, like you’re doing now. :)

                      1 Reply Last reply Reply Quote 2
                      • L
                        Lycan Thrope @José Luis Montero Castellanos
                        last edited by Lycan Thrope Nov 3, 2022, 7:36 PM Nov 3, 2022, 7:29 PM

                        @José-Luis-Montero-Castellanos ,

                        Here’s an additional screenshot, showing it using the lower case display:

                        SpaceSortingInXbaseLangLowerCase.PNG

                        Notice that the list isn’t the same, because some functions and methods used in the OOP version, don’t have capital counterparts, because when they’re used, they usually get inserted after a ., which doesn’t happen with strict procedural parts of the langauge, so if someone typed, for instance the SET command, and then a period, it wouldn’t show in the dropdown box, because there is no existent equivalent in the language. However if someone created one, then it would show in the dropdown list as previous words in the document, and allow them to reselect it. It took a while to figure out how to make NPP capabilities and dBASE’s OOP language extensions work together without forcing strict adherence to typographical conventions. :)

                        J 1 Reply Last reply Nov 3, 2022, 9:26 PM Reply Quote 0
                        • J
                          José Luis Montero Castellanos @Lycan Thrope
                          last edited by Nov 3, 2022, 9:26 PM

                          @Lycan-Thrope
                          Hey, hey :¬) …
                          It makes me feel like I’m reinventing the wheel, and I clarify that I’m not creating a lexer, just creating the auto-complete list, if you have any, it could save me time, or serve me as a guide. I tell you that I got the list to work in mode ignoreCase="yes" - I already filled the descr="abcd...", Npp’s RegEx engine and an index of Commands and Functions saved me days of hard work. I just need to fill in the parameters and return values. (handwork). The lexer thing, it’s still too big for me :¬(

                          L 1 Reply Last reply Nov 3, 2022, 9:29 PM Reply Quote 1
                          • L
                            Lycan Thrope @José Luis Montero Castellanos
                            last edited by Lycan Thrope Nov 3, 2022, 9:31 PM Nov 3, 2022, 9:29 PM

                            @José-Luis-Montero-Castellanos ,
                            I meant, that you’re making a UDL feature like I was, not a Lexer. Sorry if that wasn’t clear. Yes a Lexer was going to be too much for me, too…but this is almost as big. :)

                            J 1 Reply Last reply Nov 3, 2022, 9:35 PM Reply Quote 0
                            • J
                              José Luis Montero Castellanos @Lycan Thrope
                              last edited by José Luis Montero Castellanos Nov 3, 2022, 9:44 PM Nov 3, 2022, 9:35 PM

                              @Lycan- I understand.
                              If you are interested, now or when I have it completely ready, I will send it to you. For now I’m trying the suggestions…

                              By the way, I’m missing the syntax coloring list (userDefineLanguage). One I downloaded (hmg.xml) doesn’t meet my expectations, I want one for dark themes.

                              L 1 Reply Last reply Nov 4, 2022, 1:34 AM Reply Quote 0
                              • L
                                Lycan Thrope @José Luis Montero Castellanos
                                last edited by Lycan Thrope Nov 4, 2022, 1:53 AM Nov 4, 2022, 1:34 AM

                                @José-Luis-Montero-Castellanos ,

                                Well, I took a look at the Harbor language part and checked out the documentation about the commands and such, and sorry to say, the two aren’t really similar enough for you to do cut and paste since a lot of it is based on the older Xbase procedural and Clipper extensions styles and not true OOP, which seems closer in coding to a C++ style of object creation and such…and honestly, most of the links for Harbour were dead end 404 pages that I tried to follow from Wikipidia and search engines.

                                What I can give you is a view of a few of the Xbase commands and how it should look, but I’m afraid the hard work is going to be yours to collect all the languages commands and put in to the autoCompletion file in the order you need.

                                <KeyWord name="DELETE"/>
                                <KeyWord name="DELETED" func="yes">
                                	<Overload retVal="{lVal}" descr="Xbase - 
                                		Indicates if the current record is marked as deleted.">
                                		<Param name="[&lt;alias&gt;]"/>
                                	</Overload>
                                </KeyWord>
                                <KeyWord name="DESCENDING" func="yes">
                                	<Overload retVal="{lVal}" descr="Xbase - 
                                		Indicates if a specified index is in descending order.">
                                		<Param name="[&lt;.mdx filename expC&gt;]"/>
                                		<Param name="[&lt;index position expN&gt;"/>
                                		<Param name="[&lt;alias&gt;]]"/>
                                	</Overload>
                                </KeyWord>
                                

                                Notice the keyword only gets that one line entry, but functions /methods get the multiple line entry, and if any of the commands have multiple application you can add multiple Overload sections to expand it so that each will show up in the drop box when you type the first parenthesis that triggers the description/tips for the chosen word when it is meant to be used as a function/method rather than a command word. Note that it says 1 of 4 because there are 4 uses/variations of the command to choose from if you use the tip call to follow the hints of parameters to enter as shown in the below screenshot.

                                MultiOverloadDisplay.PNG

                                Note also, the previous code clip where the word is DELETE in caps, and there is no multiple Overload sections…that’s because when it’s used as anything other than a command, it won’t be in capitals, so it may have a lower case equivalent, but the lower case function/method use won’t have an uppercase equivalent.

                                <KeyWord name="delete"/>
                                <KeyWord name="delete" func="yes">
                                	<Overload retVal="{null}" descr="Method - Deletes the current row.
                                	Property of: Rowset, ArrayRowset
                                	Usage: &lt;oRef&gt; .delete() - &lt;oRef&gt;  = The rowset whose current row you want to delete.">
                                	<Param name=""/>
                                	</Overload>
                                	<Overload retVal="{null}" descr="Method - Deletes an element from
                                	a one-dimensional array, or deletes a row or column of elements
                                	from a two-dimensional array. 
                                	Property of: Array
                                	Usage: &lt;oRef&gt; .delete(&lt;position expN&gt;  [, &lt;row/column expN&gt; ]) - 
                                	&lt;oRef&gt;  = A reference to the one- or two-dimensional
                                	array from which you want to delete data.
                                	&lt;position expN&gt;  - When the array is a one-dimensional array, &lt;position expN&gt; 
                                	specifies the number of the element to delete.
                                	When the array is a two-dimensional array, &lt;position expN&gt;  specifies the number
                                	of the row or column whose elements you want to delete.
                                	[&lt;row/column expN&gt; ] - Either 1 or 2. If you omit this argument or specify 1,
                                	a row is deleted from a two-dimensional array. If you specify 2, a column is deleted.">
                                	<Param name="&lt;position expN&gt; "/>
                                	<Param name="&lt;row/column expN&gt; "/>
                                	</Overload>
                                	<Overload retVal="{null}" descr="Method - Removes a file from a disk,
                                	optionally sending it to the Recycle Bin.
                                	Property of: File
                                	Usage: &lt;oRef&gt; .delete(&lt;filename expC&gt;  [, &lt;recycle expL&gt; ]) - 
                                	&lt;oRef&gt;  = A reference to a File object.
                                	&lt;filename expC&gt;  - Identifies the file to remove.
                                	[&lt;recycle expL&gt; ] - Whether to send the file to the Recycle Bin instead of deleting it.
                                	If omitted, the file is deleted.">
                                	<Param name="&lt;filename expC&gt; "/>
                                	<Param name="[&lt;recycle expL&gt; ]"/>
                                	</Overload>
                                	<Overload retVal="{null}" descr="Method - Deletes the rows in the destination
                                	that are listed in the source.
                                	Property of: UpdateSet
                                	Usage: &lt;oRef&gt; .delete() - &lt;oRef&gt;  = The UpdateSet object that describes the delete.">
                                	<Param name=""/>
                                	</Overload>
                                </KeyWord>
                                

                                This might help, but the bulk work of documenting and turning your language documentation into an autoCompletion and code tip file is on you and believe me, I know how much work it is…but our language implementations are so far apart in documenting format that you won’t be able to use mine. Harbour is what is referred to as object based but not fully object oriented as dBASE Plus is.

                                I hope this helps you understand the size of a job you’ve chosen to do. It’s one of the reasons that creating a UDL with the additional features wasn’t done prior to my doing it. It’s not a job for the faint of heart. :)

                                J 1 Reply Last reply Nov 4, 2022, 2:53 AM Reply Quote 2
                                • J
                                  José Luis Montero Castellanos @Lycan Thrope
                                  last edited by Nov 4, 2022, 2:53 AM

                                  Hi: @Lycan-Thrope

                                  Anyway, I’m still learning details from your observations, and I’d like to know what programming environment you make your languagx.xml file for.

                                  Regarding the documentation to copy and paste, I’ll give you the link so you can browse it (if you’re curious).

                                  https://www.hmgforum.com/hmgdoc/data/index.htm

                                  In one day with the help of Npp’s RegEx I loaded aprox. 780 descriptions of commands and functions.

                                  Application
                                  Do() Calls a procedure or a function
                                  hb_PValue() Retrieves the value of an argument.
                                  PCount() Retrieves the number of arguments passed to a function.
                                  ProcFile() This function always returns an empty string.
                                  ProcLine() Gets the line number of the current function on the stack.
                                  ProcName() Gets the name of the current function on the stack

                                  Array
                                  AAdd() Dynamically add an element to an array
                                  AClone() Duplicate a multidimensional array
                                  ACopy() Copy elements from one array to another
                                  ADel() Delete an element from an array.
                                  AEval() Evaluates the subscript element of an array
                                  AFill() Fill an array with a specified value
                                  AIns() Insert a NIL value at an array subscript position.
                                  Array() Create an uninitialized array of …

                                  The list contains the name of the function or command with its description easily convertible to autocomplete format with just one run of Find and Replace All.

                                  From your previous comment I was able to assimilate an example of how to arrange the parameters, for which I only used one line. Thanks again! and hopefully my heart doesn’t fail me :¬) .

                                  L 1 Reply Last reply Nov 4, 2022, 5:48 PM Reply Quote 2
                                  • L
                                    Lycan Thrope @José Luis Montero Castellanos
                                    last edited by Lycan Thrope Nov 4, 2022, 6:11 PM Nov 4, 2022, 5:48 PM

                                    @José-Luis-Montero-Castellanos ,
                                    Thanks for that working link. At least from it, I was able to glean at least the following:

                                    The language uses older object-based structures that older dBASE did. It uses a C like include system for including files that have supporting code plus it uses a C like Main Function approach similar to C style, and since it’s based on Clipper, which was a C like compiler for Xbase languages that makes sense.

                                    I guess you could use my file, but you’d have to do a lot of editing removing things, which it sounds like you have a better handle on it and easier access to extrapolate and search the availble text than I did. I had to copy everything from the documentation and help files into the autoCompletion file…there was no text file to draw on…I had to create it. :) Then I was able to start sorting and using Notepad++ to form it, so you’re already ahead of the game as far as work to do is concerned…and that being said, the examples I gave you should give you the guidance you need to apply it to your language’s documented functions etc.

                                    Now you just need to do what ever sorting you need and apply whatever search and replace you need, like I did. As someone suggested, I went through the list, and every word that was a command only, I marked somehow with a phrase that I could then use to apply a skeleton search and relplace for the front of the command word (like those I showed you), and then the same for the back side (opening closing xml tags for instance).

                                    The functions took longer because I had to manually enter the information after using a skeleton frame for each part of structure, and I had a cut and paste text file of those structures so I could for instance, paste multiple “Overload…/Overload” skeletons and then hand fill each. It helped make it faster, but it was still tedious.

                                    Incidentally, I was going to make an older dBASE version file also, but hadn’t gotten on it yet, that would probably have been more similar to what you’re doing now…but alas, I never got to it.

                                    @José-Luis-Montero-Castellanos said in autoCompletion Issue:

                                    Anyway, I’m still learning details from your observations, and I’d like to know what programming environment you make your languagx.xml file for.

                                    I’m not quite sure what you’re asking here? I use the dBASEPlus UDL I developed named dbaseplus.xml, but it’s not in the library yet, as need I to finish it up. If you’re asking what environment I use it for, I use it for an outside of the IDE editor for dBASE Plus, which is made by dBASE, LLC that you can read more about it here:
                                    dBASE PLus

                                    I’m using dBASE Plus right now to write an installer for it, because the files used in Notepad++ to implement these features have multiple files with the same name and in the same case, so it’s sometimes hard for folks to install it. I’m in testing of it right now, and have come across a couple of people whose NPP installs don’t have the standard directory structure that it should for me to install into. In particular, as I understand, they have no AppData\Notepad++\functionList\ directory to hold the dbaseplus.xml functionList file, and the overrideMap.xml file that they need to link these things for the UDL language to the functionList and autoCompletion features and I’m trying to work it out with them now to find out why. Once it’s done and working I was going to release it for use in the library. Have been delayed somewhat when I started a job in July, and now I’m back at it while I look for another one since I left it at the end of September :)

                                    I’ll keep an eye out on your progress on here and if I can help with examples or what not, I’ll be glad to jump in. Good luck.

                                    1 Reply Last reply Reply Quote 1
                                    • Grzegorz ŚliwkaG
                                      Grzegorz Śliwka @PeterJones
                                      last edited by Dec 22, 2022, 1:49 PM

                                      @PeterJones

                                      Hi,
                                      Your example doesn’t work for me. I write “cam” and nothing happens, no suggestions. It is rather not correct. “all” and “don” work fine.

                                      Notepad++ v8.4.7 (64-bit)
                                      Build time : Nov 1 2022 - 23:31:11
                                      Path : C:\Tools\Notepad++\notepad++.exe
                                      Command Line : d:\Temp\test.au3
                                      Admin mode : OFF
                                      Local Conf mode : ON
                                      Cloud Config : OFF
                                      OS Name : Windows 11 (64-bit)
                                      OS Version : 21H2
                                      OS Build : 22000.1335
                                      Current ANSI codepage : 1250
                                      Plugins : none

                                      P 1 Reply Last reply Dec 22, 2022, 5:20 PM Reply Quote 0
                                      • P
                                        PeterJones @Grzegorz Śliwka
                                        last edited by Dec 22, 2022, 5:20 PM

                                        @Grzegorz-Śliwka said in autoCompletion Issue:

                                        Your example doesn’t work for me.

                                        Whereas it did work for me. Without giving us more to go on, I cannot even begin to guess what you’ve actually done, and whether you’ve really set things up right according the instructions above. Sorry.

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