Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ oxc_diagnostics = "0.108"
tree-sitter = "0.25.10"
tree-sitter-highlight = "0.25.10"
crossterm = "0.28"
lsp-types = "0.97"
lsp-types = { version = "0.97", features = ["proposed"] }
ts-rs = { version = "11.1", features = ["serde_json"] }
# Add more as needed during refactor

Expand Down
15 changes: 15 additions & 0 deletions crates/fresh-editor/src/app/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,14 @@
| Action::None => {
// Don't cancel for LSP actions or no-op
}
Action::InsertTab => {
// Allow inline completion acceptance on Tab without clearing ghost text first
self.cancel_pending_lsp_requests();
}
_ => {
// Cancel any pending LSP requests
self.cancel_pending_lsp_requests();
self.clear_inline_completion();
}
}

Expand Down Expand Up @@ -476,7 +481,10 @@
);
}
Action::LspCompletion => {
self.clear_inline_completion();
self.request_completion()?;
let _ =
self.request_inline_completion(lsp_types::InlineCompletionTriggerKind::Invoked);
}
Action::LspGotoDefinition => {
self.request_goto_definition()?;
Expand Down Expand Up @@ -1132,6 +1140,12 @@
self.handle_insert_char_editor(c)?;
}
}
Action::InsertTab => {
if self.accept_inline_completion()? {
return Ok(());
}
self.apply_action_as_events(Action::InsertTab)?;
}
// Prompt clipboard actions
Action::PromptCopy => {
if let Some(prompt) = &self.prompt {
Expand Down Expand Up @@ -1984,7 +1998,7 @@
// Add all available syntaxes from the grammar registry (100+ languages)
let mut syntax_names: Vec<&str> = self.grammar_registry.available_syntaxes();
// Sort alphabetically for easier navigation
syntax_names.sort_unstable_by(|a, b| a.to_lowercase().cmp(&b.to_lowercase()));

Check warning on line 2001 in crates/fresh-editor/src/app/input.rs

View workflow job for this annotation

GitHub Actions / clippy

consider using `sort_unstable_by_key`

warning: consider using `sort_unstable_by_key` --> crates/fresh-editor/src/app/input.rs:2001:9 | 2001 | syntax_names.sort_unstable_by(|a, b| a.to_lowercase().cmp(&b.to_lowercase())); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `syntax_names.sort_unstable_by_key(|a| a.to_lowercase())` | = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#unnecessary_sort_by = note: `#[warn(clippy::unnecessary_sort_by)]` on by default

for syntax_name in syntax_names {
// Skip "Plain Text" as we already added it at the top
Expand Down Expand Up @@ -2605,6 +2619,7 @@

// Cancel any pending LSP requests since the text is changing
self.cancel_pending_lsp_requests();
self.clear_inline_completion();

if let Some(events) = self.action_to_events(Action::InsertChar(c)) {
if events.len() > 1 {
Expand Down
Loading
Loading