robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
aa1d8a2702
master
1" Vim syntax file 2" Language: TypeScript 3" Maintainer: Herrington Darkholme 4" Last Change: 2024 May 24 5" Based On: Herrington Darkholme's yats.vim 6" Changes: Go to https://github.com/HerringtonDarkholme/yats.vim for recent changes. 7" Origin: https://github.com/othree/yajs 8" Credits: Kao Wei-Ko(othree), Jose Elera Campana, Zhao Yi, Claudio Fleiner, Scott Shattuck 9" (This file is based on their hard work), gumnos (From the #vim 10" IRC Channel in Freenode) 11 12" This is the same syntax that is in yats.vim, but: 13" - flattened into one file 14" - HiLink commands changed to "hi def link" 15" - Setting 'cpo' to the Vim value 16 17if ! exists ( "main_syntax" ) 18if exists ( "b:current_syntax" ) 19finish 20endif 21let main_syntax = 'typescript' 22endif 23 24let s: cpo_save = & cpo 25set cpo & vim 26 27" this region is NOT used in TypeScriptReact 28" nextgroup doesn't contain objectLiteral, let outer region contains it 29syntax region typescriptTypeCast matchgroup = typescriptTypeBrackets 30 \start = /< \@! /end = /> / 31 \contains = @typescriptType 32 \nextgroup = @typescriptExpression 33 \contained skipwhite oneline 34 35 36""""""""""""""""""""""""""""""""""""""""""""""""""" 37" Source the part common with typescriptreact.vim 38source <sfile>:h/shared/typescriptcommon.vim 39 40 41let b: current_syntax = "typescript" 42if main_syntax == 'typescript' 43unlet main_syntax 44endif 45 46" Svelte 5 runes ($state, $derived, $props, ...) inside .svelte.ts modules. 47if expand ( '%:t' ) =~# '\.svelte\.ts$' 48syntax match svelteRune "\$\w\+ "containedin = ALL 49highlight default link svelteRune Statement 50endif 51 52let & cpo = s: cpo_save 53unlet s: cpo_save