From bea7e81c1651fb441bbb57fddc0518a0d5f5ca32 Mon Sep 17 00:00:00 2001 From: Michael Bleuez Date: Sun, 22 May 2022 23:40:08 +0200 Subject: [PATCH 1/4] fix typo in doc --- CHANGELOG.md | 5 ++++- CHECKLIST.md | 1 + README.md | 4 ++-- doc/Python3_fifo.md | 2 +- doc/Python3_original.md | 4 ++-- doc/sniprun.txt | 2 +- ressources/CONTRIBUTING_REPL.md | 8 ++++---- src/interpreter.rs | 6 +++--- 8 files changed, 18 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 625ba769..7abd20b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## v1.2.4 +- fix typo in documentation + ## v1.2.3 - no signcolumn in Terminal display + fix line wrapping @@ -161,7 +164,7 @@ ## v0.4.3 - Rust interpreter and example now have tests -- Julia intepreter +- Julia interpreter - example.rs interpreter diff --git a/CHECKLIST.md b/CHECKLIST.md index 2a0d023d..1ec6aa6c 100644 --- a/CHECKLIST.md +++ b/CHECKLIST.md @@ -14,3 +14,4 @@ - Check CI status - Check Releases status + - Edit release name diff --git a/README.md b/README.md index 6e25141f..b9326fd3 100755 --- a/README.md +++ b/README.md @@ -257,7 +257,7 @@ Some languages, see support [table](README.md#support-levels-and-languages), als This is easier/cleaner to implement on interpreted languages, but **compiled languages can have a REPL-like behavior too** using dirty tricks, or through an intrepreter such as [evcxr](https://github.com/google/evcxr), but no compiled language has REPL behavior for now. Many interpreted languages will have this behavior enabled or disabled by default, you can change this with the -`repl_enable = { 'Intepreter_name', 'Another_one' }` and `repl_disable = {'Disabled_interpreter'}` keys in the configuration. Relevant info is available in `:SnipInfo` / `:SnipInfo ` +`repl_enable = { 'Interpreter_name', 'Another_one' }` and `repl_disable = {'Disabled_interpreter'}` keys in the configuration. Relevant info is available in `:SnipInfo` / `:SnipInfo ` Hopefully, if something does not work, or if the 'memory' is corrupted by bad code you can clear the REPL memory with `:SnipReplMemoryClean` that is a faster and less error-prone alternative to `:SnipReset` for this use case. @@ -277,7 +277,7 @@ require'sniprun'.setup({ repl_enable = {}, --# enable REPL-like behavior for the given interpreters repl_disable = {}, --# disable REPL-like behavior for the given interpreters - interpreter_options = { --# intepreter-specific options, see docs / :SnipInfo + interpreter_options = { --# interpreter-specific options, see docs / :SnipInfo GFM_original = { use_on_filetypes = {"markdown.pandoc"} --# the 'use_on_filetypes' configuration key is --# available for every interpreter diff --git a/doc/Python3_fifo.md b/doc/Python3_fifo.md index 45e4c68b..44969f82 100644 --- a/doc/Python3_fifo.md +++ b/doc/Python3_fifo.md @@ -26,7 +26,7 @@ setting a custom python interpreter and venv is also supported require'sniprun'.setup({ interpreter_options = { Python3_fifo = { - intepreter = "python3.9", + interpreter = "python3.9", venv = {"venv_project1", "venv_project2", "../venv_project2"}, } } diff --git a/doc/Python3_original.md b/doc/Python3_original.md index 876e23b4..4a645160 100644 --- a/doc/Python3_original.md +++ b/doc/Python3_original.md @@ -19,14 +19,14 @@ With or without REPL, the star imports may also not be automatically fetched, ev -To use a custom python intepreterv( maybe python2, or a particular version?) you can provide the following interpreter options:, using a venv is also supported (provide one or several relative paths "../venv" etc.. may be necessary if you didn't open neovim at the root of the project) +To use a custom python interpreter ( maybe python2, or a particular version?) you can provide the following interpreter options:, using a venv is also supported (provide one or several relative paths "../venv" etc.. may be necessary if you didn't open neovim at the root of the project) ``` require'sniprun'.setup({ interpreter_options = { Python3_original = { - intepreter = "python3.9", + interpreter = "python3.9", venv = {"venv_project1", "venv_project2", "../venv_project2"}, } } diff --git a/doc/sniprun.txt b/doc/sniprun.txt index 9d25b5b6..472fcd66 100644 --- a/doc/sniprun.txt +++ b/doc/sniprun.txt @@ -42,7 +42,7 @@ ALL COMMANDS *sniprun-commands* :SnipTerminate Kill Sniprun and child processes (equivalent to SnipReset but does not clean the cache) -:SnipInfo Get Sniprun version info and info about the available intepreters +:SnipInfo Get Sniprun version info and info about the available interpreters :SnipClose Clear virtual text and close splits and floating windows created by sniprun diff --git a/ressources/CONTRIBUTING_REPL.md b/ressources/CONTRIBUTING_REPL.md index 17e6f7bf..dfe4f500 100644 --- a/ressources/CONTRIBUTING_REPL.md +++ b/ressources/CONTRIBUTING_REPL.md @@ -1,8 +1,8 @@ -# Making a REPL-capable intepreter for sniprun +# Making a REPL-capable interpreter for sniprun ## Is it possible ? -Yes, most of the time, if the language already has an available intepreter. It _could_ be possible otherwise but has yet to be really done. +Yes, most of the time, if the language already has an available interpreter. It _could_ be possible otherwise but has yet to be really done. To avoid confusion, we'll call the language interpreter 'interpreter', and sniprun's part (implementing the Interpreter trait) the runner. @@ -22,7 +22,7 @@ To avoid confusion, we'll call the language interpreter 'interpreter', and snipr The best example I'm going to discuss is Python3\_fifo, even if it's a bit bloated from python-specific things. -Just like you implemented the Intepreter trait for a conventional runner, you'll have to implement the ReplLikeInterpreter trait. Another trait (InterpreterUtils) is automatically implemented and provides features & data persistency to help you survive across different/independent runs. +Just like you implemented the Interpreter trait for a conventional runner, you'll have to implement the ReplLikeInterpreter trait. Another trait (InterpreterUtils) is automatically implemented and provides features & data persistency to help you survive across different/independent runs. 1. Running something in the background: @@ -106,7 +106,7 @@ fn wait_out_file (....){ is executed & returned at the end of `execute_repl` that firsts send the user's snippet (wrapped with landmarks) to the FIFO pipe. 4. Helper scripts -Though not very documented, the `ressources/init_repl.sh` and `ressources/launcher.sh` script are resuable for other runners than Python3\_fifo (see Mathematica that has its own similar scripts in `src/interpreters/Mathematica_original/`. They take care of plugging together the fifo, stdout, stderr files and the interpreter's process. They also take care of closing the intepreter (and free the ressources) when nvim exits +Though not very documented, the `ressources/init_repl.sh` and `ressources/launcher.sh` script are resuable for other runners than Python3\_fifo (see Mathematica that has its own similar scripts in `src/interpreters/Mathematica_original/`. They take care of plugging together the fifo, stdout, stderr files and the interpreter's process. They also take care of closing the interpreter (and free the ressources) when nvim exits ### End notes: diff --git a/src/interpreter.rs b/src/interpreter.rs index e2b2a9a4..833d626f 100644 --- a/src/interpreter.rs +++ b/src/interpreter.rs @@ -71,7 +71,7 @@ pub trait Interpreter: ReplLikeInterpreter { SupportLevel::Unsupported } - /// This function should be overwritten if your intepreter cannot run + /// This function should be overwritten if your interpreter cannot run /// all the files for the advertised filetypes. /// It's up to you to detect it, and initialize (new()) and .run() it and return the result fn fallback(&mut self) -> Option> { @@ -259,7 +259,7 @@ impl InterpreterUtils for T { } } - /// get an intepreter option + /// get an interpreter option fn get_interpreter_option(data: &DataHolder, option: &str) -> Option { fn index_from_name( name: &str, @@ -317,7 +317,7 @@ pub trait ReplLikeInterpreter { } fn execute_repl(&mut self) -> Result { Err(SniprunError::InterpreterLimitationError(String::from( - "REPL-like behavior is not implemented for this intepreter", + "REPL-like behavior is not implemented for this interpreter", ))) } } From 5a6cc9b9bb31ff7a134a9b74afea41ef9b0334d2 Mon Sep 17 00:00:00 2001 From: Michael Bleuez Date: Mon, 23 May 2022 22:25:21 +0200 Subject: [PATCH 2/4] fix warnings from rust 1.61 --- Cargo.toml | 1 + src/interpreters/Bash_original.rs | 4 +--- src/interpreters/CS_original.rs | 4 +--- src/interpreters/C_original.rs | 2 -- src/interpreters/Cpp_original.rs | 2 -- src/interpreters/D_original.rs | 3 --- src/interpreters/FSharp_fifo.rs | 3 --- src/interpreters/GFM_original.rs | 2 -- src/interpreters/Generic.rs | 4 +--- src/interpreters/Haskell_original.rs | 5 +---- src/interpreters/JS_TS_deno.rs | 2 -- src/interpreters/JS_original.rs | 2 -- src/interpreters/Julia_jupyter.rs | 6 ------ src/interpreters/Julia_original.rs | 5 ----- src/interpreters/Lua_nvim.rs | 2 -- src/interpreters/Lua_original.rs | 4 +--- src/interpreters/Mathematica_original.rs | 5 ----- src/interpreters/OrgMode_original.rs | 2 -- src/interpreters/Prolog_original.rs | 3 +-- src/interpreters/Python3_fifo.rs | 3 --- src/interpreters/Python3_jupyter.rs | 8 ++------ src/interpreters/Python3_original.rs | 1 + src/interpreters/Ruby_original.rs | 2 -- src/interpreters/Sage_fifo.rs | 3 --- src/interpreters/Scala_original.rs | 3 --- src/interpreters/TypeScript_original.rs | 5 +---- 26 files changed, 11 insertions(+), 75 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 9807290c..aed8aba0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,6 +2,7 @@ name = "sniprun" version = "1.2.3" authors = ["michaelb "] +rust-version="1.31" edition = "2018" [features] diff --git a/src/interpreters/Bash_original.rs b/src/interpreters/Bash_original.rs index 79d09164..0df1bb9f 100644 --- a/src/interpreters/Bash_original.rs +++ b/src/interpreters/Bash_original.rs @@ -4,7 +4,6 @@ pub struct Bash_original { support_level: SupportLevel, data: DataHolder, code: String, - bash_work_dir: String, main_file_path: String, } @@ -16,12 +15,11 @@ impl Interpreter for Bash_original { builder .create(&bwd) .expect("Could not create directory for bash-original"); - let mfp = bwd.clone() + "/main.sh"; + let mfp = bwd + "/main.sh"; Box::new(Bash_original { data, support_level: level, code: String::from(""), - bash_work_dir: bwd, main_file_path: mfp, }) } diff --git a/src/interpreters/CS_original.rs b/src/interpreters/CS_original.rs index 648ec24b..98d617f8 100644 --- a/src/interpreters/CS_original.rs +++ b/src/interpreters/CS_original.rs @@ -4,7 +4,6 @@ pub struct CS_original { support_level: SupportLevel, data: DataHolder, code: String, - cs_work_dir: String, main_file_path: String, } impl ReplLikeInterpreter for CS_original {} @@ -16,12 +15,11 @@ impl Interpreter for CS_original { builder .create(&bwd) .expect("Could not create directory for cs-original"); - let mfp = bwd.clone() + "/main.coffee"; + let mfp = bwd + "/main.coffee"; Box::new(CS_original { data, support_level: level, code: String::from(""), - cs_work_dir: bwd, main_file_path: mfp, }) } diff --git a/src/interpreters/C_original.rs b/src/interpreters/C_original.rs index bf47b0a7..466d71a4 100644 --- a/src/interpreters/C_original.rs +++ b/src/interpreters/C_original.rs @@ -4,7 +4,6 @@ pub struct C_original { support_level: SupportLevel, data: DataHolder, code: String, - c_work_dir: String, bin_path: String, main_file_path: String, compiler: String, @@ -81,7 +80,6 @@ impl Interpreter for C_original { data, support_level, code: String::from(""), - c_work_dir: rwd, bin_path: bp, main_file_path: mfp, compiler: String::new(), diff --git a/src/interpreters/Cpp_original.rs b/src/interpreters/Cpp_original.rs index dd20ae4a..e584e705 100644 --- a/src/interpreters/Cpp_original.rs +++ b/src/interpreters/Cpp_original.rs @@ -4,7 +4,6 @@ pub struct Cpp_original { support_level: SupportLevel, data: DataHolder, code: String, - c_work_dir: String, bin_path: String, main_file_path: String, compiler: String, @@ -74,7 +73,6 @@ impl Interpreter for Cpp_original { data, support_level, code: String::from(""), - c_work_dir: rwd, bin_path: bp, main_file_path: mfp, compiler: String::new(), diff --git a/src/interpreters/D_original.rs b/src/interpreters/D_original.rs index 62a774de..f6a680f8 100644 --- a/src/interpreters/D_original.rs +++ b/src/interpreters/D_original.rs @@ -5,8 +5,6 @@ pub struct D_original { data: DataHolder, code: String, - ///specific to d - d_work_dir: String, main_file_path: String, } impl ReplLikeInterpreter for D_original {} @@ -26,7 +24,6 @@ impl Interpreter for D_original { data, support_level, code: String::from(""), - d_work_dir: rwd, main_file_path: mfp, }) } diff --git a/src/interpreters/FSharp_fifo.rs b/src/interpreters/FSharp_fifo.rs index 135c0a82..045c0484 100644 --- a/src/interpreters/FSharp_fifo.rs +++ b/src/interpreters/FSharp_fifo.rs @@ -5,7 +5,6 @@ pub struct FSharp_fifo { data: DataHolder, code: String, main_file_path: String, - plugin_root: String, cache_dir: String, interpreter: String, @@ -126,14 +125,12 @@ impl Interpreter for FSharp_fifo { //pre-create string pointing to main file's and binary's path let mfp = rwd.clone() + "/main.fsx"; - let pgr = data.sniprun_root_dir.clone(); Box::new(FSharp_fifo { cache_dir: rwd + "/" + &FSharp_fifo::get_nvim_pid(&data), data, support_level: level, code: String::from(""), main_file_path: mfp, - plugin_root: pgr, current_output_id: 0, interpreter: String::new(), }) diff --git a/src/interpreters/GFM_original.rs b/src/interpreters/GFM_original.rs index e73985f6..4b473d92 100644 --- a/src/interpreters/GFM_original.rs +++ b/src/interpreters/GFM_original.rs @@ -5,7 +5,6 @@ pub struct GFM_original { data: DataHolder, code: String, - language_work_dir: String, default_filetype: String, } @@ -158,7 +157,6 @@ impl Interpreter for GFM_original { data: data_clone, support_level, code: String::new(), - language_work_dir: lwd, default_filetype: ddf, }); diff --git a/src/interpreters/Generic.rs b/src/interpreters/Generic.rs index d647e5ab..cd3d4483 100644 --- a/src/interpreters/Generic.rs +++ b/src/interpreters/Generic.rs @@ -4,7 +4,6 @@ pub struct Generic { support_level: SupportLevel, data: DataHolder, code: String, - generic_work_dir: String, glot_bin_path: String, main_file_path: String, } @@ -17,13 +16,12 @@ impl Interpreter for Generic { builder .create(&rwd) .expect("Could not create directory for generic"); - let mfp = rwd.clone() + "/main.json"; + let mfp = rwd + "/main.json"; let bp = String::from(&data.sniprun_root_dir) + "/ressources/runner"; Box::new(Generic { data, support_level, code: String::from(""), - generic_work_dir: rwd, glot_bin_path: bp, main_file_path: mfp, }) diff --git a/src/interpreters/Haskell_original.rs b/src/interpreters/Haskell_original.rs index 6f4fa3e4..ad62525a 100644 --- a/src/interpreters/Haskell_original.rs +++ b/src/interpreters/Haskell_original.rs @@ -5,8 +5,6 @@ pub struct Haskell_original { data: DataHolder, code: String, - ///specific to haskell - haskell_work_dir: String, bin_path: String, main_file_path: String, } @@ -22,13 +20,12 @@ impl Interpreter for Haskell_original { .expect("Could not create directory for haskell-original"); //pre-create string pointing to main file's and binary's path - let mfp = rwd.clone() + "/main.hs"; + let mfp = rwd + "/main.hs"; let bp = String::from(&mfp[..mfp.len() - 3]); // remove extension so binary is named 'main' Box::new(Haskell_original { data, support_level, code: String::from(""), - haskell_work_dir: rwd, bin_path: bp, main_file_path: mfp, }) diff --git a/src/interpreters/JS_TS_deno.rs b/src/interpreters/JS_TS_deno.rs index 601dd15a..6dd36535 100644 --- a/src/interpreters/JS_TS_deno.rs +++ b/src/interpreters/JS_TS_deno.rs @@ -7,7 +7,6 @@ pub struct JS_TS_deno { cache_dir: String, current_output_id: u32, - language_work_dir: String, main_file_path: String, } @@ -118,7 +117,6 @@ impl Interpreter for JS_TS_deno { data, support_level, code: String::new(), - language_work_dir: lwd, main_file_path: mfp, current_output_id: 0, }) diff --git a/src/interpreters/JS_original.rs b/src/interpreters/JS_original.rs index 6d9638b0..d7886b69 100644 --- a/src/interpreters/JS_original.rs +++ b/src/interpreters/JS_original.rs @@ -4,7 +4,6 @@ pub struct JS_original { support_level: SupportLevel, data: DataHolder, code: String, - js_work_dir: String, main_file_path: String, } impl ReplLikeInterpreter for JS_original {} @@ -21,7 +20,6 @@ impl Interpreter for JS_original { data, support_level: level, code: String::from(""), - js_work_dir: bwd, main_file_path: mfp, }) } diff --git a/src/interpreters/Julia_jupyter.rs b/src/interpreters/Julia_jupyter.rs index 693c7395..0869d399 100644 --- a/src/interpreters/Julia_jupyter.rs +++ b/src/interpreters/Julia_jupyter.rs @@ -7,8 +7,6 @@ pub struct Julia_jupyter { kernel_file: String, main_file_path: String, launcher_path: String, - plugin_root: String, - cache_dir: String, } impl Interpreter for Julia_jupyter { @@ -25,18 +23,14 @@ impl Interpreter for Julia_jupyter { let mfp = pwd.clone() + "/main.jl"; let lp = pwd.clone() + "/main.sh"; - let pgr = data.sniprun_root_dir.clone(); - let kp = pwd.clone() + "/kernel_sniprun.json"; Box::new(Julia_jupyter { - cache_dir: pwd + "/" + &data.nvim_pid.to_string(), data, support_level: level, code: String::new(), kernel_file: kp, main_file_path: mfp, launcher_path: lp, - plugin_root: pgr, }) } diff --git a/src/interpreters/Julia_original.rs b/src/interpreters/Julia_original.rs index 5f8c1fd5..3ab0dc07 100644 --- a/src/interpreters/Julia_original.rs +++ b/src/interpreters/Julia_original.rs @@ -4,9 +4,7 @@ pub struct Julia_original { support_level: SupportLevel, data: DataHolder, code: String, - imports: String, main_file_path: String, - plugin_root: String, cache_dir: String, current_output_id: u32, @@ -66,14 +64,11 @@ impl Interpreter for Julia_original { //pre-create string pointing to main file's and binary's path let mfp = rwd.clone() + "/main.jl"; - let pgr = data.sniprun_root_dir.clone(); Box::new(Julia_original { data, support_level: level, code: String::from(""), - imports: String::from(""), main_file_path: mfp, - plugin_root: pgr, cache_dir: rwd, current_output_id: 0, }) diff --git a/src/interpreters/Lua_nvim.rs b/src/interpreters/Lua_nvim.rs index c8bf1c58..4bb6d3cd 100644 --- a/src/interpreters/Lua_nvim.rs +++ b/src/interpreters/Lua_nvim.rs @@ -4,7 +4,6 @@ pub struct Lua_nvim { support_level: SupportLevel, data: DataHolder, code: String, - lua_work_dir: String, main_file_path: String, } impl ReplLikeInterpreter for Lua_nvim {} @@ -21,7 +20,6 @@ impl Interpreter for Lua_nvim { data, support_level: level, code: String::from(""), - lua_work_dir: bwd, main_file_path: mfp, }) } diff --git a/src/interpreters/Lua_original.rs b/src/interpreters/Lua_original.rs index e0c4939b..02491ea8 100644 --- a/src/interpreters/Lua_original.rs +++ b/src/interpreters/Lua_original.rs @@ -4,7 +4,6 @@ pub struct Lua_original { support_level: SupportLevel, data: DataHolder, code: String, - lua_work_dir: String, main_file_path: String, } impl ReplLikeInterpreter for Lua_original {} @@ -16,12 +15,11 @@ impl Interpreter for Lua_original { builder .create(&bwd) .expect("Could not create directory for lua-original"); - let mfp = bwd.clone() + "/main.lua"; + let mfp = bwd + "/main.lua"; Box::new(Lua_original { data, support_level: level, code: String::from(""), - lua_work_dir: bwd, main_file_path: mfp, }) } diff --git a/src/interpreters/Mathematica_original.rs b/src/interpreters/Mathematica_original.rs index 8a6cce3e..f43e39f4 100644 --- a/src/interpreters/Mathematica_original.rs +++ b/src/interpreters/Mathematica_original.rs @@ -8,9 +8,6 @@ pub struct Mathematica_original { language_work_dir: String, main_file_path: String, - fifo_in: Option, - file_out: Option, - current_output_id: u32, } @@ -106,8 +103,6 @@ impl Interpreter for Mathematica_original { code: String::new(), language_work_dir: lwd, main_file_path: mfp, - fifo_in: None, - file_out: None, current_output_id: 0, }) } diff --git a/src/interpreters/OrgMode_original.rs b/src/interpreters/OrgMode_original.rs index f85f88df..88e02b23 100644 --- a/src/interpreters/OrgMode_original.rs +++ b/src/interpreters/OrgMode_original.rs @@ -5,7 +5,6 @@ pub struct OrgMode_original { data: DataHolder, code: String, - language_work_dir: String, default_filetype: String, } @@ -180,7 +179,6 @@ impl Interpreter for OrgMode_original { data: data_clone, support_level, code: String::new(), - language_work_dir: lwd, default_filetype: ddf, }); diff --git a/src/interpreters/Prolog_original.rs b/src/interpreters/Prolog_original.rs index a3fe1ac8..2975f724 100644 --- a/src/interpreters/Prolog_original.rs +++ b/src/interpreters/Prolog_original.rs @@ -4,7 +4,6 @@ pub struct Prolog_original { support_level: SupportLevel, data: DataHolder, code: String, - prolog_work_dir: String, main_file_path: String, interpreter: String, } @@ -22,7 +21,6 @@ impl Interpreter for Prolog_original { data, support_level: level, code: String::from(""), - prolog_work_dir: bwd, main_file_path: mfp, interpreter: String::new(), }) @@ -123,6 +121,7 @@ mod test_prolog_original { use super::*; // #[test] + #[allow(dead_code)] fn simple_print() { let mut data = DataHolder::new(); data.current_bloc = String::from(":- write(ok), halt."); diff --git a/src/interpreters/Python3_fifo.rs b/src/interpreters/Python3_fifo.rs index 12be4552..378fd9aa 100644 --- a/src/interpreters/Python3_fifo.rs +++ b/src/interpreters/Python3_fifo.rs @@ -6,7 +6,6 @@ pub struct Python3_fifo { code: String, imports: String, main_file_path: String, - plugin_root: String, cache_dir: String, interpreter: String, @@ -255,7 +254,6 @@ impl Interpreter for Python3_fifo { //pre-create string pointing to main file's and binary's path let mfp = rwd.clone() + "/main.py"; - let pgr = data.sniprun_root_dir.clone(); Box::new(Python3_fifo { cache_dir: rwd + "/" + &Python3_fifo::get_nvim_pid(&data), data, @@ -263,7 +261,6 @@ impl Interpreter for Python3_fifo { code: String::from(""), imports: String::from(""), main_file_path: mfp, - plugin_root: pgr, current_output_id: 0, interpreter: String::new(), venv: None, diff --git a/src/interpreters/Python3_jupyter.rs b/src/interpreters/Python3_jupyter.rs index e67e4fe3..27f11b2a 100644 --- a/src/interpreters/Python3_jupyter.rs +++ b/src/interpreters/Python3_jupyter.rs @@ -8,8 +8,6 @@ pub struct Python3_jupyter { kernel_file: String, main_file_path: String, launcher_path: String, - plugin_root: String, - cache_dir: String, } impl Python3_jupyter { @@ -61,6 +59,7 @@ impl Python3_jupyter { Ok(()) } + #[allow(dead_code)] fn get_nvim_pid(data: &DataHolder) -> String { data.nvim_pid.to_string() } @@ -125,11 +124,8 @@ impl Interpreter for Python3_jupyter { let mfp = pwd.clone() + "/main.py"; let lp = pwd.clone() + "/main.sh"; - let pgr = data.sniprun_root_dir.clone(); - let kp = pwd.clone() + "/kernel_sniprun.json"; Box::new(Python3_jupyter { - cache_dir: pwd + "/" + &Python3_jupyter::get_nvim_pid(&data), data, support_level: level, code: String::new(), @@ -137,7 +133,6 @@ impl Interpreter for Python3_jupyter { kernel_file: kp, main_file_path: mfp, launcher_path: lp, - plugin_root: pgr, }) } @@ -388,6 +383,7 @@ mod test_python3_jupyter { assert!(string_result.contains(&"a 1")); } + #[allow(dead_code)] fn test_repl() { let mut event_handler = fake_event(); event_handler.fill_data(&fake_msgpack()); diff --git a/src/interpreters/Python3_original.rs b/src/interpreters/Python3_original.rs index 92f9276d..45d7ccf5 100644 --- a/src/interpreters/Python3_original.rs +++ b/src/interpreters/Python3_original.rs @@ -327,6 +327,7 @@ mod test_python3_original { assert_eq!(string_result, "lol 1\n"); } + #[allow(dead_code)] fn test_repl() { let mut event_handler = fake_event(); event_handler.fill_data(&fake_msgpack()); diff --git a/src/interpreters/Ruby_original.rs b/src/interpreters/Ruby_original.rs index c7988cc0..5abf2815 100644 --- a/src/interpreters/Ruby_original.rs +++ b/src/interpreters/Ruby_original.rs @@ -4,7 +4,6 @@ pub struct Ruby_original { support_level: SupportLevel, data: DataHolder, code: String, - ruby_work_dir: String, main_file_path: String, } impl ReplLikeInterpreter for Ruby_original {} @@ -21,7 +20,6 @@ impl Interpreter for Ruby_original { data, support_level: level, code: String::from(""), - ruby_work_dir: bwd, main_file_path: mfp, }) } diff --git a/src/interpreters/Sage_fifo.rs b/src/interpreters/Sage_fifo.rs index 466f2a33..ad973316 100644 --- a/src/interpreters/Sage_fifo.rs +++ b/src/interpreters/Sage_fifo.rs @@ -6,7 +6,6 @@ pub struct Sage_fifo { code: String, imports: String, main_file_path: String, - plugin_root: String, cache_dir: String, interpreter: String, @@ -251,7 +250,6 @@ impl Interpreter for Sage_fifo { //pre-create string pointing to main file's and binary's path let mfp = rwd.clone() + "/main.sage"; - let pgr = data.sniprun_root_dir.clone(); Box::new(Sage_fifo { cache_dir: rwd + "/" + &Sage_fifo::get_nvim_pid(&data), data, @@ -259,7 +257,6 @@ impl Interpreter for Sage_fifo { code: String::from(""), imports: String::from(""), main_file_path: mfp, - plugin_root: pgr, current_output_id: 0, interpreter: String::new(), user_sage_config: false, diff --git a/src/interpreters/Scala_original.rs b/src/interpreters/Scala_original.rs index 588e5912..4826a09f 100644 --- a/src/interpreters/Scala_original.rs +++ b/src/interpreters/Scala_original.rs @@ -7,7 +7,6 @@ pub struct Scala_original { ///specific to compiled languages, can be modified of course language_work_dir: String, - bin_path: String, main_file_path: String, // you can and should add fields as needed } @@ -28,13 +27,11 @@ impl Interpreter for Scala_original { //pre-create string pointing to main file's and binary's path let mfp = lwd.clone() + "/Main.scala"; - let bp = lwd.clone() + "/Main"; // remove extension so binary is named 'main' Box::new(Scala_original { data, support_level, code: String::new(), language_work_dir: lwd, - bin_path: bp, main_file_path: mfp, }) } diff --git a/src/interpreters/TypeScript_original.rs b/src/interpreters/TypeScript_original.rs index 955b19e6..43b9617f 100644 --- a/src/interpreters/TypeScript_original.rs +++ b/src/interpreters/TypeScript_original.rs @@ -4,8 +4,6 @@ pub struct TypeScript_original { support_level: SupportLevel, data: DataHolder, code: String, - - language_work_dir: String, main_file_path: String, } @@ -22,12 +20,11 @@ impl Interpreter for TypeScript_original { .expect("Could not create directory for example"); //pre-create string pointing to main file's and binary's path - let mfp = lwd.clone() + "/main.ts"; + let mfp = lwd + "/main.ts"; Box::new(TypeScript_original { data, support_level, code: String::new(), - language_work_dir: lwd, main_file_path: mfp, }) } From d56c1b75db21e231cf576ba7d478059da80125a5 Mon Sep 17 00:00:00 2001 From: Michael Bleuez Date: Mon, 23 May 2022 22:42:25 +0200 Subject: [PATCH 3/4] make rust 1.55 the MSRV --- src/interpreters/GFM_original.rs | 4 ++-- src/interpreters/OrgMode_original.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/interpreters/GFM_original.rs b/src/interpreters/GFM_original.rs index 4b473d92..edc7f3b6 100644 --- a/src/interpreters/GFM_original.rs +++ b/src/interpreters/GFM_original.rs @@ -28,7 +28,7 @@ impl GFM_original { let selection_line = self.data.range[0] as usize; let mut v = vec![]; for (i,l) in lines.iter().enumerate() { - if (l.trim_start().starts_with("```") && !l.trim_start()[3..].trim().is_empty()) + if (l.trim_start().starts_with("```") && !l.trim_start()[3..].trim().is_empty()) && counter % 2 == 1 { return Err(SniprunError::CustomError(String::from( @@ -46,7 +46,7 @@ impl GFM_original { } } if counter >= 2 { - info!("counting {counter} code blocs delimiters"); + info!("counting {} code blocs delimiters", counter); if counter % 2 == 1 { return Err(SniprunError::CustomError(String::from( "Selection contains an odd number of code bloc delimiters", diff --git a/src/interpreters/OrgMode_original.rs b/src/interpreters/OrgMode_original.rs index 88e02b23..5910a3ba 100644 --- a/src/interpreters/OrgMode_original.rs +++ b/src/interpreters/OrgMode_original.rs @@ -41,13 +41,13 @@ impl OrgMode_original { } } if counter >= 2 { - info!("counting {counter} code blocs delimiters"); + info!("counting {} code blocs delimiters", counter); if counter % 2 == 1 { return Err(SniprunError::CustomError(String::from( "Selection contains an odd number of code bloc delimiters", ))); } - info!("running separately ranges : {v:?}"); + info!("running separately ranges : {:?}", v); return Err(SniprunError::ReRunRanges(v)); } info!("no muliple bloc was found"); From a42ebde4ca4fd9c3bf83ae382c0e985ff3454c97 Mon Sep 17 00:00:00 2001 From: Michael Bleuez Date: Mon, 23 May 2022 22:49:59 +0200 Subject: [PATCH 4/4] 1.55 as MSRV, fix last compil warns/errs --- .github/workflows/rust.yml | 17 ++++++++++++++--- CHANGELOG.md | 1 + README.md | 2 +- src/interpreters/GFM_original.rs | 2 +- src/interpreters/OrgMode_original.rs | 2 +- 5 files changed, 18 insertions(+), 6 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 41111c94..100c7d5e 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -12,15 +12,26 @@ env: jobs: build: - name : build - + name : build-latest-stable runs-on: ubuntu-20.04 - steps: - uses: actions/checkout@v2 - name: Build run: cargo build --verbose --release + buildmsrv: + name: build-nightly + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + - name: Install Rust 1.55 toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: 1.55 + override: true + - name: build + run: cargo build --release + buildnightly: name: build-nightly runs-on: ubuntu-20.04 diff --git a/CHANGELOG.md b/CHANGELOG.md index 7abd20b9..99ab2b4d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ ## v1.2.4 +- set Rust 1.55 as MSRV - fix typo in documentation ## v1.2.3 diff --git a/README.md b/README.md index b9326fd3..35274965 100755 --- a/README.md +++ b/README.md @@ -132,7 +132,7 @@ Sniprun will then: ### Prerequisites && dependencies -- Sniprun is compatible with **Linux** and **MacOS**. (Mac users _need_ the Rust [toolchain](https://www.rust-lang.org/tools/install)) +- Sniprun is compatible with **Linux** and **MacOS**. (Mac users _need_ the Rust [toolchain](https://www.rust-lang.org/tools/install)) >= 1.55 - **Neovim** version >= 0.5 diff --git a/src/interpreters/GFM_original.rs b/src/interpreters/GFM_original.rs index edc7f3b6..0bef8f73 100644 --- a/src/interpreters/GFM_original.rs +++ b/src/interpreters/GFM_original.rs @@ -52,7 +52,7 @@ impl GFM_original { "Selection contains an odd number of code bloc delimiters", ))); } - info!("running separately ranges : {v:?}"); + info!("running separately ranges : {:?}",v); return Err(SniprunError::ReRunRanges(v)); } info!("no muliple bloc was found"); diff --git a/src/interpreters/OrgMode_original.rs b/src/interpreters/OrgMode_original.rs index 5910a3ba..816361e9 100644 --- a/src/interpreters/OrgMode_original.rs +++ b/src/interpreters/OrgMode_original.rs @@ -28,7 +28,7 @@ impl OrgMode_original { let selection_line = self.data.range[0] as usize; let mut v = vec![]; for (i, l) in lines.iter().enumerate() { - info!("checking code bloc delimiter in : {l}"); + info!("checking code bloc delimiter in : {}",l); if l.trim_start().to_lowercase().starts_with("#+begin_src") { if counter % 2 == 1 { return Err(SniprunError::CustomError(String::from("Incomplete or nested code blocs")))} counter += 1;