How to create abbreviations for java code



  • @PeterJones said in How to create abbreviations for java code:

    you will have to find alternate solution

    I’ve been using QuickText on 32-bit and then compiled and slightly improved it for 64 and 32-bit since it seemed to be unsupported. You can find it here:

    https://github.com/vinsworldcom/nppQuickText

    Cheers.



  • @Michael-Vincent

    QuickText appears to be available via Plugins Admin (not sure why you didn’t mention that?):

    ea90da4b-d37e-47ab-a5e0-6580af2f4881-image.png



  • @Alan-Kilborn

    Interesting. I never did the pull request to nppPluginList to add it. Wonder how it got there? Also, that’s not the latest version; 0.1.1.1 is available on the GitHub releases page.

    Cheers.



  • @Michael-Vincent

    Not being a plugin author myself, I’m not sure of the process for (a) getting your plugin in the list [so I’m not sure how yours would have gotten there] or (b) getting your plugin version-bumped in the list.

    But I suspect Mr. Jones will have some sort of pointer coming up… :)



  • @Alan-Kilborn

    The other thing is that it’s not “my” plugin. Someone else is the original author, it just seemed to be abandoned. And since I was using it on 32-bit and wanted to move to 64-bit, I got it to work for that and added some extra enhancements that I wanted. So it really isn’t my plugin nor I think mine to list.

    Happy to make it available on GitHub, but feel pretty weird about it being published in some list with me as the goto / author.

    Cheers.



  • @Michael-Vincent

    Interesting. I never did the pull request to nppPluginList to add it. Wonder how it got there? Also, that’s not the latest version; 0.1.1.1 is available on the GitHub releases page.

    It appears @chcg added it with a commit last summer. And in December, updated it to 0.1.1.1.

    For adding to the list (though I’ve never done it), the nppPluginList page implies you just do a Pull Request to add it into the JSON files. You can search for closed PR to see what the PR look like that get plugins updated (I couldn’t find any PR attached to @chcg’s commits, though I admit navigating these things isn’t second nature to me yet, so there might be an associated PR with his commits).



  • @PeterJones said in How to create abbreviations for java code:

    And in December, updated it to 0.1.1.1.

    I wonder why it still shows as 0.1.0.1 in PA then?

    but feel pretty weird about it being published in some list with me as the goto / author.

    Yea, not to fault @chcg in any way, but it does seem awkward for you, given the project’s history.



  • @Alan-Kilborn said in How to create abbreviations for java code:

    I wonder why it still shows as 0.1.0.1 in PA then?

    In what version of Notepad++ / nppPluginList?

    v7.8.4 shows 0.1.1.1 for me:

    ccdc8bd9-9997-499c-bad5-fa33b5e38fcc-image.png

    c079f5aa-d343-4579-ad09-c61aa74f4b68-image.png

    (both have the DLL’s RClick > Properties > Details showing 1.1.7.0)



  • @PeterJones

    Ah, I’m forgetting that PA isn’t quite “live”, like PM used to be. A shallow replacement, sadly. And all that work put into it, too…

    Yea, I’m running a slightly older N++, so it makes sense.
    Sorry to confuse because I forgot how things work.



  • @Michael-Vincent said in How to create abbreviations for java code:

    Happy to make it available on GitHub, but feel pretty weird about it being published in some list with me as the goto / author.

    Especially if annoying people like me start asking you to make fixes, rather than the original author. Then you might have to start supporting it, or ignoring those people. :-)

    I say this for no particular reason, because I wouldn’t ask you to look into why, when I installed 0.1.1.1 via Plugins Admin, it defaulted to an empty QuickText.conf.ini, rather than using the values for the defaults – because if I were to ask you about that, it would be like trying to assign you ownership, and I wouldn’t do that. ;-)

    When that happens, then the Options… dialog is unintelligible; if that happens to someone else, they should Plugins > QuickText > Open Config File…, and paste in the contents of https://raw.githubusercontent.com/vinsworldcom/nppQuickText/master/Config/QuickText.conf.default.ini and save, then Plugins > QuickText > Refresh Configuration… – though it would be nice to not have to go through those hoops.

    Oh, you meant because of copyright/license/ownership? That makes sense, too. It was released under GPL2, so as long as you attribute the original authors, maintain license, and make it clear that you have made changes from the original, there’s nothing wrong. (I’m never sure whether GPL requires you to change the name of the project if you make a fork or not, though it doesn’t seem to be that way: IANAL.
    In other open-source communities – like Perl’s CPAN, it is possible to take ownership of abandoned open-source projects, and those don’t require renames, so I would assume it’s the same here.)

    . . . .



  • @PeterJones said in How to create abbreviations for java code:

    like Perl’s CPAN, it is possible to take ownership of abandoned open-source projects

    Yes, I’ve done that. And I know Perl better than C++ so feel more comfortable actually supporting my Perl modules.

    I don’t know why it doesn’t use the default one supplied with the ZIP file / install. Thanks for the work-around. I guess I never noticed already having it installed and working - probably had to jump through those hoops the first time I set it up from the original author and then my subsequent “upgrades” were just overwriting the DLL - the config and INI file where already in place.

    Not sure if this helps now that you’ve figured it out:

    QuickText.conf.default.ini = is an example of the the Plugin’s config file
    QuickText.default.ini = is an example for the code snippets

    When installed, it should end up like this:

    $(NPP_INSTALL_DIR)\plugins\
      |_ QuickText
      |   |_ QuickText.dll
      |   |_ QuickText.ini
      |_ Config
          |_ QuickText.conf.ini
    

    Cheers.



  • I wouldn’t do that. ;-)

    But in all seriousness, if you’d like bug reports or feature requests to be tracked on your github, I can add them. If it’s good enough for you, and you aren’t planning on any support or future fixes, then I don’t want to clutter your repo with issues that will just be ignored for years (or forever).

    (If you don’t reply, I’ll assume “no issues, please”.)



  • @PeterJones

    I don’t mind you or anyone adding issues to track as long as you don’t mind they may never be fixed :-P

    Seriously though, I found QuickText the most “useful” snippet plugin for how I worked and 2 things happened, I moved to 64-bit and Notepad++ updated Scintilla - both of which “broke” my usage of QuickText. I hacked at it with my sub-par C++ skills and was able to get 64-bit compiled with the new N++ plugin architecture and Scintilla updates so was pleased to just keep using it.

    I haven’t given much thought to how I’d re-architect QuickText to address some of my minor gripes, but as it is now, it just “works” so I leave it alone.

    I’m “more actively” updating “my” other plugins - again, none of these are “mine”, they are clones of other people’s work that either seemed abandoned, not updated in years or my request for features were turned down, so I implemented them myself. For the same reason as QuickText, I’m hesitant on listing them officially.

    But for “power users” like yourself, that can stand a bit of “buginess” and hopefully no seg-fault crashes, feel free to try them out. Again, feedback welcomed (but possibly ignored :-) (coding N++ plugins isn’t my day job).

    Cheers.



  • @PeterJones said in How to create abbreviations for java code:

    I can add them.

    5 issues!?!?! WOW, I should have said “no issues please!” LOL.

    Joking aside, thanks for taking a look and taking the time to do the write-ups. I think 11 is an easy fix, 12 I’ve notice myself and just lived with it by editing the QuickText.ini file directly to add multiple new snippets. 13 I didn’t realize, although GLOBAL tags didn’t work at all in previous original versions. 14 and 15 - dealing with Unicode scare me :-(

    I’ll probably approach in what I think is easiest: 11, 13, 12 and back burner 14 and 15 for now.

    Cheers.



  • @Michael-Vincent said in How to create abbreviations for java code:

    I should have said “no issues please!” LOL.

    I tried to warn you. ;-)

    None are showstoppers for me. Until I train myself to actually use the quick text snippets, they won’t be efficiency stoppers.

    And I have a pythonscript implementation of #15, so for now I have a workaround on that one: gist for pyscReplaceBackslashSequence.py (the mention of nppQuickText actually interrupted my development, while I explored to see if it would be enough for me; I ended up finalizing my script anyway)



  • @PeterJones said in How to create abbreviations for java code:

    actually interrupted my development, while I explored to see if it would be enough for me

    I hear that. Frequently I’ll wish there was a quicker way to do something or something I’ll see a peer doing in VS Code and I’ll think “there must be a Notepad++ way to do this”. I’ll get sidetracking trying to find something.

    I’ll look for a plugin or look for a way to script it in NppExec (my goto scripting engine). In fact I have a bunch of NppExec scripts (compile, style, help manual / docs, run, debug, open include files) that do a bit of formatting then send arguments to a monster Windows batch file that actually executes the task.

    Sometime a find a plugin that’s promising, but it doesn’t do everything or it’s just 32-bit and then I’ll find myself cloning and hacking at it (JAPH, or in this case JAN++PH [Just Another Notepad++ Plugin Hacker]) to get what I want. That’s how all of “my” plugins came to be.

    Cheers.



  • Hello, @michael-vincent, @peterjones and All,

    First, many thanks for building an x64 version of the QuickText plugin and for all the bug fixes

    May I bother you, a little bit, with a couple of weird things, still occurring in your last 0.1.2.4 version ?


    A) : First problem :

    • Let suppose that you place the caret right after a word, which is not a tag, for the current language

    • If you run the option Plugins > QuickText > Replace Tag, it writes :

      • The » character, in an ANSI encoded file ( An \xbb byte )

      • The value xBB, in reverse video, in any Unicode encoded text ( Indeed, this single byte is not valid in an Unicode file ! )

    This also happens if you run the Plugins > QuickText > Replace Tag option anywhere inside some blank range of text or even in an empty text. Is it the normal behaviour or is it a bug, due to my old Win XP SP3 laptop ?!


    B) Second problem :

    • Let’s suppose that the tags file QuickText.ini is opened, with other tabs, in your current N++ session

    • Then, you decide to delete the only tab ( copyright ) of the GLOBAL section, using the Plugins > QuickText > Options... option. After validating the suppression :

      • If the current tab is the QuickText.ini you must, first, switch to an other tab
    • Now, switch to the QuickText.ini tab to get the expected dialog : “This file has been modified by another program, do you want to reload it ?”

    • After a click on the Yes button of this dialog, you can notice that the layout of the sections of QuickText.ini has become completely different !

      • All the ini sections, which do not have any tag, have been deleted, including the [255] GLOBAL one, of course

      • From now on, the different sections are sorted alphabetically and NOT  numerically


    C) Third problem :

    • Let’s suppose that you change the TEXT section as below :
    [0]
    LANGUAGE_NAME=TXT
    LANGUAG_NAME=TXT_1
    LANGUAGES_NAME=TXT_2
    
    • After saving these changes, run the Plugins > QuickText > Refresh Configuration option

    • Then, paste the text, below, in a new text tab :

    aaaaa    LANGUAGE_NAME     zzzzz
    aaaaa    LANGUAG_NAME      zzzzz
    aaaaa    LANGUAGES_NAME    zzzzz
    
    • And run the option Plugins > QuickText > Replace Tag for each word in capitals

    We get :

    aaaaa    LANGUAGE_NAMExBB     zzzzz
    aaaaa    TXT_1      zzzzz
    aaaaa    TXT_2    zzzzz
    

    I would have expected that the LANGUAGE_NAME tag would have been expanded to the string TXT OR to the current language, for any language different of Normal Text

    BTW, why, in [0] section, the LANGUAGE_NAME is expanded to TXT whereas the language is TEXT ?


    D) To end with , a possible improvement :

    • It would be better to include all the other languages, with code over 49, giving the following default QuickText.ini file :
    [0]
    LANGUAGE_NAME=TXT
    
    [1]
    LANGUAGE_NAME=PHP
    for.sl=for (\$i = 0; \$i < $; ++\$i)\n	$
    for.ml=for (\$i = 0; \$i < $; ++\$i)\n{\n	$\n}
    foreach.sl=foreach (\$$ as \$k => \$v)\n	$
    foreach.ml=foreach (\$$ as \$k => \$v)\n{\n	$\n}
    function.public=public function $($)\n{\n	$\n}
    function.protected=protected function $($)\n{\n	$\n}
    function.private=private function $($)\n{\n	$\n}
    function.public.static=public static function $($)\n{\n	$\n}
    function.protected.static=protected static function $($)\n{\n	$\n}
    function.private.static=private static function $($)\n{\n	$\n}
    
    [2]
    LANGUAGE_NAME=C
    case=case $: $\n$
    def=#define $\n$
    default=default $: $\n$
    dowhile=do\n{\n	$\n}\nwhile ($);\n$
    dowhiles=do\n	$\nwhile ($);\n$
    else=else\n{\n	$\n}\n$
    elseif=else if ($)\n{\n	$\n}\n$
    elseifs=else if ($)\n	$\n$
    elses=else\n	$\n$
    for=for ($;$;$)\n{\n	$\n}\n$
    fors=for ($;$;$)\n	$\n$
    func=$ $($)\n{\n	$\n	return $;\n}\n$
    if=if ($)\n{\n	$\n}\n$
    ifelse=if ($)\n{\n	$\n}\nelse\n{\n	$\n}\n$
    ifelses=if ($)\n{\n	$\n}\nelse\n	$\n$
    ifs=if ($)\n	$\n$
    ifselse=if ($)\n	$\nelse\n{\n	$\n}\n$
    ifselses=if ($)\n	$\nelse\n	$\n$
    inc=#include <$>\n$
    incl=#include "$"\n$
    main=int main(int argc, char* argv[])\n{\n	$\n}\n
    switch=switch ($)\n{\n	$\n}\n$
    while=while ($)\n{\n	$\n}\n$
    whiles=while ($)\n	$\n$
    
    [3]
    LANGUAGE_NAME=CPP
    case=case $: $\n$
    class=class $ {\nprivate:\n	$\nprotected:\n	$\npublic:\n	$\n};\n$
    def=#define $\n$
    default=default $: $\n$
    dowhile=do\n{\n	$\n}\nwhile ($);\n$
    dowhiles=do\n	$\nwhile ($);\n$
    else=else\n{\n	$\n}\n$
    elseif=else if ($)\n{\n	$\n}\n$
    elseifs=else if ($)\n	$\n$
    elses=else\n	$\n$
    for=for ($;$;$)\n{\n	$\n}\n$
    fors=for ($;$;$)\n	$\n$
    func=$ $($)\n{\n	$\n	return $;\n}\n$
    hclass=#ifndef $\n#define $\n\nclass $ {\nprivate:\n	$\nprotected:\n	$\npublic:\n	$\n};\n\n#endif\n$
    if=if ($)\n{\n	$\n}\n$
    ifelse=if ($)\n{\n	$\n}\nelse\n{\n	$\n}\n$
    ifelses=if ($)\n{\n	$\n}\nelse\n	$\n$
    ifs=if ($)\n	$\n$
    ifselse=if ($)\n	$\nelse\n{\n	$\n}\n$
    ifselses=if ($)\n	$\nelse\n	$\n$
    inc=#include <$>\n$
    incl=#include "$"\n$
    main=int main(int argc, char* argv[])\n{\n	$\n}\n
    switch=switch ($)\n{\n	$\n}\n$
    while=while ($)\n{\n	$\n}\n$
    whiles=while ($)\n	$\n$
    
    [4]
    LANGUAGE_NAME=CS
    
    [5]
    LANGUAGE_NAME=OBJC
    
    [6]
    LANGUAGE_NAME=JAVA
    
    [7]
    LANGUAGE_NAME=RC
    
    [8]
    LANGUAGE_NAME=HTML
    a-id=<a id="$" href="$">$</a>
    b=<b>$</b>
    body=<body>\n	$\n</body>\n$
    body-id=<body id="$">\n	$\n</body>\n$
    br=<br />
    color.black=#000000
    color.blue=#0000FF
    color.cyan=#00FFFF
    color.green=#00FF00
    color.grey=#C0C0C0
    color.mangenta=#FF00FF
    color.white=#FFFFFF
    color.yellow=#FFFF00
    comment=<!-- $ -->\n$
    div-class=<div class="$">\n</div>
    div-id=<div id="$">\n</div>
    div-id-class=<div id="$" class="$">\n	$\n</div>
    div.p=<div class="p">\n	$\n</div>
    doctype.html.4.loose=<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"\n	"http://www.w3.org/TR/html4/loose.dtd">
    doctype.html.4.strict=<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"\n	"http://www.w3.org/TR/html4/strict.dtd">
    doctype.xhtml.1.0.loose=<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"\n	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    doctype.xhtml.1.0.strict=<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"\n	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    doctype.xhtml.1.1=<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"\n	"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    fieldset=<fieldset class="$">\n	$\n</fieldset>
    form=<form name="$" action="$">\n	$\n</form>\n$
    h1=<h1>$</h1>
    h2=<h2>$</h2>
    h3=<h3>$</h3>
    h4=<h4>$</h4>
    h5=<h5>$</h5>
    h6=<h6>$</h6>
    head=<head>\n	$\n</head>\n$
    html-body=<html>\n<head>\n		<title>$</title>\n	$\n	</head>\n	<body>\n	$\n	</body>\n</html>
    i=<i>$</i>$
    img=<img src="$" alt="$" />\n$
    input=<input type="$" name="$" />\n$
    li=<li>$</li>
    lil=<li>\n	$\n</li>
    link=<a href="$">$</a>$
    ol=<ol>\n	<li>$</li>\n</ol>
    p=<p>\n	$\n</p>
    pre=<pre>$</pre>\n$
    pre-class=<pre class="$">\n	$\n</pre>
    prel=<pre>\n	$\n</pre>
    span=<span>$</span>
    table-id=<table id="$">\n	<tr>\n		<td id="$">\n			$\n		</td>\n	</tr>\n</table>
    td=\n<td>\n	$\n</td>
    title=<title>$</title>\n$
    tr=\n<tr>\n	$\n</tr>
    ul=<ul>\n	<li>$</li>\n</ul>
    url=http://
    www=http://www.
    
    [9]
    LANGUAGE_NAME=XML
    
    [10]
    LANGUAGE_NAME=MAKEFILE
    
    [11]
    LANGUAGE_NAME=PASCAL
    
    [12]
    LANGUAGE_NAME=BATCH
    
    [13]
    LANGUAGE_NAME=INI
    
    [14]
    LANGUAGE_NAME=NFO
    
    [15]
    LANGUAGE_NAME=USER
    
    [16]
    LANGUAGE_NAME=ASP
    
    [17]
    LANGUAGE_NAME=SQL
    
    [18]
    LANGUAGE_NAME=VB
    
    [19]
    LANGUAGE_NAME=JS
    for.sl=for (var i = 0; i < $; ++i)\n	$
    for.ml=for (var i = 0; i < $; ++i)\n{\n	$\n}
    foreach.sl=for (var x in $)\n	$
    foreach.ml=for (var x in $)\n{\n	$\n}
    
    [20]
    LANGUAGE_NAME=CSS
    
    [21]
    LANGUAGE_NAME=PERL
    Dumper=use Data::Dumper; \$Data::Dumper::Sortkeys=1; print Dumper \ $; exit;$
    csv=my \$csv = Text::CSV->new( {sep_char => ',', binary => 1} )\n  or die Text::CSV->error_diag;\n\nopen my \$fh, '<', \$$\n  or die "\$!";\n\nwhile ( my \$row = \$csv->getline(\$fh) ) {\n    $\n}\nif ( not \$csv->eof ) {\n    my ( \$cde, \$str, \$pos ) = \$csv->error_diag;\n}\n$
    else=else {\n    $\n}\n$
    elsif=if ( $ ) {\n    $\n} elsif ( $ ) {\n    $\n} else {\n    $\n}\n$
    for=for my \$$ ( $ ) {\n    $\n}\n$
    if=if ( $ ) {\n    $\n}\n$
    ifelse=if ( $ ) {\n    $\n} else {\n    $\n}\n$
    mlread=my \$START = '$';\nmy \$STOP  = '$';\nmy \$INCLUDE_START = $1;\nmy \$INCLUDE_STOP  = $1;\nmy @data;\nfor ( $ ) {\n    if ( /\$START/ .. /\$STOP/ ) {\n        next if ( not \$INCLUDE_START and /\$START/ );\n        push @data, \$_ unless ( not \$INCLUDE_STOP and /\$STOP/ );\n        process_data() if ( /\$STOP/ );\n        next;\n    }\n    process_nodata();\n}\nprocess_data\n\nsub process_data {\n    return if not @data;\n    # operate on @data\n    $\n    @data = ();\n}\n\nsub process_nodata {\n    # operate on \$_\n    $\n}\n$
    open=open my \$fh, '<', \$$;\nmy @lines = <\$fh>;\nclose \$fh;\n$
    package=package $;\nuse Class::Struct;\nstruct( $ => '\$', $ => '@', $ => '$Module::Name' );\n1;\n$
    sopen=my \$lines;\n{\n    local \$/ = undef;\n    open my \$fh, '<', \$$;\n    \$lines = <\$fh>;\n    close \$fh;\n}\n$
    start=#!perl\n\nuse strict;\nuse warnings;\n\n$
    sub=sub $ {\n    my (\$$) = @_;\n\n    $\n}\n$
    wantarray=my @rets;\nmy \$retType = wantarray;\n\nif ( not defined \$retType ) {\n    print "$@rets";\n} elsif (\$retType) {\n    return @rets;\n} else {\n    return \@rets;\n}\n$
    while=while ( $ ) {\n    $\n}\n$
    
    [22]
    LANGUAGE_NAME=PYTHON
    
    [23]
    LANGUAGE_NAME=LUA
    
    [24]
    LANGUAGE_NAME=TEX
    
    [25]
    LANGUAGE_NAME=FORTRAN
    
    [26]
    LANGUAGE_NAME=BASH
    
    [27]
    LANGUAGE_NAME=FLASH
    
    [28]
    LANGUAGE_NAME=NSIS
    
    [29]
    LANGUAGE_NAME=TCL
    else=} else {\n $
    foreach=foreach $ $ {\n $\n}\n$
    if=if { $ } {\n $\n}\n$
    ifelse=if { $ }\n $\n} else {\n $\n}
    proc=# $\nproc $ { $ } {\n $\n}\n$
    regsub=regsub -all {$} "$" {$} $\n$
    
    [30]
    LANGUAGE_NAME=LISP
    
    [31]
    LANGUAGE_NAME=SCHEME
    
    [32]
    LANGUAGE_NAME=ASM
    
    [33]
    LANGUAGE_NAME=DIFF
    
    [34]
    LANGUAGE_NAME=PROPS
    
    [35]
    LANGUAGE_NAME=PS
    
    [36]
    LANGUAGE_NAME=RUBY
    
    [37]
    LANGUAGE_NAME=SMALLTALK
    
    [38]
    LANGUAGE_NAME=VHDL
    Ris=Rising_Edge ( $ )$
    access=type $ is access $;\n$
    alias=alias $ is $;\n$
    archi=architecture $ of $ is\n$\nbegin\n$\nend $;\n$
    array=type $ is\n array ( $ ) of $;\n$
    assert=assert ( $ )\n report "$"\n sevrity $;\n$
    block=$ : block $\nbegin\n $\nend block $;\n$
    case=case $ is\n when $ =>\n $;\n when others =>\n $;\nend case;\n$
    com=--\n-- $\n--
    component=component $\n port (\n $\n );\nend component $;\n$
    config=for $ : $\n use $\n $;\n$
    constant=constant $: $;\n$
    elsif=elsif ( $ ) then\n $;
    entity=entity $ is\n port (\n $\n );\nend $;\n$
    enum=type $ is ( $, $ );
    exit=exit $ when $;\n$
    file=file $ : $ is $;\n$
    for=$ : for $ in $ downto $ loop\n $;\nend loop $;\n$
    function=function (\n $\n )return $ is\n $\nbegin\n $\nend $;
    functiond=function $ (\n $\n) return $;\n$
    geneif=$ : if ( $ = $ ) generate\n $\nbegin\n $\nend generate $;
    generate=$ : for $ in $ downto $ generate\n $\nbegin\n $\nend generate $;\n$
    generic=generic (\n $\n );\n$
    genmap=generic map (\n $\n)\n$
    group=group $ is ( $ );\n$
    ieee=library ieee;\n use ieee.std_logic_1164.all;\n $
    if=if ( $ ) then\n $;\n$end if;\n$
    ifelse=if ( $ ) then\n $\nelse\n $\nend if;\n$
    ifelsif=if ( $ ) then\n $\nelsif ( $ )\n $\nend if;\n$
    loop=$ : loop\n $\nend loop;\n$
    map=$ : $\n port map (\n $\n );\n$
    mapgen=$ : $\n generic map (\n $\n )\n port map (\n $\n );\n$
    next=$ : next $ when $;\n$
    numeric=use ieee.numeric_std.all;\n$
    pack=package $ is\n $\nend package $;\n\npackage body $ is\n $\nend package body $;\n$
    port=port (\n $\n );\n$
    procedure=procedure $ (\n $\n ) is\n$\nbegin\n $\nend procedure $;\n$
    procedured=procedure $ (\n $\n);\n$
    process=$ : process ( $ )\nbegin\n $\nend process $;\n$
    proclk=$ : process ( $, $ )\n begin\n if ( $ = '$' ) then\n $ <= $;\n elsif( Rising_Edge( $ ) ) then\n $\n end if;\nend process $;
    protected=protected\n $\nend protected ;
    record=type $ is\n record\n $ : $ ;\nend record $;\n$
    start=library ieee;\n use ieee.std_logic_1164.all;\n\nentity $ is\n port (\n $\n );\nend $;\n\narchitecture $ of $ is\n$\nbegin\n$\nend $;\n$
    std=signal $ : std_logic$;\n$
    stdpi=$ : in std_logic;\n$
    stdpio=$ : inout std_logic;\n$
    stdpo=$ : out std_logic;\n$
    stdtextio=use ieee.std_logic_textio.all;\n$
    stdv=signal $ : std_logic_vector( $ downto 0);\n$
    stdvar=variable $ : std_logic;\n$
    stdvpi=$ : in std_logic_vector( $ downto $);\n$
    stdvpio=$ : inout std_logic_vector( $ downto $);\n$
    stdvpo=$ : out std_logic_vector( $ downto $);\n$
    stdvvar=variable $ : std_logic_vector( $ downto 0);\n$
    subtype=subtype $ is $;\n$
    textio=use std.textio.all;\n$
    units=units\n $;\nend units;\n$
    waitf=wait for $;\n$
    waitu=wait until $;\n$
    waituf=wait until $ for $;\n$
    when=when $ =>\n $;$
    whene=when ( $ ) else $;
    while=$ : while $ loop\n $;\nend loop;\n$
    x=x"$"$
    
    [39]
    LANGUAGE_NAME=KIX
    
    [40]
    LANGUAGE_NAME=AU3
    
    [41]
    LANGUAGE_NAME=CAML
    
    [42]
    LANGUAGE_NAME=ADA
    
    [43]
    LANGUAGE_NAME=VERILOG
    
    [44]
    LANGUAGE_NAME=MATLAB
    
    [45]
    LANGUAGE_NAME=HASKELL
    
    [46]
    LANGUAGE_NAME=INNO
    
    [47]
    LANGUAGE_NAME=SEARCHRESULT
    
    [48]
    LANGUAGE_NAME=CMAKE
    
    [49]
    LANGUAGE_NAME=YAML
    
    [50]
    LANGUAGE_NAME=COBOL
    
    [51]
    LANGUAGE_NAME=GUI4CLI
    
    [52]
    LANGUAGE_NAME=D
    
    [53]
    LANGUAGE_NAME=POWERSHELL
    
    [54]
    LANGUAGE_NAME=R
    
    [55]
    LANGUAGE_NAME=JSP
    
    [56]
    LANGUAGE_NAME=COFFEESCRIPT
    
    [57]
    LANGUAGE_NAME=JSON
    
    [58]
    LANGUAGE_NAME=JAVASCRIPT
    
    [59]
    LANGUAGE_NAME=FORTRAN_77
    
    [60]
    LANGUAGE_NAME=BAANC
    
    [61]
    LANGUAGE_NAME=SREC
    
    [62]
    LANGUAGE_NAME=IHEX
    
    [63]
    LANGUAGE_NAME=TEHEX
    
    [64]
    LANGUAGE_NAME=SWIFT
    
    [65]
    LANGUAGE_NAME=ASN1
    
    [66]
    LANGUAGE_NAME=AVS
    
    [67]
    LANGUAGE_NAME=BLITZBASIC
    
    [68]
    LANGUAGE_NAME=PUREBASIC
    
    [69]
    LANGUAGE_NAME=FREEBASIC
    
    [70]
    LANGUAGE_NAME=CSOUND
    
    [71]
    LANGUAGE_NAME=ERLANG
    
    [72]
    LANGUAGE_NAME=ESCRIPT
    
    [73]
    LANGUAGE_NAME=FORTH
    
    [74]
    LANGUAGE_NAME=LATEX
    
    [75]
    LANGUAGE_NAME=MMIXAL
    
    [76]
    LANGUAGE_NAME=NIMROD
    
    [77]
    LANGUAGE_NAME=NNCRONTAB
    
    [78]
    LANGUAGE_NAME=OSCRIPT
    
    [79]
    LANGUAGE_NAME= REBOL
    
    [80]
    LANGUAGE_NAME=REGISTRY
    
    [81]
    LANGUAGE_NAME=RUST
    
    [82]
    LANGUAGE_NAME=SPICE
    
    [83]
    LANGUAGE_NAME=TXT2TAGS
    
    [84]
    LANGUAGE_NAME=VISUALPROLOG
    
    [85]
    LANGUAGE_NAME=EXTERNAL
    
    [255]
    LANGUAGE_NAME=GLOBAL
    copyright=Copyright (C) $ 20$\n\nhttp://$\n\nAll rights reserved\n$
    

    Thanks for taking the time to read this post through to the end ;-))

    Best Regards,

    guy038



  • @guy038

    A) This does not happen for me. It is probably as expected for now since I always use ANSI encoded files and my QuickText.ini is ANSI encoded. As @PeterJones documented in the GitHub issues, UNICODE does not work in this plugin and since there is a mess of someone else’s old code, I’m not prioritizing fixing that - sorry.

    B) The tab switching to get the change notification happens for me with any file in N++. Not sure that’s related. The order of sections is as expected as well since when the file is rewritten, it’s written according to looping through the C++ vector storing the languages - I don’t believe any sort is applied. So however they are in there, they are written out. I’ll see if there’s a way to easily sort, but I don’t think it’s necessary.

    C) LANGUAGE_NAME is not a tag. It’s a comment. The original version didn’t even check for it so if yo had them, they would show up as tags. I ignored them originally, but then they weren’t rewritten to the file on save so disappeared. Now I purposefully placed them back in, but they should never be visible in the Options dialog as Tags to expend. I’ll see if I can make that more clear by making them #LANGUAGE_NAME. So the behavior if replacing tags is as expected, the first one does not expand since it is not a valid tag (not seen in Options dialog) and you’re hitting the issue in A) about encoding. The second and third don’t match the regex I look to ignore for comments so show up as valid tags and are expanded.

    D) I think would be too difficult to implement as I’d need to track all languages with some placeholder in the vector even though they don’t have tags. And as in B), they certainly wouldn’t stay in order.

    Hope that helps explain some of the behavior. I’ll see about changing C) to make the comment more obvious but I don’t think the rest will be fixed anytime soon unfortunately. I just don’t have the skills or time for that kind of re-write.

    Cheers.



  • Hi, @michael-vincent, @peterjones and All,

    Many thanks for your prompt reply :

    Regarding point A) :

    In fact , I don’t really mind about this QuickText.dll behaviour, when trying to run the Plugins > QuickText > Replace Tag option, with caret close to a word which is not a tag, for current language. But, out of curiosity, what happens when using the Replace Tag option, in your system ?

    BTW, as my settings for Setting > Preferences... > new Document > Encoding is UTF_8, with the Applied to opened ANSI files option ticked AND as the QuickText.ini file does not have any character with Unicode code-point over \x007F, the chosen encoding for the QuickText.ini file is always UTF_8, when starting N++ !

    Even if I force the QuickText.ini to have an ANSI encoding, I still get the xbb character, in reverse video, if current fie is Unicode encoded or the » character if current file is ANSI encoded !

    Regarding point B) :

    I just wanted to emphasize that, after suppression of the unique global tag copyright, in addition to all the changes of the QuickText.in file, which occurs, if the current N++ file is QuickText.ini file, then the update dialog does not appear. You’ll need to switch to any other tab and, then, switch back to the QuickText.ini to get this dialog !!

    Regarding point C) :

    Ah…OK, I understand ! And you’re right : probably the syntax #LANGUAGE_NAME would remove the ambiguity !

    Regarding point D

    Oh ! I was not asking for a dynamic and updated list of all N++ possible languages, at any time, but, only, for a static updated list of present languages, used in the v7.8.4 release !

    Cheers,

    guy038



  • @guy038

    Thanks for the feedback. Let me try to explain further.

    A)
    When using either the menu option Plugins > QuickText > Replace Tag or the shortcut key I have mapped to that (which is Tab) anywhere in a document I just get a ‘tab’ inserted (which I have N++ converting into 4 spaces). The same goes for in proximity to a tag. If my caret is adjacent to the end of a tag word for the current doc type, then the hotkey or the menu option both perform as expected - expanding the tag without insertion of any weird characters.

    Note my default file type in N++ is ANSI and when I menu option Plugins > QuickText > Open Tags File, that opens as ANSI as well.

    I’m still thinking this is an ANSI / Unicode thing, but it could also be the shortcut key you have mapped to the menu option, unless just using the menu option directly still produces the weird character insertion. If that’s the case, I’m sticking with my ANSI / Unicode issue which @PeterJones describes in GitHub issues 14 and 15.

    B)
    I believe this is just default behavior of N++. Proof of concept: create 2 files:

    %TEMP%\deleteme.txt:

    this file will be deleted
    

    %TEMP%\deleteme.bat:

    @echo off
    REM this is a 7 second sleep
    ping -n 7 localhost > NUL
    del %TEMP%\deleteme.txt
    

    Open %TEMP%\deleteme.txt in N++. In a command prompt, run the deleteme.bat file and while it’s doing its 7 second sleep, click back to N++ and activate the tab with deleteme.txt. You’ll notice nothing happens. Even after the batch file completes and deletes the file you’re looking at, N++ does nothing. You’ll need to click a different tab and the click back to the deleteme.txt tab for N++ to prompt that the file has changed do you want to reload from disk.

    I see this as the same. You have QuickText.ini open. You make a change which rewrites it. Unless you somehow reactivate the tab with QuickText.ini in it (click off it than back on it) you won’t get the N++ reload from disk prompt.

    C)
    I made that change and pushed to GitHub. There is no precompiled release, you’ll need to compile yourself. Note there are other changes you may need to manually make like removing the hash “#” as an allowedChar from your plugins/config/QuickText.conf.ini file and manually adding the hash “#” in front of all the LANGUAGE_NAME= in your plugins/QuickText/QuickText.ini file. For new installs, you won’t need to do this, but if you already have an install, you probably need to. Sorry.

    D)
    Again, this is someone else’s code that I understand about 10% of and given my poor C++ skills, I don’t really know how to improve it (i.e., GitHub issues 14 and 15 mentioned above). The tags are read into memory and are not read on demand from the file. So when reading in the tags, if a language does not have a tag, there is no entry created in the C++ vector in memory. Now when it comes time to save the file, we use an “iterator” to go through the C++ vector in memory (which no longer has any of the languages that had no tags) and it goes in whatever order a C++ iterator does (I have no idea how to make it sort nicely). In fact, like I said previously, there was no place in the memory list to store the LANGUAGE_NAME so when the file was rewritten, all that was lost. I just added that back in as part of these latest fixes.

    You can see all this in the GitHub:
    https://github.com/vinsworldcom/nppQuickText/blob/develop/lib/INIMap.cpp

    Here we have the regex when reading the tags in to ignore the LANGUAGE_NAME - now with the hash “#” to make like a coment.

    Here we have the WriteFile() routine that saves the tags file. You’ll see I had to add the “lang_menu” argument as input so I could map to the language name by ID and get the #LANGUAGE_NAME= rewritten (which wasn’t there in the original code. Also you can see the for() loop base on an iterator. It’s iterating through a data structure with key/value pairs so not easy for me to just us a for() loop with index to loop through all languages and write them to file regardless of whether they have tags or not. It could be possible, but beyond my abilities.

    All this to say I was surprised to see that this is in the Plugins Admin - I probably never noticed since I already had it installed, it never showed as “available” for me. This isn’t “my” code, just my improvements to work for me which I’m happy to share, but purposely didn’t publish myself knowing there were shortcomings / bugs / etc. that when exposed to a wider audience, people would want fixed, but would be beyond my capabilities (i.e., time, skills, general code-base understanding).

    Hope that helps clarify things.

    Cheers.


Log in to reply