Skip to content

Commit

Permalink
Merge pull request #470 from liquidz/feature/next-release
Browse files Browse the repository at this point in the history
Next release
  • Loading branch information
liquidz authored Jan 4, 2024
2 parents 4c4222d + ba2a89e commit 7ddea18
Show file tree
Hide file tree
Showing 19 changed files with 141 additions and 38 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- run: pip install -r requirements.txt
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: python doctest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-java@v3
- uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: 11
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v3
- uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: '16'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/vim_neovim.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
env:
THEMIS_VIM: ${{ steps.vim.outputs.executable }}
run: ./.vim-themis/bin/themis
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Coverage
Expand Down
12 changes: 11 additions & 1 deletion CHANGELOG.adoc
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
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)
// {{{
=== Added
* Added instant connection support for https://github.com/squint-cljs/squint[Squint].
** `:IcedInstantConnect squint`

== 3.14.3255 (2023-09-29)
=== Changed
* Bumped build.edn to 0.11.241.
* Bumped cider-nrepl to 0.44.0.
* Bumped refactor-nrepl to 3.9.1.
* Bumped nrepl to 1.1.0.
// }}}

== 3.14.3255 (2023-09-29)
// {{{
=== Fixed
* Fixed `IcedInstantConnect` to work correctly with the latest babashka.
Expand Down
2 changes: 1 addition & 1 deletion README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,6 @@ and https://github.com/liquidz/iced-nrepl[iced-nrepl].

== License

Copyright (c) 2018-2023 http://twitter.com/uochan[Masashi Iizuka]
Copyright (c) 2018-2024 https://scrapbox.io/uochan/uochan[Masashi Iizuka]

Distributed under the MIT License.
45 changes: 43 additions & 2 deletions autoload/iced/nrepl/connect.vim
Original file line number Diff line number Diff line change
Expand Up @@ -251,15 +251,56 @@ function! s:__instant_nbb(port) abort
endif
endfunction

function! s:try_connecting_to_squint(port) abort
try
return iced#repl#connect('nrepl', a:port, {
\ 'with_iced_nrepl': v:false,
\ 'initial_session': 'cljs',
\ 'verbose': v:false,
\ })
catch
return v:false
endtry
endfunction

function! s:__instant_squint(port) abort
" NOTE: A job in vim may terminate when outputting long texts such as stack traces.
" So ignoring the standard output etc.
if executable('squint')
let squint_cmd = 'squint'
elseif executable('deno')
let squint_cmd = 'deno run -A npm:squint-cljs@latest'
else
return iced#message#error('command_not_found', 'squint or deno')
endif
let cmd = ['sh', '-c', printf('%s nrepl-server :port %s > /dev/null 2>&1', squint_cmd, a:port)]
let s:running_job = iced#job_start(cmd)

let s:is_auto_connecting = v:true
call iced#message#echom('connecting')
let result = iced#util#wait({->
\ empty(s:try_connecting_to_squint(a:port))},
\ 3000)
let s:is_auto_connecting = v:false

if result
call iced#message#info('connected_to', printf('port %s', a:port))
else
call iced#message#error('connect_error')
endif
endfunction

function! iced#nrepl#connect#instant(program) abort
if iced#nrepl#is_connected()
return iced#message#info('already_connected')
endif

if a:program ==# 'babashka'
return iced#script#empty_port({port -> s:__instant_babashka(port)})
return iced#script#bb_empty_port({port -> s:__instant_babashka(port)})
elseif a:program ==# 'nbb'
return iced#script#empty_port({port -> s:__instant_nbb(port)})
return iced#script#nbb_empty_port({port -> s:__instant_nbb(port)})
elseif a:program ==# 'squint'
return iced#script#nbb_empty_port({port -> s:__instant_squint(port)})
else
return s:__instant_clj()
endif
Expand Down
2 changes: 1 addition & 1 deletion autoload/iced/palette.vim
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set cpoptions&vim

