LEFT | RIGHT |
(no file at all) | |
1 " -*- text -*- | 1 " -*- text -*- |
2 " oracle.vim -- Vim integration for the Go oracle. | 2 " oracle.vim -- Vim integration for the Go oracle. |
3 " | 3 " |
4 " Load with (e.g.) :source oracle.vim | 4 " Load with (e.g.) :source oracle.vim |
5 " Call with (e.g.) :GoOracleDescribe | 5 " Call with (e.g.) :GoOracleDescribe |
6 " while cursor or selection is over syntax of interest. | 6 " while cursor or selection is over syntax of interest. |
7 " Run :copen to show the quick-fix file. | 7 " Run :copen to show the quick-fix file. |
8 " | 8 " |
9 " This is an absolutely rudimentary integration of the Go Oracle into | 9 " This is an absolutely rudimentary integration of the Go Oracle into |
10 " Vim's quickfix mechanism and it needs a number of usability | 10 " Vim's quickfix mechanism and it needs a number of usability |
(...skipping 11 matching lines...) Expand all Loading... |
22 | 22 |
23 " The path to the Go oracle executable. | 23 " The path to the Go oracle executable. |
24 let s:go_oracle = "$GOROOT/bin/oracle" | 24 let s:go_oracle = "$GOROOT/bin/oracle" |
25 | 25 |
26 " Enable Vim to recognize GNU-style 'file:line.col-line.col: message' format. | 26 " Enable Vim to recognize GNU-style 'file:line.col-line.col: message' format. |
27 set errorformat+=%f:%l.%c-%*[0-9].%*[0-9]:\ %m | 27 set errorformat+=%f:%l.%c-%*[0-9].%*[0-9]:\ %m |
28 | 28 |
29 func! s:RunOracle(mode) abort | 29 func! s:RunOracle(mode) abort |
30 let s:pos = line2byte(line("."))+col(".") | 30 let s:pos = line2byte(line("."))+col(".") |
31 let s:errfile = tempname() | 31 let s:errfile = tempname() |
32 let s:cmd = printf("!%s -ptalog= -mode=%s '-pos=%s %d' %s >%s", | 32 let s:cmd = printf("!%s -mode=%s '-pos=%s %d' %s >%s", |
33 \ s:go_oracle, a:mode, bufname(""), s:pos, s:scope, s:errfile) | 33 \ s:go_oracle, a:mode, bufname(""), s:pos, s:scope, s:errfile) |
34 execute s:cmd | 34 execute s:cmd |
35 execute "cfile " . s:errfile | 35 execute "cfile " . s:errfile |
36 endfun | 36 endfun |
37 | 37 |
38 " Describe the expression at the current point. | 38 " Describe the expression at the current point. |
39 command! GoOracleDescribe | 39 command! GoOracleDescribe |
40 \ call s:RunOracle("describe") | 40 \ call s:RunOracle("describe") |
41 | 41 |
42 " Show possible callees of the function call at the current point. | 42 " Show possible callees of the function call at the current point. |
(...skipping 10 matching lines...) Expand all Loading... |
53 | 53 |
54 " Describe the 'implements' relation for types in the | 54 " Describe the 'implements' relation for types in the |
55 " package containing the current point. | 55 " package containing the current point. |
56 command! GoOracleImplements | 56 command! GoOracleImplements |
57 \ call s:RunOracle("implements") | 57 \ call s:RunOracle("implements") |
58 | 58 |
59 " Enumerate the set of possible corresponding sends/receives for | 59 " Enumerate the set of possible corresponding sends/receives for |
60 " this channel receive/send operation. | 60 " this channel receive/send operation. |
61 command! GoOracleChannelPeers | 61 command! GoOracleChannelPeers |
62 \ call s:RunOracle("peers") | 62 \ call s:RunOracle("peers") |
LEFT | RIGHT |