File: glimmer.vim

package info (click to toggle)
vim 2%3A9.2.0218-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 96,428 kB
  • sloc: ansic: 435,795; cpp: 6,445; makefile: 4,644; sh: 2,569; java: 2,488; xml: 2,099; python: 1,716; perl: 1,419; awk: 730; lisp: 501; cs: 458; objc: 369; sed: 35; csh: 9; haskell: 1
file content (51 lines) | stat: -rw-r--r-- 1,455 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
" Vim syntax file
" Language:     Glimmer
" Maintainer:   Devin Weaver
" Last Change:  2026 Feb 20
" Origin:       https://github.com/joukevandermaas/vim-ember-hbs
" Credits:      Jouke van der Maas
" License:      Same as Vim

" Vim detects GJS/GTS files as {java,type}script.glimmer
" Vim will read the javascript/typescript syntax files first and set
" b:current_syntax accordingly then it will read the glimmer syntax file.
" This is why we use b:current_syntax to make sure we are in the correct state
" to continue.

if exists('b:current_syntax') && b:current_syntax !~# '\v%(type|java)script'
  finish
endif

let base_syntax = b:current_syntax
unlet! b:current_syntax

let s:cpo_save = &cpo
set cpo&vim

syntax include @hbs syntax/handlebars.vim

if base_syntax == "javascript"
  syntax region glimmerTemplateBlock
    \ start="<template>" end="</template>"
    \ contains=@hbs
    \ keepend fold

  let b:current_syntax = "javascript.glimmer"
else
  " syntax/typescript.vim adds typescriptTypeCast which is in conflict with
  " <template> typescriptreact doesn't define it but we want to not include
  " the JSX syntax.
  syntax clear typescriptTypeCast

  syntax region glimmerTemplateBlock
    \ start="<template>" end="</template>"
    \ contains=@hbs
    \ containedin=typescriptClassBlock,typescriptFuncCallArg
    \ keepend fold

  let b:current_syntax = "typescript.glimmer"
endif

let &cpo = s:cpo_save
unlet s:cpo_save
unlet! base_syntax