File tree Expand file tree Collapse file tree 3 files changed +17
-4
lines changed Expand file tree Collapse file tree 3 files changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -328,7 +328,7 @@ impl Application {
328
328
self . handle_idle_timeout( ) ;
329
329
// HACK: force rendering until I can figure out how
330
330
// async jobs work
331
- self . render( ) ;
331
+ // self.render();
332
332
333
333
#[ cfg( feature = "integration" ) ]
334
334
{
Original file line number Diff line number Diff line change @@ -340,12 +340,23 @@ fn spell_check(
340
340
if event != PromptEvent :: Validate {
341
341
return Ok ( ( ) ) ;
342
342
}
343
- let doc = doc_mut ! ( cx. editor) ;
344
- let mut diagnostics = doc. spell_check ( ) ;
345
- doc. add_diagnostics ( diagnostics. as_mut ( ) ) ;
343
+ let doc = doc ! ( cx. editor) ;
344
+ // TODO: could probably just be a job?
345
+ let callback = make_spell_check_callback ( doc. id ( ) ) ;
346
+ cx. jobs . callback ( callback) ;
346
347
Ok ( ( ) )
347
348
}
348
349
350
+ async fn make_spell_check_callback ( doc_id : DocumentId ) -> anyhow:: Result < job:: Callback > {
351
+ let call: job:: Callback = Box :: new ( move |editor, _compositor| {
352
+ if let Some ( doc) = editor. document_mut ( doc_id) {
353
+ let mut diagnostics = doc. spell_check ( ) ;
354
+ doc. add_diagnostics ( diagnostics. as_mut ( ) ) ;
355
+ } ;
356
+ } ) ;
357
+ Ok ( call)
358
+ }
359
+
349
360
fn set_indent_style (
350
361
cx : & mut compositor:: Context ,
351
362
args : & [ Cow < str > ] ,
Original file line number Diff line number Diff line change @@ -1115,6 +1115,8 @@ impl Document {
1115
1115
1116
1116
pub fn add_diagnostics ( & mut self , diagnostics : & mut Vec < Diagnostic > ) {
1117
1117
self . diagnostics . append ( diagnostics) ;
1118
+ self . diagnostics
1119
+ . sort_unstable_by_key ( |diagnostic| diagnostic. range ) ;
1118
1120
}
1119
1121
1120
1122
/// Get the document's auto pairs. If the document has a recognized
You can’t perform that action at this time.
0 commit comments