sublime-yaml-nav
sublime-yaml-nav copied to clipboard
limit nav depth by setting. Add settings to sublime pref menu
Added max navigation depth, with a setting in configuration file. Added configuration editing to 'Preferences' menu
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?
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' :)
@ddiachkov any feedback?