mirror of https://github.com/helix-editor/helix
remove old document open/close events
parent
2d16a86c4c
commit
60c0882fd2
|
@ -17,7 +17,7 @@ use helix_view::{
|
||||||
GutterConfig, IndentGuidesConfig, LineEndingConfig, LineNumber, LspConfig, SearchConfig,
|
GutterConfig, IndentGuidesConfig, LineEndingConfig, LineNumber, LspConfig, SearchConfig,
|
||||||
SmartTabConfig, StatusLineConfig, TerminalConfig, WhitespaceConfig,
|
SmartTabConfig, StatusLineConfig, TerminalConfig, WhitespaceConfig,
|
||||||
},
|
},
|
||||||
events::{DocumentFocusLost, DocumentOpened, SelectionDidChange},
|
events::{DocumentDidOpen, DocumentFocusLost, SelectionDidChange},
|
||||||
extension::document_id_to_usize,
|
extension::document_id_to_usize,
|
||||||
input::KeyEvent,
|
input::KeyEvent,
|
||||||
theme::Color,
|
theme::Color,
|
||||||
|
@ -2198,7 +2198,7 @@ fn register_hook(event_kind: String, callback_fn: SteelVal) -> steel::UnRecovera
|
||||||
"document-opened" => {
|
"document-opened" => {
|
||||||
// TODO: Share this code with the above since most of it is
|
// TODO: Share this code with the above since most of it is
|
||||||
// exactly the same
|
// exactly the same
|
||||||
register_hook!(move |event: &mut DocumentOpened<'_>| {
|
register_hook!(move |event: &mut DocumentDidOpen<'_>| {
|
||||||
let cloned_func = rooted.value().clone();
|
let cloned_func = rooted.value().clone();
|
||||||
let doc_id = event.doc;
|
let doc_id = event.doc;
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ use helix_event::{events, register_event};
|
||||||
use helix_view::document::Mode;
|
use helix_view::document::Mode;
|
||||||
use helix_view::events::{
|
use helix_view::events::{
|
||||||
DiagnosticsDidChange, DocumentDidChange, DocumentDidClose, DocumentDidOpen, DocumentFocusLost,
|
DiagnosticsDidChange, DocumentDidChange, DocumentDidClose, DocumentDidOpen, DocumentFocusLost,
|
||||||
DocumentOpened, LanguageServerExited, LanguageServerInitialized, SelectionDidChange,
|
LanguageServerExited, LanguageServerInitialized, SelectionDidChange,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::commands;
|
use crate::commands;
|
||||||
|
@ -24,7 +24,6 @@ pub fn register() {
|
||||||
register_event::<DocumentFocusLost>();
|
register_event::<DocumentFocusLost>();
|
||||||
register_event::<SelectionDidChange>();
|
register_event::<SelectionDidChange>();
|
||||||
register_event::<DiagnosticsDidChange>();
|
register_event::<DiagnosticsDidChange>();
|
||||||
register_event::<DocumentOpened>();
|
|
||||||
register_event::<LanguageServerInitialized>();
|
register_event::<LanguageServerInitialized>();
|
||||||
register_event::<LanguageServerExited>();
|
register_event::<LanguageServerExited>();
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,10 +5,7 @@ use crate::{
|
||||||
DocumentOpenError, DocumentSavedEvent, DocumentSavedEventFuture, DocumentSavedEventResult,
|
DocumentOpenError, DocumentSavedEvent, DocumentSavedEventFuture, DocumentSavedEventResult,
|
||||||
Mode, SavePoint,
|
Mode, SavePoint,
|
||||||
},
|
},
|
||||||
events::{
|
events::{DocumentDidClose, DocumentDidOpen, DocumentFocusLost, DocumentSaved},
|
||||||
DocumentClosed, DocumentDidClose, DocumentDidOpen, DocumentFocusLost, DocumentOpened,
|
|
||||||
DocumentSaved,
|
|
||||||
},
|
|
||||||
graphics::{CursorKind, Rect},
|
graphics::{CursorKind, Rect},
|
||||||
handlers::Handlers,
|
handlers::Handlers,
|
||||||
info::Info,
|
info::Info,
|
||||||
|
@ -1896,10 +1893,6 @@ impl Editor {
|
||||||
|
|
||||||
self._refresh();
|
self._refresh();
|
||||||
|
|
||||||
dispatch(DocumentClosed {
|
|
||||||
editor: self,
|
|
||||||
doc: doc_id,
|
|
||||||
});
|
|
||||||
helix_event::dispatch(DocumentDidClose { editor: self, doc });
|
helix_event::dispatch(DocumentDidClose { editor: self, doc });
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
|
@ -24,8 +24,6 @@ events! {
|
||||||
DiagnosticsDidChange<'a> { editor: &'a mut Editor, doc: DocumentId }
|
DiagnosticsDidChange<'a> { editor: &'a mut Editor, doc: DocumentId }
|
||||||
// called **after** a document loses focus (but not when its closed)
|
// called **after** a document loses focus (but not when its closed)
|
||||||
DocumentFocusLost<'a> { editor: &'a mut Editor, doc: DocumentId }
|
DocumentFocusLost<'a> { editor: &'a mut Editor, doc: DocumentId }
|
||||||
DocumentOpened<'a> { editor: &'a mut Editor, doc: DocumentId }
|
|
||||||
DocumentClosed<'a> { editor: &'a mut Editor, doc: DocumentId }
|
|
||||||
DocumentSaved<'a> { editor: &'a mut Editor, doc: DocumentId }
|
DocumentSaved<'a> { editor: &'a mut Editor, doc: DocumentId }
|
||||||
|
|
||||||
LanguageServerInitialized<'a> {
|
LanguageServerInitialized<'a> {
|
||||||
|
|
Loading…
Reference in New Issue