let s:default_palette = [
\ 'Connect', 'Disconnect', 'Reconnect', 'Interrupt', 'InterruptAll',
\ 'InstantConnect', 'InstantConnect babashka', 'InstantConnect nbb', 'JackIn',
\ 'InstantConnect', 'InstantConnect babashka', 'InstantConnect nbb', 'InstantConnect squint', 'JackIn',
\ 'StartCljsRepl {{env}}',
\ 'QuitCljsRepl', 'CycleSession',
\ 'EvalNs', 'Undef', 'UndefAllInNs', 'UnaliasNs',
Expand Down
3 changes: 2 additions & 1 deletion autoload/iced/repl.vim
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ endfunction

" c.f. :h :command-completion-custom
function! iced#repl#instant_connect_complete(arg_lead, cmd_line, cursor_pos) abort
let res = ['nrepl', 'babashka', 'nbb']
let res = ['nrepl', 'babashka', 'nbb', 'squint']
call extend(res, iced#socket_repl#connect#supported_programs())
return join(res, "\n")
endfunction
Expand All @@ -52,6 +52,7 @@ function! iced#repl#instant_connect(target) abort
if a:target ==# ''
\ || (g:iced#repl#babashka_repl_type ==# 'nrepl' && a:target ==# 'babashka')
\ || a:target ==# 'nbb'
\ || a:target ==# 'squint'
call iced#nrepl#connect#instant(a:target)
elseif a:target ==# 'prepl'
call iced#prepl#connect#instant()
Expand Down
22 changes: 19 additions & 3 deletions autoload/iced/script.vim
Original file line number Diff line number Diff line change
@@ -1,17 +1,33 @@
let s:save_cpo = &cpoptions
set cpoptions&vim

function! s:setup() abort
function! s:bb_setup() abort
if !executable('bb')
call iced#promise#sync(iced#system#get('installer').install, ['bb'], 10000)
endif
endfunction

function! iced#script#empty_port(callback) abort
call s:setup()
function! iced#script#bb_empty_port(callback) abort
call s:bb_setup()
let command = printf('bb --prn %s/clj/script/empty_port.clj', g:vim_iced_home)
return iced#system#get('job_out').redir(command, a:callback)
endfunction

function! s:nbb_command() abort
if executable('nbb')
return 'nbb'
elseif executable('deno')
return 'deno run -A npm:nbb@latest'
endif

throw 'nbb or deno is not found.'
endfunction

function! iced#script#nbb_empty_port(callback) abort
let cmd = s:nbb_command()
let command = printf('%s %s/clj/script/nbb_empty_port.cljs', cmd, g:vim_iced_home)
return iced#system#get('job_out').redir(command, a:callback)
endfunction

let &cpoptions = s:save_cpo
unlet s:save_cpo
2 changes: 1 addition & 1 deletion autoload/iced/socket_repl/connect.vim
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function! iced#socket_repl#connect#instant(program) abort
return
endif

return iced#script#empty_port({port -> s:start_and_connect(port, cmd)})
return iced#script#bb_empty_port({port -> s:start_and_connect(port, cmd)})
endfunction

let &cpoptions = s:save_cpo
Expand Down
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:1.0.0 refactor-nrepl/refactor-nrepl:3.9.0 cider/cider-nrepl:0.38.1 com.github.liquidz/iced-nrepl:1.2.480'
BASE_DEPENDENCIES='nrepl/nrepl:1.1.0 refactor-nrepl/refactor-nrepl:3.9.1 cider/cider-nrepl:0.44.0 com.github.liquidz/iced-nrepl:1.2.480'
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
2 changes: 1 addition & 1 deletion build.edn
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{:lib com.github.liquidz/vim-iced
:version "3.14.{{git/commit-count}}"
:version "3.15.{{git/commit-count}}"
:documents [{:file "doc/vim-iced.txt"
:match "^Version: "
:action :replace
Expand Down
13 changes: 13 additions & 0 deletions clj/script/nbb_empty_port.cljs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
(ns nbb-empty-port
(:require
["net" :as net]))

(let [server (net/createServer)]
(.on server "listening" (fn []
(print (.-port (.address server)))
(.close server)))
(js/Promise.
(fn [resolve reject]
(.on server "close" (fn [] (resolve true)))
(.on server "error" (fn [err] (reject err)))
(.listen server 0 "localhost"))))
8 changes: 4 additions & 4 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 "1.0.0"}
refactor-nrepl/refactor-nrepl {:mvn/version "3.9.0"}
cider/cider-nrepl {:mvn/version "0.38.1"}
:deps {nrepl/nrepl {:mvn/version "1.1.0"}
refactor-nrepl/refactor-nrepl {:mvn/version "3.9.1"}
cider/cider-nrepl {:mvn/version "0.44.0"}
com.github.liquidz/iced-nrepl {:mvn/version "1.2.480"}}
:__middlewares__
["cider.nrepl/wrap-classpath"
Expand Down Expand Up @@ -39,6 +39,6 @@
:outdated {:extra-deps {com.github.liquidz/antq {:mvn/version "RELEASE"}
org.slf4j/slf4j-nop {:mvn/version "RELEASE"}}
:main-opts ["-m" "antq.core"]}
:build {:deps {com.github.liquidz/build.edn {:mvn/version "0.10.227"}}
:build {:deps {com.github.liquidz/build.edn {:mvn/version "0.11.241"}}
:ns-default build-edn.main}
:dev {}}}
14 changes: 7 additions & 7 deletions doc/vim-iced.txt
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@ LEININGEN~
$HOME/.lein/profile.clj
>
{:user
{:dependencies [[nrepl "1.0.0"]
{:dependencies [[nrepl "1.1.0"]
[com.github.liquidz/iced-nrepl "1.2.480"]
[cider/cider-nrepl "0.38.1"]]
[cider/cider-nrepl "0.44.0"]]
:repl-options {:nrepl-middleware [cider.nrepl/wrap-classpath
cider.nrepl/wrap-clojuredocs
cider.nrepl/wrap-complete
Expand All @@ -162,7 +162,7 @@ LEININGEN~
cider.nrepl/wrap-undef
cider.nrepl/wrap-xref
iced.nrepl/wrap-iced]}
:plugins [[refactor-nrepl "3.9.0"]]}}
:plugins [[refactor-nrepl "3.9.1"]]}}
<

*vim-iced-manual-boot*
Expand All @@ -173,8 +173,8 @@ BOOT~
(require (quote boot.repl))
(swap! boot.repl/*default-dependencies* concat
'[[refactor-nrepl "3.9.0"]
[cider/cider-nrepl "0.38.1"]
'[[refactor-nrepl "3.9.1"]
[cider/cider-nrepl "0.44.0"]
[com.github.liquidz/iced-nrepl "1.2.480"]])
(swap! boot.repl/*default-middleware* concat
Expand Down Expand Up @@ -203,8 +203,8 @@ SHADOW-CLJS~
shadow-cljs.edn
>
{
:dependencies [[refactor-nrepl "3.9.0"]
[cider/cider-nrepl "0.38.1"]
:dependencies [[refactor-nrepl "3.9.1"]
[cider/cider-nrepl "0.44.0"]
[com.github.liquidz/iced-nrepl "1.2.480"]]
}
<
Expand Down
39 changes: 29 additions & 10 deletions test/component_sign.vim
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ function! s:list_in_buffer() abort
return list
endfunction

function! s:dissoc(d, k) abort
let d = copy(a:d)
unlet d[a:k]
return d
endfunction

function! s:suite.list_in_buffer_test() abort
call s:setup()

Expand Down Expand Up @@ -210,18 +216,31 @@ function! s:suite.refresh_test() abort
call s:setup()
exec printf(':b %d', bufnr(s:foo_file))

call s:assert.equals(s:list_in_buffer(), [
\ {'lnum': 3, 'id': 1, 'name': 'iced_dummy1', 'group': 'default'},
\ {'lnum': 5, 'id': 1, 'name': 'iced_dummy1', 'group': 'group1'},
\ {'lnum': 7, 'id': 2, 'name': 'iced_dummy2', 'group': 'default'},
\ ])
let before_list_in_buffer = s:list_in_buffer()
let before_ids = map(copy(before_list_in_buffer), {_, v -> v['id']})

call s:assert.equals(
\ map(copy(before_list_in_buffer), {_, v -> s:dissoc(v, 'id')}),
\ [
\ {'lnum': 3, 'name': 'iced_dummy1', 'group': 'default'},
\ {'lnum': 5, 'name': 'iced_dummy1', 'group': 'group1'},
\ {'lnum': 7, 'name': 'iced_dummy2', 'group': 'default'},
\ ])

call s:sign.refresh({'file': s:foo_file})
call s:assert.equals(s:list_in_buffer(), [
\ {'lnum': 3, 'id': 3, 'name': 'iced_dummy1', 'group': 'default'},
\ {'lnum': 5, 'id': 1, 'name': 'iced_dummy1', 'group': 'group1'},
\ {'lnum': 7, 'id': 4, 'name': 'iced_dummy2', 'group': 'default'},
\ ])

let after_list_in_buffer = s:list_in_buffer()
let after_ids = map(copy(after_list_in_buffer), {_, v -> v['id']})

call s:assert.equals(
\ map(copy(after_list_in_buffer), {_, v -> s:dissoc(v, 'id')}),
\ [
\ {'lnum': 3, 'name': 'iced_dummy1', 'group': 'default'},
\ {'lnum': 5, 'name': 'iced_dummy1', 'group': 'group1'},
\ {'lnum': 7, 'name': 'iced_dummy2', 'group': 'default'},
\ ])

call s:assert.not_equals(before_ids, after_ids)

call s:teardown()
endfunction
3 changes: 3 additions & 0 deletions test/nrepl_eval.vim
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ function! s:suite.code_test() abort
let g:iced#eval#keep_inline_result = v:false
let g:iced#eval#popup_highlight = 'Comment'
let g:iced#eval#inside_comment = v:false
let g:iced#eval#popup_spinner_texts = ['']
let g:iced#eval#popup_align = 'after'
let g:iced#eval#popup_spinner_interval = 100
let p = iced#nrepl#eval#code('(comment (+ 1 2 3))')
call iced#promise#wait(p)

Expand Down

0 comments on commit 7ddea18

Please sign in to comment.