aeda3bc
Branches > main > aeda3bc > files
Update conjure to latest
Commit: aeda3bcfa4f1c3499f09c71c59041c19951b4fbd
Parent: d1eb5fd
127 changed files:
nvim/pack/plugins/opt/conjure/.github/workflows/benchmark.yaml view file
@@ -4,10 +4,12 @@ jobs: benchmark:+ env:+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} strategy: matrix: os: [ubuntu-latest]- neovim-version: ["v0.11.3"]+ neovim-version: ["0.11.6"] runs-on: ${{ matrix.os }} @@ -18,7 +20,5 @@ uses: jdx/mise-action@v2 - name: Benchmark- env:- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: |- mise run -t neovim@${{ matrix.neovim-version }} benchmark+ mise run -t aqua:neovim/neovim@${{ matrix.neovim-version }} benchmarknvim/pack/plugins/opt/conjure/.github/workflows/test.yaml view file
@@ -4,12 +4,14 @@ jobs: test:+ env:+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} strategy: matrix: # TODO: Get windows-latest working. # Currently errors with: ln: failed to create symbolic link '.test/nvim/pack/main/start/conjure' -> '../../../../../': File name too long os: [ubuntu-latest, macOS-latest]- neovim-version: ["0.10.4", "0.11.3"]+ neovim-version: ["0.10.4", "0.11.6"] runs-on: ${{ matrix.os }} @@ -28,7 +30,5 @@ restore-keys: conjure- - name: Test- env:- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: |- mise run -t neovim@${{ matrix.neovim-version }} test+ mise run -t aqua:neovim/neovim@${{ matrix.neovim-version }} testnvim/pack/plugins/opt/conjure/.nvim.fnl view file
@@ -25,6 +25,9 @@ ; (set vim.g.conjure#filetype#fennel "conjure.client.fennel.nfnl") ; (set vim.g.conjure#filetype#scheme "conjure.client.snd-s7.stdio") ; (set vim.g.conjure#debug true)+; (set vim.g.conjure#client#clojure#nrepl#eval#auto_require false)++; (set vim.g.conjure#log#linked_to_client_state true) (set vim.g.conjure#client#scheme#stdio#command "chicken-csi -:c") (set vim.g.conjure#client#scheme#stdio#prompt_pattern "\n-#;%d-> ")nvim/pack/plugins/opt/conjure/Dockerfile view file
@@ -10,4 +10,7 @@ # RUN npm install -g typescript # RUN npm install -g ts-node +# picolisp+# RUN apt-get install -y picolisp+ CMD nvimnvim/pack/plugins/opt/conjure/deps.edn view file
@@ -1,24 +1,24 @@ {:paths ["dev/clojure/src"] :deps- {org.clojure/clojure {:mvn/version "1.11.3"}- org.clojure/tools.logging {:mvn/version "1.1.0"}- lambdaisland/kaocha {:mvn/version "1.66.1034"}- nubank/matcher-combinators {:mvn/version "3.9.1"}}+ {org.clojure/clojure {:mvn/version "1.12.4"}+ org.clojure/tools.logging {:mvn/version "1.3.1"}+ lambdaisland/kaocha {:mvn/version "1.91.1392"}+ nubank/matcher-combinators {:mvn/version "3.10.0"}} :aliases {:nrepl {:extra-deps- {nrepl/nrepl {:mvn/version "1.4.0"}}}+ {nrepl/nrepl {:mvn/version "1.5.2"}}} :cider {:extra-deps- {cider/cider-nrepl {:mvn/version "0.57.0"}}}+ {cider/cider-nrepl {:mvn/version "0.58.0"}}} :cljs {:extra-deps- {org.clojure/clojurescript {:mvn/version "1.11.4"}}}+ {org.clojure/clojurescript {:mvn/version "1.12.134"}}} :piggieback {:extra-deps- {cider/piggieback {:mvn/version "0.5.3"}}}}}+ {cider/piggieback {:mvn/version "0.6.1"}}}}}nvim/pack/plugins/opt/conjure/dev/javascript/sandbox.js view file
@@ -143,3 +143,10 @@ const tb = thisBody(); tb.get()++let msg = `await + booboo`++msg++export { arrowThis }nvim/pack/plugins/opt/conjure/dev/picolisp/sandbox.l view file
@@ -0,0 +1,29 @@+(= 2 2)+# => T++(= 2 3)+# => NIL++(+ 2 3)+# => 5++(cons 5 6)+# => (5 . 6)++'(7 . (8 9))+# => (7 8 9)++(de hello (name)+ (println 'greetings name)+ NIL)+# => hello++(hello 'conjurer)+# => greetings conjurer NIL+# ^-----stdio------^ ^--return value++(apply * (range 1 6))+# => 720++(apply * (range 1 40))+# => 815915283247897734345611269596115894272000000000nvim/pack/plugins/opt/conjure/dev/python/sandbox.py view file
@@ -1,5 +1,6 @@ # Should be able to evaluate all of these. + def add(a, b): return a + b @@ -28,12 +29,14 @@ print(i) return "all done!" + print_things_then_return() def newline_in_function_bug(): return "hey\n\n" + "\\n" + "\n" + "ho" + newline_in_function_bug() @@ -48,6 +51,7 @@ """ print(f"Description: {description}") + fn_with_multiline_str() import csv@@ -57,7 +61,6 @@ # Class definition # - from https://docs.python.org/3/tutorial/classes.html class Dog:- def __init__(self, name): self.name = name self.tricks = []@@ -65,10 +68,11 @@ def add_trick(self, trick): self.tricks.append(trick) -d = Dog('Fido')-e = Dog('Buddy')-d.add_trick('roll_over')-e.add_trick('play dead')++d = Dog("Fido")+e = Dog("Buddy")+d.add_trick("roll_over")+e.add_trick("play dead") d.tricks e.tricks @@ -77,13 +81,15 @@ # - from https://docs.python.org/3.10/tutorial/classes.html from dataclasses import dataclass + @dataclass class Employee: name: str dept: str salary: int -john = Employee('john', 'computer lab', 1000)++john = Employee("john", "computer lab", 1000) john.dept john.salary @@ -92,11 +98,13 @@ # - https://docs.python.org/3.8/library/functools.html?highlight=decorator#functools.cached_property from functools import lru_cache + @lru_cache(maxsize=None) def fib(n): if n < 2: return n- return fib(n-1) + fib(n-2)+ return fib(n - 1) + fib(n - 2)+ [fib(n) for n in range(16)] # [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610]@@ -106,8 +114,8 @@ # Need to have numpy and matplotlib packages installed.-import numpy as np import matplotlib.pyplot as plt+import numpy as np # numpy examples. @@ -122,14 +130,11 @@ # Need to have pandas package installed. import pandas nvim/pack/plugins/opt/conjure/dev/typescript/sandbox.ts view file
@@ -335,7 +335,25 @@ export function funFun() { return "export function Fun" } export { } -const arrowThis = () => {- let a = 1;- return this.a + 1;-}+// const arrowThis = () => {+// let a = 1;+// return this.a + 1;+// }+//+// class Foo {+// a: number;+// fn: () => number;+// constructor() {+// this.a = 1+// this.fn = () => this.a+// }+// }+//+// let foooooo = new Foo()+// foooooo.fn()+//+//+// let msg = `a +// b`+//+// msgnvim/pack/plugins/opt/conjure/doc/conjure-client-clojure-nrepl.txt view file
@@ -220,6 +220,13 @@ Only used if you used the `$port` variable in your `cmd` setting. Default: `".nrepl-port"` + *g:conjure#client#clojure#nrepl#connection#auto_repl#stop_on_new_conn*+`g:conjure#client#clojure#nrepl#connection#auto_repl#stop_on_new_conn`+ Automatically stop the auto-repl process when connecting to a+ different nREPL server. This prevents leaving a babashka REPL+ running after you connect to your own nREPL.+ Default: `true`+ *g:conjure#client#clojure#nrepl#eval#pretty_print* `g:conjure#client#clojure#nrepl#eval#pretty_print` Should results be pretty printed by the nREPL server.nvim/pack/plugins/opt/conjure/doc/conjure-client-common-lisp-swank.txt view file
@@ -41,6 +41,20 @@ <localleader>cd Disconnect from the REPL. +<localleader>dr Invoke a restart of the debugger by number. When an+ evaluation signals an unhandled condition or calls+ `(break)`, the log shows the condition, the numbered+ restarts and the backtrace. Other evaluations keep+ working while the debugger waits.++<localleader>m1 Macroexpand the form under the cursor once+ (`swank:swank-macroexpand-1`) and show the result+ in the log.++<localleader>ma Fully macroexpand the form under the cursor+ (`swank:swank-macroexpand-all`) and show the result+ in the log.+ ============================================================================== CONFIGURATION *conjure-client-common-lisp-swank-configuration* @@ -77,4 +91,20 @@ Default: `true` + *g:conjure#client#common_lisp#swank#mapping#invoke_restart*+`g:conjure#client#common_lisp#swank#mapping#invoke_restart`+ Prompt for a restart number and invoke it in the innermost+ debugger level.+ Default: `"dr"`++ *g:conjure#client#common_lisp#swank#mapping#macroexpand_1*+`g:conjure#client#common_lisp#swank#mapping#macroexpand_1`+ Macroexpand the current form once.+ Default: `"m1"`++ *g:conjure#client#common_lisp#swank#mapping#macroexpand_all*+`g:conjure#client#common_lisp#swank#mapping#macroexpand_all`+ Fully macroexpand the current form.+ Default: `"ma"`+ vim:tw=78:sw=2:ts=2:ft=help:norl:et:listchars=nvim/pack/plugins/opt/conjure/doc/conjure-client-javascript-stdio.txt view file
@@ -37,8 +37,7 @@ { "ts-node": { // ts-node config here- }- },+ }, "compilerOptions": { "target": "es2022", "module": "es2022"nvim/pack/plugins/opt/conjure/doc/conjure-client-picolisp-stdio.txt view file
@@ -0,0 +1,69 @@+ *conjure-client-picolisp-stdio*++==============================================================================+CONTENTS *conjure-client-picolisp-stdio-contents*++ 1. Introduction ........ |conjure-client-picolisp-stdio-introduction|+ 2. Mappings ................ |conjure-client-picolisp-stdio-mappings|+ 3. Configuration ...... |conjure-client-picolisp-stdio-configuration|++==============================================================================+INTRODUCTION *conjure-client-picolisp-stdio-introduction*++Conjure starts a picolisp REPL within Neovim when you first open a Picolisp file.++You should be able to evaluate files and forms as you would with other Conjure+supported languages right away.++Check out `:ConjureSchool` if you're unsure about what evaluation operations+you can perform.++ * https://picolisp.com/wiki/?home++==============================================================================+MAPPINGS *conjure-client-picolisp-stdio-mappings*++These mappings are the defaults, you can change them as described in+|conjure-mappings| and |conjure-configuration|.++See |conjure-client-picolisp-stdio-configuration| for specific configuration+options relevant to these mappings.++<localleader>cs Start the picolisp REPL if it's not running already.++<localleader>cS Stop any existing picolisp REPL.++==============================================================================+CONFIGURATION *conjure-client-picolisp-stdio-configuration*++All configuration can be set as described in |conjure-configuration|.+++ *g:conjure#client#picolisp#stdio#mapping#start*+`g:conjure#client#picolisp#stdio#mapping#start`+ Start the picolisp REPL if it's not running already.+ Default: `"cs"`++ *g:conjure#client#picolisp#stdio#mapping#stop*+`g:conjure#client#picolisp#stdio#mapping#stop`+ Stop any existing picolisp REPL.+ Default: `"cS"`++ *g:conjure#client#picolisp#stdio#command*+`g:conjure#client#picolisp#stdio#command`+ The default picolisp repl (ie. plain `pil +`) includes bracketed+ paste escape sequences in its output, as well as prefixing+ the result with an arrow `->`.+ We can alter this behavior by running our own, simpler, read-eval-print-loop.+ Default: >+ `["pil" "-(prog (print '>>>) (flush) (while (read) (println (eval @)) (print '>>>) (flush)))" "+"]`++ *g:conjure#client#picolisp#stdio#prompt_pattern*+`g:conjure#client#picolisp#stdio#prompt_pattern`+ Lua pattern to identify a new REPL prompt. This match signals to+ Conjure that the previous evaluation is complete and we're ready+ to submit more code as well as collect all output prior to the+ marker as the result.+ Default: `">>>"`++vim:tw=78:sw=2:ts=2:ft=help:norl:et:listchars=nvim/pack/plugins/opt/conjure/doc/conjure-client-python-stdio.txt view file
@@ -19,12 +19,23 @@ point to include `__repl__` if you wish to execute your software from the REPL as well as the command line. >python- if __name__ == "__main__" or "__repl__":+ if __name__ in ("__main__", "__repl__"):++Conjure also sets `__file__` to the path of the buffer being evaluated before+each evaluation. Multi-line evaluations use that path as the filename passed to+Python's `compile`, so tracebacks should point back at the evaluated buffer. Once you have tree sitter installed and configured (remember to run `:TSInstall python`!) you should be able to evaluate forms just like you would in any other Conjure supported language. +By default, Conjure uses `python3` to create a REPL, which can be best managed+using Python virtual environments. Look for how to "activate" a virtual+environment using your Python build tool of choice. For example, running+`eval $(poetry env activate)` before opening Neovim makes `python3` equivalent+to `poetry run python3`, enabling Conjure to seamlessly integrate with your+Poetry project.+ Check out `:ConjureSchool` if you're unsure about what evaluation operations you can perform. @@ -51,7 +62,6 @@ All configuration can be set as described in |conjure-configuration|. - *g:conjure#client#python#stdio#mapping#start* `g:conjure#client#python#stdio#mapping#start` Start the Python REPL if it's not running already.@@ -65,7 +75,9 @@ *g:conjure#client#python#stdio#command* `g:conjure#client#python#stdio#command` Command used to start the Python REPL, you can modify this to add- arguments or change the command entirely.+ arguments or change the command entirely. Tip: Start Neovim within+ a Python virtual environment to make best use of the default+ command. Default: `"python3 -iq"` *g:conjure#client#python#stdio#prompt_pattern*@@ -76,4 +88,12 @@ marker as the result. Default: `">>> "` + *g:conjure#client#python#stdio#auto_set_file*+`g:conjure#client#python#stdio#auto_set_file`+ Automatically set `__file__` to the path of the buffer being+ evaluated before each evaluation. Disable this if you're+ evaluating scripts rather than modules and don't want `__file__`+ defined in your REPL environment.+ Default: `true`+ vim:tw=78:sw=2:ts=2:ft=help:norl:et:listchars=nvim/pack/plugins/opt/conjure/doc/conjure-client-sql-stdio.txt view file
@@ -19,11 +19,10 @@ you set `conjure#client_on_load` to `v:false`. This client was initially developed using PostgreSQL's `psql` command line-client. Thus, the default configuration values for `command` and `prompt-`pattern` are set for `psql`. The `command` string is set to use a connection-URL to a `postgres` database with a `postgres` user and password of-`postgres`. The database is served by a local PostgreSQL server listening on-the default port.+client. Thus, the default configuration values are geared towards `psql`. The+`command` string is set to use a connection URL to a `postgres` database with+a `postgres` user and password of `postgres`. The database is served by+a local PostgreSQL server listening on the default port. Also, if you set up a `~/.pgpass` password file, like so: @@ -42,7 +41,6 @@ Please note that connecting to databases can be a security risk so consult the appropriate people for your particular situation and environment.- You can use another SQL database with its command line client so check the |conjure-client-sql-stdio-configuration and the documentation for that command@@ -121,6 +119,21 @@ semi-colon which is required to execute true statements. Default: `"^[.\\]%w"` + *g:conjure#client#sql#stdio#doc_table*+`g:conjure#client#sql#stdio#doc_table`+ REPL command issued to show docs for a table.+ Default: `"\\d"`++ *g:conjure#client#sql#stdio#doc_function*+`g:conjure#client#sql#stdio#doc_function`+ REPL command issued to show docs for a function.+ Default: `"\\df+"`++ *g:conjure#client#sql#stdio#doc_statement*+`g:conjure#client#sql#stdio#doc_statement`+ REPL command issued to show docs for a statement.+ Default: `"\\h"`+ ============================================================================== TROUBLESHOOTING *conjure-client-sql-stdio-trouble* nvim/pack/plugins/opt/conjure/doc/conjure.txt view file
@@ -211,8 +211,18 @@ available in the core plugin. Each language client also has its own set of mappings and settings you can alter. -You can also set `b:` prefixed versions of all configuration values for buffer-local settings that override their global counterparts.+You can also set buffer local overrides via Lua, useful for per-filetype+configuration in a `FileType` autocmd (must be set before `BufEnter`):+>+ vim.b["conjure#mapping#doc_word"] = false++ vim.api.nvim_create_autocmd("FileType", {+ pattern = "lua",+ callback = function()+ vim.b["conjure#mapping#doc_word"] = false+ end,+ })+< As an example, we can change the default prefix from `<localleader>` to `,c` with the following command:@@ -268,7 +278,8 @@ Default: > ["clojure", "elixir", "fennel", "janet", "hy", "julia", "racket",- "scheme", "lua", "lisp", "python", "ruby", "rust", "sql"]+ "scheme", "lua", "lisp", "python", "ruby", "rust", "sql",+ "picolisp"] < *g:conjure#filetype#clojure* `g:conjure#filetype#clojure`@@ -322,21 +333,30 @@ Help: |conjure-client-racket-stdio| Default: `"conjure.client.racket.stdio"` + *g:conjure#filetype#ruby* `g:conjure#filetype#ruby` Client to use for `Ruby` buffers. Help: |conjure-client-ruby-stdio| Default: `"conjure.client.ruby.stdio"` + *g:conjure#filetype#rust* `g:conjure#filetype#rust` Client to use for `Rust` buffers. Help: |conjure-client-rust-evcxr| Default: `"conjure.client.rust.evcxr"`- *g:conjure#filetype#sql*++ *g:conjure#filetype#sql* `g:conjure#filetype#sql` Client to use for `SQL` buffers. Help: |conjure-client-sql-stdio| Default: `"conjure.client.sql.stdio"` + *g:conjure#filetype#picolisp*+`g:conjure#filetype#picolisp`+ Client to use for `picolisp` buffers.+ Help: |conjure-client-picolisp-stdio|+ Default: `"conjure.client.picolisp.stdio"`+ *g:conjure#filetype_suffixes#[filetype]* `g:conjure#filetype_suffixes#[filetype]` If a client is loading when it shouldn't we can configure that@@ -470,6 +490,12 @@ Opens the log in the current window. Default: `"le"` + *g:conjure#mapping#log_hud*+`g:conjure#mapping#log_hud`+ Opens the log in the HUD, even if `g:conjure#log#hud#enabled`+ is `false`. It closes again when you move the cursor.+ Default: `"lh"`+ *g:conjure#mapping#log_toggle* `g:conjure#mapping#log_toggle` Toggles open or closed the log, using the last used log open@@ -591,8 +617,7 @@ *g:conjure#highlight#enabled* `g:conjure#highlight#enabled`- Enable highlighting of evaluated forms. Requires support for the- highlight API, so you'll need Neovim 0.5+.+ Enable highlighting of evaluated forms. Default: `false` *g:conjure#highlight#group*@@ -700,6 +725,16 @@ < Default: `false` + *g:conjure#log#hud#open_before_first_eval*+`g:conjure#log#hud#open_before_first_eval`+ Allow the HUD to open before your first evaluation of the session.+ Set this to `false` if the messages Conjure logs while it starts+ or connects to a REPL, such as the connection status, should not+ open the HUD. These messages are still written to the log. After+ your first evaluation the HUD behaves as normal. You can open+ the HUD at any time with |g:conjure#mapping#log_hud|.+ Default: `true`+nvim/pack/plugins/opt/conjure/fnl/conjure-spec/client/clojure/nrepl/action_spec.fnl view file
@@ -20,4 +20,34 @@ (assert.are.equals "foo" (action.extract-test-name-from-form "( deftest foo (+ 10 20))")))) (it "deftest form with metadata" (fn []- (assert.are.equals "foo" (action.extract-test-name-from-form "(deftest ^:kaocha/skip foo :xyz)"))))))))+ (assert.are.equals "foo" (action.extract-test-name-from-form "(deftest ^:kaocha/skip foo :xyz)"))))))++ (describe "clojure->vim-completion"+ (fn []+ (it "uses the full nREPL type as the kind"+ (fn []+ (each [_ t (ipairs [:function :macro :special-form :var :local+ :namespace :class :keyword :resource :method+ :static-method :field :static-field :data-reader])]+ (assert.are.equals+ t+ (. (action.clojure->vim-completion {:candidate "x" :type t}) :kind)))))++ (it "has no kind when the type is missing or empty"+ (fn []+ (assert.is_nil (. (action.clojure->vim-completion {:candidate "x"}) :kind))+ (assert.is_nil (. (action.clojure->vim-completion {:candidate "x" :type ""}) :kind))))++ (it "builds the menu and info from the other fields"+ (fn []+ (assert.same+ {:word "map"+ :menu "clojure.core ([f coll]) ([f c1 c2])"+ :info "Returns a lazy sequence."+ :kind "function"}+ (action.clojure->vim-completion+ {:candidate "map"+ :type "function"+ :ns "clojure.core"+ :doc "Returns a lazy sequence."+ :arglists ["([f coll])" "([f c1 c2])"]}))))))))nvim/pack/plugins/opt/conjure/fnl/conjure-spec/client/clojure/nrepl/server_spec.fnl view file
@@ -0,0 +1,138 @@+(local {: describe : it} (require :plenary.busted))+(local assert (require :luassert.assert))+(local server (require :conjure.client.clojure.nrepl.server))+(local state (require :conjure.client.clojure.nrepl.state))+(local core (require :nfnl.core))++(fn make-conn [opts]+ "Create a minimal mock conn object for testing."+ (core.merge+ {:ready? false+ :pending-evals []+ :setup-timeout nil+ :host "localhost"+ :port 12345+ :session "test-session"+ :describe {}+ :seen-ns {}+ :send (fn [])+ :destroy (fn [])}+ opts))++(fn set-conn! [conn]+ (core.assoc (state.get) :conn conn))++(fn clear-conn! []+ (core.assoc (state.get) :conn nil))++(describe "client.clojure.nrepl.server"+ (fn []++ (describe "with-conn-or-warn"+ (fn []+ (it "calls f when conn exists"+ (fn []+ (set-conn! (make-conn))+ (var called? false)+ (server.with-conn-or-warn (fn [_conn] (set called? true)))+ (assert.is_true called?)+ (clear-conn!)))++ (it "does not call f when no conn"+ (fn []+ (clear-conn!)+ (var called? false)+ (server.with-conn-or-warn (fn [_conn] (set called? true)) {:silent? true})+ (assert.is_false called?)))))++ (describe "with-conn-ready-or-queue"+ (fn []+ (it "calls f immediately when conn is ready"+ (fn []+ (set-conn! (make-conn {:ready? true}))+ (var called? false)+ (server.with-conn-ready-or-queue (fn [_conn] (set called? true)))+ (assert.is_true called?)+ (clear-conn!)))++ (it "queues f when conn is not ready"+ (fn []+ (let [conn (make-conn {:ready? false})]+ (set-conn! conn)+ (var called? false)+ (server.with-conn-ready-or-queue (fn [_conn] (set called? true)))+ (assert.is_false called?)+ (assert.are.equals 1 (length conn.pending-evals))+ (clear-conn!))))++ (it "does not call f or queue when no conn"+ (fn []+ (clear-conn!)+ (var called? false)+ (server.with-conn-ready-or-queue (fn [_conn] (set called? true)) {:silent? true})+ (assert.is_false called?)))))++ (describe "mark-ready!"+ (fn []+ (it "sets ready? and drains pending evals in order"+ (fn []+ (let [conn (make-conn {:ready? false})+ results []]+ (set-conn! conn)+ (table.insert conn.pending-evals (fn [_conn] (table.insert results :first)))+ (table.insert conn.pending-evals (fn [_conn] (table.insert results :second)))+ (table.insert conn.pending-evals (fn [_conn] (table.insert results :third)))+ (server.mark-ready!)+ (assert.is_true conn.ready?)+ (assert.same [:first :second :third] results)+ (assert.are.equals 0 (length conn.pending-evals))+ (clear-conn!))))++ (it "is idempotent — second call is a no-op"+ (fn []+ (let [conn (make-conn {:ready? false})+ call-count {:n 0}]+ (set-conn! conn)+ (table.insert conn.pending-evals (fn [_conn] (set call-count.n (+ call-count.n 1))))+ (server.mark-ready!)+ (assert.are.equals 1 call-count.n)+ ;; Second call should not drain again.nvim/pack/plugins/opt/conjure/fnl/conjure-spec/client/common-lisp/swank_spec.fnl view file
@@ -53,7 +53,7 @@ {:prefix "def" :cb completion-cb}) ((a.get-in mock-remote.send-calls [2 :cb]) - (format-swank-return "(\"defun\") \"def\""))+ (format-swank-return "\"defun\" \"\"")) (swank.disconnect) (assert.has-substring @@ -75,7 +75,7 @@ {:prefix nil :cb completion-cb}) ((a.get-in mock-remote.send-calls [2 :cb]) - (format-swank-return "(\"something\") \"\""))+ (format-swank-return "\"something\" \"\"")) (swank.disconnect) (assert.has-substring @@ -98,7 +98,7 @@ {:prefix "def" :cb completion-cb}) ((a.get-in mock-remote.send-calls [2 :cb]) - (format-swank-return "(\"defun\") \"def\""))+ (format-swank-return "\"defun\" \"\"")) (swank.disconnect) (assert.same ["defunct" "defun"] (. completion-cb-calls 1)))))@@ -131,10 +131,73 @@ {:prefix "s" :cb completion-cb}) ((a.get-in mock-remote.send-calls [2 :cb]) - (format-swank-return "(\"symbol\") \"s\""))+ (format-swank-return "\"symbol\" \"\"")) (swank.disconnect) - (assert.same ["symbol"] (. completion-cb-calls 1)))))))+ (assert.same ["symbol"] (. completion-cb-calls 1)))))++ (it "evaluates the completion request in COMMON-LISP-USER with the buffer package as the argument"+ (fn []+ (mock-tsc.set-mock-completions [])+ (swank.connect {})+ (swank.completions+ {:prefix "de"+ :context "my-pkg"+ :cb (fn [])})+ (swank.disconnect)++ (let [msg (a.get-in mock-remote.send-calls [2 :msg])]+ (assert.has-substring "swank:simple%-completions \\\"de\\\" \\\"my%-pkg\\\"" msg)+ (assert.has-substring "\"COMMON%-LISP%-USER\" t" msg))))++ (it "merges classified swank completions with treesitter completions by word"+ (fn []+ (let [completion-cb-calls []+ completion-cb+ (fn [res]+ (table.insert completion-cb-calls res))]+ (mock-tsc.set-mock-completions ["decf" "defunct"])++ (swank.connect {})+ (swank.completions+ {:prefix "de"+ :cb completion-cb})+ ((a.get-in mock-remote.send-calls [2 :cb])+ (format-swank-return "\"debug\" \"---------\" \"decf\" \"-f---m---\""))+ (swank.disconnect)++ (assert.same+ [{:word "decf" :kind "macro"} "defunct" "debug"]+ (. completion-cb-calls 1)))))))++ (describe "parse-completions"+ (fn []+ (it "pairs each name with the kind from its flags"+ (fn []+ (assert.same+ ["debug" "foo" {:word "decf" :kind "macro"}]+ (swank.parse-completions+ "(\"debug\" \"---------\" \"foo\" \"\" \"decf\" \"-f---m---\")"))))++ (it "returns nothing for NIL"+ (fn []+ (assert.same [] (swank.parse-completions "NIL"))))++ (it "picks the most specific kind from the flags"+ (fn []+ (each [flags kind (pairs {"b--------" "variable"+ "-f-------" "function"+ "-fg------" "generic-function"+ "---c-----" "class"+ "----t----" "type"+ "-f-ct----" "function"+ "-f---m---" "macro"+ "-f----s--" "special-operator"+ "-------p-" "package"+ "-f------a" "accessor"})]+ (assert.same [{:word "x" :kind kind}]+ (swank.parse-completions+ (.. "(\"x\" \"" flags "\")"))))))))nvim/pack/plugins/opt/conjure/fnl/conjure-spec/client/python/stdio_spec.fnl view file
@@ -0,0 +1,36 @@+(local {: describe : it} (require :plenary.busted))+(local assert (require :luassert.assert))+(local python (require :conjure.client.python.stdio))++(describe "conjure.client.python.stdio"+ (fn []+ (describe "prep-code"+ (fn []+ (it "sets __file__ before evaluating expressions"+ (fn []+ (tset python :str-is-python-expr? (fn [_] true))++ (assert.same+ "__file__ = base64.b64decode('L3RtcC9leGFtcGxlLnB5').decode()\n__file__\n"+ (python.prep-code+ {:code "__file__"+ :file-path "/tmp/example.py"}))))++ (it "sets __file__ and uses it as the filename for exec evaluations"+ (fn []+ (tset python :str-is-python-expr? (fn [_] false))++ (assert.same+ "__file__ = base64.b64decode('L3RtcC9leGFtcGxlLnB5').decode()\nexec(compile(base64.b64decode('cHJpbnQoX19maWxlX18p'), __file__, 'exec'))\n"+ (python.prep-code+ {:code "print(__file__)"+ :file-path "/tmp/example.py"}))))++ (it "uses a fallback filename when no file path is available"+ (fn []+ (tset python :str-is-python-expr? (fn [_] true))++ (assert.same+ "__file__ = base64.b64decode('PGNvbmp1cmU+').decode()\n__file__\n"+ (python.prep-code+ {:code "__file__"}))))))))nvim/pack/plugins/opt/conjure/fnl/conjure-spec/client/scheme/mock-stdio.fnl view file
@@ -1,13 +1,17 @@+(var last-opts nil)+ (var mock-send (fn [_])) (local set-mock-send (fn [send] (set mock-send send))) -(local start - (fn [] +(local start+ (fn [opts]+ (set last-opts opts) {:send mock-send :destroy (fn [])})) -{ : start +{ :get-last-opts (fn [] last-opts)+ : start : set-mock-send } nvim/pack/plugins/opt/conjure/fnl/conjure-spec/client/scheme/stdio_spec.fnl view file
@@ -15,6 +15,116 @@ (fn [] (tset package.loaded "conjure.remote.stdio" mock-stdio) + (describe "format-msg"+ (fn []+ (it "preserves Chez output ending in a space and number"+ (fn []+ (assert.same ["; (out) number after, with space: 1"]+ (scheme.format-msg {:out "number after, with space: 1"}))))++ (it "preserves a final numeric line in batched output"+ (fn []+ (assert.same ["; (out) first line" "; (out) 42"]+ (scheme.format-msg+ (scheme.unbatch [{:out "first line\n"} {:out "42"}])))))++ (it "preserves numeric MIT Scheme values"+ (fn []+ (assert.same ["42"]+ (scheme.format-msg {:out ";Value: 42"}))))))++ (it "preserves Chez numeric output with value prefixes disabled"+ (fn []+ (let [key "conjure#client#scheme#stdio#value_prefix_pattern"+ previous (. vim.g key)]+ (tset vim.g key false)+ (let [actual (scheme.format-msg {:out "number: 1\n42\n"})]+ (tset vim.g key previous)+ (assert.same ["number: 1" "42"] actual)))))++ (describe "prompt cleanup"+ (fn []+ (it "removes normal and error prompt levels after joining split reads"+ (fn []+ (each [_ prompt (ipairs ["1 ]=> " "12 error> "])]+ (each [_ split (ipairs [0 1 2 3])]+ (let [msgs [{:out (.. "number: 42\n" (string.sub prompt 1 split))}+ {:out (string.sub prompt (+ split 1))}]+ lines (scheme.format-msg (scheme.unbatch msgs))]+ (assert.same ["; (out) number: 42"] lines))))))))++ (it "keeps the MIT value as the final result without a prompt blank line"+ (fn []+ (assert.same ["42"]+ (scheme.format-msg+ (scheme.unbatch [{:out ";Value: 42\n\n1 "} {:out "]=> "}])))))++ (it "keeps custom prompt stripping in the transport"+ (fn []+ (let [key "conjure#client#scheme#stdio#prompt_pattern"+ previous (. vim.g key)]+ (tset vim.g key "^> ")+ (scheme.start)+ (let [opts (mock-stdio.get-last-opts)+ actual (scheme.format-msg {:out "number: 42"})]+ (scheme.stop)+ (tset vim.g key previous)+ (assert.same "^> " opts.prompt-pattern)+ (assert.is_false opts.preserve-prompt?)+ (assert.same ["; (out) number: 42"] actual)))))++ (it "preserves the reported output with the original Chez quick-start settings"+ (fn []+ (let [command-key "conjure#client#scheme#stdio#command"+ prompt-key "conjure#client#scheme#stdio#prompt_pattern"+ previous-command (. vim.g command-key)+ previous-prompt (. vim.g prompt-key)]+ (tset vim.g command-key "petite")+ (tset vim.g prompt-key "> $?")+ (scheme.start)+ (let [opts (mock-stdio.get-last-opts)+ output "number after, without space:1\nnumber after, with space: 1\n> "+ stripped (string.gsub output opts.prompt-pattern "")+ actual (scheme.format-msg {:out stripped})]+ (scheme.stop)+ (tset vim.g command-key previous-command)+ (tset vim.g prompt-key previous-prompt)+ (assert.same "petite" opts.cmd)+ (assert.same "> $?" opts.prompt-pattern)+ (assert.is_false opts.preserve-prompt?)+ (assert.same ["; (out) number after, without space:1"+ "; (out) number after, with space: 1"+ "; (out) "] actual)))))++ (it "preserves numbers with nested Chez prompts and value prefixes disabled"+ (fn []+ (let [command-key "conjure#client#scheme#stdio#command"+ prompt-key "conjure#client#scheme#stdio#prompt_pattern"+ value-key "conjure#client#scheme#stdio#value_prefix_pattern"+ previous-command (. vim.g command-key)+ previous-prompt (. vim.g prompt-key)+ previous-value (. vim.g value-key)]+ (tset vim.g command-key "petite")+ (tset vim.g prompt-key ">+ ")+ (tset vim.g value-key false)+ (scheme.start)nvim/pack/plugins/opt/conjure/fnl/conjure-spec/config_spec.fnl view file
nvim/pack/plugins/opt/conjure/fnl/conjure-spec/event_spec.fnl view file
nvim/pack/plugins/opt/conjure/fnl/conjure-spec/log_spec.fnl view file
nvim/pack/plugins/opt/conjure/fnl/conjure-spec/remote/stdio-prompt_spec.fnl view file
nvim/pack/plugins/opt/conjure/fnl/conjure-spec/remote/stdio_spec.fnl view file
nvim/pack/plugins/opt/conjure/fnl/conjure-spec/remote/swank_spec.fnl view file
nvim/pack/plugins/opt/conjure/fnl/conjure-spec/remote/transport/bencode_spec.fnl view file
nvim/pack/plugins/opt/conjure/fnl/conjure-spec/tree-sitter-completions_spec.fnl view file
nvim/pack/plugins/opt/conjure/fnl/conjure-spec/tree-sitter_spec.fnl view file
nvim/pack/plugins/opt/conjure/fnl/conjure/client/clojure/nrepl/action.fnl view file
nvim/pack/plugins/opt/conjure/fnl/conjure/client/clojure/nrepl/init.fnl view file
nvim/pack/plugins/opt/conjure/fnl/conjure/client/clojure/nrepl/server.fnl view file
nvim/pack/plugins/opt/conjure/fnl/conjure/client/common-lisp/swank.fnl view file
nvim/pack/plugins/opt/conjure/fnl/conjure/client/fennel/aniseed.fnl view file
nvim/pack/plugins/opt/conjure/fnl/conjure/client/fennel/def-str-util.fnl view file
nvim/pack/plugins/opt/conjure/fnl/conjure/client/fennel/nfnl.fnl view file
nvim/pack/plugins/opt/conjure/fnl/conjure/client/hy/stdio.fnl view file
nvim/pack/plugins/opt/conjure/fnl/conjure/client/javascript/import-replacer.fnl view file
nvim/pack/plugins/opt/conjure/fnl/conjure/client/javascript/stdio.fnl view file
nvim/pack/plugins/opt/conjure/fnl/conjure/client/javascript/transformers.fnl view file
nvim/pack/plugins/opt/conjure/fnl/conjure/client/php/psysh.fnl view file
nvim/pack/plugins/opt/conjure/fnl/conjure/client/picolisp/stdio.fnl view file
nvim/pack/plugins/opt/conjure/fnl/conjure/client/python/stdio.fnl view file
nvim/pack/plugins/opt/conjure/fnl/conjure/client/r/stdio.fnl view file
nvim/pack/plugins/opt/conjure/fnl/conjure/client/scheme/stdio.fnl view file
nvim/pack/plugins/opt/conjure/fnl/conjure/client/snd-s7/stdio.fnl view file
nvim/pack/plugins/opt/conjure/fnl/conjure/client/sql/stdio.fnl view file
nvim/pack/plugins/opt/conjure/fnl/conjure/client/sql/tree-sitter.fnl view file
nvim/pack/plugins/opt/conjure/fnl/conjure/config.fnl view file
nvim/pack/plugins/opt/conjure/fnl/conjure/eval.fnl view file
nvim/pack/plugins/opt/conjure/fnl/conjure/event.fnl view file
nvim/pack/plugins/opt/conjure/fnl/conjure/log.fnl view file
nvim/pack/plugins/opt/conjure/fnl/conjure/mapping.fnl view file
nvim/pack/plugins/opt/conjure/fnl/conjure/remote/socket.fnl view file
nvim/pack/plugins/opt/conjure/fnl/conjure/remote/stdio.fnl view file
nvim/pack/plugins/opt/conjure/fnl/conjure/remote/stdio2.fnl view file
nvim/pack/plugins/opt/conjure/fnl/conjure/remote/swank.fnl view file
nvim/pack/plugins/opt/conjure/fnl/conjure/remote/transport/base64.fnl view file
nvim/pack/plugins/opt/conjure/fnl/conjure/remote/transport/bencode.fnl view file
nvim/pack/plugins/opt/conjure/fnl/conjure/school.fnl view file
nvim/pack/plugins/opt/conjure/fnl/conjure/sponsors.fnl view file
nvim/pack/plugins/opt/conjure/fnl/conjure/tree-sitter-completions.fnl view file
nvim/pack/plugins/opt/conjure/fnl/conjure/tree-sitter.fnl view file
nvim/pack/plugins/opt/conjure/fnl/conjure/uuid.fnl view file
nvim/pack/plugins/opt/conjure/lua/conjure-spec/client/clojure/nrepl/action_spec.lua view file
nvim/pack/plugins/opt/conjure/lua/conjure-spec/client/clojure/nrepl/server_spec.lua view file
nvim/pack/plugins/opt/conjure/lua/conjure-spec/client/common-lisp/swank_spec.lua view file
nvim/pack/plugins/opt/conjure/lua/conjure-spec/client/python/stdio_spec.lua view file
nvim/pack/plugins/opt/conjure/lua/conjure-spec/client/scheme/mock-stdio.lua view file
nvim/pack/plugins/opt/conjure/lua/conjure-spec/client/scheme/stdio_spec.lua view file
nvim/pack/plugins/opt/conjure/lua/conjure-spec/config_spec.lua view file
nvim/pack/plugins/opt/conjure/lua/conjure-spec/event_spec.lua view file
nvim/pack/plugins/opt/conjure/lua/conjure-spec/log_spec.lua view file
nvim/pack/plugins/opt/conjure/lua/conjure-spec/remote/stdio-prompt_spec.lua view file
nvim/pack/plugins/opt/conjure/lua/conjure-spec/remote/stdio_spec.lua view file
nvim/pack/plugins/opt/conjure/lua/conjure-spec/remote/swank_spec.lua view file
nvim/pack/plugins/opt/conjure/lua/conjure-spec/remote/transport/bencode_spec.lua view file
nvim/pack/plugins/opt/conjure/lua/conjure-spec/tree-sitter-completions_spec.lua view file
nvim/pack/plugins/opt/conjure/lua/conjure-spec/tree-sitter_spec.lua view file
nvim/pack/plugins/opt/conjure/lua/conjure/client/clojure/nrepl/action.lua view file
nvim/pack/plugins/opt/conjure/lua/conjure/client/clojure/nrepl/init.lua view file
nvim/pack/plugins/opt/conjure/lua/conjure/client/clojure/nrepl/server.lua view file
nvim/pack/plugins/opt/conjure/lua/conjure/client/common-lisp/swank.lua view file
nvim/pack/plugins/opt/conjure/lua/conjure/client/fennel/aniseed.lua view file
nvim/pack/plugins/opt/conjure/lua/conjure/client/fennel/def-str-util.lua view file
nvim/pack/plugins/opt/conjure/lua/conjure/client/fennel/nfnl.lua view file
nvim/pack/plugins/opt/conjure/lua/conjure/client/hy/stdio.lua view file
nvim/pack/plugins/opt/conjure/lua/conjure/client/javascript/import-replacer.lua view file
nvim/pack/plugins/opt/conjure/lua/conjure/client/javascript/stdio.lua view file
nvim/pack/plugins/opt/conjure/lua/conjure/client/javascript/transformers.lua view file
nvim/pack/plugins/opt/conjure/lua/conjure/client/php/psysh.lua view file
nvim/pack/plugins/opt/conjure/lua/conjure/client/picolisp/stdio.lua view file
nvim/pack/plugins/opt/conjure/lua/conjure/client/python/stdio.lua view file
nvim/pack/plugins/opt/conjure/lua/conjure/client/r/stdio.lua view file
nvim/pack/plugins/opt/conjure/lua/conjure/client/scheme/stdio.lua view file
nvim/pack/plugins/opt/conjure/lua/conjure/client/snd-s7/stdio.lua view file
nvim/pack/plugins/opt/conjure/lua/conjure/client/sql/stdio.lua view file
nvim/pack/plugins/opt/conjure/lua/conjure/client/sql/tree-sitter.lua view file
nvim/pack/plugins/opt/conjure/lua/conjure/config.lua view file
nvim/pack/plugins/opt/conjure/lua/conjure/eval.lua view file
nvim/pack/plugins/opt/conjure/lua/conjure/event.lua view file
nvim/pack/plugins/opt/conjure/lua/conjure/log.lua view file
nvim/pack/plugins/opt/conjure/lua/conjure/mapping.lua view file
nvim/pack/plugins/opt/conjure/lua/conjure/nfnl/api.lua view file
nvim/pack/plugins/opt/conjure/lua/conjure/nfnl/callback.lua view file
nvim/pack/plugins/opt/conjure/lua/conjure/nfnl/compile.lua view file
nvim/pack/plugins/opt/conjure/lua/conjure/nfnl/config.lua view file
nvim/pack/plugins/opt/conjure/lua/conjure/nfnl/init.lua view file
nvim/pack/plugins/opt/conjure/lua/conjure/remote/socket.lua view file
nvim/pack/plugins/opt/conjure/lua/conjure/remote/stdio.lua view file
nvim/pack/plugins/opt/conjure/lua/conjure/remote/stdio2.lua view file
nvim/pack/plugins/opt/conjure/lua/conjure/remote/swank.lua view file
nvim/pack/plugins/opt/conjure/lua/conjure/remote/transport/base64.lua view file
nvim/pack/plugins/opt/conjure/lua/conjure/remote/transport/bencode.lua view file
nvim/pack/plugins/opt/conjure/lua/conjure/school.lua view file
nvim/pack/plugins/opt/conjure/lua/conjure/sponsors.lua view file
nvim/pack/plugins/opt/conjure/lua/conjure/tree-sitter-completions.lua view file
nvim/pack/plugins/opt/conjure/lua/conjure/tree-sitter.lua view file
nvim/pack/plugins/opt/conjure/lua/conjure/uuid.lua view file
nvim/pack/plugins/opt/conjure/mise.toml view file
nvim/pack/plugins/opt/conjure/package-lock.json view file
nvim/pack/plugins/opt/conjure/package.json view file
nvim/pack/plugins/opt/conjure/res/queries/fennel/ext-def.scm view file
nvim/pack/plugins/opt/conjure/res/queries/fennel/local-def.scm view file
nvim/pack/plugins/opt/conjure/scripts/test view file