merge from master

pull/8675/merge^2
mattwparas 1 year ago
commit 575046cacf

128
Cargo.lock generated

@ -99,9 +99,9 @@ dependencies = [
[[package]]
name = "aho-corasick"
version = "1.0.5"
version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c378d78423fdad8089616f827526ee33c19f2fddbd5de1629152c9593ba4783"
checksum = "ea5d730647d4fadd988536d06fecce94b7b4f2a7efdae548f1cf4b63205518ab"
dependencies = [
"memchr",
]
@ -245,9 +245,9 @@ dependencies = [
[[package]]
name = "bumpalo"
version = "3.13.0"
version = "3.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1"
checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec"
[[package]]
name = "bytecount"
@ -301,9 +301,9 @@ dependencies = [
[[package]]
name = "chrono"
version = "0.4.30"
version = "0.4.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "defd4e7873dbddba6c7c91e199c7fcb946abc4a6a4ac3195400bcfb01b5de877"
checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38"
dependencies = [
"android-tzdata",
"iana-time-zone",
@ -569,9 +569,9 @@ dependencies = [
[[package]]
name = "fastrand"
version = "2.0.0"
version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764"
checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5"
[[package]]
name = "fern"
@ -655,7 +655,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.33",
"syn 2.0.37",
]
[[package]]
@ -886,9 +886,9 @@ dependencies = [
[[package]]
name = "gix-date"
version = "0.7.4"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0a825babda995d788e30d306a49dacd1e93d5f5d33d53c7682d0347cef40333c"
checksum = "8e9a04a1d2387c955ec91059d56b673000dd24f3c07cad08ed253e36381782bf"
dependencies = [
"bstr",
"itoa",
@ -1348,7 +1348,7 @@ version = "0.4.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "759c97c1e17c55525b57192c06a267cda0ac5210b222d6b82189a2338fa1c13d"
dependencies = [
"aho-corasick 1.0.5",
"aho-corasick 1.1.1",
"bstr",
"fnv",
"log",
@ -1634,9 +1634,9 @@ dependencies = [
[[package]]
name = "hermit-abi"
version = "0.3.2"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b"
checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7"
[[package]]
name = "hex"
@ -1745,9 +1745,9 @@ dependencies = [
[[package]]
name = "indexmap"
version = "2.0.0"
version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d"
checksum = "ad227c3af19d4914570ad36d30409928b75967c298feb9ea1969db3a610bb14e"
dependencies = [
"equivalent",
"hashbrown 0.14.0",
@ -1755,9 +1755,9 @@ dependencies = [
[[package]]
name = "indoc"
version = "2.0.3"
version = "2.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c785eefb63ebd0e33416dfcb8d6da0bf27ce752843a45632a67bf10d4d4b5c4"
checksum = "1e186cfbae8084e513daff4240b4797e342f988cecda4fb6c939150f96315fd8"
[[package]]
name = "io-close"
@ -2163,13 +2163,13 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
[[package]]
name = "pretty"
version = "0.12.1"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "563c9d701c3a31dfffaaf9ce23507ba09cbe0b9125ba176d15e629b0235e9acc"
checksum = "b55c4d17d994b637e2f4daf6e5dc5d660d209d5642377d675d7a1c3ab69fa579"
dependencies = [
"arrayvec",
"typed-arena",
"unicode-segmentation",
"unicode-width",
]
[[package]]
@ -2273,9 +2273,9 @@ dependencies = [
[[package]]
name = "rayon"
version = "1.7.0"
version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d2df5196e37bcc87abebc0053e20787d73847bb33134a69841207dd0a47f03b"
checksum = "9c27db03db7734835b3f53954b534c91069375ce6ccaa2e065441e07d9b6cdb1"
dependencies = [
"either",
"rayon-core",
@ -2283,14 +2283,12 @@ dependencies = [
[[package]]
name = "rayon-core"
version = "1.11.0"
version = "1.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4b8f95bd6966f5c87776639160a66bd8ab9895d9d4ab01ddba9fc60661aebe8d"
checksum = "5ce3fb6ad83f861aac485e76e1985cd109d9a3713802152be56c3b1f0e0658ed"
dependencies = [
"crossbeam-channel",
"crossbeam-deque",
"crossbeam-utils",
"num_cpus",
]
[[package]]
@ -2308,7 +2306,7 @@ version = "1.9.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "697061221ea1b4a94a624f67d0ae2bfe4e22b8a17b6a192afb11046542cc8c47"
dependencies = [
"aho-corasick 1.0.5",
"aho-corasick 1.1.1",
"memchr",
"regex-automata",
"regex-syntax 0.7.5",
@ -2320,7 +2318,7 @@ version = "0.3.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2f401f4955220693b56f8ec66ee9c78abffd8d1c4f23dc41a23839eb88f0795"
dependencies = [
"aho-corasick 1.0.5",
"aho-corasick 1.1.1",
"memchr",
"regex-syntax 0.7.5",
]
@ -2373,9 +2371,9 @@ dependencies = [
[[package]]
name = "rustix"
version = "0.38.13"
version = "0.38.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d7db8590df6dfcd144d22afd1b83b36c21a18d7cbc1dc4bb5295a8712e9eb662"
checksum = "747c788e9ce8e92b12cd485c49ddf90723550b654b32508f979b71a7b1ecda4f"
dependencies = [
"bitflags 2.4.0",
"errno",
@ -2407,9 +2405,9 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
[[package]]
name = "semver"
version = "1.0.18"
version = "1.0.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918"
checksum = "ad977052201c6de01a8ef2aa3378c4bd23217a056337d1d6da40468d267a4fb0"
[[package]]
name = "serde"
@ -2428,7 +2426,7 @@ checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.33",
"syn 2.0.37",
]
[[package]]
@ -2450,7 +2448,7 @@ checksum = "8725e1dfadb3a50f7e5ce0b1a540466f6ed3fe7a0fca2ac2b8b831d31316bd00"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.33",
"syn 2.0.37",
]
[[package]]
@ -2540,9 +2538,9 @@ dependencies = [
[[package]]
name = "smallvec"
version = "1.11.0"
version = "1.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9"
checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a"
[[package]]
name = "smartstring"
@ -2557,9 +2555,9 @@ dependencies = [
[[package]]
name = "smawk"
version = "0.3.1"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f67ad224767faa3c7d8b6d91985b78e70a1324408abcb1cfcc2be4c06bc06043"
checksum = "b7c388c1b5e93756d0c740965c41e8822f866621d41acbdf6336a6a168f8840c"
[[package]]
name = "socket2"
@ -2619,7 +2617,7 @@ version = "0.4.0"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.33",
"syn 2.0.37",
]
[[package]]
@ -2666,9 +2664,9 @@ dependencies = [
[[package]]
name = "syn"
version = "2.0.33"
version = "2.0.37"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9caece70c63bfba29ec2fed841a09851b14a235c60010fa4de58089b6c025668"
checksum = "7303ef2c05cd654186cb250d29049a24840ca25d2747c25c0381c8d9e2f582e8"
dependencies = [
"proc-macro2",
"quote",
@ -2690,9 +2688,9 @@ dependencies = [
[[package]]
name = "termcolor"
version = "1.2.0"
version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6"
checksum = "6093bad37da69aab9d123a8091e4be0aa4a03e4d601ec641c327398315f62b64"
dependencies = [
"winapi-util",
]
@ -2719,22 +2717,22 @@ dependencies = [
[[package]]
name = "thiserror"
version = "1.0.48"
version = "1.0.49"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9d6d7a740b8a666a7e828dd00da9c0dc290dff53154ea77ac109281de90589b7"
checksum = "1177e8c6d7ede7afde3585fd2513e611227efd6481bd78d2e82ba1ce16557ed4"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
version = "1.0.48"
version = "1.0.49"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49922ecae66cc8a249b77e68d1d0623c1b2c514f0060c27cdc68bd62a1219d35"
checksum = "10712f02019e9288794769fba95cd6847df9874d49d871d062172f9dd41bc4cc"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.33",
"syn 2.0.37",
]
[[package]]
@ -2758,9 +2756,9 @@ dependencies = [
[[package]]
name = "time"
version = "0.3.23"
version = "0.3.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "59e399c068f43a5d116fedaf73b203fa4f9c519f17e2b34f63221d3792f81446"
checksum = "cd0cbfecb4d19b5ea75bb31ad904eb5b9fa13f21079c3b92017ebdf4999a5890"
dependencies = [
"itoa",
"libc",
@ -2772,15 +2770,15 @@ dependencies = [
[[package]]
name = "time-core"
version = "0.1.1"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb"
checksum = "2e153e1f1acaef8acc537e68b44906d2db6436e2b35ac2c6b42640fff91f00fd"
[[package]]
name = "time-macros"
version = "0.2.10"
version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "96ba15a897f3c86766b757e5ac7221554c6750054d74d5b28844fce5fb36a6c4"
checksum = "fd80a657e71da814b8e5d60d3374fc6d35045062245d80224748ae522dd76f36"
dependencies = [
"time-core",
]
@ -2827,7 +2825,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.33",
"syn 2.0.37",
]
[[package]]
@ -2868,7 +2866,7 @@ version = "0.19.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8123f27e969974a3dfba720fdb560be359f57b44302d280ba72e76a74480e8a"
dependencies = [
"indexmap 2.0.0",
"indexmap 2.0.1",
"serde",
"serde_spanned",
"toml_datetime",
@ -2907,9 +2905,9 @@ checksum = "6af6ae20167a9ece4bcb41af5b80f8a1f1df981f6391189ce00fd257af04126a"
[[package]]
name = "typenum"
version = "1.16.0"
version = "1.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba"
checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825"
[[package]]
name = "unicase"
@ -2967,9 +2965,9 @@ checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36"
[[package]]
name = "unicode-width"
version = "0.1.10"
version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b"
checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85"
[[package]]
name = "url"
@ -3026,7 +3024,7 @@ dependencies = [
"once_cell",
"proc-macro2",
"quote",
"syn 2.0.33",
"syn 2.0.37",
"wasm-bindgen-shared",
]
@ -3048,7 +3046,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.33",
"syn 2.0.37",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
@ -3095,9 +3093,9 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
[[package]]
name = "winapi-util"
version = "0.1.5"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596"
dependencies = [
"winapi",
]

@ -44,6 +44,7 @@
| forth | ✓ | | | `forth-lsp` |
| fortran | ✓ | | ✓ | `fortls` |
| fsharp | ✓ | | | `fsautocomplete` |
| gas | ✓ | ✓ | | |
| gdscript | ✓ | ✓ | ✓ | |
| gemini | ✓ | | | |
| git-attributes | ✓ | | | |
@ -121,7 +122,7 @@
| prolog | | | | `swipl` |
| protobuf | ✓ | | ✓ | `bufls`, `pb` |
| prql | ✓ | | | |
| purescript | ✓ | | | `purescript-language-server` |
| purescript | ✓ | | | `purescript-language-server` |
| python | ✓ | ✓ | ✓ | `pylsp` |
| qml | ✓ | | ✓ | `qmlls` |
| r | ✓ | | | `R` |

@ -245,9 +245,12 @@ We use a similar set of scopes as
- `diff` - version control changes
- `plus` - additions
- `gutter` - gutter indicator
- `minus` - deletions
- `gutter` - gutter indicator
- `delta` - modifications
- `moved` - renamed or moved files/changes
- `gutter` - gutter indicator
#### Interface

@ -5,6 +5,7 @@
<project_license>MPL-2.0</project_license>
<name>Helix</name>
<summary>A post-modern text editor</summary>
<summary xml:lang="ar">مُحَرِّرُ نُصُوصٍ سَابِقٌ لِعَهدِه</summary>
<description>
<p>
@ -17,6 +18,17 @@
<li>Smart, incremental syntax highlighting and code editing via tree-sitter</li>
</ul>
</description>
<description xml:lang="ar">
<p>
مُحَرِّرُ نُصُوصٍ يَعمَلُ فِي الطَّرَفِيَّة، مُستَلهَمٌ مِن Kakoune وَ Neovim وَمَكتُوبٌ بِلُغَةِ رَست البَرمَجِيَّة.
</p>
<ul>
<li>تَحرِيرٌ وَضعِيٌّ شَبيهٌ بِـVim</li>
<li>تَحدِيدَاتٌ لِلنَّصِ مُتَعَدِّدَة</li>
<li>دَعْمٌ مُدمَجٌ لِخَوادِمِ اللُّغَات</li>
<li>تَحرِيرُ التَّعلِيمَاتِ البَّرمَجِيَّةِ مَعَ تَمييزٍ لِلتَّركِيبِ النَّحُويِّ بِواسِطَةِ tree-sitter</li>
</ul>
</description>
<launchable type="desktop-id">Helix.desktop</launchable>

@ -1,6 +1,7 @@
[Desktop Entry]
Name=Helix
GenericName=Text Editor
GenericName[ar]=مُحَرِّرُ نُصُوص
GenericName[de]=Texteditor
GenericName[fr]=Éditeur de texte
GenericName[ru]=Текстовый редактор
@ -9,7 +10,7 @@ GenericName[tr]=Metin Düzenleyici
Comment=Edit text files
Comment[af]=Redigeer tekslêers
Comment[am]=የጽሑፍ ፋይሎች ያስተካክሉ
Comment[ar]=حرّر ملفات نصية
Comment[ar]=مُحَرِّرُ مِلَفَّاتٍ نَصِّيَّة
Comment[az]=Mətn fayllarını redaktə edin
Comment[be]=Рэдагаваньне тэкставых файлаў
Comment[bg]=Редактиране на текстови файлове
@ -79,6 +80,7 @@ Exec=hx %F
Terminal=true
Type=Application
Keywords=Text;editor;
Keywords[ar]=نص;نصوص;محرر;
Keywords[fr]=Texte;éditeur;
Keywords[ru]=текст;текстовый редактор;
Keywords[sr]=Текст;едитор;

@ -55,4 +55,4 @@ parking_lot = "0.12"
[dev-dependencies]
quickcheck = { version = "1", default-features = false }
indoc = "2.0.3"
indoc = "2.0.4"

@ -749,36 +749,40 @@ impl Registry {
}
}
pub fn get(
&mut self,
language_config: &LanguageConfiguration,
doc_path: Option<&std::path::PathBuf>,
root_dirs: &[PathBuf],
pub fn get<'a>(
&'a mut self,
language_config: &'a LanguageConfiguration,
doc_path: Option<&'a std::path::PathBuf>,
root_dirs: &'a [PathBuf],
enable_snippets: bool,
) -> Result<HashMap<LanguageServerName, Arc<Client>>> {
language_config
.language_servers
.iter()
.map(|LanguageServerFeatures { name, .. }| {
) -> impl Iterator<Item = (LanguageServerName, Result<Arc<Client>>)> + 'a {
language_config.language_servers.iter().map(
move |LanguageServerFeatures { name, .. }| {
if let Some(clients) = self.inner.get(name) {
if let Some((_, client)) = clients.iter().enumerate().find(|(i, client)| {
client.try_add_doc(&language_config.roots, root_dirs, doc_path, *i == 0)
}) {
return Ok((name.to_owned(), client.clone()));
return (name.to_owned(), Ok(client.clone()));
}
}
let client = self.start_client(
match self.start_client(
name.clone(),
language_config,
doc_path,
root_dirs,
enable_snippets,
)?;
let clients = self.inner.entry(name.clone()).or_default();
clients.push(client.clone());
Ok((name.clone(), client))
})
.collect()
) {
Ok(client) => {
self.inner
.entry(name.to_owned())
.or_default()
.push(client.clone());
(name.clone(), Ok(client))
}
Err(err) => (name.to_owned(), Err(err)),
}
},
)
}
pub fn iter_clients(&self) -> impl Iterator<Item = &Arc<Client>> {

@ -73,7 +73,7 @@ steel-core = { workspace = true, optional = true }
[target.'cfg(not(windows))'.dependencies] # https://github.com/vorner/signal-hook/issues/100
signal-hook-tokio = { version = "0.3", features = ["futures-v0_3"] }
libc = "0.2.147"
libc = "0.2.148"
[target.'cfg(target_os = "macos")'.dependencies]
crossterm = { version = "0.27", features = ["event-stream", "use-dev-tty"] }
@ -83,5 +83,5 @@ helix-loader = { version = "0.6", path = "../helix-loader" }
[dev-dependencies]
smallvec = "1.11"
indoc = "2.0.3"
indoc = "2.0.4"
tempfile = "3.8.0"

@ -14,6 +14,7 @@ use helix_core::{
};
use helix_view::{
graphics::{Margin, Rect, Style},
theme::Modifier,
Theme,
};
@ -183,7 +184,9 @@ impl Markdown {
// Transform text in `<code>` blocks into `Event::Code`
let mut in_code = false;
let parser = parser.filter_map(|event| match event {
Event::Html(tag) if *tag == *"<code>" => {
Event::Html(tag)
if tag.starts_with("<code") && matches!(tag.chars().nth(5), Some(' ' | '>')) =>
{
in_code = true;
None
}
@ -275,17 +278,21 @@ impl Markdown {
);
lines.extend(tui_text.lines.into_iter());
} else {
let style = if let Some(Tag::Heading(level, ..)) = tags.last() {
match level {
let style = match tags.last() {
Some(Tag::Heading(level, ..)) => match level {
HeadingLevel::H1 => heading_styles[0],
HeadingLevel::H2 => heading_styles[1],
HeadingLevel::H3 => heading_styles[2],
HeadingLevel::H4 => heading_styles[3],
HeadingLevel::H5 => heading_styles[4],
HeadingLevel::H6 => heading_styles[5],
},
Some(Tag::Emphasis) => text_style.add_modifier(Modifier::ITALIC),
Some(Tag::Strong) => text_style.add_modifier(Modifier::BOLD),
Some(Tag::Strikethrough) => {
text_style.add_modifier(Modifier::CROSSED_OUT)
}
} else {
text_style
_ => text_style,
};
spans.push(Span::styled(text, style));
}

@ -1192,71 +1192,80 @@ impl Editor {
}
/// Refreshes the language server for a given document
pub fn refresh_language_servers(&mut self, doc_id: DocumentId) -> Option<()> {
pub fn refresh_language_servers(&mut self, doc_id: DocumentId) {
self.launch_language_servers(doc_id)
}
/// Launch a language server for a given document
fn launch_language_servers(&mut self, doc_id: DocumentId) -> Option<()> {
fn launch_language_servers(&mut self, doc_id: DocumentId) {
if !self.config().lsp.enable {
return None;
return;
}
// if doc doesn't have a URL it's a scratch buffer, ignore it
let doc = self.documents.get_mut(&doc_id)?;
let doc_url = doc.url()?;
let Some(doc) = self.documents.get_mut(&doc_id) else {
return;
};
let Some(doc_url) = doc.url() else {
return;
};
let (lang, path) = (doc.language.clone(), doc.path().cloned());
let config = doc.config.load();
let root_dirs = &config.workspace_lsp_roots;
// try to find language servers based on the language name
let language_servers = lang.as_ref().and_then(|language| {
// store only successfully started language servers
let language_servers = lang.as_ref().map_or_else(HashMap::default, |language| {
self.language_servers
.get(language, path.as_ref(), root_dirs, config.lsp.snippets)
.map_err(|e| {
log::error!(
"Failed to initialize the language servers for `{}` {{ {} }}",
language.scope(),
e
)
.filter_map(|(lang, client)| match client {
Ok(client) => Some((lang, client)),
Err(err) => {
log::error!(
"Failed to initialize the language servers for `{}` - `{}` {{ {} }}",
language.scope(),
lang,
err
);
None
}
})
.ok()
.collect::<HashMap<_, _>>()
});
if let Some(language_servers) = language_servers {
let language_id = doc.language_id().map(ToOwned::to_owned).unwrap_or_default();
// only spawn new language servers if the servers aren't the same
let doc_language_servers_not_in_registry =
doc.language_servers.iter().filter(|(name, doc_ls)| {
language_servers
.get(*name)
.map_or(true, |ls| ls.id() != doc_ls.id())
});
if language_servers.is_empty() {
return;
}
for (_, language_server) in doc_language_servers_not_in_registry {
tokio::spawn(language_server.text_document_did_close(doc.identifier()));
}
let language_id = doc.language_id().map(ToOwned::to_owned).unwrap_or_default();
let language_servers_not_in_doc = language_servers.iter().filter(|(name, ls)| {
doc.language_servers
// only spawn new language servers if the servers aren't the same
let doc_language_servers_not_in_registry =
doc.language_servers.iter().filter(|(name, doc_ls)| {
language_servers
.get(*name)
.map_or(true, |doc_ls| ls.id() != doc_ls.id())
.map_or(true, |ls| ls.id() != doc_ls.id())
});
for (_, language_server) in language_servers_not_in_doc {
// TODO: this now races with on_init code if the init happens too quickly
tokio::spawn(language_server.text_document_did_open(
doc_url.clone(),
doc.version(),
doc.text(),
language_id.clone(),
));
}
for (_, language_server) in doc_language_servers_not_in_registry {
tokio::spawn(language_server.text_document_did_close(doc.identifier()));
}
let language_servers_not_in_doc = language_servers.iter().filter(|(name, ls)| {
doc.language_servers
.get(*name)
.map_or(true, |doc_ls| ls.id() != doc_ls.id())
});
doc.language_servers = language_servers;
for (_, language_server) in language_servers_not_in_doc {
// TODO: this now races with on_init code if the init happens too quickly
tokio::spawn(language_server.text_document_did_open(
doc_url.clone(),
doc.version(),
doc.text(),
language_id.clone(),
));
}
Some(())
doc.language_servers = language_servers;
}
fn _refresh(&mut self) {
@ -1460,7 +1469,7 @@ impl Editor {
doc.set_version_control_head(self.diff_providers.get_current_head_name(&path));
let id = self.new_document(doc);
let _ = self.launch_language_servers(id);
self.launch_language_servers(id);
id
};

@ -94,9 +94,9 @@ pub fn diff<'doc>(
theme: &Theme,
_is_focused: bool,
) -> GutterFn<'doc> {
let added = theme.get("diff.plus");
let deleted = theme.get("diff.minus");
let modified = theme.get("diff.delta");
let added = theme.get("diff.plus.gutter");
let deleted = theme.get("diff.minus.gutter");
let modified = theme.get("diff.delta.gutter");
if let Some(diff_handle) = doc.diff_handle() {
let hunks = diff_handle.load();
let mut hunk_i = 0;

@ -317,7 +317,7 @@ indent = { tab-width = 2, unit = " " }
name = "json"
scope = "source.json"
injection-regex = "json"
file-types = ["json", "jsonc", "arb", "ipynb", "geojson", "gltf"]
file-types = ["json", "jsonc", "arb", "ipynb", "geojson", "gltf", "webmanifest", "flake.lock", ".babelrc"]
roots = []
language-servers = [ "vscode-json-language-server" ]
auto-format = true
@ -546,7 +546,7 @@ name = "javascript"
scope = "source.js"
injection-regex = "(js|javascript)"
language-id = "javascript"
file-types = ["js", "mjs", "cjs"]
file-types = ["js", "mjs", "cjs", "rules"]
shebangs = ["node"]
roots = []
comment-token = "//"
@ -1003,7 +1003,10 @@ language-servers = [ "purescript-language-server" ]
indent = { tab-width = 2, unit = " " }
auto-format = true
formatter = { command = "purs-tidy", args = ["format"] }
grammar = "haskell"
[[grammar]]
name = "purescript"
source = { git = "https://github.com/maskhjarna/tree-sitter-purescript", rev = "5f5a030826849b7be17596d372967f60051b42bd" }
[[language]]
name = "zig"
@ -1084,6 +1087,7 @@ source = { git = "https://github.com/uyha/tree-sitter-cmake", rev = "6e51463ef30
name = "make"
scope = "source.make"
file-types = ["Makefile", "makefile", "make", "mk"]
shebangs = ["make", "gmake"]
injection-regex = "(make|makefile|Makefile|mk)"
roots = []
comment-token = "#"
@ -2202,7 +2206,7 @@ source = { git = "https://github.com/Unoqwy/tree-sitter-kdl", rev = "e1cd292c6d1
name = "xml"
scope = "source.xml"
injection-regex = "xml"
file-types = ["xml", "mobileconfig", "plist", "xib", "storyboard", "svg", "xsd", "gml", "xaml", "gir", "rss", "atom", "opml"]
file-types = ["xml", "mobileconfig", "plist", "xib", "storyboard", "svg", "xsd", "gml", "xaml", "gir", "rss", "atom", "opml", "policy"]
indent = { tab-width = 2, unit = " " }
roots = []
@ -2290,7 +2294,8 @@ file-types = [
"container",
"volume",
"kube",
"network"
"network",
".editorconfig"
]
injection-regex = "ini"
comment-token = "#"
@ -2495,7 +2500,7 @@ source = { git = "https://github.com/erasin/tree-sitter-po", rev = "417cee9abb20
[[language]]
name = "nasm"
scope = "source.nasm"
file-types = ["asm", "s", "S", "nasm"]
file-types = ["asm", "S", "nasm"]
injection-regex = "n?asm"
roots = []
comment-token = ";"
@ -2505,6 +2510,19 @@ indent = { tab-width = 8, unit = " " }
name = "nasm"
source = { git = "https://github.com/naclsn/tree-sitter-nasm", rev = "a0db15db6fcfb1bf2cc8702500e55e558825c48b" }
[[language]]
name = "gas"
scope = "source.gas"
file-types = ["s"]
injection-regex = "gas"
roots = []
comment-token = "#"
indent = { tab-width = 8, unit = " " }
[[grammar]]
name = "gas"
source = { git = "https://github.com/sirius94/tree-sitter-gas", rev = "60f443646b20edee3b7bf18f3a4fb91dc214259a" }
[[language]]
name = "rst"
scope = "source.rst"

@ -0,0 +1,21 @@
(comment) @comment
(number) @constant.numeric
(directive_name) @keyword.directive
(symbol) @variable
(label) @function
(label)
(instruction_prefix) @keyword
(instruction_name) @function.special
(register) @constant.builtin
(string) @string
(char) @constant.character
(type) @type
(constant "$" @constant)
(operand_modifier) @attribute
(expression
["-" "+" "*" "/" "="] @operator)
["(" ")"] @punctuation.bracket
["," ":"] @punctuation.delimiter

@ -0,0 +1,2 @@
((comment) @injection.content
(#set! injection.language "comment"))

@ -0,0 +1,2 @@
(comment) @comment.inside
(comment)+ @comment.around

@ -24,7 +24,6 @@
; Identifiers
((identifier) @constant (match? @constant "^[A-Z][A-Z\\d_]+$"))
(const_spec
name: (identifier) @constant)
@ -38,6 +37,7 @@
(type_spec
name: (type_identifier) @constructor)
(field_identifier) @variable.other.member
(keyed_element (literal_element (identifier) @variable.other.member))
(identifier) @variable
(package_identifier) @namespace

@ -5,6 +5,20 @@
((((comment) @injection.language) .
(indented_string_expression (string_fragment) @injection.content))
(#set! injection.combined))
((binding
(comment) @injection.language
expression: (indented_string_expression (string_fragment) @injection.content))
(#set! injection.combined))
; Common attribute keys corresponding to Python scripts,
; such as those for NixOS VM tests in nixpkgs/nixos/tests.
((binding
attrpath: (attrpath (identifier) @_path)
expression: (indented_string_expression
(string_fragment) @injection.content))
(#match? @_path "(^|\\.)testScript$")
(#set! injection.language "python")
(#set! injection.combined))
; Common attribute keys corresponding to scripts,
; such as those of stdenv.mkDerivation.

@ -1 +1,122 @@
; inherits: haskell
; ----------------------------------------------------------------------------
; Literals and comments
(integer) @constant.numeric.integer
(exp_negation) @constant.numeric.integer
(exp_literal (float)) @constant.numeric.float
(char) @constant.character
(string) @string
(con_unit) @constant.builtin ; unit, as in ()
(comment) @comment
; ----------------------------------------------------------------------------
; Punctuation
[
"("
")"
"{"
"}"
"["
"]"
] @punctuation.bracket
[
(comma)
";"
] @punctuation.delimiter
; ----------------------------------------------------------------------------
; Keywords, operators, includes
[
"if"
"then"
"else"
"case"
"of"
] @keyword.control.conditional
[
"import"
"module"
] @keyword.control.import
[
(operator)
(constructor_operator)
(type_operator)
(tycon_arrow)
(qualified_module) ; grabs the `.` (dot), ex: import System.IO
(all_names)
"="
"|"
"::"
"∷"
"=>"
"⇒"
"->"
"→"
"<-"
"←"
"\\"
"`"
"@"
] @operator
(qualified_module (module) @constructor)
(module) @namespace
(qualified_type (module) @namespace)
(qualified_variable (module) @namespace)
(import (module) @namespace)
[
(where)
"let"
"in"
"class"
"instance"
"derive"
"foreign"
"data"
"newtype"
"type"
"as"
"do"
"ado"
"forall"
"∀"
"infix"
"infixl"
"infixr"
] @keyword
; ----------------------------------------------------------------------------
; Functions and variables
(signature name: (variable) @type)
(function name: (variable) @function)
; true or false
((variable) @constant.builtin.boolean
(#match? @constant.builtin.boolean "^(true|false)$"))
(variable) @variable
(exp_infix (variable) @operator) ; consider infix functions as operators
("@" @namespace) ; "as" pattern operator, e.g. x@Constructor
; ----------------------------------------------------------------------------
; Types
(type) @type
(constructor) @constructor

@ -1 +1,2 @@
; inherits: haskell
((comment) @injection.content
(#set! injection.language "comment"))

@ -1 +1,4 @@
; inherits: haskell
(signature name: (variable)) @local.definition
(function name: (variable)) @local.definition
(pat_name (variable)) @local.definition
(exp_name (variable)) @local.reference

@ -0,0 +1,13 @@
(comment) @comment.inside
[
(data)
(type)
(newtype)
] @class.around
((signature)? (function rhs:(_) @function.inside)) @function.around
(exp_lambda) @function.around
(data (type_variable) @parameter.inside)
(patterns (_) @parameter.inside)

@ -10,14 +10,18 @@
[
(kw_forall)
(unique_kw)
(structural_kw)
(type_kw)
(kw_equals)
(do)
(ability)
(where)
] @keyword
(kw_let) @keyword.function
(type_kw) @keyword.storage.type
(unique) @keyword.storage.modifier
(structural) @keyword.storage.modifier
("use") @keyword.control.import
@ -31,6 +35,7 @@
(arrow_symbol)
(">")
(or)
(and)
(bang)
] @operator
@ -47,13 +52,22 @@
;; Types
(record_field name: (wordy_id) @variable.other.member type: (wordy_id) @type)
[
(type_name)
(type_signature)
(effect)
] @type
(type_constructor (type_name (wordy_id) @constructor))
(ability_declaration type_name: (wordy_id) @type type_arg: (wordy_id) @variable.parameter)
(effect (wordy_id) @special) ;; NOTE: an effect is just like a type, but in signature we special case it
;; Namespaces
(path) @namespace
(namespace) @namespace
;; Terms
(type_signature term_name: (path)? @variable term_name: (wordy_id) @variable)
(type_signature (wordy_id) @type)
(type_signature (delayed (wordy_id)) @type)
(term_definition param: (wordy_id) @variable.parameter)
(term_definition) @variable
(function_application function_name: (path)? function_name: (wordy_id) @function)
;; Punctuation
[
@ -70,3 +84,4 @@
"]"
] @punctuation.bracket
(test_watch_expression (wordy_id) @keyword.directive)

@ -0,0 +1,151 @@
# An approximation/port of the Cyan Light Theme from Jetbrains
#
# Original Color Scheme here https://plugins.jetbrains.com/plugin/12102-cyan-light-theme
"attribute" = "blue"
"type" = "shade07"
"type.enum.variant" = "purple"
"constructor" = "shade07"
"constant" = "darker_blue"
"constant.builtin.boolean" = "blue"
"constant.character" = "blue"
"constant.character.escape" = "dark_red"
"constant.numeric" = "blue"
"string" = "green"
"string.regexp" = "blue"
"string.special" = { fg = "dark_red", modifiers = ["underlined"] }
"comment" = "comment_gray"
"variable" = "green_blue"
"variable.builtin" = { fg = "darker_blue" }
"variable.parameter" = "purple"
"variable.other.member" = "purple"
"label" = { fg = "darker_blue", modifiers = ["underlined"] }
"punctuation" = "shade06"
"keyword" = "darker_blue"
"keyword.control.exception" = "darker_blue"
"operator" = "shade06"
"function" = "shade07"
"function.macro" = "yellow"
"function.builtin" = { fg = "shade07", modifiers = ["italic"] }
"function.special" = "dark_red"
"function.method" = "dark_yellow"
"tag" = "darker_blue"
"special" = "shade06"
"namespace" = "darker_blue"
"markup.bold" = { fg = "shade06", modifiers = ["bold"] }
"markup.italic" = { fg = "shade06", modifiers = ["italic"] }
"markup.strikethrough" = { fg = "shade06", modifiers = ["crossed_out"] }
"markup.heading" = { fg = "purple" }
"markup.list" = "darker_blue"
"markup.list.numbered" = "darker_blue"
"markup.list.unnumbered" = "darker_blue"
"markup.link.url" = "shade06"
"markup.link.text" = { fg = "dark_blue", modifiers = ['underlined'] }
"markup.link.label" = "dark_blue"
"markup.quote" = "green"
"markup.raw" = "green"
"markup.raw.inline" = "green"
"markup.raw.block" = "green"
"diff.plus" = "diff_green"
"diff.minus" = "diff_red"
"diff.delta" = "diff_blue"
# ui specific
"ui.background" = { bg = "shade00" }
"ui.cursor" = { bg = "shade02" }
"ui.cursor.primary" = { bg = "cursor_blue" }
"ui.cursor.match" = { fg = "shade00", bg = "shade04" }
"ui.cursor.primary.select" = { bg = "light_purple" }
"ui.cursor.primary.insert" = { bg = "light_green" }
"ui.selection" = { bg = "lighter_blue" }
"ui.selection.primary" = { bg = "lighter_blue" }
"ui.highlight" = { bg = "faint_blue" }
"ui.cursorline.primary" = { bg = "faint_blue" }
"ui.linenr" = { fg = "shade03" }
"ui.linenr.selected" = { fg = "shade04", bg = "faint_blue", modifiers = [
"bold",
] }
"ui.statusline" = { fg = "shade06", bg = "shade02" }
"ui.statusline.inactive" = { fg = "shade04", bg = "shade01" }
"ui.statusline.normal" = { fg = "shade00", bg = "blue" }
"ui.statusline.insert" = { fg = "shade00", bg = "green" }
"ui.statusline.select" = { fg = "shade00", bg = "purple" }
"ui.popup" = { bg = "shade01", fg = "shade04" }
"ui.window" = { bg = "shade00", fg = "shade04" }
"ui.help" = { fg = "shade06", bg = "shade01" }
"ui.text" = "shade05"
"ui.text.focus" = { fg = "shade07", bg = "light_blue" }
"ui.virtual" = "shade03"
"ui.virtual.ruler" = { bg = "shade04" }
"ui.menu" = { fg = "shade05", bg = "shade01" }
"ui.menu.selected" = { fg = "shade07", bg = "light_blue" }
"hint" = "shade04"
"info" = "light_blue"
"warning" = "orange"
"error" = "red"
"diagnostic" = { modifiers = [] }
"diagnostic.hint" = { underline = { color = "shade04", style = "line" } }
"diagnostic.info" = { underline = { color = "light_blue", style = "line" } }
"diagnostic.warning" = { underline = { color = "orange", style = "curl" } }
"diagnostic.error" = { underline = { color = "red", style = "curl" } }
[palette]
shade00 = "#f2f3f7"
shade01 = "#dadde8"
shade02 = "#c1c6d9"
shade03 = "#a9b0ca"
shade04 = "#525c85"
shade05 = "#434b6c"
shade06 = "#343a54"
shade07 = "#25293c"
background = "#f2f3f7"
foreground = "#25293c"
comment_gray = "#808080"
diff_blue = "#C3D6E8"
faint_blue = "#E8Eef1"
lighter_blue = "#d0eaff"
light_blue = "#99ccff"
cursor_blue = "#80bfff"
blue = "#0073E6"
dark_blue = "#185b93"
darker_blue = "#000080"
purple = "#660E7A"
light_purple = "#ED9CFF"
diff_green = "#C9DEC1"
green = "#00733B"
light_green = "#5DCE87"
green_blue = "#458383"
yellow = "#808000"
dark_yellow = "#7A7A43"
light_orange = "#f9c881"
orange = "#F49810"
diff_red = "#EBBCBC"
red = "#d90016"
dark_red = "#7F0000"

@ -1,5 +1,6 @@
# Author : Gokul Soumya <gokulps15@gmail.com>
"tag" = { fg = "red" }
"attribute" = { fg = "yellow" }
"comment" = { fg = "light-gray", modifiers = ["italic"] }
"constant" = { fg = "cyan" }

Loading…
Cancel
Save