Skip to content

Commit 7183c22

Browse files
committed
feat!: add support for basic icons
1 parent a1ee13e commit 7183c22

30 files changed

Lines changed: 2612 additions & 415 deletions

File tree

Cargo.lock

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ sonic-rs = "0.5"
5757
globset = "0.4"
5858
etcetera = "0.11"
5959
arc-swap = "1.9"
60+
ahash = "0.8"
61+
smartstring = { version = "1.0.1", features = ["serde"]}
62+
arrayvec = { version = "0.7", features = ["serde"] }
63+
serde = { version = "1" }
6064

6165
[workspace.package]
6266
version = "25.7.1"

helix-core/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ helix-parsec = { path = "../helix-parsec" }
2222

2323
ropey.workspace = true
2424
smallvec = "1.15"
25-
smartstring = "1.0.1"
25+
smartstring.workspace = true
2626
unicode-segmentation.workspace = true
2727
# unicode-width is changing width definitions
2828
# that both break our logic and disagree with common

helix-core/src/doc_formatter.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ use std::mem::replace;
1717
#[cfg(test)]
1818
mod test;
1919

20+
use helix_stdx::string::StackString;
2021
use unicode_segmentation::{Graphemes, UnicodeSegmentation};
2122

2223
use helix_stdx::rope::{RopeGraphemes, RopeSliceExt};
@@ -147,7 +148,7 @@ pub struct TextFormat {
147148
pub tab_width: u16,
148149
pub max_wrap: u16,
149150
pub max_indent_retain: u16,
150-
pub wrap_indicator: Box<str>,
151+
pub wrap_indicator: StackString,
151152
pub wrap_indicator_highlight: Option<Highlight>,
152153
pub viewport_width: u16,
153154
pub soft_wrap_at_text_width: bool,
@@ -161,7 +162,7 @@ impl Default for TextFormat {
161162
tab_width: 4,
162163
max_wrap: 3,
163164
max_indent_retain: 4,
164-
wrap_indicator: Box::from(" "),
165+
wrap_indicator: StackString::from(" "),
165166
viewport_width: 17,
166167
wrap_indicator_highlight: None,
167168
soft_wrap_at_text_width: false,

helix-core/src/doc_formatter/test.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
use helix_stdx::string::StackString;
2+
13
use crate::doc_formatter::{DocumentFormatter, TextFormat};
24
use crate::text_annotations::{InlineAnnotation, Overlay, TextAnnotations};
35

@@ -8,7 +10,7 @@ impl TextFormat {
810
tab_width: 2,
911
max_wrap: 3,
1012
max_indent_retain: 4,
11-
wrap_indicator: ".".into(),
13+
wrap_indicator: StackString::from("."),
1214
wrap_indicator_highlight: None,
1315
// use a prime number to allow lining up too often with repeat
1416
viewport_width: 17,

helix-lsp-types/src/completion.rs

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use serde::{Deserialize, Serialize};
22

33
use crate::{
4-
Command, Documentation, MarkupKind, PartialResultParams, TagSupport,
4+
Command, Documentation, MarkupKind, PartialResultParams, SymbolKind, TagSupport,
55
TextDocumentPositionParams, TextDocumentRegistrationOptions, TextEdit, WorkDoneProgressOptions,
66
WorkDoneProgressParams,
77
};
@@ -55,6 +55,41 @@ impl CompletionItemKind {
5555
}
5656
}
5757

58+
impl CompletionItemKind {
59+
#[inline]
60+
#[must_use]
61+
pub const fn as_str(self) -> Option<&'static str> {
62+
match self {
63+
Self::TEXT => Some("text"),
64+
Self::METHOD => SymbolKind::METHOD.as_str(),
65+
Self::FUNCTION => SymbolKind::FUNCTION.as_str(),
66+
Self::CONSTRUCTOR => SymbolKind::CONSTRUCTOR.as_str(),
67+
Self::FIELD => SymbolKind::FIELD.as_str(),
68+
Self::VARIABLE => SymbolKind::VARIABLE.as_str(),
69+
Self::CLASS => SymbolKind::CLASS.as_str(),
70+
Self::INTERFACE => SymbolKind::INTERFACE.as_str(),
71+
Self::MODULE => SymbolKind::MODULE.as_str(),
72+
Self::PROPERTY => SymbolKind::PROPERTY.as_str(),
73+
Self::UNIT => Some("unit"),
74+
Self::VALUE => Some("value"),
75+
Self::ENUM => SymbolKind::ENUM.as_str(),
76+
Self::KEYWORD => Some("keyword"),
77+
Self::SNIPPET => Some("snippet"),
78+
Self::COLOR => Some("color"),
79+
Self::FILE => SymbolKind::FILE.as_str(),
80+
Self::REFERENCE => Some("reference"),
81+
Self::FOLDER => Some("folder"),
82+
Self::ENUM_MEMBER => SymbolKind::ENUM_MEMBER.as_str(),
83+
Self::CONSTANT => SymbolKind::CONSTANT.as_str(),
84+
Self::STRUCT => SymbolKind::STRUCT.as_str(),
85+
Self::EVENT => SymbolKind::EVENT.as_str(),
86+
Self::OPERATOR => SymbolKind::OPERATOR.as_str(),
87+
Self::TYPE_PARAMETER => SymbolKind::TYPE_PARAMETER.as_str(),
88+
_ => None,
89+
}
90+
}
91+
}
92+
5893
#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
5994
#[serde(rename_all = "camelCase")]
6095
pub struct CompletionItemCapability {

helix-lsp-types/src/lib.rs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1279,6 +1279,42 @@ impl SymbolKind {
12791279
}
12801280
}
12811281

1282+
impl SymbolKind {
1283+
#[inline]
1284+
#[must_use]
1285+
pub const fn as_str(self) -> Option<&'static str> {
1286+
match self {
1287+
Self::FILE => Some("file"),
1288+
Self::MODULE => Some("module"),
1289+
Self::NAMESPACE => Some("namespace"),
1290+
Self::PACKAGE => Some("package"),
1291+
Self::CLASS => Some("class"),
1292+
Self::METHOD => Some("method"),
1293+
Self::PROPERTY => Some("property"),
1294+
Self::FIELD => Some("field"),
1295+
Self::CONSTRUCTOR => Some("construct"),
1296+
Self::ENUM => Some("enum"),
1297+
Self::INTERFACE => Some("interface"),
1298+
Self::FUNCTION => Some("function"),
1299+
Self::VARIABLE => Some("variable"),
1300+
Self::CONSTANT => Some("constant"),
1301+
Self::STRING => Some("string"),
1302+
Self::NUMBER => Some("number"),
1303+
Self::BOOLEAN => Some("boolean"),
1304+
Self::ARRAY => Some("array"),
1305+
Self::OBJECT => Some("object"),
1306+
Self::KEY => Some("key"),
1307+
Self::NULL => Some("null"),
1308+
Self::ENUM_MEMBER => Some("enum_member"),
1309+
Self::STRUCT => Some("struct"),
1310+
Self::EVENT => Some("event"),
1311+
Self::OPERATOR => Some("operator"),
1312+
Self::TYPE_PARAMETER => Some("type_param"),
1313+
_ => None,
1314+
}
1315+
}
1316+
}
1317+
12821318
/// Specific capabilities for the `SymbolKind` in the `workspace/symbol` request.
12831319
#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
12841320
#[serde(rename_all = "camelCase")]

helix-stdx/src/path.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ fn path_component_regex(windows: bool) -> String {
220220

221221
/// Regex for delimited environment captures like `${HOME}`.
222222
fn braced_env_regex(windows: bool) -> String {
223-
r"\$\{(?:".to_owned() + &path_component_regex(windows) + r"|[/:=])+\}"
223+
r"\$\{(?:".to_owned() + path_component_regex(windows).as_str() + r"|[/:=])+\}"
224224
}
225225

226226
fn compile_path_regex(

helix-term/src/application.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ impl Application {
496496
})
497497
})
498498
.unwrap_or_else(|| editor.theme_loader.default_theme(true_color));
499-
let _ = editor.set_theme(theme);
499+
let _ = editor.set_theme(Arc::from(theme));
500500
}
501501

502502
#[cfg(windows)]

0 commit comments

Comments
 (0)