From 0291db2bb55197d41c9d8008c343b8777ab3b3ad Mon Sep 17 00:00:00 2001 From: liquidz Date: Thu, 13 Jun 2024 08:16:26 +0900 Subject: [PATCH 1/3] breaking: Remove support for nREPL's sideloader --- autoload/iced/nrepl.vim | 10 ---- autoload/iced/nrepl/sideloader.vim | 77 ------------------------------ doc/pages/index.adoc | 6 --- doc/pages/sideloader.adoc | 72 ---------------------------- doc/vim-iced.txt | 62 ------------------------ ftplugin/clojure.vim | 6 --- message/iced/en.txt | 3 -- 7 files changed, 236 deletions(-) delete mode 100644 autoload/iced/nrepl/sideloader.vim delete mode 100644 doc/pages/sideloader.adoc diff --git a/autoload/iced/nrepl.vim b/autoload/iced/nrepl.vim index e89ad27f6..8a865b00a 100644 --- a/autoload/iced/nrepl.vim +++ b/autoload/iced/nrepl.vim @@ -42,7 +42,6 @@ let g:iced#nrepl#skip_evaluation_when_buffer_size_is_exceeded let g:iced#nrepl#printer = get(g:, 'iced#nrepl#printer', 'default') let g:iced#nrepl#path_translation = get(g:, 'iced#nrepl#path_translation', {}) let g:iced#nrepl#init_cljs_ns = get(g:, 'iced#nrepl#init_cljs_ns', 'cljs.user') -let g:iced#nrepl#enable_sideloader = get(g:, 'iced#nrepl#enable_sideloader', v:false) let s:id_counter = 1 function! iced#nrepl#id() abort @@ -271,7 +270,6 @@ function! s:dispatcher(ch, resp) abort let future = iced#system#get('future') let need_debug_input_response = '' - let sideloader_lookup_response = '' for resp in responses if type(resp) != v:t_dict @@ -295,8 +293,6 @@ function! s:dispatcher(ch, resp) abort for status in get(resp, 'status', ['']) if status ==# 'need-debug-input' let need_debug_input_response = resp - elseif status ==# 'sideloader-lookup' - let sideloader_lookup_response = resp endif endfor endfor @@ -338,8 +334,6 @@ function! s:dispatcher(ch, resp) abort call iced#buffer#stdout#open() endif call iced#nrepl#debug#start(need_debug_input_response) - elseif !empty(sideloader_lookup_response) - call iced#nrepl#sideloader#lookup(sideloader_lookup_response) endif endfunction " }}} @@ -419,10 +413,6 @@ function! s:warm_up() abort call iced#nrepl#ns#load_current_file({_ -> ''}) endif call iced#format#set_indentexpr() - - if g:iced#nrepl#enable_sideloader && iced#nrepl#is_supported_op('sideloader-start') - call iced#nrepl#sideloader#start() - endif endfunction function! s:status(ch) abort diff --git a/autoload/iced/nrepl/sideloader.vim b/autoload/iced/nrepl/sideloader.vim deleted file mode 100644 index a8e229010..000000000 --- a/autoload/iced/nrepl/sideloader.vim +++ /dev/null @@ -1,77 +0,0 @@ -let s:save_cpo = &cpoptions -set cpoptions&vim - -let s:default_source_root = executable('ghq') - \ ? trim(system('git config ghq.root')) - \ : '' -let g:iced#source_root = get(g:, 'iced#source_root', s:default_source_root) - -function! iced#nrepl#sideloader#start() abort - if !iced#nrepl#is_connected() | return | endif - if !executable('base64') - return iced#message#error('not_installed', 'base64') - endif - - if empty(g:iced#source_root) - return iced#message#error('no_source_root') - endif - - call iced#nrepl#send({ - \ 'op': 'sideloader-start', - \ 'session': iced#nrepl#current_session(), - \ 'callback': {_ -> ''}, - \ 'does_not_capture_id': v:true, - \ }) - call iced#message#info('started_sideloader') -endfunction - -function! iced#nrepl#sideloader#stop() abort - " NOTE: nrepl doesn't have a op to stop sideloader. - " but sideloader is a session specific mode, - " so we can stop sideloading by stopping to use current session. - if !iced#nrepl#is_connected() | return | endif - - let current_session = iced#nrepl#clj_session() - return iced#nrepl#clone(current_session, - \ {resp -> iced#nrepl#set_session('clj', resp['new-session']) || - \ iced#nrepl#close(current_session, - \ {_ -> iced#message#info('stopped_sideloader')})}) -endfunction - -function! s:lookup(file, callback) abort - if empty(a:file) - return a:callback('') - endif - - call iced#system#get('job_out').redir(printf('base64 %s', a:file), a:callback) -endfunction - -function! s:provide(session, type, name, content) abort - if !empty(a:content) - call iced#message#info('provided_sideloader', a:name, a:type) - endif - - call iced#nrepl#send({ - \ 'op': 'sideloader-provide', - \ 'session': a:session, - \ 'type': a:type, - \ 'name': a:name, - \ 'content': a:content, - \ 'does_not_capture_id': v:true, - \ }) -endfunction - -function! iced#nrepl#sideloader#lookup(resp) abort - if !has_key(a:resp, 'name') || !has_key(a:resp, 'type') | return | endif - - let name = a:resp['name'] - let session = a:resp['session'] - let type = a:resp['type'] - - call iced#system#get('find').file(g:iced#source_root, name, {file -> - \ s:lookup(file, {content -> - \ s:provide(session, type, name, content)})}) -endfunction - -let &cpoptions = s:save_cpo -unlet s:save_cpo diff --git a/doc/pages/index.adoc b/doc/pages/index.adoc index 853da2ef3..dcc647935 100644 --- a/doc/pages/index.adoc +++ b/doc/pages/index.adoc @@ -147,12 +147,6 @@ include::refactoring.adoc[] [small]#<># // }}} -include::sideloader.adoc[] -// back to top {{{ -[.text-right] -[small]#<># -// }}} - include::static_analysis.adoc[] // back to top {{{ [.text-right] diff --git a/doc/pages/sideloader.adoc b/doc/pages/sideloader.adoc deleted file mode 100644 index 8a9cb4f7e..000000000 --- a/doc/pages/sideloader.adoc +++ /dev/null @@ -1,72 +0,0 @@ -== Sideloader [[sideloader]] - -WARNING: `base64` command is required to use sideloader. - -Sideloader is a new feature from https://metaredux.com/posts/2020/03/28/nrepl-0-7.html[nREPL 0.7], and enables injecting code -remotely in a running server on demand. - -vim-iced provides following commands for sideloader: - -- {help_html}#%3AIcedStartSideloader[IcedStartSideloader] -- {help_html}#%3AIcedStopSideloader[IcedStopSideloader] - -When nREPL requires to look up some codes, -vim-iced will search in {help_html}#g%3Aiced%23source_root[g:iced#source_root]. - -It is assumed that sources under {help_html}#g%3Aiced%23source_root[g:iced#source_root] is managed by tools such as https://github.com/x-motemen/ghq[ghq]. - -vim-iced will use `find` or https://github.com/sharkdp/fd[fd] as a searching file program. - -=== Starting sideloader - -There are following ways to start sideloader: - -- execute {help_html}#%3AIcedStartSideloader[IcedStartSideloader] command. -- set `v:true` to {help_html}#g%3Aiced%23nrepl%23enable_sideloader[g:iced#nrepl#enable_sideloader] before launching vim/nvim. - -=== Stopping sideloader - -nREPL does not provide the way to stop sideloader officially. -But sideloader is a session specific mode, so we can stop sideloading by stopping to use current session. - -Executing {help_html}#%3AIcedStopSideloader[IcedStopSideloader] command will -renew the current Clojure session. - -=== Example - -* Premise -** https://github.com/x-motemen/ghq[ghq] is installed -** `clojure.data.json` is cloned via `ghq get https://github.com/clojure/data.json` -** No dependency for `clojure.data.json` in project.clj - -First, prepare the following code. - -[source,clojure] ----- -(ns foo.core) - -(comment - (require '[clojure.data.json :as json]) - (json/write-str {:foo "bar"})) ----- - -When you evaluate `comment` form, you will see the following error. - ----- -class java.io.FileNotFoundException -Execution error (FileNotFoundException) at foo.core/eval13426 (form-init6273881382280324078.clj:7). -Could not locate clojure/data/json__init.class, clojure/data/json.clj or clojure/data/json.cljc on classpath. ----- - -Then, execute {help_html}#%3AIcedStartSideloader[IcedStartSideloader] command, and you can see `Sideloader has started.` message is shown. - -So let's evaluate again! -You'll see the expected result such as `"{\"foo\":\"bar\"}"`. - -You can also confirm that sideloader works clearly in `:message` command results. ----- -Provided clojure/data/json.clj as resource to sideloader. -Provided clojure/data/json.clj as resource to sideloader. -Provided clojure/data/json_compat_0_1.clj as resource to sideloader. -Provided clojure/data/json_compat_0_1.clj as resource to sideloader. ----- diff --git a/doc/vim-iced.txt b/doc/vim-iced.txt index 1641a5d38..2b134eaf6 100644 --- a/doc/vim-iced.txt +++ b/doc/vim-iced.txt @@ -42,7 +42,6 @@ CONTENTS *vim-iced-contents* Format on writing files |vim-iced-formatting-on-writing-files| Indenting |vim-iced-indenting| Refactoring |vim-iced-refactoring| - Sideloader |vim-iced-sideloader| Static analysis |vim-iced-static-analysis| clj-kondo |vim-iced-static-analysis-clj-kondo| Notification |vim-iced-notification| @@ -62,7 +61,6 @@ CONTENTS *vim-iced-contents* Command palettes |vim-iced-customizing-palette| Hooks |vim-iced-customizing-hooks| Popup window |vim-iced-customizing-popup-window| - Sideloader |vim-iced-customizing-sideloader| Notification |vim-iced-customizing-notification| Default keys |vim-iced-customizing-default-keys| Changelog |vim-iced-changelog| @@ -726,28 +724,6 @@ REFACTORING *vim-iced-refactoring* See also: - |g:iced#refactor#insert_newline_after_require| -============================================================================== -SIDELOADER *vim-iced-sideloader* - - WARNING: `base64` command is required to use sideloader. - - Sideloader is a new feature from nREPL 0.7, and enables injecting code - remotely in a running server on demand. - - vim-iced provides following commands for sideloader: - - |:IcedStartSideloader|. - - |:IcedStoptSideloader|. - - When nREPL requires to look up some codes, - vim-iced will search in |g:iced#source_root|. - - It is assumed that sources under |g:iced#source_root| is managed by - tools such as `ghq`. - - https://github.com/x-motemen/ghq - - vim-iced will use `find` or `fd` as a searching file program. - - https://github.com/sharkdp/fd - ============================================================================== STATIC ANALYSIS *vim-iced-static-analysis* @@ -1461,22 +1437,6 @@ COMMANDS *vim-iced-commands* If `let` form is not found in current top list, cursor is not moved. Key is mapped to |(iced_jump_to_let)|. - *:IcedStartSideloader* -:IcedStartSideloader - Start side-loading. - Key is mapped to |(iced_start_sideloader)|. - See also |vim-iced-sideloader|. - - *:IcedStopSideloader* -:IcedStopSideloader - Stop side-loading. - NOTE: nREPL does not provide the way to stop sideloader officially. - But sideloader is a session specific mode, so we can stop - sideloading by stopping to use current session. - - Key is mapped to |(iced_start_sideloader)|. - See also |vim-iced-sideloader|. - *:IcedYankNsName* :IcedYankNsName Yank the current namespace name into `"` register. @@ -1947,14 +1907,6 @@ KEY MAPPINGS *vim-iced-key-mappings* (iced_jump_to_let) Same as |:IcedJumpToLet|. - *(iced_start_sideloader)* -(iced_start_sideloader) - Same as |:IcedStartSideloader|. - - *(iced_stop_sideloader)* -(iced_stop_sideloader) - Same as |:IcedStopSideloader|. - *(iced_yank_ns_name)* (iced_yank_ns_name) Same as |:IcedYankNsName|. @@ -2733,20 +2685,6 @@ g:iced#popup#neovim#style - https://neovim.io/doc/user/api.html#nvim_open_win() Default value is `'minimal'`. ------------------------------------------------------------------------------- -SIDELOADER *vim-iced-customizing-sideloader* - - - *g:iced#nrepl#enable_sideloader* -g:iced#nrepl#enable_sideloader - If `v:true`, vim-iced starts sideloader on startup automatically. - Default value is `v:false`. - - *g:iced#source_root* -g:iced#source_root - If you have `ghq`, `git config ghq.root` will be the value automatically. - - https://github.com/x-motemen/ghq - ------------------------------------------------------------------------------ NOTIFICATION *vim-iced-customizing-notification* diff --git a/ftplugin/clojure.vim b/ftplugin/clojure.vim index 5b289da8c..df2ada9fd 100644 --- a/ftplugin/clojure.vim +++ b/ftplugin/clojure.vim @@ -197,9 +197,6 @@ command! IcedJumpToNextError call iced#system#get('sign').jump_to command! IcedJumpToPrevError call iced#system#get('sign').jump_to_next({'name': iced#nrepl#test#sign_name()}) command! IcedJumpToLet call iced#let#jump_to_let() -command! IcedStartSideloader call iced#nrepl#sideloader#start() -command! IcedStopSideloader call iced#nrepl#sideloader#stop() - command! -nargs=? -complete=custom,iced#component#installer#complete \ IcedUpdateTool call iced#system#get('installer').reinstall() @@ -322,9 +319,6 @@ nnoremap (iced_jump_to_next_sign) :IcedJumpToNextSign nnoremap (iced_jump_to_prev_sign) :IcedJumpToPrevSign nnoremap (iced_jump_to_let) :IcedJumpToLet -nnoremap (iced_start_sideloader) :IcedStartSideloader -nnoremap (iced_stop_sideloader) :IcedStopSideloader - nnoremap (iced_update_tool) :IcedUpdateTool "" }}} diff --git a/message/iced/en.txt b/message/iced/en.txt index 755d83202..bd0f5131a 100644 --- a/message/iced/en.txt +++ b/message/iced/en.txt @@ -80,7 +80,6 @@ 'ns_not_found': '(ns ..) form is not found.', 'ns_vars_error': 'Failed to fetch ns vars.', 'popup_error': 'Failed to open popup: %s.', - 'provided_sideloader': 'Provided %s as %s to sideloader.', 'quitted_cljs_repl': 'CLJS repl has quit.', 'reading': 'Still reading..', 'required': 'Required.', @@ -98,9 +97,7 @@ 'start_to_refresh': 'Start to refresh %s...', 'start_to_trace': 'Start to trace: %s.', 'started_cljs_repl': 'CLJS repl has started.', - 'started_sideloader': 'Sideloader has started.', 'stop_to_trace': 'Stop to trace: %s.', - 'stopped_sideloader': 'Sideloader has stopped.', 'test_summary': '%s: Ran %d assertions, in %d test functions. %d failures, %d errors.', 'testing': 'Testing...', 'testing_var': 'Testing: %s', From bb1087978e2b746f783f02dcc4f72cd3b0ff7404 Mon Sep 17 00:00:00 2001 From: liquidz Date: Sun, 16 Jun 2024 05:43:25 +0900 Subject: [PATCH 2/3] docs: Update CHANGELOG --- CHANGELOG.adoc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 2baba6769..000bcd80c 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -1,6 +1,12 @@ All notable changes to this project will be documented in this file. This change log follows the conventions of http://keepachangelog.com/[keepachangelog.com]. == Unreleased (dev) +// {{{ +=== Changed +* (Breaking) Removed support for nREPL's sideloader functionality. +** nREPL will remove support for sideloader and wrap-sideloader middleware +*** https://github.com/nrepl/nrepl/pull/335 +// }}} == 3.15.3283 (2024-02-29) // {{{ From cfc6b51ca742a90d6dd07e8e7a3f773c707928ae Mon Sep 17 00:00:00 2001 From: liquidz Date: Sun, 16 Jun 2024 05:44:21 +0900 Subject: [PATCH 3/3] chore: Bump major version to 4.0.0 becasue of breaking changes --- build.edn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.edn b/build.edn index 3f282f00a..1da8ac89e 100644 --- a/build.edn +++ b/build.edn @@ -1,5 +1,5 @@ {:lib com.github.liquidz/vim-iced - :version "3.15.{{git/commit-count}}" + :version "4.0.{{git/commit-count}}" :documents [{:file "doc/vim-iced.txt" :match "^Version: " :action :replace