-
-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #95 from michaelb/dev
5.10
- Loading branch information
Showing
29 changed files
with
1,692 additions
and
436 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,5 @@ test/ | |
download_dir/ | ||
target/ | ||
ressources/infofile.txt | ||
Cargo.lock | ||
test_sniprun.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# Lua API to sniprun | ||
|
||
You can use sniprun API from: | ||
|
||
```lua | ||
|
||
local sa = require('sniprun.api') | ||
|
||
``` | ||
|
||
then, some functions are accessible, such as | ||
|
||
``` | ||
sa.run_range(r_start, r_end, <filetype>, <config>) | ||
sa.run_string(codestring, <filetype>, <config>) | ||
``` | ||
|
||
ranges are integers matching the (inclusive) line numbers | ||
|
||
codestring must be a string | ||
|
||
filetype (optionnal) must be a string such as 'python' | ||
|
||
config (optionnal) allows to override the default/user config. It's particularly interesting to provide the display type 'Api' in this field if you wish to retrieve sniprun's output without interference on the user UI. | ||
|
||
|
||
You can register listeners that will be called upon (async) sniprun output: | ||
|
||
|
||
``` | ||
sa.register_listener(custom_function) | ||
``` | ||
|
||
where custom function is a function that take one unique argument: a table which contains at least two entries: | ||
|
||
- 'status' (a string that's either 'ok' or 'error' for now, but your function should accept & manage other values) | ||
- 'message' (also a string, maybe be mutliline) | ||
|
||
(Simply put, registered functions are callbacks) | ||
|
||
|
||
|
||
| ||
| ||
|
||
Thus, an example of such a function (imitating the 'Classic' display with 'uwu' tendencies) would be | ||
|
||
``` | ||
local api_listener = function (d) | ||
if d.status == 'ok' then | ||
print("Nice uwu: ", d.message) | ||
elseif d.status == 'error' then | ||
print("Oh nyow! Somethuwuing went wyong: ", d.message) | ||
else | ||
print("Whut is this myeow? I don't knyow this status type nyah") | ||
end | ||
end | ||
sa.register_listener(api_listener) | ||
``` | ||
|
||
|
||
## Warnings | ||
|
||
Beware, sniprun is still thightly coupled to the current nvim buffer & instance, but there should not be dependencies for non-REPL, and interpreters running under Bloc-Level. | ||
|
||
REPL-capable and Import level (or more) interpreter may fetch information from the current buffer | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Before releasing | ||
|
||
- check compilation success | ||
- create a version bump commit | ||
- merge | ||
- create a new tag vX.Y.Z on master | ||
- git push --origin vX.Y.Z | ||
|
||
# After release | ||
|
||
- Check CI status | ||
- Check Releases status |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "sniprun" | ||
version = "0.5.9" | ||
version = "0.5.10" | ||
authors = ["michaelb <[email protected]>"] | ||
edition = "2018" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
the Orgmode\_original interpreter helps you running code blocs defined in org code blocs delimiters | ||
|
||
inline, switches and headers are not supported/ignored | ||
|
||
# example 1 | ||
|
||
------------- | ||
|
||
``` | ||
#+NAME: demo | ||
#+BEGIN_SRC bash | ||
echo "lol" # << you can run sniprun on this line | ||
\# or the whole visual selection following: | ||
for i in {1..4};do | ||
echo $i | ||
done | ||
#+END_SRC | ||
``` | ||
|
||
|
||
# example 2 | ||
|
||
------------- | ||
|
||
``` | ||
#+NAME: demo_run_whole_bloc | ||
#+BEGIN_SRC rust << running on this line will run the entire bloc | ||
println!("test"); | ||
println!("test2"); | ||
#+END_SRC | ||
``` | ||
|
||
------------- | ||
|
||
**the language name must be there (otherwise the default * will be used) at the bloc start** and has to match the language name or the filetype associated | ||
|
||
\* python, but you can ofc configure that: | ||
|
||
``` | ||
require'sniprun'.setup({ | ||
interpreter_options = { | ||
OrgMode_original = { | ||
default_filetype = 'bash' -- default filetype/language name | ||
} | ||
} | ||
}) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
## Sage\_fifo interpreter | ||
|
||
This is a pipe-based implementation: you have to run sniprun once before being able to send code snippets (configure an autcmd?) | ||
|
||
A sage REPL is launcher in the background and won't quit until you exit neovim (or after 10h). | ||
|
||
This interpreter only works in REPL-mode (and behaves REPL-like by default) | ||
|
||
two configurations keys are available: | ||
|
||
``` | ||
require'sniprun'.setup({ | ||
interpreter_options = { | ||
Sage_fifo = { | ||
interpreter = "sage", | ||
sage_user_config = 1, -- the actual value has no effect, only the presence of the key is important | ||
} | ||
} | ||
} | ||
}); | ||
``` | ||
|
||
Sage\_fifo currently support auto-importing python imports |
Oops, something went wrong.