Skip to content

Commit

Permalink
Add new color theme 'iroaseta' (helix-editor#10381)
Browse files Browse the repository at this point in the history
* Add new color theme 'iroaseta'

* Update runtime/themes/iroaseta.toml

Co-authored-by: postsolar <[email protected]>

* Update iroaseta.toml

Add virtual jump label theme setting

* Update runtime/themes/iroaseta.toml

Co-authored-by: Michael Davis <[email protected]>

* Update iroaseta.toml

update storage. keyword.storage. according to suggestion, and update color.

* Update iroaseta.toml

remove unused palette

* Update iroaseta.toml

add missing setting for bufferline

* Update iroaseta.toml

update diagnostic fg color

* Update iroaseta.toml

I made the config more comprehensive and took all available themes settings from the manual. Some are commented out though.

* Update iroaseta.toml

add missing colors

* Update iroaseta.toml

Made some final adjustments to the color theme to improve visibility and reduce eye strain.

* Update runtime/themes/iroaseta.toml

Co-authored-by: Michael Davis <[email protected]>

* Update runtime/themes/iroaseta.toml

Co-authored-by: Michael Davis <[email protected]>

* Update iroaseta.toml

remove redundant settings

* Update iroaseta.toml

update color name

---------

Co-authored-by: postsolar <[email protected]>
Co-authored-by: Michael Davis <[email protected]>

Large Gruvbox refactoring (helix-editor#10773)

* gruvbox refactoring

* removed unnecessary lines

* set purple1 for operators

* changed diagnostics colors

* removed some unnecessary lines

* set diff.delta color to yellow

* removed some tag colors

Delay auto-save until exiting insert mode (helix-editor#11047)

Saving while in insert mode causes issues with the modification
indicator and this is very easy to reproduce with the current state of
the auto-save hook. We can tweak the hook slightly to await the mode
switch out of insert mode to perform the save.

The debounce is preserved: if you save and then immediately exit insert
mode the debounce will be respected. If the debounce lapses while you
are in insert mode, the save occurs as you switch out of insert mode
immediately.

VHDL highlights.scm improvement (helix-editor#10845)

Fix homebrew formula link (helix-editor#11058)

Co-authored-by: Mark Murphy <[email protected]>

build(deps): bump the rust-dependencies group with 3 updates (helix-editor#11072)

Bumps the rust-dependencies group with 3 updates: [log](https://github.com/rust-lang/log), [serde_json](https://github.com/serde-rs/json) and [cc](https://github.com/rust-lang/cc-rs).

Updates `log` from 0.4.21 to 0.4.22
- [Release notes](https://github.com/rust-lang/log/releases)
- [Changelog](https://github.com/rust-lang/log/blob/master/CHANGELOG.md)
- [Commits](rust-lang/log@0.4.21...0.4.22)

Updates `serde_json` from 1.0.117 to 1.0.120
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](serde-rs/json@v1.0.117...v1.0.120)

Updates `cc` from 1.0.100 to 1.0.104
- [Release notes](https://github.com/rust-lang/cc-rs/releases)
- [Changelog](https://github.com/rust-lang/cc-rs/blob/main/CHANGELOG.md)
- [Commits](rust-lang/cc-rs@cc-v1.0.100...cc-v1.0.104)

---
updated-dependencies:
- dependency-name: log
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: rust-dependencies
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: rust-dependencies
- dependency-name: cc
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: rust-dependencies
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

chore: update cairo tree sitter + queries (helix-editor#11067)

Bump time from broken version (0.3.23) (helix-editor#11065)

Tell language servers that Helix can request formatting (helix-editor#11064)

Without providing the formatting capability, the language server might not advertise its ability to format in return, causing the :format command to be broken.

Override far too dark cursorline (helix-editor#11071)

Add hsc filetype to haskell (helix-editor#11074)
  • Loading branch information
YardQuit authored and salman-farooq-sh committed Dec 21, 2024
1 parent 6ed0d0c commit aad7df5
Show file tree
Hide file tree
Showing 12 changed files with 517 additions and 421 deletions.
49 changes: 37 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/releases.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ being published.
* Post to reddit
* [Example post](https://www.reddit.com/r/rust/comments/uzp5ze/helix_editor_2205_released/)

[homebrew formula]: https://github.com/Homebrew/homebrew-core/blob/master/Formula/helix.rb
[homebrew formula]: https://github.com/Homebrew/homebrew-core/blob/master/Formula/h/helix.rb

## Changelog Curation

Expand Down
3 changes: 3 additions & 0 deletions helix-lsp/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,9 @@ impl Client {
prepare_support_default_behavior: None,
honors_change_annotations: Some(false),
}),
formatting: Some(lsp::DocumentFormattingClientCapabilities {
dynamic_registration: Some(false),
}),
code_action: Some(lsp::CodeActionClientCapabilities {
code_action_literal_support: Some(lsp::CodeActionLiteralSupport {
code_action_kind: lsp::CodeActionKindLiteralSupport {
Expand Down
76 changes: 66 additions & 10 deletions helix-term/src/handlers/auto_save.rs
Original file line number Diff line number Diff line change
@@ -1,39 +1,82 @@
use std::time::Duration;
use std::{
sync::{
atomic::{self, AtomicBool},
Arc,
},
time::Duration,
};

use anyhow::Ok;
use arc_swap::access::Access;

use helix_event::{register_hook, send_blocking};
use helix_view::{events::DocumentDidChange, handlers::Handlers, Editor};
use helix_view::{
document::Mode,
events::DocumentDidChange,
handlers::{AutoSaveEvent, Handlers},
Editor,
};
use tokio::time::Instant;

use crate::{
commands, compositor,
events::OnModeSwitch,
job::{self, Jobs},
};

#[derive(Debug)]
pub(super) struct AutoSaveHandler;
pub(super) struct AutoSaveHandler {
save_pending: Arc<AtomicBool>,
}

impl AutoSaveHandler {
pub fn new() -> AutoSaveHandler {
AutoSaveHandler
AutoSaveHandler {
save_pending: Default::default(),
}
}
}

impl helix_event::AsyncHook for AutoSaveHandler {
type Event = u64;
type Event = AutoSaveEvent;

fn handle_event(
&mut self,
timeout: Self::Event,
_: Option<tokio::time::Instant>,
event: Self::Event,
existing_debounce: Option<tokio::time::Instant>,
) -> Option<Instant> {
Some(Instant::now() + Duration::from_millis(timeout))
match event {
Self::Event::DocumentChanged { save_after } => {
Some(Instant::now() + Duration::from_millis(save_after))
}
Self::Event::LeftInsertMode => {
if existing_debounce.is_some() {
// If the change happened more recently than the debounce, let the
// debounce run down before saving.
existing_debounce
} else {
// Otherwise if there is a save pending, save immediately.
if self.save_pending.load(atomic::Ordering::Relaxed) {
self.finish_debounce();
}
None
}
}
}
}

fn finish_debounce(&mut self) {
job::dispatch_blocking(move |editor, _| request_auto_save(editor))
let save_pending = self.save_pending.clone();
job::dispatch_blocking(move |editor, _| {
if editor.mode() == Mode::Insert {
// Avoid saving while in insert mode since this mixes up
// the modification indicator and prevents future saves.
save_pending.store(true, atomic::Ordering::Relaxed);
} else {
request_auto_save(editor);
save_pending.store(false, atomic::Ordering::Relaxed);
}
})
}
}

Expand All @@ -54,7 +97,20 @@ pub(super) fn register_hooks(handlers: &Handlers) {
register_hook!(move |event: &mut DocumentDidChange<'_>| {
let config = event.doc.config.load();
if config.auto_save.after_delay.enable {
send_blocking(&tx, config.auto_save.after_delay.timeout);
send_blocking(
&tx,
AutoSaveEvent::DocumentChanged {
save_after: config.auto_save.after_delay.timeout,
},
);
}
Ok(())
});

let tx = handlers.auto_save.clone();
register_hook!(move |event: &mut OnModeSwitch<'_, '_>| {
if event.old_mode == Mode::Insert {
send_blocking(&tx, AutoSaveEvent::LeftInsertMode)
}
Ok(())
});
Expand Down
8 changes: 7 additions & 1 deletion helix-view/src/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,17 @@ use crate::{DocumentId, Editor, ViewId};
pub mod dap;
pub mod lsp;

#[derive(Debug)]
pub enum AutoSaveEvent {
DocumentChanged { save_after: u64 },
LeftInsertMode,
}

pub struct Handlers {
// only public because most of the actual implementation is in helix-term right now :/
pub completions: Sender<lsp::CompletionEvent>,
pub signature_hints: Sender<lsp::SignatureHelpEvent>,
pub auto_save: Sender<u64>,
pub auto_save: Sender<AutoSaveEvent>,
}

impl Handlers {
Expand Down
4 changes: 2 additions & 2 deletions languages.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1269,7 +1269,7 @@ source = { git = "https://github.com/ikatyang/tree-sitter-yaml", rev = "0e36bed1
name = "haskell"
scope = "source.haskell"
injection-regex = "hs|haskell"
file-types = ["hs", "hs-boot"]
file-types = ["hs", "hs-boot", "hsc"]
roots = ["Setup.hs", "stack.yaml", "cabal.project"]
comment-token = "--"
block-comment-tokens = { start = "{-", end = "-}" }
Expand Down Expand Up @@ -2081,7 +2081,7 @@ language-servers = [ "cairo-language-server" ]

[[grammar]]
name = "cairo"
source = { git = "https://github.com/starkware-libs/tree-sitter-cairo", rev = "0596baab741ffacdc65c761d5d5ffbbeae97f033" }
source = { git = "https://github.com/starkware-libs/tree-sitter-cairo", rev = "e3a0212261c125cb38248458cd856c0ffee2b398" }

[[language]]
name = "cpon"
Expand Down
6 changes: 6 additions & 0 deletions runtime/queries/cairo/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,12 @@
; -------
; Keywords
; -------

(for_expression
"for" @keyword.control.repeat)

"in" @keyword.control

[
"match"
"if"
Expand Down
8 changes: 7 additions & 1 deletion runtime/queries/cairo/indents.scm
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,10 @@
(#not-same-line? @expr-start @pattern-guard)
) @indent


(for_expression
"in" @in
.
(_) @indent
(#not-same-line? @in @indent)
(#set! "scope" "all")
)
Loading

0 comments on commit aad7df5

Please sign in to comment.