mirror of https://github.com/helix-editor/helix
Merge branch 'helix-editor:master' into master
commit
fc72600497
|
@ -8,6 +8,9 @@ on:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: "00 01 * * *"
|
- cron: "00 01 * * *"
|
||||||
|
|
||||||
|
env:
|
||||||
|
MSRV: "1.76"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check:
|
check:
|
||||||
name: Check (msrv)
|
name: Check (msrv)
|
||||||
|
@ -18,7 +21,9 @@ jobs:
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Install MSRV toolchain
|
- name: Install MSRV toolchain
|
||||||
uses: dtolnay/rust-toolchain@1.76
|
uses: dtolnay/rust-toolchain@master
|
||||||
|
with:
|
||||||
|
toolchain: ${{ env.MSRV }}
|
||||||
|
|
||||||
- uses: Swatinem/rust-cache@v2
|
- uses: Swatinem/rust-cache@v2
|
||||||
with:
|
with:
|
||||||
|
@ -39,7 +44,9 @@ jobs:
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Install MSRV toolchain
|
- name: Install MSRV toolchain
|
||||||
uses: dtolnay/rust-toolchain@1.76
|
uses: dtolnay/rust-toolchain@master
|
||||||
|
with:
|
||||||
|
toolchain: ${{ env.MSRV }}
|
||||||
|
|
||||||
- uses: Swatinem/rust-cache@v2
|
- uses: Swatinem/rust-cache@v2
|
||||||
with:
|
with:
|
||||||
|
@ -71,8 +78,9 @@ jobs:
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Install MSRV toolchain
|
- name: Install MSRV toolchain
|
||||||
uses: dtolnay/rust-toolchain@1.76
|
uses: dtolnay/rust-toolchain@master
|
||||||
with:
|
with:
|
||||||
|
toolchain: ${{ env.MSRV }}
|
||||||
components: rustfmt, clippy
|
components: rustfmt, clippy
|
||||||
|
|
||||||
- uses: Swatinem/rust-cache@v2
|
- uses: Swatinem/rust-cache@v2
|
||||||
|
@ -99,7 +107,9 @@ jobs:
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Install MSRV toolchain
|
- name: Install MSRV toolchain
|
||||||
uses: dtolnay/rust-toolchain@1.76
|
uses: dtolnay/rust-toolchain@master
|
||||||
|
with:
|
||||||
|
toolchain: ${{ env.MSRV }}
|
||||||
|
|
||||||
- uses: Swatinem/rust-cache@v2
|
- uses: Swatinem/rust-cache@v2
|
||||||
with:
|
with:
|
||||||
|
|
|
@ -136,9 +136,9 @@ checksum = "df8670b8c7b9dae1793364eafadf7239c40d669904660c5960d74cfd80b46a53"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cc"
|
name = "cc"
|
||||||
version = "1.2.1"
|
version = "1.2.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "fd9de9f2205d5ef3fd67e685b0df337994ddd4495e2a28d185500d0e1edfea47"
|
checksum = "f34d93e62b03caf570cccc334cbc6c2fceca82f39211051345108adcba3eebdc"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"shlex",
|
"shlex",
|
||||||
]
|
]
|
||||||
|
@ -1757,15 +1757,15 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libc"
|
name = "libc"
|
||||||
version = "0.2.165"
|
version = "0.2.167"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "fcb4d3d38eab6c5239a362fa8bae48c03baf980a6e7079f063942d563ef3533e"
|
checksum = "09d6582e104315a817dff97f75133544b2e094ee22447d2acf4a74e189ba06fc"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libloading"
|
name = "libloading"
|
||||||
version = "0.8.5"
|
version = "0.8.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4"
|
checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"windows-targets 0.52.6",
|
"windows-targets 0.52.6",
|
||||||
|
|
|
@ -225,6 +225,7 @@
|
||||||
| uxntal | ✓ | | | |
|
| uxntal | ✓ | | | |
|
||||||
| v | ✓ | ✓ | ✓ | `v-analyzer` |
|
| v | ✓ | ✓ | ✓ | `v-analyzer` |
|
||||||
| vala | ✓ | ✓ | | `vala-language-server` |
|
| vala | ✓ | ✓ | | `vala-language-server` |
|
||||||
|
| vento | ✓ | | | |
|
||||||
| verilog | ✓ | ✓ | | `svlangserver` |
|
| verilog | ✓ | ✓ | | `svlangserver` |
|
||||||
| vhdl | ✓ | | | `vhdl_ls` |
|
| vhdl | ✓ | | | `vhdl_ls` |
|
||||||
| vhs | ✓ | | | |
|
| vhs | ✓ | | | |
|
||||||
|
|
|
@ -59,10 +59,16 @@ the default value (e.g. to `10240` from `256`) by running `ulimit -n 10240`.
|
||||||
|
|
||||||
## Minimum Stable Rust Version (MSRV) Policy
|
## Minimum Stable Rust Version (MSRV) Policy
|
||||||
|
|
||||||
Helix follows the MSRV of Firefox.
|
Helix keeps an intentionally low MSRV for the sake of easy building and packaging
|
||||||
The current MSRV and future changes to the MSRV are listed in the [Firefox documentation].
|
downstream. We follow [Firefox's MSRV policy]. Once Firefox's MSRV increases we
|
||||||
|
may bump ours as well, but be sure to check that popular distributions like Ubuntu
|
||||||
|
package the new MSRV version. When increasing the MSRV, update these three places:
|
||||||
|
|
||||||
[Firefox documentation]: https://firefox-source-docs.mozilla.org/writing-rust-code/update-policy.html
|
* the `workspace.package.rust-version` key in `Cargo.toml` in the repository root
|
||||||
|
* the `env.MSRV` key at the top of `.github/workflows/build.yml`
|
||||||
|
* the `toolchain.channel` key in `rust-toolchain.toml`
|
||||||
|
|
||||||
|
[Firefox's MSRV policy]: https://firefox-source-docs.mozilla.org/writing-rust-code/update-policy.html
|
||||||
[good-first-issue]: https://github.com/helix-editor/helix/labels/E-easy
|
[good-first-issue]: https://github.com/helix-editor/helix/labels/E-easy
|
||||||
[log-file]: https://github.com/helix-editor/helix/wiki/FAQ#access-the-log-file
|
[log-file]: https://github.com/helix-editor/helix/wiki/FAQ#access-the-log-file
|
||||||
[architecture.md]: ./architecture.md
|
[architecture.md]: ./architecture.md
|
||||||
|
|
|
@ -147,10 +147,7 @@ pub fn find_block_comments(
|
||||||
let mut only_whitespace = true;
|
let mut only_whitespace = true;
|
||||||
let mut comment_changes = Vec::with_capacity(selection.len());
|
let mut comment_changes = Vec::with_capacity(selection.len());
|
||||||
let default_tokens = tokens.first().cloned().unwrap_or_default();
|
let default_tokens = tokens.first().cloned().unwrap_or_default();
|
||||||
// TODO: check if this can be removed on MSRV bump
|
|
||||||
#[allow(clippy::redundant_clone)]
|
|
||||||
let mut start_token = default_tokens.start.clone();
|
let mut start_token = default_tokens.start.clone();
|
||||||
#[allow(clippy::redundant_clone)]
|
|
||||||
let mut end_token = default_tokens.end.clone();
|
let mut end_token = default_tokens.end.clone();
|
||||||
|
|
||||||
let mut tokens = tokens.to_vec();
|
let mut tokens = tokens.to_vec();
|
||||||
|
|
|
@ -346,7 +346,7 @@ pub struct RopeGraphemes<'a> {
|
||||||
cursor: GraphemeCursor,
|
cursor: GraphemeCursor,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> fmt::Debug for RopeGraphemes<'a> {
|
impl fmt::Debug for RopeGraphemes<'_> {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
f.debug_struct("RopeGraphemes")
|
f.debug_struct("RopeGraphemes")
|
||||||
.field("text", &self.text)
|
.field("text", &self.text)
|
||||||
|
@ -358,7 +358,7 @@ impl<'a> fmt::Debug for RopeGraphemes<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> RopeGraphemes<'a> {
|
impl RopeGraphemes<'_> {
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn new(slice: RopeSlice) -> RopeGraphemes {
|
pub fn new(slice: RopeSlice) -> RopeGraphemes {
|
||||||
let mut chunks = slice.chunks();
|
let mut chunks = slice.chunks();
|
||||||
|
@ -423,7 +423,7 @@ pub struct RevRopeGraphemes<'a> {
|
||||||
cursor: GraphemeCursor,
|
cursor: GraphemeCursor,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> fmt::Debug for RevRopeGraphemes<'a> {
|
impl fmt::Debug for RevRopeGraphemes<'_> {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
f.debug_struct("RevRopeGraphemes")
|
f.debug_struct("RevRopeGraphemes")
|
||||||
.field("text", &self.text)
|
.field("text", &self.text)
|
||||||
|
@ -435,7 +435,7 @@ impl<'a> fmt::Debug for RevRopeGraphemes<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> RevRopeGraphemes<'a> {
|
impl RevRopeGraphemes<'_> {
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn new(slice: RopeSlice) -> RevRopeGraphemes {
|
pub fn new(slice: RopeSlice) -> RevRopeGraphemes {
|
||||||
let (mut chunks, mut cur_chunk_start, _, _) = slice.chunks_at_byte(slice.len_bytes());
|
let (mut chunks, mut cur_chunk_start, _, _) = slice.chunks_at_byte(slice.len_bytes());
|
||||||
|
@ -542,7 +542,7 @@ impl<'a> From<&'a str> for GraphemeStr<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> From<String> for GraphemeStr<'a> {
|
impl From<String> for GraphemeStr<'_> {
|
||||||
fn from(g: String) -> Self {
|
fn from(g: String) -> Self {
|
||||||
let len = g.len();
|
let len = g.len();
|
||||||
let ptr = Box::into_raw(g.into_bytes().into_boxed_slice()) as *mut u8;
|
let ptr = Box::into_raw(g.into_bytes().into_boxed_slice()) as *mut u8;
|
||||||
|
|
|
@ -386,7 +386,7 @@ enum IndentCaptureType<'a> {
|
||||||
Align(RopeSlice<'a>),
|
Align(RopeSlice<'a>),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> IndentCaptureType<'a> {
|
impl IndentCaptureType<'_> {
|
||||||
fn default_scope(&self) -> IndentScope {
|
fn default_scope(&self) -> IndentScope {
|
||||||
match self {
|
match self {
|
||||||
IndentCaptureType::Indent | IndentCaptureType::IndentAlways => IndentScope::Tail,
|
IndentCaptureType::Indent | IndentCaptureType::IndentAlways => IndentScope::Tail,
|
||||||
|
|
|
@ -660,7 +660,7 @@ impl Selection {
|
||||||
pub fn fragments<'a>(
|
pub fn fragments<'a>(
|
||||||
&'a self,
|
&'a self,
|
||||||
text: RopeSlice<'a>,
|
text: RopeSlice<'a>,
|
||||||
) -> impl DoubleEndedIterator<Item = Cow<'a, str>> + ExactSizeIterator<Item = Cow<str>> + 'a
|
) -> impl DoubleEndedIterator<Item = Cow<'a, str>> + ExactSizeIterator<Item = Cow<'a, str>>
|
||||||
{
|
{
|
||||||
self.ranges.iter().map(move |range| range.fragment(text))
|
self.ranges.iter().map(move |range| range.fragment(text))
|
||||||
}
|
}
|
||||||
|
@ -744,7 +744,7 @@ pub struct LineRangeIter<'a> {
|
||||||
text: RopeSlice<'a>,
|
text: RopeSlice<'a>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Iterator for LineRangeIter<'a> {
|
impl Iterator for LineRangeIter<'_> {
|
||||||
type Item = (usize, usize);
|
type Item = (usize, usize);
|
||||||
|
|
||||||
fn next(&mut self) -> Option<Self::Item> {
|
fn next(&mut self) -> Option<Self::Item> {
|
||||||
|
|
|
@ -619,7 +619,7 @@ pub enum CapturedNode<'a> {
|
||||||
Grouped(Vec<Node<'a>>),
|
Grouped(Vec<Node<'a>>),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> CapturedNode<'a> {
|
impl CapturedNode<'_> {
|
||||||
pub fn start_byte(&self) -> usize {
|
pub fn start_byte(&self) -> usize {
|
||||||
match self {
|
match self {
|
||||||
Self::Single(n) => n.start_byte(),
|
Self::Single(n) => n.start_byte(),
|
||||||
|
@ -1852,7 +1852,7 @@ struct HighlightIterLayer<'a> {
|
||||||
depth: u32,
|
depth: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> fmt::Debug for HighlightIterLayer<'a> {
|
impl fmt::Debug for HighlightIterLayer<'_> {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
f.debug_struct("HighlightIterLayer").finish()
|
f.debug_struct("HighlightIterLayer").finish()
|
||||||
}
|
}
|
||||||
|
@ -2109,7 +2109,7 @@ impl HighlightConfiguration {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> HighlightIterLayer<'a> {
|
impl HighlightIterLayer<'_> {
|
||||||
// First, sort scope boundaries by their byte offset in the document. At a
|
// First, sort scope boundaries by their byte offset in the document. At a
|
||||||
// given position, emit scope endings before scope beginnings. Finally, emit
|
// given position, emit scope endings before scope beginnings. Finally, emit
|
||||||
// scope boundaries from deeper layers first.
|
// scope boundaries from deeper layers first.
|
||||||
|
@ -2247,7 +2247,7 @@ fn intersect_ranges(
|
||||||
result
|
result
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> HighlightIter<'a> {
|
impl HighlightIter<'_> {
|
||||||
fn emit_event(
|
fn emit_event(
|
||||||
&mut self,
|
&mut self,
|
||||||
offset: usize,
|
offset: usize,
|
||||||
|
@ -2302,7 +2302,7 @@ impl<'a> HighlightIter<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Iterator for HighlightIter<'a> {
|
impl Iterator for HighlightIter<'_> {
|
||||||
type Item = Result<HighlightEvent, Error>;
|
type Item = Result<HighlightEvent, Error>;
|
||||||
|
|
||||||
fn next(&mut self) -> Option<Self::Item> {
|
fn next(&mut self) -> Option<Self::Item> {
|
||||||
|
|
|
@ -217,7 +217,7 @@ impl<'a> TreeCursor<'a> {
|
||||||
|
|
||||||
/// Returns an iterator over the children of the node the TreeCursor is on
|
/// Returns an iterator over the children of the node the TreeCursor is on
|
||||||
/// at the time this is called.
|
/// at the time this is called.
|
||||||
pub fn children(&'a mut self) -> ChildIter {
|
pub fn children(&'a mut self) -> ChildIter<'a> {
|
||||||
let parent = self.node();
|
let parent = self.node();
|
||||||
|
|
||||||
ChildIter {
|
ChildIter {
|
||||||
|
@ -229,7 +229,7 @@ impl<'a> TreeCursor<'a> {
|
||||||
|
|
||||||
/// Returns an iterator over the named children of the node the TreeCursor is on
|
/// Returns an iterator over the named children of the node the TreeCursor is on
|
||||||
/// at the time this is called.
|
/// at the time this is called.
|
||||||
pub fn named_children(&'a mut self) -> ChildIter {
|
pub fn named_children(&'a mut self) -> ChildIter<'a> {
|
||||||
let parent = self.node();
|
let parent = self.node();
|
||||||
|
|
||||||
ChildIter {
|
ChildIter {
|
||||||
|
|
|
@ -211,7 +211,7 @@ impl<A, M> Layer<'_, A, M> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, A, M> From<(&'a [A], M)> for Layer<'a, A, M> {
|
impl<'a, A, M> From<(&'a [A], M)> for Layer<'a, A, M> {
|
||||||
fn from((annotations, metadata): (&'a [A], M)) -> Layer<A, M> {
|
fn from((annotations, metadata): (&'a [A], M)) -> Layer<'a, A, M> {
|
||||||
Layer {
|
Layer {
|
||||||
annotations,
|
annotations,
|
||||||
current_index: Cell::new(0),
|
current_index: Cell::new(0),
|
||||||
|
|
|
@ -769,7 +769,7 @@ impl<'a> ChangeIterator<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Iterator for ChangeIterator<'a> {
|
impl Iterator for ChangeIterator<'_> {
|
||||||
type Item = Change;
|
type Item = Change;
|
||||||
|
|
||||||
fn next(&mut self) -> Option<Self::Item> {
|
fn next(&mut self) -> Option<Self::Item> {
|
||||||
|
|
|
@ -497,7 +497,6 @@ pub struct CompletionItem {
|
||||||
/// insertText is ignored.
|
/// insertText is ignored.
|
||||||
///
|
///
|
||||||
/// Most editors support two different operation when accepting a completion item. One is to insert a
|
/// Most editors support two different operation when accepting a completion item. One is to insert a
|
||||||
|
|
||||||
/// completion text and the other is to replace an existing text with a completion text. Since this can
|
/// completion text and the other is to replace an existing text with a completion text. Since this can
|
||||||
/// usually not predetermined by a server it can report both ranges. Clients need to signal support for
|
/// usually not predetermined by a server it can report both ranges. Clients need to signal support for
|
||||||
/// `InsertReplaceEdits` via the `textDocument.completion.insertReplaceSupport` client capability
|
/// `InsertReplaceEdits` via the `textDocument.completion.insertReplaceSupport` client capability
|
||||||
|
|
|
@ -137,7 +137,7 @@ impl Serialize for Version {
|
||||||
|
|
||||||
struct VersionVisitor;
|
struct VersionVisitor;
|
||||||
|
|
||||||
impl<'v> Visitor<'v> for VersionVisitor {
|
impl Visitor<'_> for VersionVisitor {
|
||||||
type Value = Version;
|
type Value = Version;
|
||||||
|
|
||||||
fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
|
fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||||
|
|
|
@ -43,7 +43,7 @@ pub trait Parser<'a> {
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
impl<'a, F, T> Parser<'a> for F
|
impl<'a, F, T> Parser<'a> for F
|
||||||
where
|
where
|
||||||
F: Fn(&'a str) -> ParseResult<T>,
|
F: Fn(&'a str) -> ParseResult<'a, T>,
|
||||||
{
|
{
|
||||||
type Output = T;
|
type Output = T;
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ grep-searcher = "0.1.14"
|
||||||
|
|
||||||
[target.'cfg(not(windows))'.dependencies] # https://github.com/vorner/signal-hook/issues/100
|
[target.'cfg(not(windows))'.dependencies] # https://github.com/vorner/signal-hook/issues/100
|
||||||
signal-hook-tokio = { version = "0.3", features = ["futures-v0_3"] }
|
signal-hook-tokio = { version = "0.3", features = ["futures-v0_3"] }
|
||||||
libc = "0.2.165"
|
libc = "0.2.167"
|
||||||
|
|
||||||
[target.'cfg(target_os = "macos")'.dependencies]
|
[target.'cfg(target_os = "macos")'.dependencies]
|
||||||
crossterm = { version = "0.28", features = ["event-stream", "use-dev-tty", "libc"] }
|
crossterm = { version = "0.28", features = ["event-stream", "use-dev-tty", "libc"] }
|
||||||
|
|
|
@ -98,7 +98,7 @@ pub struct Context<'a> {
|
||||||
pub jobs: &'a mut Jobs,
|
pub jobs: &'a mut Jobs,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Context<'a> {
|
impl Context<'_> {
|
||||||
/// Push a new component onto the compositor.
|
/// Push a new component onto the compositor.
|
||||||
pub fn push_layer(&mut self, component: Box<dyn Component>) {
|
pub fn push_layer(&mut self, component: Box<dyn Component>) {
|
||||||
self.callback
|
self.callback
|
||||||
|
|
|
@ -27,7 +27,7 @@ pub struct Context<'a> {
|
||||||
pub jobs: &'a mut Jobs,
|
pub jobs: &'a mut Jobs,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Context<'a> {
|
impl Context<'_> {
|
||||||
/// Waits on all pending jobs, and then tries to flush all pending write
|
/// Waits on all pending jobs, and then tries to flush all pending write
|
||||||
/// operations for all documents.
|
/// operations for all documents.
|
||||||
pub fn block_try_flush_writes(&mut self) -> anyhow::Result<()> {
|
pub fn block_try_flush_writes(&mut self) -> anyhow::Result<()> {
|
||||||
|
|
|
@ -346,10 +346,6 @@ impl<T: Item + 'static> Component for Menu<T> {
|
||||||
|
|
||||||
let win_height = area.height as usize;
|
let win_height = area.height as usize;
|
||||||
|
|
||||||
const fn div_ceil(a: usize, b: usize) -> usize {
|
|
||||||
(a + b - 1) / b
|
|
||||||
}
|
|
||||||
|
|
||||||
let rows = options
|
let rows = options
|
||||||
.iter()
|
.iter()
|
||||||
.map(|option| option.format(&self.editor_data));
|
.map(|option| option.format(&self.editor_data));
|
||||||
|
@ -390,7 +386,7 @@ impl<T: Item + 'static> Component for Menu<T> {
|
||||||
|
|
||||||
let scroll_style = theme.get("ui.menu.scroll");
|
let scroll_style = theme.get("ui.menu.scroll");
|
||||||
if !fits {
|
if !fits {
|
||||||
let scroll_height = div_ceil(win_height.pow(2), len).min(win_height);
|
let scroll_height = win_height.pow(2).div_ceil(len).min(win_height);
|
||||||
let scroll_line = (win_height - scroll_height) * scroll
|
let scroll_line = (win_height - scroll_height) * scroll
|
||||||
/ std::cmp::max(1, len.saturating_sub(win_height));
|
/ std::cmp::max(1, len.saturating_sub(win_height));
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,7 @@ impl<'a> From<&'a Path> for PathOrId<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> From<DocumentId> for PathOrId<'a> {
|
impl From<DocumentId> for PathOrId<'_> {
|
||||||
fn from(v: DocumentId) -> Self {
|
fn from(v: DocumentId) -> Self {
|
||||||
Self::Id(v)
|
Self::Id(v)
|
||||||
}
|
}
|
||||||
|
|
|
@ -344,12 +344,8 @@ impl<T: Component> Component for Popup<T> {
|
||||||
let fits = len <= win_height;
|
let fits = len <= win_height;
|
||||||
let scroll_style = cx.editor.theme.get("ui.menu.scroll");
|
let scroll_style = cx.editor.theme.get("ui.menu.scroll");
|
||||||
|
|
||||||
const fn div_ceil(a: usize, b: usize) -> usize {
|
|
||||||
(a + b - 1) / b
|
|
||||||
}
|
|
||||||
|
|
||||||
if !fits {
|
if !fits {
|
||||||
let scroll_height = div_ceil(win_height.pow(2), len).min(win_height);
|
let scroll_height = win_height.pow(2).div_ceil(len).min(win_height);
|
||||||
let scroll_line = (win_height - scroll_height) * scroll
|
let scroll_line = (win_height - scroll_height) * scroll
|
||||||
/ std::cmp::max(1, len.saturating_sub(win_height));
|
/ std::cmp::max(1, len.saturating_sub(win_height));
|
||||||
|
|
||||||
|
|
|
@ -415,7 +415,8 @@ impl Prompt {
|
||||||
let cols = std::cmp::max(1, area.width / max_len);
|
let cols = std::cmp::max(1, area.width / max_len);
|
||||||
let col_width = (area.width.saturating_sub(cols)) / cols;
|
let col_width = (area.width.saturating_sub(cols)) / cols;
|
||||||
|
|
||||||
let height = ((self.completion.len() as u16 + cols - 1) / cols)
|
let height = (self.completion.len() as u16)
|
||||||
|
.div_ceil(cols)
|
||||||
.min(10) // at most 10 rows (or less)
|
.min(10) // at most 10 rows (or less)
|
||||||
.min(area.height.saturating_sub(1));
|
.min(area.height.saturating_sub(1));
|
||||||
|
|
||||||
|
|
|
@ -212,7 +212,7 @@ impl<'a> From<Cow<'a, str>> for Span<'a> {
|
||||||
#[derive(Debug, Default, Clone, PartialEq, Eq)]
|
#[derive(Debug, Default, Clone, PartialEq, Eq)]
|
||||||
pub struct Spans<'a>(pub Vec<Span<'a>>);
|
pub struct Spans<'a>(pub Vec<Span<'a>>);
|
||||||
|
|
||||||
impl<'a> Spans<'a> {
|
impl Spans<'_> {
|
||||||
/// Returns the width of the underlying string.
|
/// Returns the width of the underlying string.
|
||||||
///
|
///
|
||||||
/// ## Examples
|
/// ## Examples
|
||||||
|
|
|
@ -123,7 +123,7 @@ impl<'a> Block<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Widget for Block<'a> {
|
impl Widget for Block<'_> {
|
||||||
fn render(self, area: Rect, buf: &mut Buffer) {
|
fn render(self, area: Rect, buf: &mut Buffer) {
|
||||||
if area.area() == 0 {
|
if area.area() == 0 {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -129,7 +129,7 @@ impl<'a> Paragraph<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Widget for Paragraph<'a> {
|
impl Widget for Paragraph<'_> {
|
||||||
fn render(mut self, area: Rect, buf: &mut Buffer) {
|
fn render(mut self, area: Rect, buf: &mut Buffer) {
|
||||||
buf.set_style(area, self.style);
|
buf.set_style(area, self.style);
|
||||||
let text_area = match self.block.take() {
|
let text_area = match self.block.take() {
|
||||||
|
|
|
@ -39,7 +39,7 @@ impl<'a, 'b> WordWrapper<'a, 'b> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'b> LineComposer<'a> for WordWrapper<'a, 'b> {
|
impl<'a> LineComposer<'a> for WordWrapper<'a, '_> {
|
||||||
fn next_line(&mut self) -> Option<(&[StyledGrapheme<'a>], u16)> {
|
fn next_line(&mut self) -> Option<(&[StyledGrapheme<'a>], u16)> {
|
||||||
if self.max_line_width == 0 {
|
if self.max_line_width == 0 {
|
||||||
return None;
|
return None;
|
||||||
|
@ -152,7 +152,7 @@ impl<'a, 'b> LineTruncator<'a, 'b> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'b> LineComposer<'a> for LineTruncator<'a, 'b> {
|
impl<'a> LineComposer<'a> for LineTruncator<'a, '_> {
|
||||||
fn next_line(&mut self) -> Option<(&[StyledGrapheme<'a>], u16)> {
|
fn next_line(&mut self) -> Option<(&[StyledGrapheme<'a>], u16)> {
|
||||||
if self.max_line_width == 0 {
|
if self.max_line_width == 0 {
|
||||||
return None;
|
return None;
|
||||||
|
|
|
@ -34,7 +34,7 @@ pub struct Cell<'a> {
|
||||||
style: Style,
|
style: Style,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Cell<'a> {
|
impl Cell<'_> {
|
||||||
/// Set the `Style` of this cell.
|
/// Set the `Style` of this cell.
|
||||||
pub fn style(mut self, style: Style) -> Self {
|
pub fn style(mut self, style: Style) -> Self {
|
||||||
self.style = style;
|
self.style = style;
|
||||||
|
@ -351,7 +351,7 @@ impl TableState {
|
||||||
}
|
}
|
||||||
|
|
||||||
// impl<'a> StatefulWidget for Table<'a> {
|
// impl<'a> StatefulWidget for Table<'a> {
|
||||||
impl<'a> Table<'a> {
|
impl Table<'_> {
|
||||||
// type State = TableState;
|
// type State = TableState;
|
||||||
|
|
||||||
pub fn render_table(
|
pub fn render_table(
|
||||||
|
@ -486,7 +486,7 @@ fn render_cell(buf: &mut Buffer, cell: &Cell, area: Rect, truncate: bool) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Widget for Table<'a> {
|
impl Widget for Table<'_> {
|
||||||
fn render(self, area: Rect, buf: &mut Buffer) {
|
fn render(self, area: Rect, buf: &mut Buffer) {
|
||||||
let mut state = TableState::default();
|
let mut state = TableState::default();
|
||||||
Table::render_table(self, area, buf, &mut state, false);
|
Table::render_table(self, area, buf, &mut state, false);
|
||||||
|
|
|
@ -5,7 +5,7 @@ use arc_swap::access::DynAccess;
|
||||||
use helix_core::NATIVE_LINE_ENDING;
|
use helix_core::NATIVE_LINE_ENDING;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
clipboard::{ClipboardProvider, ClipboardType},
|
clipboard::{ClipboardError, ClipboardProvider, ClipboardType},
|
||||||
Editor,
|
Editor,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -238,6 +238,10 @@ fn read_from_clipboard<'a>(
|
||||||
RegisterValues::new(iter::once(contents.into()))
|
RegisterValues::new(iter::once(contents.into()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Err(ClipboardError::ReadingNotSupported) => match saved_values {
|
||||||
|
Some(values) => RegisterValues::new(values.iter().map(Cow::from).rev()),
|
||||||
|
None => RegisterValues::new(iter::empty()),
|
||||||
|
},
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
log::error!(
|
log::error!(
|
||||||
"Failed to read {} clipboard: {err}",
|
"Failed to read {} clipboard: {err}",
|
||||||
|
@ -307,13 +311,13 @@ impl<'a> Iterator for RegisterValues<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> DoubleEndedIterator for RegisterValues<'a> {
|
impl DoubleEndedIterator for RegisterValues<'_> {
|
||||||
fn next_back(&mut self) -> Option<Self::Item> {
|
fn next_back(&mut self) -> Option<Self::Item> {
|
||||||
self.iter.next_back()
|
self.iter.next_back()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> ExactSizeIterator for RegisterValues<'a> {
|
impl ExactSizeIterator for RegisterValues<'_> {
|
||||||
fn len(&self) -> usize {
|
fn len(&self) -> usize {
|
||||||
self.iter.len()
|
self.iter.len()
|
||||||
}
|
}
|
||||||
|
|
|
@ -705,7 +705,7 @@ impl<'a> Iterator for Traverse<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> DoubleEndedIterator for Traverse<'a> {
|
impl DoubleEndedIterator for Traverse<'_> {
|
||||||
fn next_back(&mut self) -> Option<Self::Item> {
|
fn next_back(&mut self) -> Option<Self::Item> {
|
||||||
loop {
|
loop {
|
||||||
let key = self.stack.pop()?;
|
let key = self.stack.pop()?;
|
||||||
|
|
|
@ -3168,7 +3168,7 @@ indent = { tab-width = 4, unit = " " }
|
||||||
|
|
||||||
[[grammar]]
|
[[grammar]]
|
||||||
name = "just"
|
name = "just"
|
||||||
source = { git = "https://github.com/poliorcetics/tree-sitter-just", rev = "6e28fa6cba511c694247cd802d1c3b14f8d34dbb" }
|
source = { git = "https://github.com/poliorcetics/tree-sitter-just", rev = "180bb15d64c63585c4f65c551350048f21987bcb" }
|
||||||
|
|
||||||
[[language]]
|
[[language]]
|
||||||
name = "gn"
|
name = "gn"
|
||||||
|
@ -3463,7 +3463,11 @@ source = { git = "https://github.com/urbit-pilled/tree-sitter-hoon", rev = "1d5d
|
||||||
[[language]]
|
[[language]]
|
||||||
name = "hocon"
|
name = "hocon"
|
||||||
scope = "source.conf"
|
scope = "source.conf"
|
||||||
file-types = ["conf"]
|
file-types = [
|
||||||
|
{ glob = "**/src/*/resources/**/*.conf" },
|
||||||
|
{ glob = "*scalafmt*.conf" },
|
||||||
|
{ glob = "*scalafix*.conf" },
|
||||||
|
]
|
||||||
comment-token = "#"
|
comment-token = "#"
|
||||||
auto-format = true
|
auto-format = true
|
||||||
indent = { tab-width = 2, unit = " " }
|
indent = { tab-width = 2, unit = " " }
|
||||||
|
@ -3956,3 +3960,14 @@ language-servers = ["ada-gpr-language-server"]
|
||||||
[[grammar]]
|
[[grammar]]
|
||||||
name = "gpr"
|
name = "gpr"
|
||||||
source = { git = "https://github.com/brownts/tree-sitter-gpr", rev = "cea857d3c18d1385d1f5b66cd09ea1e44173945c" }
|
source = { git = "https://github.com/brownts/tree-sitter-gpr", rev = "cea857d3c18d1385d1f5b66cd09ea1e44173945c" }
|
||||||
|
|
||||||
|
[[language]]
|
||||||
|
name = "vento"
|
||||||
|
scope = "text.html.vto"
|
||||||
|
file-types = ["vto"]
|
||||||
|
block-comment-tokens = { start = "{{#", end = "#}}" }
|
||||||
|
indent = { tab-width = 4, unit = " " }
|
||||||
|
|
||||||
|
[[grammar]]
|
||||||
|
name = "vento"
|
||||||
|
source = { git = "https://github.com/ventojs/tree-sitter-vento", rev = "3321077d7446c1b3b017c294fd56ce028ed817fe" }
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
[
|
[
|
||||||
"export"
|
"export"
|
||||||
"import"
|
"import"
|
||||||
|
"unexport"
|
||||||
] @keyword.control.import
|
] @keyword.control.import
|
||||||
|
|
||||||
"mod" @keyword.directive
|
"mod" @keyword.directive
|
||||||
|
@ -18,6 +19,11 @@
|
||||||
"else"
|
"else"
|
||||||
] @keyword.control.conditional
|
] @keyword.control.conditional
|
||||||
|
|
||||||
|
[
|
||||||
|
"&&"
|
||||||
|
"||"
|
||||||
|
] @operator
|
||||||
|
|
||||||
; Variables
|
; Variables
|
||||||
|
|
||||||
(value
|
(value
|
||||||
|
@ -31,6 +37,9 @@
|
||||||
|
|
||||||
(shell_variable_name) @variable
|
(shell_variable_name) @variable
|
||||||
|
|
||||||
|
(unexport
|
||||||
|
name: (identifier) @variable)
|
||||||
|
|
||||||
; Functions
|
; Functions
|
||||||
|
|
||||||
(recipe
|
(recipe
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
(comment) @comment
|
||||||
|
|
||||||
|
(keyword) @keyword
|
||||||
|
|
||||||
|
(tag
|
||||||
|
[
|
||||||
|
"{{"
|
||||||
|
"{{-"
|
||||||
|
"}}"
|
||||||
|
"-}}"
|
||||||
|
] @punctuation.bracket)
|
||||||
|
|
||||||
|
"|>" @operator
|
|
@ -0,0 +1,6 @@
|
||||||
|
((content) @injection.content
|
||||||
|
(#set! injection.language "html")
|
||||||
|
(#set! injection.combined))
|
||||||
|
|
||||||
|
((code) @injection.content
|
||||||
|
(#set! injection.language "javascript"))
|
|
@ -52,6 +52,8 @@
|
||||||
"markup.list" = "mauve"
|
"markup.list" = "mauve"
|
||||||
"markup.bold" = { modifiers = ["bold"] }
|
"markup.bold" = { modifiers = ["bold"] }
|
||||||
"markup.italic" = { modifiers = ["italic"] }
|
"markup.italic" = { modifiers = ["italic"] }
|
||||||
|
"markup.list.unchecked" = "overlay2"
|
||||||
|
"markup.list.checked" = "green"
|
||||||
"markup.link.url" = { fg = "blue", modifiers = ["italic", "underlined"] }
|
"markup.link.url" = { fg = "blue", modifiers = ["italic", "underlined"] }
|
||||||
"markup.link.text" = "blue"
|
"markup.link.text" = "blue"
|
||||||
"markup.raw" = "flamingo"
|
"markup.raw" = "flamingo"
|
||||||
|
|
|
@ -26,6 +26,8 @@
|
||||||
"ui.menu.selected" = { bg = "ui", fg = "tx" }
|
"ui.menu.selected" = { bg = "ui", fg = "tx" }
|
||||||
"ui.debug" = { fg = "or", bg = "bg" }
|
"ui.debug" = { fg = "or", bg = "bg" }
|
||||||
"ui.highlight.frameline" = { bg = "ye" }
|
"ui.highlight.frameline" = { bg = "ye" }
|
||||||
|
"ui.bufferline" = { fg = "tx-2", bg = "bg-2"}
|
||||||
|
"ui.bufferline.active" = { fg = "ye", bg = "bg-2" }
|
||||||
"diagnostic.hint" = { underline = { color = "bl", style = "curl" } }
|
"diagnostic.hint" = { underline = { color = "bl", style = "curl" } }
|
||||||
"diagnostic.info" = { underline = { color = "bl", style = "curl" } }
|
"diagnostic.info" = { underline = { color = "bl", style = "curl" } }
|
||||||
"diagnostic.warning" = { underline = { color = "ye", style = "curl" } }
|
"diagnostic.warning" = { underline = { color = "ye", style = "curl" } }
|
||||||
|
@ -36,7 +38,6 @@
|
||||||
"info" = { fg = "ye", modifiers = ["bold"] }
|
"info" = { fg = "ye", modifiers = ["bold"] }
|
||||||
"warning" = { fg = "or", modifiers = ["bold"] }
|
"warning" = { fg = "or", modifiers = ["bold"] }
|
||||||
"error" = { fg = "re", modifiers = ["bold"] }
|
"error" = { fg = "re", modifiers = ["bold"] }
|
||||||
|
|
||||||
"attribute" = "ye"
|
"attribute" = "ye"
|
||||||
"type" = "ye"
|
"type" = "ye"
|
||||||
"constructor" = "gr"
|
"constructor" = "gr"
|
||||||
|
@ -62,7 +63,6 @@
|
||||||
"function" = "or"
|
"function" = "or"
|
||||||
"tag" = "bl"
|
"tag" = "bl"
|
||||||
"namespace" = "re"
|
"namespace" = "re"
|
||||||
|
|
||||||
"markup.heading" = "or"
|
"markup.heading" = "or"
|
||||||
"markup.list" = "ye"
|
"markup.list" = "ye"
|
||||||
"markup.bold" = { fg = "or", modifiers = ["bold"] }
|
"markup.bold" = { fg = "or", modifiers = ["bold"] }
|
||||||
|
@ -88,6 +88,7 @@ ui = "#E6E4D9"
|
||||||
bg-2 = "#F2F0E5"
|
bg-2 = "#F2F0E5"
|
||||||
bg = "#FFFCF0"
|
bg = "#FFFCF0"
|
||||||
|
|
||||||
|
|
||||||
re = "#AF3029"
|
re = "#AF3029"
|
||||||
or = "#BC5215"
|
or = "#BC5215"
|
||||||
ye = "#AD8301"
|
ye = "#AD8301"
|
||||||
|
|
Loading…
Reference in New Issue