Created
May 28, 2011 02:29
-
-
Save hara/996529 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"============================================================================= | |
" Licensed under the MIT license: | |
" http://www.opensource.org/licenses/mit-license.php | |
"============================================================ | |
function! unite#sources#outline#aspvbs#outline_info() | |
return s:outline_info | |
endfunction | |
let s:Util = unite#sources#outline#import('Util') | |
let s:embedded = '<%\s*' | |
let s:ident_ptn = '\<\h\w*\>' | |
let s:label_ptn = '\(' . s:ident_ptn . '\)' | |
let s:visibility_ptn = '\%(\<public\>\%(\s\+default\>\)\=\|\<private\>\)' | |
let s:class_ptn = '\<class\s\+' . s:label_ptn | |
let s:func_ptn = s:visibility_ptn . '\=\s*\<function\s\+' . s:label_ptn | |
let s:sub_ptn = s:visibility_ptn . '\=\s*\<sub\s\+' . s:label_ptn | |
let s:prop_get_ptn = s:visibility_ptn . '\=\s*\<property\s\+get\s\+' . s:label_ptn | |
let s:prop_set_ptn = s:visibility_ptn . '\=\s*\<property\s\+set\s\+' . s:label_ptn | |
let s:prop_let_ptn = s:visibility_ptn . '\=\s*\<property\s\+let\s\+' . s:label_ptn | |
let s:heading_ptn = '^\%(' . s:embedded . '\)\=\s*\%(' . | |
\ s:class_ptn . '\|' . | |
\ s:func_ptn . '\|' . | |
\ s:sub_ptn . '\|' . | |
\ s:prop_get_ptn . '\|' . | |
\ s:prop_set_ptn . '\|' . | |
\ s:prop_let_ptn . '\)\c' | |
let s:outline_info = { | |
\ 'heading': s:heading_ptn, | |
\ 'skip': { | |
\ 'header': '^''', | |
\ }, | |
\ 'not_match_patterns': [ | |
\ s:Util.shared_pattern('*', 'parameter_list'), | |
\ ], | |
\} | |
function! s:outline_info.create_heading(which, heading_line, matched_line, context) | |
let h_lnum = a:context.heading_lnum | |
let level = s:Util.get_indent_level(a:context, h_lnum) + 3 | |
let type = 'generic' | |
let word = a:heading_line | |
if a:which ==# 'heading' | |
if a:heading_line =~? s:class_ptn | |
else | |
let word = substitute(word, '\cpublic', '+', '') | |
let word = substitute(word, '\cprivate', '-', '') | |
endif | |
endif | |
let heading = { | |
\ 'word' : word, | |
\ 'level': level, | |
\ 'type' : type, | |
\ } | |
return heading | |
endfunction |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment