Comments (5)
yeah I noticed it, I think the best idea is to add debouncing, hopefully its not that hard :)
from irust.
@pzmarzly would be great if you test out 55a00e3
from irust.
Well, it is fast now, though autocomplete does not trigger after pasting (as due to synchronous nature of the event loop, it doesn't know if a character is the last one). I don't think it's that much of an issue, and changing that would require major changes to IRust. I'm fine with current state.
from irust.
Auto complete doesn't trigger after pasting cause I'm not using a real debouncer.
A real debouncer triggers the function after timer expires, something like this
use std::time::{Duration, Instant};
const WAIT_TIMEOUT: u64 = 50;
pub struct Debouncer {
timer: Instant,
function: Option<impl Fn>
}
impl Debouncer {
pub fn new() -> Self {
Self {
timer: Instant::now(),
function: None,
}
}
pub fn start(&mut self) {
std::thread::spawn(||{
if self.timer.elapsed() >= Duration::from_millis(WAIT_TIMEOUT) {
self.function;
}
})
}
pub fn run(&mut self, mut function: impl FnMut() -> std::io::Result<()>) {
self.function = Some(function);
self.timer = Instant::now();
}
}
Then call start()
at the begining of the program so it checks the timer all the time to know when it should trigger the callback
But Its not easy to implement I would need some guidance to make it work
from irust.
But I'm also satisfied with current result so we I think we should just leave this for the future^^
from irust.
Related Issues (20)
- Add :cargo command
- Add predefined themes
- Rework how irust server works
- Use `rustyline` or `reedline` for input? HOT 1
- Move theme settings from config.toml to themes config
- Improve Jupyter kernel support HOT 7
- typing twice in windows with crossterm-0.26+ HOT 2
- Can irust repl evaluate code with release mode instead of debug mode? HOT 3
- Cannot use two `irust_repl`s at the same time. HOT 27
- Rust analyzer is not working on Windows HOT 6
- Interactive usage HOT 3
- IRust installation fails due to use of unstable library feature 'once_cell' HOT 3
- FileNotFoundError while `python -m irust_kernel.install` HOT 1
- cargo-edit requires --path argument for a local dependency after version 0.9.1 HOT 2
- irust doesn't display Thai text properly. HOT 1
- Unclear documentation on importing local crates HOT 5
- Autocomplete doesn't work HOT 10
- untitled issue HOT 4
- Proposal: Split eval output HOT 3
- Use `rust-analyser` instead of `racer` for autocompletion HOT 7
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 irust.