kbilsted / NotepadPlusPlusPluginPack.Net

.Net package to install into visual studio to make plugins for Notepad++
Apache License 2.0
164 stars 52 forks source link

Add patch for NaN, Inf compiler errors, quality-of-life improvement in WhatIsNpp #94

Closed molsonkiko closed 1 year ago

molsonkiko commented 2 years ago

As noted in issue #93, some dependency in the project causes compiler errors if the compiler sees double.Infinity, double.NegativeInfinity, double.NaN, or anything else like 1d / 0d that can be compiled to one of those via static analysis.

The NanInf class would solve that simply by safely creating those at runtime. I added a menu command with information on these errors and how to use the class. It's a crude and inelegant solution, but it works.

I also replaced insertCurrentPath with getCurrentPath, so you can get the current absolute file path as a string. I used this to periodically check the active file in whatIsNpp so that changing the active file stops the printing of text.

I changed the argument type for NotepadPPGateway.GetFilePath from int to IntPtr to ensure that it can handle the 64-bit buffer ID's made by 64-bit Notepad++, and also added a new plugin command, Show files closed this session, to illustrate how this method can be used to register the name of a file when it's closed (since the user might close a file other than the currently open file).

I flagged IScintillaGateway.SetLexerLanguage as not working and indicated that people should use INotepadPPGateway.SetCurrentLanguage instead. Nothing groundbreaking, but I think it's probably good to have.

molsonkiko commented 1 year ago

I'm going to close this PR and reopen with just the NanInf.cs addition. This should make my changes easier to review and merge.

I will also create a PR with just the int->IntPtr change in GetFilePath.