[Feature Request] Intelligent delimiters insert



  • Hi,

    I’d like to suggest to add option to use “Intelligent” insert of delimiters, when I type it right before/after word/character. As optional setting per delimiter, or just one for all of them in menu Settings -> Preferences -> Auto-Completion ->Auto-Insert.

    When I type delimiter (let’s say quotes) out of word (not right before/after word) it works just fine:

    "" word ""
    

    Let’s say I want just put existing word to quotes. So we have:

    word
    

    Now when I try to add quotes(or any other delimieter) right before/after word, it will add also one more quote like this:

    word""
    ""word
    

    But I’d like if now it will add only one delimiter = don’t use auto-insert now:

    word"
    "word
    


    Thank you for considering it.


    Best regards,
    Tomas



  • Could you try this binary and tell me what you think?
    https://notepad-plus-plus.org/temp/npp.zip



  • @donho Looks like Google has disabled that link :(



  • @dail Fixed. Thank you for noticing.



  • This has also annoyed me for quite a while so I’m glad to see something like this. This is much nicer than before. One thing I’d suggest is how you determine when you are “next” to something. For example, try to type:

    puts("string")

    The second parenthesis is auto-inserted, which is great, but once you type the " it does not auto insert the second quote since it thinks it is “next” to something.

    Also, on a side note, I’ve noticed some editors auto-wrap (not sure what a good terminology is) when you have something selected. For example if you select a string such as string and then type a " it would become "string". Same goes for parenthesis, brackets, etc. Makes it much easier to edit in certain cases. :)



  • @donho : Thank you very much! Tested, and it works perfectly.

    One more question: Do you prefer to post suggestions/bugs here on community, or on GitHub? So I know what is better for you, not to complicate things.
    If here, maybe it would be nice to have separated section for it? Or maybe even type of comments, so I can set it as resolved ;). Something like questions. But maybe I’m just thinking too much ;).

    @dail : Sure, it would be also nice feature, to close selected text to typed delimiter.

    Also one more suggestion for this feature in auto-insert for html/xml close tag. Let’s say we have any xml:

    <node name="abc"/>
    

    Then I’d like to add > as value, right after c. Or better say to “value” part. Just to use it while writing regular expression etc… I will get:

    <node name="abc></node>"/>
    


    So maybe to ignore this feature even in this case. Sure it’s not best to add non-xml-correct character as value. But I type it normal way. And after it’s done, I use plugin XML Tools -> Convert selection XML to text (). But on the other hand, maybe this is just my different approach, that is not needed globally. Still maybe also others would like to don’t auto-close xml tag while in value area?