Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Smithy IDL #759

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ A collection of language packs for Vim.
> One to rule them all, one to find them, one to bring them all and in the darkness bind them.

- It **won't affect your startup time**, as scripts are loaded only on demand\*.
- It **installs and updates 120+ times faster** than the <!--Package Count-->599<!--/Package Count--> packages it consists of.
- It **installs and updates 120+ times faster** than the <!--Package Count-->600<!--/Package Count--> packages it consists of.
- It is also more secure (scripts loaded for every filetype are generated by vim-polyglot)
- Best syntax and indentation support (no other features). Hand-selected language packs.
- Automatically detects indentation (includes performance-optimized version of [vim-sleuth](https://github.com/tpope/vim-sleuth), can be disabled)
Expand Down Expand Up @@ -181,6 +181,7 @@ On top of all language packs from [vim repository](https://github.com/vim/vim/tr
- [sh](https://github.com/arzg/vim-sh) (Shell syntax highlighting for sh, bash, bats, cgi, command and 8 more files)
- [slim](https://github.com/slim-template/vim-slim) (Slim syntax highlighting for slim files)
- [slime](https://github.com/slime-lang/vim-slime-syntax) (Syntax highlighting for slime files)
- [smithy](https://github.com/jasdel/vim-smithy) (Syntax highlighting for smithy files)
- [smt2](https://github.com/bohlender/vim-smt2) (SMT syntax highlighting for smt2 and smt files)
- [solidity](https://github.com/TovarishFin/vim-solidity) (Solidity syntax highlighting for sol files)
- [stylus](https://github.com/wavded/vim-stylus) (Stylus syntax highlighting for styl and stylus files)
Expand Down
4 changes: 4 additions & 0 deletions autoload/polyglot/init.vim
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,10 @@ if !has_key(g:polyglot_is_disabled, 'snobol4')
au BufNewFile,BufRead *.sno,*.spt setf snobol4
endif

if !has_key(g:polyglot_is_disabled, 'smithy')
au BufNewFile,BufRead *.smithy setf smithy
endif

if !has_key(g:polyglot_is_disabled, 'smith')
au BufNewFile,BufRead *.smith,*.smt setf smith
endif
Expand Down
1 change: 1 addition & 0 deletions autoload/polyglot/sleuth.vim
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,7 @@ let s:globs = {
\ 'smarty': '*.tpl',
\ 'smcl': '*.hlp,*.ihlp,*.smcl',
\ 'smith': '*.smt,*.smith',
\ 'smithy': '*.smithy',
\ 'sml': '*.sml',
\ 'smt2': '*.smt2,*.smt',
\ 'snobol4': '*.sno,*.spt',
Expand Down
8 changes: 8 additions & 0 deletions ftplugin/smithy.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
if polyglot#init#is_disabled(expand('<sfile>:p'), 'smithy', 'ftplugin/smithy.vim')
finish
endif

" Smithy vim configuration
"-------------------------

set tabstop=8 softtabstop=0 expandtab shiftwidth=4 smarttab
8 changes: 8 additions & 0 deletions packages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4618,6 +4618,14 @@ filetypes:
- pattern: "*.smt,*.smith"
description: SMITH
---
name: smithy
remote: jasdel/vim-smithy
filetypes:
- name: smithy
patterns:
- pattern: "*.smithy"
description: Smithy IDL
---
name: snobol4
native: true
glob: "**/snobol4.vim"
Expand Down
47 changes: 47 additions & 0 deletions syntax/smithy.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
if polyglot#init#is_disabled(expand('<sfile>:p'), 'smithy', 'syntax/smithy.vim')
finish
endif

syn case match

syn keyword smithyNamespace namespace
syn keyword smithyMetadata metadata suppresssions
syn keyword smithyKeywords use apply
syn keyword smithyMember member
syn region smithyTrait start="@" end="\w*"

hi def link smithyNamespace Statement
hi def link smithyMetadata Statement
hi def link smithyKeywords Keyword
hi def link smithyMember Label
hi def link smithyTrait Identifier


" Predefined types
syn keyword smithyContainer list set map union document structure service operation
syn keyword smithySimpleType boolean blob string byte short integer long float double timestamp

hi def link smithyContainer Type
hi def link smithySimpleType Type

" Comments
syn region smithyCommentBlock start="///" end="$" contains=@Spell
syn region smithyComment start="//" end="$" contains=@Spell

hi def link smithyCommentBlock Comment
hi def link smithyComment Comment

" Literal strings
syn region smithyString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=@Spell
syn region smithyMultiLineString start=+"""+ end=+"""+ contains=@Spell

hi def link smithyString String
hi def link smithyMultiLineString String

" Regions
syn region smithyParen start='(' end=')' transparent
syn region smithyBlock start="{" end="}" transparent
syn region smithyList start="\[" end="\]" transparent


" vim: sw=2 ts=2 et
1 change: 1 addition & 0 deletions tests/filetypes.vim
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,7 @@ call TestFiletype('slrnrc')
call TestFiletype('slrnsc')
call TestFiletype('st')
call TestFiletype('smith')
call TestFiletype('smithy')
call TestFiletype('snobol4')
call TestFiletype('mib')
call TestFiletype('hog')
Expand Down