Highlighting matched single and double quotes.
-
Hello,
This is my first post here.
I have just installed Notepad++ V7.7.1.
I note that it matches braces, brackets, curly braces by highlighting. This is a great help in editing and writing code.However, it does not do this for singe and double quotes
Is there as setting, coding, plug-in or some other way of adding this feature? -
from core scintilla it is not supported but I’m unaware if some plugin is out there which simulates this behavior.
Especially for quotes and double quotes it is hard to determine whether the one at the current position is used as the opening or closing mark. -
Thank y9ou for that reference.
I understand that with braces etc. nesting may be accomplished, therefore, searching for a close brace is in order.However, single and double quotes cannot be nested and a simple search for the next occurrence from every second entry would suffice.
Also, a total sum of single and double quotes in a document would prove that each occurrence is matched (of course not known if correctly matched). -
@Frank-Hutterer said:
However, single and double quotes cannot be nested
I disagree. Just because the programming language you happen to use happens to make you think it does not allow nesting of quotes does not mean that no one who uses Notepad++ for a variety of programming and other text editing needs will ever need to nest quotes.
In writing us-en dialog, it’s pretty easy to nest quotes:
George said, "did you hear, John asked 'why did you say "the end is nigh"?'".
And in any programming language I’ve used, there have been ways to nest and/or escape quotes, not all of which have to be balanced:
printf("Hello, world. I said \"Hello, world\"! Notice my unbalanced quote '\"' embedded in this string\n");
. -
I must admit, since I am using TCL/TK a lot, quotes cannot be nested (except for delimited ones), I assumed that other languages would do the same.
However, I don’t see the nesting in your examples. I didn’t think that single quotes inside double quotes is nesting, like brackets inside braces I don’t think of as nesting. Braces inside braces or brackets inside brackets I call nesting.
Checking Notepad++ now, I notice that it highlights delimited braces etc as valid matches. This makes debugging complicated due to incorrect highlighting of matching. Due to this problem it doesn’t really matter that there is no highlighting for matched quotes anyway.
I do take your point that there may be languages that do allow nesting of quotes.
-
Just checked NPP for highlighting of matched braces etc. in another language and disregards delimited braces. Therefore, NPP matches correctly depending on the language.
-
@Frank-Hutterer said:
I don’t see the nesting in your examples
Seriously?
"did you hear, John asked 'why did you say "the end is nigh"?'"
Seems pretty clear to me the
the end is nigh
's quoting is nested inside the quoting of the whole thing.The rest of your posting doesn’t make much sense to me either; guess I just don’t “get it”.