Skip to content

Commit

Permalink
Merge pull request #420 from liquidz/dev
Browse files Browse the repository at this point in the history
3.9.3
  • Loading branch information
liquidz authored Jul 6, 2022
2 parents f4ba5f0 + ff527b5 commit e59c560
Show file tree
Hide file tree
Showing 26 changed files with 180 additions and 140 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ jobs:
- uses: actions/checkout@v3
- uses: DeLaGuardo/setup-clj-kondo@master
with:
version: '2022.05.31'
version: '2022.06.22'
- run: clj-kondo --parallel --lint clj:test/clj --config '{:output {:pattern "::{{level}} file={{filename}},line={{row}},col={{col}}::{{message}}"}}'
17 changes: 17 additions & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,23 @@ All notable changes to this project will be documented in this file. This change

== Unreleased (dev)

== 3.9.3 (2022-07-07)
// {{{
=== Changed
* https://github.com/liquidz/vim-iced/issues/417[#417]: Updated `IcedDefJump` to support `jumplist`.
** See `:h jumplist` for jumplist.
* Bumped cider-nrepl 0.28.5.
* Bumped refactor-nrepl to 3.5.3.
* Bumped jet to 0.2.18.

=== Fixed
* Fixed some commands not to add extra jumplist.
** `IcedAddArity``
** `IcedAddNs``
** `IcedFormat``
* Fixed `IcedAddMissing` to fallback to nREPL when failed to add missings by clj-kondo.
// }}}

== 3.9.2 (2022-06-12)
// {{{
=== Changed
Expand Down
5 changes: 5 additions & 0 deletions autoload/iced/buffer.vim
Original file line number Diff line number Diff line change
Expand Up @@ -175,5 +175,10 @@ function! iced#buffer#close(bufname) abort
endif
endfunction

function! iced#buffer#reset() abort
let s:manager = ''
let s:info = {}
endfunction

let &cpo = s:save_cpo
unlet s:save_cpo
2 changes: 1 addition & 1 deletion autoload/iced/component/edn.vim
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function! iced#component#edn#start(this) abort
else
let s:edn.available = v:true
let s:edn.job = a:this['job']
let s:edn.jet = s:edn.job.start('jet --to json', {
let s:edn.jet = s:edn.job.start('jet --no-pretty --to json', {
\ 'out_cb': funcref('s:out_callback', s:edn),
\ 'drop': 'never',
\ })
Expand Down
12 changes: 6 additions & 6 deletions autoload/iced/component/format/native_image.vim
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ function! s:__current_form(result) abort
let code = trim(join(res.buf, "\n"))
if !empty(code)
let @@ = code
silent normal! gv"0p
keepjumps silent normal! gv"0p
endif
finally
let res['_back_to_bufnr'] = current_bufnr
Expand Down Expand Up @@ -180,18 +180,18 @@ function! s:fmt.minimal(opt) abort
try
if jump_to_its_match
" NOTE: vim-sexp's slurp move cursor to tail of form
normal! %
keepjumps normal! %
endif

let ncol = max([col('.')-1, 0])

let char = getline('.')[ncol]
if char ==# '['
silent normal! va[y
keepjumps silent normal! va[y
elseif char ==# '{'
silent normal! va{y
keepjumps silent normal! va{y
else
silent normal! va(y
keepjumps silent normal! va(y
endif
let code = @@

Expand All @@ -207,7 +207,7 @@ function! s:fmt.minimal(opt) abort
let code = trim(join(d.buf, "\n"))
if !empty(code)
let @@ = iced#util#add_indent(ncol, code)
silent normal! gv"0p
keepjumps silent normal! gv"0p
endif
finally
let @@ = reg_save
Expand Down
12 changes: 6 additions & 6 deletions autoload/iced/component/format/nrepl.vim
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ function! s:__format_form(resp, finally_args) abort

if has_key(a:resp, 'formatted') && !empty(a:resp['formatted'])
let @@ = a:resp['formatted']
silent normal! gv"0p
keepjumps silent normal! gv"0p
elseif has_key(a:resp, 'error')
call iced#message#error_str(a:resp['error'])
endif
Expand Down Expand Up @@ -156,24 +156,24 @@ function! s:fmt.minimal(opt) abort
try
if jump_to_its_match
" NOTE: vim-sexp's slurp move cursor to tail of form
normal! %
keepjumps normal! %
endif

let ncol = max([col('.')-1, 0])

let char = getline('.')[ncol]
if char ==# '['
silent normal! va[y
keepjumps silent normal! va[y
elseif char ==# '{'
silent normal! va{y
keepjumps silent normal! va{y
else
silent normal! va(y
keepjumps silent normal! va(y
endif
let code = @@
let resp = iced#nrepl#op#iced#sync#format_code(code, iced#nrepl#ns#alias_dict(ns_name))
if has_key(resp, 'formatted') && !empty(resp['formatted'])
let @@ = iced#util#add_indent(ncol, resp['formatted'])
silent normal! gv"0p
keepjumps silent normal! gv"0p
endif
finally
let @@ = reg_save
Expand Down
2 changes: 1 addition & 1 deletion autoload/iced/nrepl.vim
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ function! iced#nrepl#check_session_validity(...) abort
let sess_key = iced#nrepl#current_session_key()
let is_verbose = get(a:, 1, v:true)

if !empty(sess_key) && !empty(ext) && ext !=# 'cljc' && sess_key !=# ext
if !empty(sess_key) && !empty(ext) && ext !=# 'cljc' && ext !=# 'edn' && sess_key !=# ext
if is_verbose
call iced#message#error('invalid_session', ext)
endif
Expand Down
6 changes: 4 additions & 2 deletions autoload/iced/nrepl/navigate.vim
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ function! s:jump_to_local_definition(local_def) abort
let row = get(a:local_def, 'row', 1)
let col = get(a:local_def, 'col', 1)

call iced#util#add_curpos_to_jumplist()
call cursor(row, col)
endfunction

Expand Down Expand Up @@ -326,12 +327,13 @@ function! s:jump(base_symbol, jump_cmd, resp) abort
endif
endif

call iced#util#add_curpos_to_jumplist()
if expand('%:p') !=# path
call iced#system#get('ex_cmd').exe(printf(':%s %s', a:jump_cmd, path))
call iced#system#get('ex_cmd').exe(printf(':keepjumps %s %s', a:jump_cmd, path))
endif

call cursor(line, column)
normal! zz

redraw!
endfunction
" }}}
Expand Down
2 changes: 1 addition & 1 deletion autoload/iced/nrepl/ns/util.vim
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function! iced#nrepl#ns#util#replace(new_ns) abort
call iced#message#error('ns_not_found')
return
endif
silent normal! dab
keepjumps silent normal! dab

let new_ns = trim(a:new_ns)
let before_lnum = len(split(@@, '\r\?\n'))
Expand Down
39 changes: 27 additions & 12 deletions autoload/iced/nrepl/refactor.vim
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,11 @@ function! s:__add_missing_ns_select_candidates(symbol_alias, candidates) abort
\ 'accept': {_, ns_name -> s:__add_missing_ns_add(ns_name, a:symbol_alias)}
\ })
else
return iced#message#echom('no_candidates')
call iced#message#echom('no_candidates')
return v:false
endif

return v:true
endfunction

function! s:__add_missing_ns_ns_alias_candidates(symbol_alias, ns_candidates, alias_dict) abort
Expand Down Expand Up @@ -226,13 +229,23 @@ function! iced#nrepl#refactor#add_missing_ns(symbol) abort

if c >= 65 && c <= 90
return iced#promise#call('iced#nrepl#op#iced#java_class_candidates', [symbol, g:iced#ns#class_map])
\.then(funcref('s:__add_missing_java_class_select_candidates'))
elseif kondo.is_analyzed()
return s:__add_missing_by_clj_kondo_analysis(symbol)
elseif iced#nrepl#is_supported_op('resolve-missing')
\.then(funcref('s:__add_missing_java_class_select_candidates'))
endif

let added = v:false
if kondo.is_analyzed()
\ && s:__add_missing_by_clj_kondo_analysis(symbol)
let added = v:true
endif

if ! added
\ && iced#nrepl#is_supported_op('resolve-missing')
call iced#nrepl#op#refactor#add_missing(symbol, {resp ->
\ s:__add_missing_ns_resolve_missing(symbol, resp)})
else
\ s:__add_missing_ns_resolve_missing(symbol, resp)})
let added = v:true
endif

if ! added
return iced#message#error('not_supported')
endif
endfunction " }}}
Expand Down Expand Up @@ -374,14 +387,14 @@ function! iced#nrepl#refactor#add_arity() abort
" For single arity
silent normal! v
call setpos('.', beginning_of_defn)
silent normal! %hy
keepjumps silent normal! %hy
let arity_and_body = @@
if beginning_var_name[1] == beginning_of_arity[1]
let @@ = printf("\n ([])\n (%s)", arity_and_body)
silent normal! gv"0pj
keepjumps silent normal! gv"0pj
else
let @@ = printf("([])\n (%s)", arity_and_body)
silent normal! gv"0p
keepjumps silent normal! gv"0p
endif
endif

Expand All @@ -406,8 +419,10 @@ endfunction

function! s:got_var(var) abort
if !has_key(a:var, 'file')
\|| !has_key(a:var, 'ns') || !has_key(a:var, 'name')
\|| !has_key(a:var, 'column') || !has_key(a:var, 'line')
\ || !has_key(a:var, 'ns')
\ || !has_key(a:var, 'name')
\ || !has_key(a:var, 'column')
\ || !has_key(a:var, 'line')
return iced#message#error('not_found')
endif

Expand Down
11 changes: 6 additions & 5 deletions autoload/iced/paredit.vim
Original file line number Diff line number Diff line change
Expand Up @@ -114,16 +114,17 @@ function! iced#paredit#get_current_top_object_raw(...) abort
call setpos('.', start_pos)
" move to pair
" NOTE: `%` may be matched to parentheses in comment block without matchit.vim
silent exe "normal \<Plug>(sexp_move_to_next_bracket)"
" NOTE: <Plug>(sexp_move_to_next_bracket) changes jumplist
call sexp#move_to_nearest_bracket('n', 1)
let end_pos = getcurpos()

if s:is_in_range(pos, start_pos, end_pos)
" select end_pos to start_pos
call setpos('.', end_pos)
silent exe 'normal! v'
silent exe 'keepjumps normal! v'
call setpos('.', start_pos)
" NOTE: `0` is to wrap top level tag literal
silent exe 'normal! 0y'
silent exe 'keepjumps normal! 0y'

let result = {
\ 'code': @@,
Expand Down Expand Up @@ -174,7 +175,7 @@ function! iced#paredit#find_parent_form_raw(prefixes) abort
try
while v:true
let @@ = ''
silent exe 'normal! vaby'
silent exe 'keepjumps normal! vaby'
if empty(@@) | break | endif

let code = @@
Expand All @@ -201,7 +202,7 @@ endfunction

function! iced#paredit#get_outer_list_raw() abort
try
silent normal! va(y
keepjumps silent normal! va(y
finally
silent exe "normal! \<Esc>"
endtry
Expand Down
6 changes: 6 additions & 0 deletions autoload/iced/system.vim
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,12 @@ function! iced#system#reset_component(name) abort
call iced#system#set_component(a:name, s:org_system_map[a:name])
endfunction

function! iced#system#reset_all_components() abort
for name in keys(s:org_system_map)
call iced#system#reset_component(name)
endfor
endfunction

function! iced#system#get(name) abort
if has_key(s:component_cache, a:name)
return s:component_cache[a:name]
Expand Down
6 changes: 6 additions & 0 deletions autoload/iced/util.vim
Original file line number Diff line number Diff line change
Expand Up @@ -248,5 +248,11 @@ function! iced#util#store_and_slide_registers(v) abort
let @1 = a:v
endfunction

function! iced#util#add_curpos_to_jumplist() abort
" :h jumplist
" > You can explicitly add a jump by setting the ' mark with "m'".
silent normal! m'
endfunction

let &cpoptions = s:save_cpo
unlet s:save_cpo
2 changes: 1 addition & 1 deletion bin/iced
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ SCRIPT_DIR=$(cd $(dirname $0); pwd)
PROJECT_DIR=$(cd $SCRIPT_DIR; cd ..; pwd)
VERSION=$(grep 'Version: ' ${SCRIPT_DIR}/../doc/vim-iced.txt | cut -d' ' -f2)

BASE_DEPENDENCIES='nrepl/nrepl:0.9.0 refactor-nrepl/refactor-nrepl:3.5.2 cider/cider-nrepl:0.28.4 com.github.liquidz/iced-nrepl:1.2.12'
BASE_DEPENDENCIES='nrepl/nrepl:0.9.0 refactor-nrepl/refactor-nrepl:3.5.3 cider/cider-nrepl:0.28.5 com.github.liquidz/iced-nrepl:1.2.12'
BASE_MIDDLEWARES='cider.nrepl/wrap-classpath cider.nrepl/wrap-clojuredocs cider.nrepl/wrap-complete cider.nrepl/wrap-debug cider.nrepl/wrap-format cider.nrepl/wrap-info cider.nrepl/wrap-macroexpand cider.nrepl/wrap-ns cider.nrepl/wrap-out cider.nrepl/wrap-refresh cider.nrepl/wrap-stacktrace cider.nrepl/wrap-spec cider.nrepl/wrap-test cider.nrepl/wrap-trace cider.nrepl/wrap-undef cider.nrepl/wrap-xref refactor-nrepl.middleware/wrap-refactor iced.nrepl/wrap-iced'

CLJS_DEPENDENCIES='cider/piggieback:0.5.3'
Expand Down
4 changes: 2 additions & 2 deletions deps.edn
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{:paths ["clj/repl"]
:deps {nrepl/nrepl {:mvn/version "0.9.0"}
refactor-nrepl/refactor-nrepl {:mvn/version "3.5.2"}
cider/cider-nrepl {:mvn/version "0.28.4"}
refactor-nrepl/refactor-nrepl {:mvn/version "3.5.3"}
cider/cider-nrepl {:mvn/version "0.28.5"}
com.github.liquidz/iced-nrepl {:mvn/version "1.2.12"}}
:__middlewares__
["cider.nrepl/wrap-classpath"
Expand Down
14 changes: 7 additions & 7 deletions doc/vim-iced.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
*vim-iced.txt* Clojure interactive development environment for Vim8/Neovim

Version: 3.9.2
Version: 3.9.3
Author : Masashi Iizuka <liquidz.uo+vim@gmail.com>
License: MIT LICENSE

Expand Down Expand Up @@ -140,7 +140,7 @@ LEININGEN~
{:user
{:dependencies [[nrepl "0.9.0"]
[com.github.liquidz/iced-nrepl "1.2.12"]
[cider/cider-nrepl "0.28.4"]]
[cider/cider-nrepl "0.28.5"]]
:repl-options {:nrepl-middleware [cider.nrepl/wrap-classpath
cider.nrepl/wrap-clojuredocs
cider.nrepl/wrap-complete
Expand All @@ -158,7 +158,7 @@ LEININGEN~
cider.nrepl/wrap-undef
cider.nrepl/wrap-xref
iced.nrepl/wrap-iced]}
:plugins [[refactor-nrepl "3.5.2"]]}}
:plugins [[refactor-nrepl "3.5.3"]]}}
<

*vim-iced-manual-boot*
Expand All @@ -169,8 +169,8 @@ BOOT~
(require (quote boot.repl))
(swap! boot.repl/*default-dependencies* concat
'[[refactor-nrepl "3.5.2"]
[cider/cider-nrepl "0.28.4"]
'[[refactor-nrepl "3.5.3"]
[cider/cider-nrepl "0.28.5"]
[com.github.liquidz/iced-nrepl "1.2.12"]])
(swap! boot.repl/*default-middleware* concat
Expand Down Expand Up @@ -199,8 +199,8 @@ SHADOW-CLJS~
shadow-cljs.edn
>
{
:dependencies [[refactor-nrepl "3.5.2"]
[cider/cider-nrepl "0.28.4"]
:dependencies [[refactor-nrepl "3.5.3"]
[cider/cider-nrepl "0.28.5"]
[com.github.liquidz/iced-nrepl "1.2.12"]]
}
<
Expand Down
2 changes: 1 addition & 1 deletion ftplugin/clojure.vim
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ if exists('g:loaded_vim_iced')
finish
endif
let g:loaded_vim_iced = 1
let g:vim_iced_version = 30902
let g:vim_iced_version = 30903
let g:vim_iced_home = expand('<sfile>:p:h:h')
" NOTE: https://github.com/vim/vim/commit/162b71479bd4dcdb3a2ef9198a1444f6f99e6843
" Add functions for defining and placing signs.
Expand Down
Loading

0 comments on commit e59c560

Please sign in to comment.