File tree Expand file tree Collapse file tree 1 file changed +21
-3
lines changed
Filter options
Expand file tree Collapse file tree 1 file changed +21
-3
lines changed
Original file line number Diff line number Diff line change @@ -161,17 +161,35 @@ endfunction
161
161
162
162
nnoremap <silent> <Plug> RefactorCleanNs :<C-U> call <SID> clean_ns()<CR>
163
163
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
+
164
180
function ! s: resolve_missing () abort
181
+ " TODO: Check indices
182
+
165
183
call s: init_refactor_nrepl ()
166
184
167
- let sym = expand (' <cword>' )
185
+ let [alias, sym] = s: split_symbol ( expand (' <cword>' ) )
168
186
let res = fireplace#message ({' op' : ' resolve-missing' , ' symbol' : sym})
169
187
let choices = fireplace#evalparse (' (quote ' . res [0 ].candidates . ' )' )
170
188
171
189
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]' ))
173
191
call inputrestore ()
174
- echo choices[x - 1 ]
192
+ echo ' [ ' . choices[x - 1 ][ 0 ] . ' :as ' . alias . ' ] '
175
193
176
194
" TODO: Insert choice to :require form
177
195
endfunction
You can’t perform that action at this time.
0 commit comments