Some time ago I wrote about an IDE plugin I made that modifies code completion behavior to be able to find even misspelled identifiers (like TComponent(o).comstate -> TComponent(o).ComponentState). I was asked a number of times to make the source public and I did just that (thanks for the interest btw).

Some time ago I wrote about an IDE plugin I made that modifies code completion behavior to be able to find even misspelled identifiers (like TComponent(o).comstate -> TComponent(o).ComponentState). I was asked a number of times to make the source public and I did just that (thanks for the interest btw).

There aren't many comments in the code but if you're used to developing and IDE expert I think there should be no problems getting around the code fast enough. The idea is really simple, just wrap some IDE interface implementation around and modify the behavior.

Although the completion works just fine most of the time, I noticed that the wrapper may interfere with class completion functionality (I never had time to fully investigate the issue - patches welcome ;-) ), I'm not fully sure if this is caused by the wrapper or maybe some other plugin(s) I have enabled in the IDE.
https://bitbucket.org/shadow_cs/delphi-smart-code-completion/

Comments

  1. Thanks Honza. I've successfully created the XE4 package from your XE5 pkg, tweaked the InnoSetup script, and installed it for my XE4. In the same time, I realized it's not exactly what I have imagined - it can be smarter, for example, when I typed "sm", the "ShowModal" method should have higher priority than the others, ie. totake "Camel-Case" into account :). All after all, it opened the door for us including me to make improvements :) Thanks very much!

    ReplyDelete
  2. Edwin Yip​ yes you're right I know that there are a lot of improvements possible, camel case completion is kinda obvious eclipse does that for quite some time ;-). My hope is that together we can tweak the functionality and make it more powerful, maybe add some settings and more. I regret it took me so much time to publish it to be honest I forgot about it and recent posts made me remember.

    ReplyDelete
  3. +Honza Rameš Thank very much for opening sourcing it! BTW, I haven't looked at the source yet - It must be a reason that you make it a DLL, instead of a bpl that can be installed right inside the IDE, right?

    ReplyDelete
  4. Also unit name completion does not work any more. But thanks for the great start :)

    ReplyDelete
  5. Hello Honza, now I have a problem - At this moment I want to revert back to CnPack's Input Helper, but I couldn't. I've uninstalled the SmartCodeComplete DLL, I've unchecked the "Code completion" tick in the IDE's Options window, I've tried the CNPack Input Helper's 'Disable IDE Codecompeletion" button, but no luck... Any hint? Thanks.

    ReplyDelete
  6. OK, FWIW, I finally managed to reverted back to CnPack Input Helper, you must disable the "Auto invoke" checkbox in the IDE Options window.

    ReplyDelete
  7. Fabian S. Biehn​​ it works for me, but maybe it behaves a little differently than you might expect. Nevertheless I would be very happy for any pull request if you fix a bug or a bug report or feature proposal. I cannot promise you to fix those on regular basis but I'll try to do my best. To locate issues you may want to compile it in debug configuration (it will output a lot of debug messages) or debug a secondary IDE instance with the DLL loaded in it. Man I really need to work on the wiki.

    ReplyDelete
  8. Oh and Edwin Yip​ I don't load it as BPL because I'm plugging it inside some low level functionality and I'm afraid it might crash if unloaded improperly. But maybe it would work just fine.

    ReplyDelete
  9. ooh that's cool , how does it work ? should i put the dll file in the bin folder ?

    ReplyDelete
  10. Hamza Benzaoui​ today I added an installer that will build the package and register it with installed IDEs, it doesn't support all versions (yet). I'd like to ask everyone if you have other versions installed and tested please submit a pull request with modified Build.ini and added project with other version of the IDE.

    ReplyDelete
  11. I just pushed and update that adds CamelCase notations a rank bump if you enter first letters of each word (as suggested by Edwin Yip).

    ReplyDelete
  12. Honza Rameš Excellent! I will try it later Honza.

    ReplyDelete
  13. I added another feature: the code insight list can be sorted based on a score of each item. But due to some issues I wan't able to resolve concerning method completion, I had to disable it for now (but it can be enabled by hand, see wiki). Unfortunately I don't think I'll be able to resolve this issue without knowing how the IDE works under the hood which is very unlikely to happen (any help would be appreciated). If you don't like the way the score is computed all you have to do is modify the GetScore method, I think it is fairly straight forward and you don't have to deal with the rest.

    ReplyDelete

Post a Comment