Community
    • Login

    javascript navigation

    Scheduled Pinned Locked Moved Notepad++ & Plugin Development
    9 Posts 3 Posters 852 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Robert UlphR
      Robert Ulph
      last edited by

      Are there any plugins that allow me to easily navigate around a set of js files? At the moment if I want to find where something is defined I have to use Find In Files, which is a little slow. I’m wondering if there might be a plugin that helps.

      And are there any other javascript plugins that I should know about? I have found JSTool which is good for formatting and other things. But is there anything else?

      Thanks.

      Michael VincentM 1 Reply Last reply Reply Quote 0
      • Michael VincentM
        Michael Vincent @Robert Ulph
        last edited by Michael Vincent

        @Robert-Ulph said in javascript navigation:

        And are there any other javascript plugins that I should know about?

        Not necessarily a Javascript-specific plugin, but you could look at the ‘tags’ plugins that use ctags.

        I use (a modified version of) TagLEET. There is also NppGTags which I’ve tried and works OK - I just prefer the TagLEET interface. Both are available from the “Plugin Admin” and both have 32- and 64-bit versions.

        TagLEET requires you to create a tags file in the root of your project’s directory. I forget if NppGTags does it automatically or if you need to create as well. As you code and add new functions, you’ll need to periodically re-run the tag generation (usually just ctags -R) from the root of your project’s directory.

        Cheers.

        1 Reply Last reply Reply Quote 3
        • Robert UlphR
          Robert Ulph
          last edited by

          Thanks.

          This looks like quite a lot of complication for what I would have imagined to be quite simple. For instance this. Maybe I’ll find time to get used to it.

          My alternative when working on an issue is just to write down on a piece of paper the line numbers of the functions that are relevant and look at those to navigate around.

          Michael VincentM 1 Reply Last reply Reply Quote 0
          • Michael VincentM
            Michael Vincent @Robert Ulph
            last edited by

            @Robert-Ulph said in javascript navigation:

            This looks like quite a lot of complication

            Not that hard.

            1. Install ctags
            2. Make sure it’s in your PATH
            3. create a config file for common options (here’s a subset of what I use):
              C:\Users\YOUR_USERNAME\.ctags
            --c-kinds=+cdefglmnpstuvx
            --c++-kinds=+cdefglmnpstuvx
            --extra=fq
            --fields=+n
            --file-scope=yes
            
            --regex-perl=/^[ \t]*?use[ \t]+([^; ]+).*;/\1/u,use,uses/
            --regex-perl=/[ \t]*?my[ \t]+[$@%]([^; ]+).*;/\1/v,variable,variables/
            
            1. Set a shortcut key in N++ for Plugins => TagLEET => Lookup Tag. I use “Alt+Enter”

            cd YOUR_PROJECT_DIRECTORY
            ctags -R
            

            Steps 1-4 are one-time setup. For new projects, you just need to do step 5 and enjoy ctags navigation magic!

            Cheers.

            1 Reply Last reply Reply Quote 2
            • Robert UlphR
              Robert Ulph
              last edited by

              It seems that if you use the formatting tool with JSTool you have to be careful to select the code you want it to apply to. Otherwise it does it to the whole document, and messes up any html as well as php code and converts the file type (bottom left of notepad++) to javascript, which you don’t want if you have a php file.

              1 Reply Last reply Reply Quote 0
              • Robert UlphR
                Robert Ulph
                last edited by

                1. What PATH?

                I can just bookmark lines in Notepad++, which is very easy, although it doesn’t navigate across documents.

                Alan KilbornA Michael VincentM 2 Replies Last reply Reply Quote 0
                • Alan KilbornA
                  Alan Kilborn @Robert Ulph
                  last edited by

                  @Robert-Ulph said in javascript navigation:

                  …bookmark lines…which is very easy, although it doesn’t navigate across documents.

                  Is there a missing feature in Notepad++, to quickly show all bookmarked lines across all documents?
                  Something that could write its output to the Find result window maybe?
                  Like a Find in All Open Docs where the search target, instead of being text, is merely the bookmark status on a line?
                  Seems like a natural feature evolution!

                  1 Reply Last reply Reply Quote 0
                  • Michael VincentM
                    Michael Vincent @Robert Ulph
                    last edited by

                    @Robert-Ulph said in javascript navigation:

                    What PATH?

                    Your Windows PATH environment variable:

                    cmd.exe

                    echo %PATH%

                    Just put ctags.exe in a directory that’s in that path. Or add a directory where you install ctags to your PATH:

                    Control Panel => System => Advanced System Settings => Environment Variables

                    0434fc85-5f6b-48cd-8e2e-21d14cc8cc71-image.png

                    Cheers.

                    Alan KilbornA 1 Reply Last reply Reply Quote 5
                    • Alan KilbornA
                      Alan Kilborn @Michael Vincent
                      last edited by Alan Kilborn

                      @Michael-Vincent said in javascript navigation:

                      Your Windows PATH environment variable

                      Perhaps showing my advanced age, but I never thought we’d get to the point where THAT had to be explained. :-)
                      Nice job doing it.
                      If we ever need a FAQ entry on it, that could be the model.

                      1 Reply Last reply Reply Quote 4
                      • First post
                        Last post
                      The Community of users of the Notepad++ text editor.
                      Powered by NodeBB | Contributors