- Der Konfigurationstext bekommt eine Highlight-Ebene; die Vim-Syntax liegt unter syntax/ und wird als /static/junction.vim zum Download ausgeliefert. - UI-Texte und Kommentare sind auf Englisch (Repo-Konvention). - Snapshot, Requests, Spend und Config laufen über die vorhandenen Kontrollbefehle; /api/stream hält die Anzeige aktuell.
84 lines
3.4 KiB
VimL
84 lines
3.4 KiB
VimL
" Vim syntax file
|
|
" Language: Junction router config (pf.conf-style)
|
|
" Maintainer: Junction
|
|
" Usage: put in ~/.vim/syntax/junction.vim and add to ftdetect:
|
|
" au BufRead,BufNewFile junction.conf,*.junction.conf set filetype=junction
|
|
|
|
if exists("b:current_syntax")
|
|
finish
|
|
endif
|
|
|
|
syn case match
|
|
|
|
" Comments
|
|
syn match junctionComment "#.*$" contains=@Spell
|
|
|
|
" Strings
|
|
syn region junctionString start=+"+ skip=+\\"+ end=+"+ oneline
|
|
syn region junctionString start=+'+ skip=+\\'+ end=+'+ oneline
|
|
|
|
" Blocks
|
|
syn keyword junctionBlock endpoint pool vkey mcp nextgroup=junctionName skipwhite
|
|
syn match junctionName "\<[A-Za-z0-9_.:-]\+\>" contained
|
|
|
|
" Top-level and rule keywords
|
|
syn keyword junctionKeyword listen connect_timeout_ms offline_hold_s max_body_bytes
|
|
syn keyword junctionKeyword max_inflight queue_timeout retry_num retry_backoff retry_max_wait
|
|
syn keyword junctionKeyword offline_wait spend_log guard request log_prefix
|
|
syn keyword junctionKeyword cache_ttl cache_entries cache_bytes cache tcp cache_secret_env cache_peer cache_peer_timeout_ms
|
|
syn keyword junctionKeyword so_reuseport drain_timeout mcp_auth auto_endpoints
|
|
syn keyword junctionKeyword probe_interval probe_timeout ctx_chars_per_token prices_path
|
|
syn keyword junctionKeyword metrics control control_unix control_tcp
|
|
syn keyword junctionKeyword balance compress compress_keep compress_min_bytes
|
|
syn keyword junctionKeyword mcp_cache_ttl cache_deterministic_only
|
|
|
|
" Rule directives
|
|
syn keyword junctionRule req pass block
|
|
syn keyword junctionCondition for path need check retry ctx vision strip as
|
|
syn keyword junctionCheckValue hooks none
|
|
syn keyword junctionSpecial on_hard on_soft skip delay
|
|
|
|
" Endpoint/block properties
|
|
syn keyword junctionProperty base kind context priority timeout idle_timeout cooldown
|
|
syn keyword junctionProperty hook hook_retry hook_backoff wake api_key_env
|
|
syn keyword junctionProperty auth_basic_user pass_cmd base_cmd usage_cmd usage_poll_s
|
|
syn keyword junctionProperty budget_soft budget_hard on_soft_delay_s on_hard_skip
|
|
syn keyword junctionProperty offpeak_from offpeak_to cost_weight
|
|
syn keyword junctionProperty tls_verify tls_ca cache_on header vision max_model_inflight probe_on
|
|
syn keyword junctionProperty connect_timeout_ms weight compress
|
|
syn keyword junctionProperty url cmd headers timeout_s retry_ms enabled
|
|
syn keyword junctionProperty token_env allow endpoints mcp_tools rpm budget_usd budget
|
|
|
|
" Booleans / values
|
|
syn keyword junctionBoolean on off true false auto all none
|
|
syn keyword junctionBalance first round-robin least-usage cost
|
|
syn keyword junctionKind remote local opencode-go opencode
|
|
|
|
" Numbers, durations, sizes, percents
|
|
syn match junctionNumber "\<\d\+\(\.\d\+\)\=\>"
|
|
syn match junctionOperator "[{},=<>*]"
|
|
|
|
" Paths/URLs (simple heuristic)
|
|
syn match junctionPath "\(^\|\s\)\zs/\f\+"
|
|
syn match junctionUrl "\<https\?://\f\+"
|
|
|
|
hi def link junctionComment Comment
|
|
hi def link junctionString String
|
|
hi def link junctionBlock Structure
|
|
hi def link junctionName Identifier
|
|
hi def link junctionKeyword Keyword
|
|
hi def link junctionRule Statement
|
|
hi def link junctionCondition Conditional
|
|
hi def link junctionCheckValue Constant
|
|
hi def link junctionSpecial Special
|
|
hi def link junctionProperty Type
|
|
hi def link junctionBoolean Boolean
|
|
hi def link junctionBalance Constant
|
|
hi def link junctionKind Constant
|
|
hi def link junctionNumber Number
|
|
hi def link junctionOperator Operator
|
|
hi def link junctionPath Underlined
|
|
hi def link junctionUrl Underlined
|
|
|
|
let b:current_syntax = "junction"
|