sublime-yaml-nav icon indicating copy to clipboard operation
sublime-yaml-nav copied to clipboard

limit nav depth by setting. Add settings to sublime pref menu

Open ubyjvovk opened this issue 8 years ago • 3 comments

Added max navigation depth, with a setting in configuration file. Added configuration editing to 'Preferences' menu

ubyjvovk avatar Mar 16 '16 13:03 ubyjvovk

I believe yaml-nav is primarily used for rails localization/configuration files. So typical structure will be something like this: <lang>.<controller>.<view>.<key>.<sometimes-even-subkeys>. I think default depth = 3 is too small.

Alternatively we could limit path from the right (eg. en.activerecord.attributes.point.id will become ...atributes.point.id). What do you think?

ddiachkov avatar Mar 17 '16 20:03 ddiachkov

I use this mainly for navigating swagger files, which look like this:


paths:
  /account/login:
    post:
      description: |
        ## __Service: Login__
      parameters:
        - name: LoginRequest
          in: body
          description: User login credentials
          required: true
          schema:
            $ref: '#/definitions/accountLogin'
      responses:
        '200':
          description: the login was sucessful.  
          properties:
              correlationID:
                type: string
              apiKey:
                type: string
                format: uuid
              emailVerified:
                type: boolean
              userId:
                type: string
                format: uuid

As you can see, unique API nodes are 2-3 levels deep, but leaf nodes are repeating (request type/params/etc), so this is why I made depth limiter. With maxlevel == 3, I navigate by API endpoints, while with maxlevel>3, navigation becomes too cluttered with individual parameters.

But I understand that for RoR-style i18n files it might be different, so the default setting is totally up to you. Maybe it's even better to have default maxlevel = 1000, developers should be able to configure it.

Idea: have optional parameter 'trim', which is like maxlevel, but cuts top N levels. Then you can name them 'mindepth' and 'maxdepth' :)

ubyjvovk avatar Mar 17 '16 22:03 ubyjvovk

@ddiachkov any feedback?

ubyjvovk avatar Mar 27 '16 23:03 ubyjvovk