neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

typescript.vim (1417B)


      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 
     17 if !exists("main_syntax")
     18  if exists("b:current_syntax")
     19    finish
     20  endif
     21  let main_syntax = 'typescript'
     22 endif
     23 
     24 let s:cpo_save = &cpo
     25 set cpo&vim
     26 
     27 " this region is NOT used in TypeScriptReact
     28 " nextgroup doesn't contain objectLiteral, let outer region contains it
     29 syntax 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
     38 source <sfile>:h/shared/typescriptcommon.vim
     39 
     40 
     41 let b:current_syntax = "typescript"
     42 if main_syntax == 'typescript'
     43  unlet main_syntax
     44 endif
     45 
     46 let &cpo = s:cpo_save
     47 unlet s:cpo_save