[New Plugin] ComparePlus v1.0.0
-
@guy038 said in [New Plugin] ComparePlus v1.0.0:
the parameter to use is -nosession ( and not -noSession )
You’re right. However, I will take the opportunity to say that it is a bit odd that it is this way (all lowercase) when,
-openSession
(one I use often) is mixed case. -
@guy038 said in [New Plugin] ComparePlus v1.0.0:
don’t bother about my previous post ! No need to investigate further about the provided cases. The solution was obvious
I don’t know that I agree fully with that.
It seems reasonable to want to do a command line compare and start the compare automatically between the 2 files where the files are loaded into a running Notepad++'s current session.
Of course, a user doing this would probably want to close the 2 files when they are done analyzing the compare, to avoid the files remaining in the remembered session, but even that is not a certaintly.
I suppose
-nosession
is ignored if N++ is already running (with a session) and another command line invocation ofnotepad++.exe
occurs (without-multiInst
).Maybe that’s the ultimate solution for something like a “git difftool” solution using this new plugin capability: using
-multiInst -nosession -pluginMessage=compare
… -
-
@pnedev said in [New Plugin] ComparePlus v1.0.0:
Try removing the quotes from compare - run it like that:
–pluginMessage=compareSo is this actually a bug in the ComparePlus plugin?
(I don’t mean the--
part, which obviously should have just been-
, I mean the lack of quotes)From the description in the N++ user manual HERE, I’d say a correct argument looks like this:
-pluginMessage="compare filepath1 filepath2"
(And of course, if either of the filepaths contains spaces, then my brain is starting to hurt, but…)
Does it work without the double quotes because it must be used as the last argument on the N++ command line, and anything after
-pluginMessage=
is passed to the plugin and not looked at at all by N++?And how does N++ know that this specific one is meant for the ComparePlus plugin? Or does this same message get sent to all plugins? (that would strike me as “not a good thing”)
-
Hello, @pnedev, @alan-kilborn and All,
Alan, I did some tests with files with a space character. If I assume that no instance of Notepad++ is running before each test, the command line behavior of the
Compare-plus
plugin is presently :-
notepad++ -nosession -pluginMessage=compare "E:\844_x64\cha nge.log" "E:\844_x64\cop ie.log"
opens a new instance of N++ with the two tabscha nge.log
andcop ie.log
only which are correctly compared -
notepad++ -nosession -pluginMessage="compare E:\844_x64\cha nge.log E:\844_x64\cop ie.log"
opens a new instance of N++ with thenew 1
tab only -
notepad++ -nosession -pluginMessage="compare" "E:\844_x64\cha nge.log" "E:\844_x64\cop ie.log"
opens a new instance of N++ with the two tabscha nge.log
andcop ie.log
only but without any comparison process
Best Regards,
guy038
-
-
Your analysis is good to know, and thank you, but lest anyone think your reply fully answers my questions, it does not. If no one else replies, then perhaps to get to the bottom of it, a dive into the source code for Notepad++ is going to be in order.
-
The compare trigger is
-pluginMessage=compare
exactly (thanks for the double--
notice. The quotes must be omitted from the plugin message.
All plugins (that care about it) may parse the string after the equality sign (so the stringcompare
gets to all plugins that care to check it). This should not be a problem and ComparePlus cannot avoid that.
The right way to go is to compare the files that are given on the command line but outside thepluginMessage
string. That is because this way Notepad++ actually opens the files automatically and I don’t have to open them myself :) (which is of course not that much of a problem but its better to leave that to Notepad++) and because of the spaces in the files (or their path) as you mentioned although that might be avoided as in Python by using single quotes for example.My idea was to give the user a way to quickly and directly trigger compare from the command line and not to do some sophisticated things (at least that was the initial intention).
I am working on the sessions problem and which file is the first and the second and which of the two is considered the new and which the old. Other than that I don’t intend to change the compare process trigger (that is the-pluginMessage=compare
option) as it serves its purpose. If you think it is not enough and might bring confusion or problems please share your thoughts on such cases and your ideas and I will consider them.
I appreciate your feedback, thanks.@guy038 ,
Thanks for the tests. Just to mention that in your last try the comparison was not started because thecompare
was in quotes. If only one file is given on the command line the comparison should not start (at least that’s the intention).
Thank you.BR
-
Several more things to directly answer your questions and to give you some idea on the Notepad++ implementation for the plugin messages (at least as I remember it and as I understand it):
So is this actually a bug in the ComparePlus plugin?
I don’t consider it a bug, it is simply how I have implemented that functionality.
Does it work without the double quotes because it must be used as the last argument on the N++ command line, and anything after -pluginMessage= is passed to the plugin and not looked at at all by N++?
Again, it works that way because I have implemented it that way and it is not meant to be the last option on the command line.
I think Notepad++ will get everything after-pluginMessage=
and send it to the plugins regardless of the quotes. If there are quotes then the message will include the spaces inside otherwise it will stop on the first space. That’s my idea on that, I haven’t checked it (at least now) but I surely have done some tests back then when I implemented the message parsing.And how does N++ know that this specific one is meant for the ComparePlus plugin?
It doesn’t know. It sends the message to all plugins.
So what I understood about the Notepad++ “message to plugins” function when I was implementing the handling in CP is that on Notepad++ start it parses the command line and sends dedicated message to all plugins with the string from the command line.
I didn’t like that enough for my needs so I implemented N++ command line parsing directly in CP and I do not handle the N++ plugin message. I wanted to avoid parsing the plugins message string because that would mean that I had to avoid accidentally matching “compare” word if another plugin used it or to implement some other more distinctive string to trigger compare.
I wanted the compare trigger to be something simple so the user doesn’t have to write much on the command line so I simply check if the command line contains-pluginMessage=compare
. -
-
Hello all,
ComparePlus v1.1.0 is ready.
These are the release notes - shortly, several bugs have been fixed, the command line issues discussed here have been resolved (the command line should benotepad++ -pluginMessage=compare new_file.txt old_file.txt
and as @Vitalii-Dovgan suggested there are settings to enable/disable the toolbar icons.
The new version of the plugin is using the new Scintilla headers coming with Notepad++ v8.4.7 but I have tested it with N++ v8.4.6 as well and it worked OK.
Enjoy!BR
-
Hi @pnedev,
I have installed Notepad++ v8.4.7 and then ComparePlus with the Plugins Admin, but this is version 1.0. I can’t see a newer version with Plugins Admin - Updates. Will it take some time until it appears there? -
@datatraveller1 said in [New Plugin] ComparePlus v1.0.0:
Will it take some time until it appears there?
Yes, it isn’t dynamic. Plugin developers, after releasing a new version of their plugin, have to request that N++'s plugin info be updated. Apparently the boat was missed for getting this into 8.4.7 and will have to wait for what’s next.
EDIT: I’ve been informed that the plugin author’s request was made for updating N++'s plugin list info in time (theoretically) but the release machinery was already in motion, so the update for ComparePlus 1.1 didn’t make it in. Chalk it up to unfortunate timing. :-(
-
You can also manually download ComparePlus v1.1.0 from the link that @pnedev provided, and install it in your v8.4.6 or v8.4.7 Notepad++, even if it hasn’t made it to the Plugins Admin (which it won’t until v8.4.8 at this point)
-
Thank you @PeterJones and @Alan-Kilborn,
As Peter suggested, I manually updated the directoryc:\Program Files\Notepad++\plugins\ComparePlus\
with the content of the plugin fileComparePlus_cp_1.1.0_x64.zip
successfully.