Menu

New plugin: CCompletion

2007-09-28
2012-11-14
1 2 3 > >> (Page 1 of 3)
  • Nobody/Anonymous

    It's an autocompletion plugin, that also features two other similar functionalities:
    - find identifier and display it in secondary view
    - go to identitifer
    For more information on usage, see the plugin help.

    The plugin uses Exuberant Ctags and can operate with all identifiers that Ctags recognizes.
    You need to download ctags.exe from
    http://ctags.sourceforge.net
    and place it in your N++\plugins directory.

    Even though this is first release, the plugin is version 1.00 and will probably not be further developed. Well, we'll see ;)

    Download:
    http://freeweb.siol.net/rmihor/NppCCompletionPlugin100.zip

    I would like to thank Don for his help with the N++ plugin system and, of course, for the N++ itself. Thanks!

    Regards,
    Bostjan

     
    • kib2

      kib2 - 2007-09-29

      It seems to work fine for me, thanks a lot Bostjan.

       
    • Nobody/Anonymous

      Can it support php?
      In Ctags's site, it said ctags support php, but when I use your plugin with php file, a popup with message "invalid ctags file format" is shown.

       
    • Nobody/Anonymous

      >>> Can it support php?

      Yes, of course. I just tested it with some example PHP code from
      http://px.sklar.com/code.html?id=540&fmt=pl
      and it worked fine. Could you send me the ctags.tmp file that doesn't work? You can find the email address in the plugin About dialog.

      Regards,
      Bostjan

       
      • Nobody/Anonymous

        Just sent you the ctags.tmp file.

         
        • Nobody/Anonymous

          I found two errors.
          1. Fixed ending sequence to include a tabulator while parsing. I'm still not sure if Ctags can include this as well into identifier signature, but it works for now ;)
          2. Ctags included at least one line where a long identifier signature filled several lines. I modified my parser so it survives multiple calls for one identifier.

          I uploaded the new version of the plugin:
          http://freeweb.siol.net/rmihor/NppCCompletionPlugin101.zip

          Regards,
          Bostjan

           
          • Nobody/Anonymous

            It works fine now! Thanks for your great work!

             
    • Nobody/Anonymous

      Hi thaks for this good plug-in.
      Do you think that it could be possible to allow user to change colum size because sometimes it is not possible to watch the source filepath

      Thanks

       
      • Nobody/Anonymous

        I might add that in the future. Keep your fingers crossed ;)

        Regards,
        Bostjan

         
    • Nobody/Anonymous

      Question for Don:

      would it be possible to add a notification message N++ sends to plugins, when any file gets saved? It would enable me to auto-regenerate tags whenever user saves. I would add an option to enable this feature, disabled by default. CCompletion would also launch a thread for this purpose so it wouldn't stall N++ GUI thread on every save.

      Thanks a lot!
      Bostjan

       
    • Harry

      Harry - 2007-10-03

      Well, currently you can subclass Notepad++ to do this. I'd like such a message aswell as it keeps me from having to subclass Notepad++ as its not a very beautiful lthing to do ;)

      You can do it by doing so:

      //Subclass notepad++ to intercept messages (autosave)
      DefaultNotepadPPWindowProc = (WNDPROC) SetWindowLongPtr(nppData._nppHandle,GWLP_WNDPROC,(LONG)&NotepadPPWindowProc);

      ....

      LRESULT CALLBACK NotepadPPWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
          switch(msg) {
              case NPPM_SAVECURRENTFILE: {
                  //Document being saved
                  if (uploadOnSave) {
                      LRESULT result = CallWindowProc(DefaultNotepadPPWindowProc, hwnd, msg, wParam, lParam);    //call the N++ loop first, so the file gets saved
                      if (result)    //only allow uploading if the save was successfull
                          //Do you update CTags thingey here
                      return result;
                  }
                  break; }
              case WM_COMMAND: {
                  if (LOWORD(wParam) == IDM_FILE_SAVE) {
                      LRESULT result = CallWindowProc(DefaultNotepadPPWindowProc, hwnd, msg, wParam, lParam); //call the N++ loop first, so the file gets saved
                      if (result) //only allow uploading if the save was successfull
                          //Do you update CTags thingey here
                      return result;
                  }
                  break; }
          }
          return CallWindowProc(DefaultNotepadPPWindowProc, hwnd, msg, wParam, lParam);
      }

      Hope that helps you

       
      • Nobody/Anonymous

        Thanks for the idea!

        I use subclassing a lot, but somehow it didn't hit me that I could subclass N++. Probably because I never subclassed upwards the hierarchy.

        Regards,
        Bostjan

         
      • Don HO

        Don HO - 2007-10-03

        I thought this message exists :
        https://sourceforge.net/forum/message.php?msg_id=4472358

        After quick checking, I realized that I was wrong.

        So the notification message NPPN_FILESAVED will be implemented in next release (probably v4.4).

        Let me know if you need the modified binary to test your plugin.

        Don

         
        • DV

          DV - 2007-10-04

          It would be very cool to have two different notifications:
          1) NPPN_FILEBEFORESAVE
          2) NPPN_FILESAVED

          The first one, NPPN_FILEBEFORESAVE, tells that the file is about to be saved. So, when a plugin receives this notification, it can do some actions before the file is saved. It could be such actions as: removing trailing spaces, removing empty lines and so on.
          Thus, this notification allows to do pre-saving actions.

          The second one, NPPN_FILESAVED, tells that the file has been saved.
          Thus, this notifications allows to do post-saving actions.

           
          • Don HO

            Don HO - 2007-10-04

            OK, will be added.

            Don

             
            • Merijn Bosma

              Merijn Bosma - 2007-10-05

              I'm trying to make a plugin which transparently will encrypt and decrypt a certain own file format.
              This requires both such a notify (and also for loading of course), but also the possibility to change the actual data before it's saved and after it's opened.

              Is there any way to do this now, or is it possible to add this to N++?

              tx, Merijn

               
        • Nobody/Anonymous

          Thanks, Don!

          That binary sounds nice.

          Regards,
          Bostjan

           
    • Nobody/Anonymous

      Hi, thanks for this great plugin.
      Only one request, if possible, it would be very cool if you have only one tags list for a directory and all the subdirectories: so the plugin would be very "perfect" !!

      thanks again

      Mauro

       
      • Nobody/Anonymous

        If I understood you correctly, you wish to see identifiers that are located in files of the superdirectories (parent directories) and same level directories.

        The plugin currently shows one list for the current directory and all the subdirectories. All the identifiers from subdirectories are included. You just have to trigger it from one of the files on that level.

        But having only one list would require adding settings for base project directory. To enable several projects going at the same time, I would need to add a system for any number of such paths. We're getting dangerously close to an IDE here, arent we? :)

        Still, I know big projects don't include only from subdirectories and current directory, so I'll probably add it soon.

        Regards,
        Bostjan

         
        • Nobody/Anonymous

          Ok you are rigth... but if you have a root directory and several branches if you select i.e a function call in a file and the identifier is on a different branch, then notepad tries to open that file from a wrong path. Is this a mistake ?

          Regards

          Mauro

           
          • Nobody/Anonymous

            ... I've just give a look to the ctags file and I've seen that the information where the identifier is located contains only a relative path; maybe could be enough tell to the exuberant program to store the complete path !!

            regards
            Mauro

             
            • Nobody/Anonymous

              That would solve some issues, but I didn't find a Ctags option to output a full path. Besides, the new system with a specified project directory won't require that.

              Regards,
              Bostjan

               
          • Nobody/Anonymous

            Did you encounter this? As far as I know, it shouldn't happen with CC 1.01. Could you provide me with additional data?

            Regards,
            Bostjan

             
            • Nobody/Anonymous

              No, sorry was a my mistake... it don't happen

              Regards

              Mauro

               
    • Nobody/Anonymous

      Just uploaded CCompletion v1.02.

      1. Added ability for user to provide base project directories (up to 16). CCompletion will show all the identifiers in all the files within the project. Identifier lookup and go to identifier work as well, of course.
      It's not neccessary to provide a project directory, though. CCompletion will still work as before, if you don't.

      2. Added a thread for ctags.exe execution, preparing for automatic tag regeneration when any file gets saved (coming after next Notepad++ release).

      3. Modified the column ratios somewhat, so that file paths have more space.

      Link:
      http://freeweb.siol.net/rmihor/NppCCompletionPlugin102.zip

      Let me know if you find any bugs.

      Regards,
      Bostjan

       
1 2 3 > >> (Page 1 of 3)