Comments (4)
I guess that you also want REPL capabilities within sniprun, as," it's possible to run a snippet declaring one variable, and then another one using it" ?
If so, I can implement that, but I'll need some time and luck
If you don't require REPL capabilities, it should be possible to get it running by yourself with the generic interpreter
from sniprun.
Well, ofc REPL capability would be nice, but in the mean time, I tried to use the generic interpreter, but the Typescript_original runs instead.
my config:
config = function()
require("sniprun").setup({
interpreter_options = {
Generic = {
Bun = {
supported_filetypes = { "typescript" },
extension = ".ts",
interpreter = "bun repl",
compiler = "",
}
}
},
selected_interpreters = { 'Generic' },
})
end,
from sniprun.
There is indeed an error in my current code driving behavior of sniprun when the Generic interpreter is used on a language that already has support. Something not too complex, but since you'll wait anyway I can make a proper TS/JS Bun intepreter... and maybe REPL-capable
from sniprun.
So..
There is a fix for for the Generic interpreter issue, which should allow you to run the Generic interpreter with this config:
selected_interpreters = { 'Generic' },
interpreter_options = {
Generic = {
error_truncate="long",
Bun = {
supported_filetypes = { "typescript", "javascript" },
extension = ".ts",
interpreter = "bun run",
compiler = "",
}
}
},
I also made a "full-fledged" bun-based js/ts interpreter, but it doesn't bring much more than the generic config, except for .... a repl mode!
However, bun repl
itself is ..... very very janky about its stdin/stdout, most notably, the order is sometimes borked.
(simplified example with an intentionnal error 'le b=1':
echo "let a=1;console.log('start');a;le b=1;console.log('end')" | bun repl
.... blablah
> console.log('start')
> le b=1
× Expected ';', '}' or <eof>
╭─[$bun$repl.ts:1:1]
1 │ le b=1
· ─┬ ─
· ╰── This is the expression part of an expression statement
╰────
> a
> console.log('end')
start
end
1
So I expect low reliability on complex prompts
You can try these changes on the dev
branch (you'll need rust and sh ./install.sh 1
to compile locally sniprun), or wait for the 1.3.9 release that will probably happen next week
from sniprun.
Related Issues (20)
- add feature can auto add nested local package's function in go . HOT 3
- go file cant process dot import. HOT 2
- api.run_string cant work as expected. HOT 8
- Add a pre process goimports for golang project before really run_string. HOT 3
- Releases contain un-updated `Cargo.lock` file HOT 10
- Releases contain un-updated `Cargo.lock` file HOT 2
- Option to open Terminal in horizontal split HOT 2
- SnipRun is not working on markdown .md files on MacOS HOT 2
- Python3_jupyter not working HOT 3
- [FEATURE] Explicit configuration for binaries HOT 3
- Error detected while processing function SnipRunLauncher HOT 6
- C+OpenGL ERROR HOT 1
- No Neorg support anymore? HOT 7
- Cpp Compile-Time Error HOT 2
- How to run the entire current file? HOT 4
- Improve shell scripts portability HOT 3
- Improvement: Update Lua code to use Neovim API functions HOT 4
- Current Update breaks, rust Repl not outputing result. HOT 4
- Python import list depend will got a error when run script HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sniprun.