diff --git a/.github/workflows/document.yml b/.github/workflows/document.yml index 75a784b5..b187ad86 100644 --- a/.github/workflows/document.yml +++ b/.github/workflows/document.yml @@ -44,22 +44,22 @@ jobs: name: document path: target/html - nightly-deploy: - if: github.ref == 'refs/heads/dev' - needs: [asciidoc, help] - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/download-artifact@master - with: - name: document - path: document - - uses: netlify/actions/cli@master - env: - NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_PERSONAL_ACCESS_TOKEN }} - NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} - with: - args: deploy --dir=document --prod + # nightly-deploy: + # if: github.ref == 'refs/heads/dev' + # needs: [asciidoc, help] + # runs-on: ubuntu-latest + # steps: + # - uses: actions/checkout@v2 + # - uses: actions/download-artifact@master + # with: + # name: document + # path: document + # - uses: netlify/actions/cli@master + # env: + # NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_PERSONAL_ACCESS_TOKEN }} + # NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} + # with: + # args: deploy --dir=document --prod deploy: if: github.ref == 'refs/heads/main' diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 238987a5..4a990758 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -2,6 +2,15 @@ All notable changes to this project will be documented in this file. This change == Unreleased (dev) +== 3.7.4 (2022-01-09) +// {{{ +=== Changed +* https://github.com/liquidz/vim-iced/issues/225[#225] https://github.com/liquidz/vim-iced/issues/372[#372]: Updated to use `ns` optional parameter in evaluating code. + +=== Fixed +* Fixed to open zip file correctly on v8.2.3606 or later. +// }}} + == 3.7.3 (2021-12-29) // {{{ === Changed diff --git a/README.adoc b/README.adoc index 885fb901..975599cc 100644 --- a/README.adoc +++ b/README.adoc @@ -171,6 +171,6 @@ and https://github.com/liquidz/iced-nrepl[iced-nrepl]. == License -Copyright (c) 2018-2021 http://twitter.com/uochan[Masashi Iizuka] +Copyright (c) 2018-2022 http://twitter.com/uochan[Masashi Iizuka] Distributed under the MIT License. diff --git a/autoload/iced/clojuredocs.vim b/autoload/iced/clojuredocs.vim index f6857a3a..66709a30 100644 --- a/autoload/iced/clojuredocs.vim +++ b/autoload/iced/clojuredocs.vim @@ -87,10 +87,10 @@ function! s:parse_qualified_symbol(qualified_symbol) abort let i = stridx(a:qualified_symbol, '/') if i < 0 | return {} | endif - return { + return iced#promise#resolve({ \ 'ns': a:qualified_symbol[0:i-1], \ 'name': a:qualified_symbol[i+1:], - \ } + \ }) endfunction function! s:construct_error_message() abort @@ -122,18 +122,19 @@ endfunction function! iced#clojuredocs#open(symbol) abort call iced#message#echom('fetching') - call iced#promise#call('iced#nrepl#ns#in', []) - \.then({_ -> (stridx(a:symbol, '/') > 0) - \ ? s:parse_qualified_symbol(a:symbol) - \ : iced#promise#call('iced#nrepl#var#get', [a:symbol])}) - \.then({resp -> iced#util#has_status(resp, 'no-info') - \ ? iced#promise#reject('not-found') - \ : s:lookup(resp)}) - \.then({resp -> iced#util#has_status(resp, 'no-doc') - \ ? iced#message#error_str(s:construct_error_message()) - \ : s:show_doc(resp)}, - \ {err -> iced#message#error_str(s:construct_error_message())}) - \.catch({err -> iced#message#error('unexpected_error', err)}) + + let p = (stridx(a:symbol, '/') > 0) + \ ? s:parse_qualified_symbol(a:symbol) + \ : iced#promise#call('iced#nrepl#var#get', [a:symbol]) + + call p.then({resp -> iced#util#has_status(resp, 'no-info') + \ ? iced#promise#reject('not-found') + \ : s:lookup(resp)}) + \.then({resp -> iced#util#has_status(resp, 'no-doc') + \ ? iced#message#error_str(s:construct_error_message()) + \ : s:show_doc(resp)}, + \ {err -> iced#message#error_str(s:construct_error_message())}) + \.catch({err -> iced#message#error('unexpected_error', err)}) endfunction let &cpoptions = s:save_cpo diff --git a/autoload/iced/nrepl.vim b/autoload/iced/nrepl.vim index 935b9593..90237ad5 100644 --- a/autoload/iced/nrepl.vim +++ b/autoload/iced/nrepl.vim @@ -415,11 +415,8 @@ function! s:warm_up() abort endif if iced#nrepl#check_session_validity(v:false) - if iced#nrepl#ns#name() ==# s:nrepl['init_ns'] - call iced#nrepl#ns#in() - else - call iced#nrepl#ns#load_current_file({_ -> ''}) - endif + \ && iced#nrepl#ns#name_by_buf() !=# s:nrepl['init_ns'] + call iced#nrepl#ns#load_current_file({_ -> ''}) endif call iced#format#set_indentexpr() @@ -640,6 +637,11 @@ function! iced#nrepl#eval(code, ...) abort \ 'callback': Callback, \ } + let ns_name = get(option, 'ns', '') + if !empty(ns_name) + let msg['ns'] = ns_name + endif + if has_key(option, 'use-printer?') let msg['nrepl.middleware.print/print'] = get(s:printer_dict, g:iced#nrepl#printer, s:printer_dict['default']) endif diff --git a/autoload/iced/nrepl/auto.vim b/autoload/iced/nrepl/auto.vim index 63e8464d..d017468f 100644 --- a/autoload/iced/nrepl/auto.vim +++ b/autoload/iced/nrepl/auto.vim @@ -26,17 +26,7 @@ function! iced#nrepl#auto#bufenter() abort if !iced#nrepl#is_connected() | return | endif call s:auto_switching_session() - " eval `in-ns` automatically - " NOTE: Do not use `iced#nrepl#ns#in` here - " because ns-name by `*in*` var may be different in new buffer. - if ! iced#nrepl#check_session_validity(v:false) | return | endif - let ns_name = iced#nrepl#ns#name_by_buf() - let ns_name = (empty(ns_name)) - \ ? iced#nrepl#init_ns() - \ : ns_name - if !empty(ns_name) - call iced#nrepl#ns#in(ns_name, {_ -> ''}) - endif + call iced#nrepl#ns#create() endfunction function! iced#nrepl#auto#bufread() abort @@ -49,7 +39,7 @@ function! iced#nrepl#auto#bufread() abort call s:auto_switching_session() if !iced#nrepl#check_session_validity(v:false) | return | endif - call iced#nrepl#ns#require_if_not_loaded_promise() + call iced#nrepl#ns#create() call iced#format#set_indentexpr() endfunction diff --git a/autoload/iced/nrepl/cljs.vim b/autoload/iced/nrepl/cljs.vim index d4bedb2f..0ac8eeb9 100644 --- a/autoload/iced/nrepl/cljs.vim +++ b/autoload/iced/nrepl/cljs.vim @@ -19,7 +19,7 @@ function! s:set_cljs_session(original_cljs_session) abort call iced#nrepl#set_session('cljs', a:original_cljs_session) call iced#nrepl#set_session('clj', cloned_cljs_session) " Quit **CLONED** cljs session to work as a clj session - return iced#nrepl#eval#code(s:quit_code, {'session': 'clj', 'ignore_session_validity': v:true, 'verbose': v:false}) + return iced#nrepl#eval#code(s:quit_code, {'session': 'clj', 'ignore_session_validity': v:true, 'verbose': v:false, 'ignore_ns': v:true}) endfunction function! s:unset_cljs_session() abort @@ -49,24 +49,23 @@ function! iced#nrepl#cljs#check_switching_session(eval_resp, evaluated_code) abo let env_name = iced#nrepl#cljs#env_name() if eq_to_clj_session && ns ==# g:iced#nrepl#init_cljs_ns + " Switch to CLJS session from CLJ session let p = s:set_cljs_session(eval_session) " shadow-cljs forces you to change current session to CLJS if ext !=# 'clj' || env_name ==# 'shadow-cljs' call iced#nrepl#change_current_session('cljs') - call iced#nrepl#ns#in() call iced#hook#run('session_switched', {'session': 'cljs'}) endif call iced#message#info('started_cljs_repl') return p + elseif eq_to_cljs_session \ && !get(iced#nrepl#get_cljs_env(), 'ignore-quit-detecting', v:false) \ && a:evaluated_code ==# s:quit_code + " Quit CLJS session call s:unset_cljs_session() call iced#nrepl#change_current_session('clj') - if ext !=# 'cljs' - call iced#nrepl#ns#in() - endif call iced#message#info('quitted_cljs_repl') call iced#hook#run('session_switched', {'session': 'clj'}) @@ -108,7 +107,7 @@ function! iced#nrepl#cljs#start_repl(code, ...) abort else let code = printf('(do %s (cider.piggieback/cljs-repl %s))', pre_code, a:code) endif - call iced#nrepl#eval#code(code, {'ignore_session_validity': v:true}) + call iced#nrepl#eval#code(code, {'ignore_session_validity': v:true, 'ignore_ns': v:true}) return v:true endif return v:false @@ -116,12 +115,12 @@ endfunction function! iced#nrepl#cljs#stop_repl(...) abort if iced#nrepl#cljs_session() !=# '' - call iced#nrepl#eval#code(s:quit_code, {'session': 'cljs', 'ignore_session_validity': v:true}) + call iced#nrepl#eval#code(s:quit_code, {'session': 'cljs', 'ignore_session_validity': v:true, 'ignore_ns': v:true}) let opt = get(a:, 1, {}) let post_code = get(opt, 'post', '') if !empty(post_code) - call iced#nrepl#eval#code(post_code, {'ignore_session_validity': v:true}) + call iced#nrepl#eval#code(post_code, {'ignore_session_validity': v:true, 'ignore_ns': v:true}) endif return v:true endif diff --git a/autoload/iced/nrepl/document.vim b/autoload/iced/nrepl/document.vim index bcc23753..a38665a4 100644 --- a/autoload/iced/nrepl/document.vim +++ b/autoload/iced/nrepl/document.vim @@ -118,8 +118,8 @@ endfunction function! s:generate_doc_by_meta(symbol) abort let code = iced#socket_repl#document#code(a:symbol) - return iced#promise#call('iced#nrepl#ns#in', []) - \.then({_ -> iced#promise#call('iced#nrepl#eval', [code])}) + let opt = {'ns': iced#nrepl#ns#name_by_buf()} + return iced#promise#call('iced#nrepl#eval', [code, opt]) \.then({resp -> get(resp, 'value', '')}) \.then({value -> substitute(value, '\(^"\|"$\)', '', 'g')}) \.then({value -> substitute(trim(value), '\\n', "\n", 'g')}) @@ -160,8 +160,7 @@ endfunction function! iced#nrepl#document#open(symbol) abort if iced#nrepl#is_supported_op('info') if !iced#nrepl#check_session_validity() | return | endif - return iced#promise#call('iced#nrepl#ns#in', []) - \.then({_ -> iced#promise#call('iced#nrepl#var#get', [a:symbol])}) + return iced#promise#call('iced#nrepl#var#get', [a:symbol]) \.then({resp -> s:generate_doc(resp)}) \.then(funcref('s:view_doc_on_buffer')) else @@ -181,8 +180,7 @@ function! iced#nrepl#document#popup_open(symbol) abort if !iced#nrepl#check_session_validity() return iced#promise#resolve(v:false) endif - return iced#promise#call('iced#nrepl#ns#in', []) - \.then({_ -> iced#promise#call('iced#nrepl#var#get', [a:symbol])}) + return iced#promise#call('iced#nrepl#var#get', [a:symbol]) \.then({resp -> s:generate_doc(resp)}) \.then(funcref('s:view_doc_on_popup')) else @@ -416,8 +414,7 @@ endfunction function! iced#nrepl#document#usecase(symbol) abort let ns = iced#nrepl#ns#name() - return iced#promise#call('iced#nrepl#ns#in', []) - \.then({_ -> iced#promise#call('iced#nrepl#var#get', [a:symbol])}) + return iced#promise#call('iced#nrepl#var#get', [a:symbol]) \.then({resp -> s:__usecase_find_references(resp)}) \.then({refs -> s:find_usecase(refs)}) endfunction diff --git a/autoload/iced/nrepl/eval.vim b/autoload/iced/nrepl/eval.vim index 561849ff..6eb42254 100644 --- a/autoload/iced/nrepl/eval.vim +++ b/autoload/iced/nrepl/eval.vim @@ -102,9 +102,15 @@ function! iced#nrepl#eval#code(code, ...) abort unlet opt['callback'] endif + if !get(opt, 'ignore_ns', v:false) + let ns_name = iced#nrepl#ns#name_by_buf() + if !empty(ns_name) + let opt['ns'] = ns_name + endif + endif + try - return iced#nrepl#ns#require_if_not_loaded_promise() - \.then({_ -> iced#promise#call('iced#nrepl#eval', [code, opt])}) + return iced#promise#call('iced#nrepl#eval', [code, opt]) \.then(Callback) finally let @@ = reg_save diff --git a/autoload/iced/nrepl/navigate.vim b/autoload/iced/nrepl/navigate.vim index f124318d..a91f89f6 100644 --- a/autoload/iced/nrepl/navigate.vim +++ b/autoload/iced/nrepl/navigate.vim @@ -430,18 +430,18 @@ function! iced#nrepl#navigate#browse_references(symbol) abort elseif stridx(symbol, ':') == 0 call s:fn_refs_callback(s:clj_kondo_analysis_to_fn_refs(kondo.keyword_usages(symbol[1:]))) else - call iced#nrepl#ns#in({_ -> iced#nrepl#var#get(symbol, {resp -> + call iced#nrepl#var#get(symbol, {resp -> \ s:got_var_info(resp, {ns, symbol -> \ s:fn_refs_callback(s:clj_kondo_analysis_to_fn_refs(kondo.references(ns, symbol))) - \ })})}) + \ })}) endif elseif iced#nrepl#is_supported_op('fn-refs') " Use cider-nrepl's xref op " In this case, only loaded vars are detected. - call iced#nrepl#ns#in({_ -> iced#nrepl#var#get(a:symbol, {resp -> + call iced#nrepl#var#get(a:symbol, {resp -> \ s:got_var_info(resp, {ns, symbol -> \ iced#nrepl#op#cider#fn_refs(ns, symbol, s:fn_refs_callback) - \ })})}) + \ })}) else call iced#message#error('not_supported') endif @@ -455,17 +455,17 @@ function! iced#nrepl#navigate#browse_dependencies(symbol) abort let kondo = iced#system#get('clj_kondo') if kondo.is_analyzed() " Use clj-kondo's analysis - call iced#nrepl#ns#in({_ -> iced#nrepl#var#get(a:symbol, {resp -> + call iced#nrepl#var#get(a:symbol, {resp -> \ s:got_var_info(resp, {ns, symbol -> \ s:fn_deps_callback(s:clj_kondo_analysis_to_fn_deps(kondo.dependencies(ns, symbol))) - \ })})}) + \ })}) elseif iced#nrepl#is_supported_op('fn-deps') " Use cider-nrepl's xref op " In this case, only loaded vars are detected. - call iced#nrepl#ns#in({_ -> iced#nrepl#var#get(a:symbol, {resp -> + call iced#nrepl#var#get(a:symbol, {resp -> \ s:got_var_info(resp, {ns, symbol -> \ iced#nrepl#op#cider#fn_deps(ns, symbol, s:fn_deps_callback) - \ })})}) + \ })}) else call iced#message#error('not_supported') endif diff --git a/autoload/iced/nrepl/ns.vim b/autoload/iced/nrepl/ns.vim index 1fd1557d..1a84f601 100644 --- a/autoload/iced/nrepl/ns.vim +++ b/autoload/iced/nrepl/ns.vim @@ -7,23 +7,33 @@ let g:iced#nrepl#ns#refresh_after_fn = get(g:, 'iced#nrepl#ns#refresh_after_fn', let s:V = vital#iced#new() let s:D = s:V.import('Data.Dict') -function! s:buffer_ns_loaded() abort - let b:iced_ns_loaded = 1 +let s:create_ns_code = join([ + \ '(when-not (clojure.core/find-ns ''%s)', + \ ' (clojure.core/create-ns ''%s))', + \ ]) + +function! s:buffer_ns_created() abort + let b:iced_ns_created = 1 return v:true endfunction -function! iced#nrepl#ns#require_if_not_loaded_promise() abort - if exists('b:iced_ns_loaded') - return iced#promise#resolve(v:true) - endif +function! iced#nrepl#ns#create() abort + if exists('b:iced_ns_created') | return | endif + if !iced#nrepl#is_connected() | return | endif - if !iced#nrepl#is_connected() && !iced#nrepl#auto_connect() - return iced#promise#resolve(v:false) - endif + let ns_name = iced#nrepl#ns#name_by_buf() + if ns_name ==# '' | return | endif + let create_code = printf(s:create_ns_code, ns_name, ns_name) " NOTE: For midje user, requiring ns leads running tests. - " So vim-iced evaluates ns form in CLJ session. - return iced#promise#call('iced#nrepl#ns#eval', []) + " So vim-iced only evaluates ns form in CLJ session. + let Require_fn = function('iced#nrepl#ns#eval') + + return iced#nrepl#eval(create_code, {resp -> + \ (get(resp, 'value', 'nil') ==# 'nil') + \ ? s:buffer_ns_created() + \ : iced#promise#call(Require_fn, []).then({_ -> s:buffer_ns_created()}) + \ }) endfunction function! iced#nrepl#ns#get() abort @@ -92,33 +102,20 @@ function! iced#nrepl#ns#eval(callback) abort if empty(code) call a:callback('') else - call iced#nrepl#eval(code, {'verbose': v:false}, {resp -> s:buffer_ns_loaded() && a:callback(resp)}) + call iced#nrepl#eval( + \ code, + \ {'verbose': v:false, 'ns': iced#nrepl#ns#name_by_buf()}, + \ {resp -> s:buffer_ns_created() && a:callback(resp)}) endif endfunction -function! iced#nrepl#ns#in(...) abort - let ns_name = '' - let Callback = '' - - if a:0 == 1 - let ns_name = iced#nrepl#ns#name() - let Callback = get(a:, 1, {_ -> ''}) - elseif a:0 == 2 - let ns_name = get(a:, 1, '') - let Callback = get(a:, 2, {_ -> ''}) - endif - - let ns_name = empty(ns_name) ? iced#nrepl#ns#name() : ns_name - let Callback = (type(Callback) == v:t_func) ? Callback : {_ -> ''} - if empty(ns_name) | return | endif - call iced#nrepl#eval(printf('(in-ns ''%s)', ns_name), {'verbose': v:false}, {resp -> - \ s:buffer_ns_loaded() && Callback(resp)}) -endfunction - function! iced#nrepl#ns#require(ns_name, callback) abort if !iced#nrepl#is_connected() | return iced#message#error('not_connected') | endif let code = printf('(clojure.core/require ''%s)', a:ns_name) - call iced#nrepl#eval(code, {'verbose': v:false}, {resp -> s:buffer_ns_loaded() && a:callback(resp)}) + call iced#nrepl#eval( + \ code, + \ {'verbose': v:false, 'ns': iced#nrepl#ns#name_by_buf()}, + \ {resp -> s:buffer_ns_created() && a:callback(resp)}) endfunction function! s:cljs_load_file(callback) abort @@ -141,7 +138,6 @@ function! s:loaded(resp, callback) abort elseif has_key(a:resp, 'err') return iced#nrepl#eval#err(a:resp['err']) endif - call iced#nrepl#ns#in(a:callback) endfunction function! s:required(resp) abort @@ -159,9 +155,9 @@ function! iced#nrepl#ns#load_current_file(...) abort if ! iced#nrepl#check_session_validity() | return | endif if iced#nrepl#is_supported_op('load-file') - call iced#nrepl#load_file({resp -> s:buffer_ns_loaded() && s:loaded(resp, Cb)}) + call iced#nrepl#load_file({resp -> s:buffer_ns_created() && s:loaded(resp, Cb)}) else - call s:cljs_load_file({resp -> s:buffer_ns_loaded() && Cb(resp)}) + call s:cljs_load_file({resp -> s:buffer_ns_created() && Cb(resp)}) endif endfunction @@ -178,26 +174,12 @@ function! iced#nrepl#ns#reload_all() abort if iced#nrepl#current_session_key() ==# 'clj' let ns = iced#nrepl#ns#name() let code = printf('(clojure.core/require ''%s :reload-all)', ns) - call iced#nrepl#eval(code, Cb) + call iced#nrepl#eval(code, {'ns': ns}, Cb) else call s:cljs_load_file(Cb) endif endfunction -function! iced#nrepl#ns#in_init_ns() abort - if iced#nrepl#current_session_key() ==# 'cljs' - return iced#message#error('invalid_session', 'clj') - endif - - let ns_name = iced#nrepl#init_ns() - if empty(ns_name) - call iced#message#warn('not_found') - return - endif - - call iced#nrepl#ns#in(ns_name, {resp -> iced#nrepl#eval#out(resp)}) -endfunction - function! iced#nrepl#ns#does_exist(ns_name) abort " FIXME: Workaround for supporting cider-nrepl 0.21.0 " In cljs, find-ns is bootstrap only. @@ -280,7 +262,7 @@ function! iced#nrepl#ns#unalias(alias_name, ...) abort endif let code = printf("(ns-unalias '%s '%s)", ns_name, alias_name) - return iced#nrepl#eval(code, Callback) + return iced#nrepl#eval(code, {'ns': ns_name}, Callback) endfunction function! iced#nrepl#ns#yank_name() abort diff --git a/autoload/iced/nrepl/var.vim b/autoload/iced/nrepl/var.vim index e640b5ce..81882756 100644 --- a/autoload/iced/nrepl/var.vim +++ b/autoload/iced/nrepl/var.vim @@ -120,7 +120,7 @@ function! iced#nrepl#var#extract_by_current_top_list(callback) abort endif let pos = ret['curpos'] - let option = {'line': pos[1], 'column': pos[2]} + let option = {'line': pos[1], 'column': pos[2], 'ns': iced#nrepl#ns#name_by_buf()} call iced#nrepl#eval(code, option, {resp -> \ s:extract_var_name(resp, a:callback)}) endfunction diff --git a/autoload/iced/util.vim b/autoload/iced/util.vim index fe7afa2e..b1eb3808 100644 --- a/autoload/iced/util.vim +++ b/autoload/iced/util.vim @@ -189,7 +189,13 @@ function! iced#util#normalize_path(path) abort let path = substitute(a:path, '^file:', '', '') " NOTE: jar:file:/path/to/jarfile.jar!/path/to/file.clj if stridx(path, 'jar:') == 0 - let path = substitute(path, '^jar:file:', 'zipfile:', '') + " cf. https://github.com/vim/vim/compare/v8.2.3605...v8.2.3606 + if has('patch-8.2.3606') || has('nvim') + let path = substitute(path, '^jar:file:', 'zipfile://', '') + else + let path = substitute(path, '^jar:file:', 'zipfile:', '') + endif + let path = substitute(path, '!/', '::', '') endif return path diff --git a/doc/vim-iced.txt b/doc/vim-iced.txt index 48931af9..e71ed2f8 100644 --- a/doc/vim-iced.txt +++ b/doc/vim-iced.txt @@ -1,6 +1,6 @@ *vim-iced.txt* Clojure interactive development environment for Vim8/Neovim -Version: 3.7.3 +Version: 3.7.4 Author : Masashi Iizuka License: MIT LICENSE @@ -1321,11 +1321,6 @@ COMMANDS *vim-iced-commands* If {ns} is not passed, current buffer's ns name is used. Key is mapped to |(iced_toggle_trace_ns)|. - *:IcedInInitNs* -:IcedInInitNs - Sets `*ns*` to the session's initnal namespace name. - Key is mapped to |(iced_in_init_ns)|. - *:IcedJumpToNextSign* :IcedJumpToNextSign Jump cursor to next sign in current buffer. @@ -1788,10 +1783,6 @@ KEY MAPPINGS *vim-iced-key-mappings* (iced_toggle_trace_ns) Same as |:IcedToggleTraceNs|. - *(iced_in_init_ns)* -(iced_in_init_ns) - Same as |:IcedInInitNs|. - *(iced_jump_to_next_sign)* (iced_jump_to_next_sign) Same as |:IcedJumpToNextSign|. diff --git a/ftplugin/clojure.vim b/ftplugin/clojure.vim index 0240afbc..8f77bd42 100644 --- a/ftplugin/clojure.vim +++ b/ftplugin/clojure.vim @@ -2,7 +2,7 @@ if exists('g:loaded_vim_iced') finish endif let g:loaded_vim_iced = 1 -let g:vim_iced_version = 30703 +let g:vim_iced_version = 30704 let g:vim_iced_home = expand(':p:h:h') " NOTE: https://github.com/vim/vim/commit/162b71479bd4dcdb3a2ef9198a1444f6f99e6843 " Add functions for defining and placing signs. @@ -85,7 +85,7 @@ command! -nargs=+ -complete=custom,iced#nrepl#cljs#env_complete command! IcedQuitCljsRepl call iced#nrepl#cljs#stop_repl_via_env() command! IcedCycleSession call iced#nrepl#cljs#cycle_session() -command! -nargs=1 IcedEval call iced#repl#execute('eval_code', , {'ignore_session_validity': v:true}) +command! -nargs=1 IcedEval call iced#repl#execute('eval_code', , {'ignore_session_validity': v:true, 'ignore_ns': v:true}) command! IcedEvalNs call iced#nrepl#eval#ns() command! -range IcedEvalVisual call iced#nrepl#eval#visual() command! IcedRequire call iced#repl#execute('load_current_file') @@ -177,8 +177,6 @@ command! command! -nargs=? IcedToggleTraceVar call iced#nrepl#trace#toggle_var() command! -nargs=? IcedToggleTraceNs call iced#nrepl#trace#toggle_ns() -command! IcedInInitNs call iced#nrepl#ns#in_init_ns() - command! IcedJumpToNextSign call iced#system#get('sign').jump_to_next() command! IcedJumpToPrevSign call iced#system#get('sign').jump_to_prev() command! IcedJumpToNextError call iced#system#get('sign').jump_to_next({'name': iced#nrepl#test#sign_name()}) @@ -300,8 +298,6 @@ nnoremap nnoremap (iced_toggle_trace_ns) :IcedToggleTraceNs nnoremap (iced_toggle_trace_var) :IcedToggleTraceVar -nnoremap (iced_in_init_ns) :IcedInInitNs - nnoremap (iced_jump_to_next_sign) :IcedJumpToNextSign nnoremap (iced_jump_to_prev_sign) :IcedJumpToPrevSign nnoremap (iced_jump_to_let) :IcedJumpToLet diff --git a/test/nrepl.vim b/test/nrepl.vim index 0d48d8f9..0e77a875 100644 --- a/test/nrepl.vim +++ b/test/nrepl.vim @@ -208,13 +208,13 @@ function! s:suite.path_translation_handler_with_normalize_path_test() abort call s:assert.equals( \ iced#nrepl#path_translation_handler(['path', 'hello'], resp, ''), - \ {'path': '/tmp/foo/bar', 'hello': ['/tmp/world', 'zipfile:/tmp/world.jar::tmp/file.clj']}, + \ {'path': '/tmp/foo/bar', 'hello': ['/tmp/world', 'zipfile:///tmp/world.jar::tmp/file.clj']}, \ ) let g:iced#nrepl#path_translation = {'/tmp': '/src'} call s:assert.equals( \ iced#nrepl#path_translation_handler(['path', 'hello'], resp, ''), - \ {'path': '/src/foo/bar', 'hello': ['/src/world', 'zipfile:/src/world.jar::tmp/file.clj']}, + \ {'path': '/src/foo/bar', 'hello': ['/src/world', 'zipfile:///src/world.jar::tmp/file.clj']}, \ ) let g:iced#nrepl#path_translation = {} diff --git a/test/nrepl_auto.vim b/test/nrepl_auto.vim index ce448d33..185b9065 100644 --- a/test/nrepl_auto.vim +++ b/test/nrepl_auto.vim @@ -65,7 +65,8 @@ function! s:suite.bufenter_in_clj_file_test() abort call s:test.clear_messages() call iced#nrepl#auto#bufenter() call s:assert.equals(iced#nrepl#current_session(), 'clj-session') - call s:assert.equals(s:test.get_messages()[0]['code'], '(in-ns ''clj.foo)') + call s:assert.equals(s:test.get_messages()[0]['code'], '(when-not (clojure.core/find-ns ''clj.foo) (clojure.core/create-ns ''clj.foo))') + unlet b:iced_ns_created " Switched session call iced#nrepl#change_current_session('cljs') @@ -74,7 +75,8 @@ function! s:suite.bufenter_in_clj_file_test() abort call s:assert.equals(iced#nrepl#current_session(), 'cljs-session') call iced#nrepl#auto#bufenter() call s:assert.equals(iced#nrepl#current_session(), 'clj-session') - call s:assert.equals(s:test.get_messages()[0]['code'], '(in-ns ''clj.foo)') + call s:assert.equals(s:test.get_messages()[0]['code'], '(when-not (clojure.core/find-ns ''clj.foo) (clojure.core/create-ns ''clj.foo))') + unlet b:iced_ns_created call s:teardown() let g:iced#nrepl#auto#does_switch_session = v:false @@ -89,7 +91,8 @@ function! s:suite.bufenter_in_cljs_file_test() abort call s:test.clear_messages() call iced#nrepl#auto#bufenter() call s:assert.equals(iced#nrepl#current_session(), 'cljs-session') - call s:assert.equals(s:test.get_messages()[0]['code'], '(in-ns ''cljs.bar)') + call s:assert.equals(s:test.get_messages()[0]['code'], '(when-not (clojure.core/find-ns ''cljs.bar) (clojure.core/create-ns ''cljs.bar))') + unlet b:iced_ns_created " Switched session call iced#nrepl#change_current_session('clj') @@ -98,7 +101,8 @@ function! s:suite.bufenter_in_cljs_file_test() abort call s:assert.equals(iced#nrepl#current_session(), 'clj-session') call iced#nrepl#auto#bufenter() call s:assert.equals(iced#nrepl#current_session(), 'cljs-session') - call s:assert.equals(s:test.get_messages()[0]['code'], '(in-ns ''cljs.bar)') + call s:assert.equals(s:test.get_messages()[0]['code'], '(when-not (clojure.core/find-ns ''cljs.bar) (clojure.core/create-ns ''cljs.bar))') + unlet b:iced_ns_created call s:teardown() let g:iced#nrepl#auto#does_switch_session = v:false diff --git a/test/nrepl_navigate.vim b/test/nrepl_navigate.vim index d66a54bf..b6893a12 100644 --- a/test/nrepl_navigate.vim +++ b/test/nrepl_navigate.vim @@ -120,7 +120,7 @@ function! s:suite.jump_to_def_in_jar_test() abort call iced#nrepl#navigate#jump_to_def('dummy') call s:assert.equals( \ s:ex_cmd.get_last_args(), - \ {'exe': ':edit zipfile:/path/to/jarfile.jar::path/to/file.clj'}) + \ {'exe': ':edit zipfile:///path/to/jarfile.jar::path/to/file.clj'}) call s:teardown() endfunction diff --git a/test/util.vim b/test/util.vim index 855a894d..7924e879 100644 --- a/test/util.vim +++ b/test/util.vim @@ -131,7 +131,7 @@ function! s:suite.normalize_path_test() abort call s:assert.equals(iced#util#normalize_path('/foo/bar.txt'), \ '/foo/bar.txt') call s:assert.equals(iced#util#normalize_path('jar:file:/path/to/jarfile.jar!/path/to/file.clj'), - \ 'zipfile:/path/to/jarfile.jar::path/to/file.clj') + \ 'zipfile:///path/to/jarfile.jar::path/to/file.clj') endfunction function! s:suite.list_to_dict_test() abort