Home
Welcome
About This Wiki
sandbox (play here)
This shows you the differences between two versions of the page.
brightscript [2015/09/12 21:10] dblume |
brightscript [2015/09/24 09:39] (current) dblume |
||
---|---|---|---|
Line 2: | Line 2: | ||
Here are some BrightScript tips. | Here are some BrightScript tips. | ||
+ | |||
+ | ===== tags ===== | ||
+ | |||
+ | Make [[https://www.perturb.org/display/1135_Adding_ctags_support_for_BrightScript.html|tags more useful with BrightScript support]]. What follows is the same, but with the necessary case-insensitive support. | ||
+ | |||
+ | Add this to your $HOME/.ctags file. | ||
+ | |||
+ | <code> | ||
+ | --langdef=BrightScript | ||
+ | --langmap=BrightScript:.brs | ||
+ | --regex-BrightScript=/^function[ \t]*([a-zA-Z0-9_]+)/\1/f,function/i | ||
+ | --regex-BrightScript=/^sub[ \t]*([a-zA-Z0-9_]+)/\1/s,sub/i | ||
+ | --regex-BrightScript=/^[ \t]*(\w+) ?=/\1/v,variable/ | ||
+ | </code> | ||
+ | |||
+ | Then, run ctags from the channel's main directory like so: | ||
+ | |||
+ | <code bash> | ||
+ | #/bin/bash | ||
+ | set -eu -o pipefail # See: https://sipb.mit.edu/doc/safe-shell/ | ||
+ | |||
+ | # Make the tags file at the project root | ||
+ | ctags -n --if0=yes --c++-kinds=+p --file-tags=yes -R \ | ||
+ | --links=no --extra=fq \ | ||
+ | --exclude='*/images/*' | ||
+ | |||
+ | # Append to it symbols from the BrightScript SDK | ||
+ | ctags --append=yes -n --if0=yes --c++-kinds=+p --file-tags=yes -R \ | ||
+ | --links=no --extra=fq \ | ||
+ | ../../../dev/Netflix/Include # \ | ||
+ | # ../../../dev/Netflix/Scripting | ||
+ | |||
+ | # Then do the tags in /source and its subdirectories | ||
+ | find . -mindepth 1 \ | ||
+ | '(' -path '*/images' ')' -prune \ | ||
+ | -or '(' -type d ')' -print | while read i | ||
+ | do | ||
+ | pushd "$i" 1> /dev/null | ||
+ | ctags -n --if0=yes --c++-kinds=+p --file-tags=yes -R \ | ||
+ | --links=no --extra=fq | ||
+ | popd 1> /dev/null | ||
+ | done | ||
+ | |||
+ | # Finally, there'll be empty tags files, unlink those | ||
+ | # find . -name tags -size -2 -mtime -1 -print | xargs rm | ||
+ | find . -name tags -size -2 -mtime -1 -delete | ||
+ | </code> | ||
+ | |||
+ | ===== Sublime Text 3 ===== | ||
On a Windows system, here's a template Sublime project: | On a Windows system, here's a template Sublime project: | ||
Line 16: | Line 65: | ||
}, | }, | ||
"osx": { | "osx": { | ||
- | "shell_cmd": "zip \"$project_base_name.zip\" manifest source/*.* images" | + | "shell_cmd": "zip \"$project_base_name.zip\" manifest source/*.* images/*.*" |
}, | }, | ||
"linux": { | "linux": { | ||
- | "shell_cmd": "zip \"$project_base_name.zip\" manifest source/*.* images" | + | "shell_cmd": "zip \"$project_base_name.zip\" manifest source/*.* images/*.*" |
} | } | ||
} | } | ||
Line 42: | Line 91: | ||
</file> | </file> | ||
- | ===== Syntax Highlighting ===== | + | ==== Syntax Highlighting ==== |
BrightScript Language Definition Bundle for Sublime Text 2 is available here: [[https://github.com/cmink/BrightScript.tmbundle|cmink/BrightScript.tmbundle]] | BrightScript Language Definition Bundle for Sublime Text 2 is available here: [[https://github.com/cmink/BrightScript.tmbundle|cmink/BrightScript.tmbundle]] | ||
Line 55: | Line 104: | ||
$ zip BrightScript.sublime-package BrightScript.tmbundle/* | $ zip BrightScript.sublime-package BrightScript.tmbundle/* | ||
</code> | </code> | ||
+ | |||
+ | ===== Vim ===== | ||
+ | |||
+ | Add [[https://github.com/chooh/brightscript.vim|BrightScript syntax hightlighting in vim]]. (ftdetect/ and syntax/ go in your $HOME/.vim/ subdirectory.) | ||
+ |