Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4b47233

Browse filesBrowse files
committed
Split symbols
1 parent 25d8880 commit 4b47233
Copy full SHA for 4b47233

File tree

Expand file treeCollapse file tree

1 file changed

+21
-3
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+21
-3
lines changed

‎plugin/cider.vim

Copy file name to clipboardExpand all lines: plugin/cider.vim
+21-3Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,17 +161,35 @@ endfunction
161161

162162
nnoremap <silent> <Plug>RefactorCleanNs :<C-U>call <SID>clean_ns()<CR>
163163
164+
function! s:split_symbol(sym) abort
165+
if a:sym =~ '\/'
166+
return split(a:sym, '\/')
167+
elseif a:sym =~ '\.'
168+
let parts = split(a:sym, '\.')
169+
return [join(parts[0:-1], '.'), parts[-1]]
170+
else
171+
return [0, a:sym]
172+
endif
173+
endfunction
174+
175+
" echom scriptease#dump(s:split_symbol('java.util.Date'))
176+
" echom scriptease#dump(s:split_symbol('Date'))
177+
" echom scriptease#dump(s:split_symbol('clojure.string/split'))
178+
" echom scriptease#dump(s:split_symbol('str/split'))
179+
164180
function! s:resolve_missing() abort
181+
" TODO: Check indices
182+
165183
call s:init_refactor_nrepl()
166184

167-
let sym = expand('<cword>')
185+
let [alias, sym] = s:split_symbol(expand('<cword>'))
168186
let res = fireplace#message({'op': 'resolve-missing', 'symbol': sym})
169187
let choices = fireplace#evalparse('(quote ' . res[0].candidates . ')')
170188

171189
call inputsave()
172-
let x = inputlist(["Select: "] + map(choices, '(v:key+ 1) . ". " . v:val[0]'))
190+
let x = inputlist(["Select: "] + map(copy(choices), '(v:key+ 1) . ". " . v:val[0]'))
173191
call inputrestore()
174-
echo choices[x - 1]
192+
echo '[' . choices[x - 1][0] . ' :as ' . alias . ']'
175193

176194
" TODO: Insert choice to :require form
177195
endfunction

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.