Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider adding native Scintilla Autocomplete #41

Open
vinsworldcom opened this issue Dec 5, 2023 · 8 comments · May be fixed by #42
Open

Consider adding native Scintilla Autocomplete #41

vinsworldcom opened this issue Dec 5, 2023 · 8 comments · May be fixed by #42

Comments

@vinsworldcom
Copy link

Would you consider adding an option (perhaps a checkbox in settings) to use Scintilla autocomplete instead of a plugin "native" version? This would mean that simply typing would also trigger autocompletes (so long as enabled in Notepad++) for tag database items.

Scintilla autocomplete has a lot to be desired and there is not way to integrate with the already existing Notepad++ autocomplete features, but with Scintilla autocomplete, it would "just happen" when typing vs. having to setup yet another shortcut key for autocompletion.

I do something similar in (my fork of) TagLeet.

Cheers.

@pnedev
Copy link
Owner

pnedev commented Dec 5, 2023

Sounds like a useful idea (one may also monitor Scintilla notifications for added/deleted text to accomplish this as I kind-of do in the plugin). I'll implement it some time in the future (when I find the time that is :) ).
Maybe it is good to set a starting character number before triggering the autocomplete because otherwise when you enter just one char a possibly very large autocomplete list will appear which IMO feels more like a "noise" and distraction when typing than something really useful.

Thanks and regards

@vinsworldcom vinsworldcom linked a pull request Dec 7, 2023 that will close this issue
@pnedev
Copy link
Owner

pnedev commented Dec 7, 2023

Hi again Vince,

Could you please check this development build: 64-bit, 32-bit. It is using the native plugin autocomplete list now but it is auto-shown on char input (after the third entered character). Is this example kind-of what you are expecting and proposing?

P.S. I see you have made an example PR but I don't have time to look at it right now. Sorry about that and thanks 👍

@vinsworldcom
Copy link
Author

vinsworldcom commented Dec 7, 2023

@pnedev very nice! I would welcome the character number be customizable, default at 3, but I would probably set to 1 as I have Notepad++ autocomplete set there as well.

Other than that, the only thing is it makes an audible system "ding", "bell" whatever sound whenever a character is typed and the plugin Autocomplete window is visible. You need to type slowly, but it is for each typed character. Typing fast, you may only hear the bell once or twice.

PS: I only tried the 64-bit version.

Cheers.

PS: The same "system beep" was happening when pressing Tab in the Function List in Notepad++ itself a while back. It was fixed in this file:

https://github.com/notepad-plus-plus/notepad-plus-plus/blob/master/PowerEditor/src/WinControls/FunctionList/functionListPanel.cpp

Search for "remove beep" and you'll see a SetWindowLongPtr() call, a few times this shows up in this file. Maybe a clue how to fix it?

@vinsworldcom
Copy link
Author

Some testing and this simple change removes the annoying beep for me:

nppgtags/src/AutoCompleteWin.cpp:

448:                 case LVN_KEYDOWN:
449:                     if (ACW->onKeyDown(((LPNMLVKEYDOWN)lParam)->wVKey))
450:-                         return 0;
450:+                         return 1;
451:                 break;

Cheers.

@vinsworldcom
Copy link
Author

I'm testing now and it all was going so good until I tried to use multiple caret - which multi-editing is now enabled by default in Notepad++ 8.6. Using your plugin native Autocomplete, I can't do multi carets. As soon as the plugin autocomplete pops up, the multi-carets are lost to just the active caret.

I'm going to keep playing with my PR to see if I can't fix the issues. I think we'll need to use the Notepad++ / Scintilla native autocomplete functions in order to get the full integration and usefulness.

Cheers.

@pnedev
Copy link
Owner

pnedev commented Dec 8, 2023

Thanks Vince for debugging the beep issue, the feedback and the testing 👍
You are right, I haven't implemented the NppGTags autocomplete function with multi-caret in mind.

BR

P.S. I can easily disable plugin Autocomplete triggering if multi-editing is at hand if that's something useful for you as initial approach.

@vinsworldcom
Copy link
Author

Yes, I use multi-caret quite regularly. It would be unfortunate if it could not work in multi-caret mode. The Scintilla native autocomplete does work in multi-caret mode.

I think I've corrected most of the problems with my PR. I'm using it now in my Notepad++ daily use to see if any other issues come up.

Cheers.

@pnedev
Copy link
Owner

pnedev commented Dec 9, 2023

OK, I'll try it myself soon and probably merge it.
Thank you for looking into this.

P.S. Later I'll also add automatic autocomplete on char input + starting character per database setting.
You might also want to check my latest commits to dev branch - I have done some optimizations and fixes (including what you have already found about the "Create missing database" prompt on automatic autocomplete). One of those is a single check per file activation if it is included in a database and "caching" the result so no extensive database path lookup is done on each char input while editing a single file. There are some more fixes that might not be relevant to your implementation with Scintilla autocomplete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants