diff options
-rw-r--r-- | .gitmodules | 4 | ||||
-rw-r--r-- | Cargo.lock | 49 | ||||
-rw-r--r-- | book/theme/css/chrome.css | 2 | ||||
-rw-r--r-- | book/theme/css/general.css | 5 | ||||
-rw-r--r-- | book/theme/css/variables.css | 14 | ||||
-rw-r--r-- | helix-core/Cargo.toml | 1 | ||||
-rw-r--r-- | helix-core/src/selection.rs | 8 | ||||
-rw-r--r-- | helix-core/src/syntax.rs | 13 | ||||
-rw-r--r-- | helix-lsp/src/lib.rs | 10 | ||||
m--------- | helix-syntax/languages/tree-sitter-vue | 0 | ||||
-rw-r--r-- | helix-term/src/commands.rs | 14 | ||||
-rw-r--r-- | helix-term/src/ui/picker.rs | 6 | ||||
-rw-r--r-- | languages.toml | 35 | ||||
-rw-r--r-- | runtime/queries/vue/highlights.scm | 21 | ||||
-rw-r--r-- | runtime/queries/vue/injections.scm | 17 |
15 files changed, 134 insertions, 65 deletions
diff --git a/.gitmodules b/.gitmodules index d1fc1517..95b3670b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -122,3 +122,7 @@ path = helix-syntax/languages/tree-sitter-svelte url = https://github.com/Himujjal/tree-sitter-svelte shallow = true +[submodule "helix-syntax/languages/tree-sitter-vue"] + path = helix-syntax/languages/tree-sitter-vue + url = https://github.com/ikatyang/tree-sitter-vue + shallow = true @@ -37,9 +37,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bstr" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90682c8d613ad3373e66de8c6411e0ae2ab2571e879d2efbf73558cc66f21279" +checksum = "ba3569f383e8f1598449f1a423e72e99569137b47740b1da11ef19af3d5c3223" dependencies = [ "lazy_static", "memchr", @@ -54,9 +54,9 @@ checksum = "72feb31ffc86498dacdbd0fcebb56138e7177a8cc5cea4516031d15ae85a742e" [[package]] name = "bytes" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b700ce4376041dcd0a327fd0097c41095743c4c8af8887265942faf1100bd040" +checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8" [[package]] name = "cassowary" @@ -368,6 +368,7 @@ dependencies = [ "regex", "ropey", "serde", + "serde_json", "similar", "smallvec", "tendril", @@ -514,18 +515,18 @@ dependencies = [ [[package]] name = "instant" -version = "0.1.10" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bee0328b1209d157ef001c94dd85b4f8f64139adb0eac2659f4b08382b2f474d" +checksum = "716d3d89f35ac6a34fd0eed635395f4c3b76fa889338a4632e5231a8684216bd" dependencies = [ "cfg-if", ] [[package]] name = "itoa" -version = "0.4.7" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" +checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" [[package]] name = "jsonrpc-core" @@ -548,9 +549,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.99" +version = "0.2.103" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7f823d141fe0a24df1e23b4af4e3c7ba9e5966ec514ea068c93024aa7deb765" +checksum = "dd8f7255a17a627354f321ef0055d63b898c6fb27eff628af4d1b66b7331edf6" [[package]] name = "libloading" @@ -564,9 +565,9 @@ dependencies = [ [[package]] name = "lock_api" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0382880606dff6d15c9476c416d18690b72742aa7b605bb6dd6ec9030fbf07eb" +checksum = "712a4d093c9976e24e7dbca41db895dabcbac38eb5f4045393d17a95bdfb1109" dependencies = [ "scopeguard", ] @@ -694,9 +695,9 @@ checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56" [[package]] name = "parking_lot" -version = "0.11.1" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d7744ac029df22dca6284efe4e898991d28e3085c706c972bcd7da4a27a15eb" +checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" dependencies = [ "instant", "lock_api", @@ -705,9 +706,9 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.8.3" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa7a782938e745763fe6907fc6ba86946d72f49fe7e21de074e08128a99fb018" +checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" dependencies = [ "cfg-if", "instant", @@ -737,9 +738,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "proc-macro2" -version = "1.0.28" +version = "1.0.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c7ed8b8c7b886ea3ed7dde405212185f423ab44682667c8c6dd14aa1d9f6612" +checksum = "b9f5105d4fdaab20335ca9565e106a5d9b82b6219b5ba735731124ac6711d23d" dependencies = [ "unicode-xid", ] @@ -982,9 +983,9 @@ checksum = "d44a3643b4ff9caf57abcee9c2c621d6c03d9135e0d8b589bd9afb5992cb176a" [[package]] name = "syn" -version = "1.0.74" +version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1873d832550d4588c3dbc20f01361ab00bfe741048f71e3fecf145a7cc18b29c" +checksum = "a4eac2e6c19f5c3abc0c229bea31ff0b9b091c7b14990e8924b92902a303a0c0" dependencies = [ "proc-macro2", "quote", @@ -1042,9 +1043,9 @@ dependencies = [ [[package]] name = "tinyvec" -version = "1.3.1" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "848a1e1181b9f6753b5e96a092749e29b11d19ede67dfbbd6c7dc7e0f49b5338" +checksum = "f83b2a3d4d9091d0abd7eba4dc2710b1718583bd4d8992e2190720ea38f391f7" dependencies = [ "tinyvec_macros", ] @@ -1077,9 +1078,9 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "1.3.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54473be61f4ebe4efd09cec9bd5d16fa51d70ea0192213d754d2d500457db110" +checksum = "154794c8f499c2619acd19e839294703e9e32e7630ef5f46ea80d4ef0fbee5eb" dependencies = [ "proc-macro2", "quote", diff --git a/book/theme/css/chrome.css b/book/theme/css/chrome.css index 72b7f188..aba8a417 100644 --- a/book/theme/css/chrome.css +++ b/book/theme/css/chrome.css @@ -196,7 +196,7 @@ a > .hljs { border-radius: 3px; } -:not(pre):not(a) > .hljs { +:not(pre):not(a):not(td):not(p) > .hljs { color: var(--inline-code-color); overflow-x: initial; } diff --git a/book/theme/css/general.css b/book/theme/css/general.css index ddc2387a..9b280d08 100644 --- a/book/theme/css/general.css +++ b/book/theme/css/general.css @@ -162,7 +162,6 @@ table thead td { table thead th { padding: .75rem; text-align: left; - color: var(--table-border-color); font-weight: 500; line-height: 1.5; width: auto; @@ -228,3 +227,7 @@ blockquote *:last-child { margin: 5px 0px; font-weight: bold; } + +.result-no-output { + font-style: italic; +} diff --git a/book/theme/css/variables.css b/book/theme/css/variables.css index db1a11b8..b62c7558 100644 --- a/book/theme/css/variables.css +++ b/book/theme/css/variables.css @@ -13,7 +13,6 @@ .ayu { --bg: hsl(210, 25%, 8%); --fg: #c5c5c5; - --heading-fg: #c5c5c5; --sidebar-bg: #14191f; --sidebar-fg: #c8c9db; @@ -54,7 +53,6 @@ .coal { --bg: hsl(200, 7%, 8%); --fg: #98a3ad; - --heading-fg: #98a3ad; --sidebar-bg: #292c2f; --sidebar-fg: #a1adb8; @@ -95,7 +93,6 @@ .light { --bg: hsl(0, 0%, 100%); --fg: hsl(0, 0%, 0%); - --heading-fg: hsl(0, 0%, 0%); --sidebar-bg: #fafafa; --sidebar-fg: hsl(0, 0%, 0%); @@ -110,7 +107,7 @@ --links: #20609f; - --inline-code-color: #a39e9b; + --inline-code-color: #301900; --theme-popup-bg: #fafafa; --theme-popup-border: #cccccc; @@ -136,7 +133,6 @@ .navy { --bg: hsl(226, 23%, 11%); --fg: #bcbdd0; - --heading-fg: #bcbdd0; --sidebar-bg: #282d3f; --sidebar-fg: #c8c9db; @@ -177,7 +173,6 @@ .rust { --bg: hsl(60, 9%, 87%); --fg: #262625; - --heading-fg: #262625; --sidebar-bg: #3b2e2a; --sidebar-fg: #c8c9db; @@ -192,7 +187,7 @@ --links: #2b79a2; - --inline-code-color: #c5c8c6; + --inline-code-color: #6e6b5e; --theme-popup-bg: #e1e1db; --theme-popup-border: #b38f6b; @@ -218,8 +213,7 @@ @media (prefers-color-scheme: dark) { .light.no-js { --bg: hsl(200, 7%, 8%); - --fg: #ebeafa; - --heading-fg: #ebeafa; + --fg: #98a3ad; --sidebar-bg: #292c2f; --sidebar-fg: #a1adb8; @@ -234,7 +228,7 @@ --links: #2b79a2; - --inline-code-color: #6e6b5e; + --inline-code-color: #c5c8c6; --theme-popup-bg: #141617; --theme-popup-border: #43484d; diff --git a/helix-core/Cargo.toml b/helix-core/Cargo.toml index 34cbba9f..51096453 100644 --- a/helix-core/Cargo.toml +++ b/helix-core/Cargo.toml @@ -28,6 +28,7 @@ arc-swap = "1" regex = "1" serde = { version = "1.0", features = ["derive"] } +serde_json = "1.0" toml = "0.5" similar = "2.1" diff --git a/helix-core/src/selection.rs b/helix-core/src/selection.rs index 755ee679..18af4d08 100644 --- a/helix-core/src/selection.rs +++ b/helix-core/src/selection.rs @@ -29,10 +29,10 @@ use std::borrow::Cow; /// "(anchor, head)", followed by example text with "[" and "]" /// inserted to represent the anchor and head positions: /// -/// - (0, 3): [Som]e text. -/// - (3, 0): ]Som[e text. -/// - (2, 7): So[me te]xt. -/// - (1, 1): S[]ome text. +/// - (0, 3): `[Som]e text`. +/// - (3, 0): `]Som[e text`. +/// - (2, 7): `So[me te]xt`. +/// - (1, 1): `S[]ome text`. /// /// Ranges are considered to be inclusive on the left and /// exclusive on the right, regardless of anchor-head ordering. diff --git a/helix-core/src/syntax.rs b/helix-core/src/syntax.rs index 547b2572..9c433f3d 100644 --- a/helix-core/src/syntax.rs +++ b/helix-core/src/syntax.rs @@ -30,6 +30,15 @@ where .transpose() } +fn deserialize_lsp_config<'de, D>(deserializer: D) -> Result<Option<serde_json::Value>, D::Error> +where + D: serde::Deserializer<'de>, +{ + Option::<toml::Value>::deserialize(deserializer)? + .map(|toml| toml.try_into().map_err(serde::de::Error::custom)) + .transpose() +} + #[derive(Debug, Serialize, Deserialize)] pub struct Configuration { pub language: Vec<LanguageConfiguration>, @@ -45,7 +54,9 @@ pub struct LanguageConfiguration { pub file_types: Vec<String>, // filename ends_with? <Gemfile, rb, etc> pub roots: Vec<String>, // these indicate project roots <.git, Cargo.toml> pub comment_token: Option<String>, - pub config: Option<String>, + + #[serde(default, skip_serializing, deserialize_with = "deserialize_lsp_config")] + pub config: Option<serde_json::Value>, #[serde(default)] pub auto_format: bool, diff --git a/helix-lsp/src/lib.rs b/helix-lsp/src/lib.rs index 35cff754..7fa65928 100644 --- a/helix-lsp/src/lib.rs +++ b/helix-lsp/src/lib.rs @@ -318,15 +318,7 @@ impl Registry { let (client, incoming, initialize_notify) = Client::start( &config.command, &config.args, - serde_json::from_str(language_config.config.as_deref().unwrap_or("")) - .map_err(|e| { - log::error!( - "LSP Config, {}, in `languages.toml` for `{}`", - e, - language_config.scope() - ) - }) - .ok(), + language_config.config.clone(), id, )?; self.incoming.push(UnboundedReceiverStream::new(incoming)); diff --git a/helix-syntax/languages/tree-sitter-vue b/helix-syntax/languages/tree-sitter-vue new file mode 160000 +Subproject 91fe2754796cd8fba5f229505a23fa08f3546c0 diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index f005e376..95c46a4e 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -1291,7 +1291,8 @@ fn global_search(cx: &mut Context) { cx.push_layer(Box::new(prompt)); - let root = find_root(None).unwrap_or_else(|| PathBuf::from("./")); + let current_path = doc_mut!(cx.editor).path().cloned(); + let show_picker = async move { let all_matches: Vec<(usize, PathBuf)> = UnboundedReceiverStream::new(all_matches_rx).collect().await; @@ -1301,14 +1302,19 @@ fn global_search(cx: &mut Context) { editor.set_status("No matches found".to_string()); return; } + let picker = FilePicker::new( all_matches, move |(_line_num, path)| { - path.strip_prefix(&root) - .unwrap_or(path) + let relative_path = helix_core::path::get_relative_path(path) .to_str() .unwrap() - .into() + .to_owned(); + if current_path.as_ref().map(|p| p == path).unwrap_or(false) { + format!("{} (*)", relative_path).into() + } else { + relative_path.into() + } }, move |editor: &mut Editor, (line_num, path), action| { match editor.open(path.into(), action) { diff --git a/helix-term/src/ui/picker.rs b/helix-term/src/ui/picker.rs index c5b90a9c..9be2a73e 100644 --- a/helix-term/src/ui/picker.rs +++ b/helix-term/src/ui/picker.rs @@ -270,12 +270,18 @@ impl<T> Picker<T> { } pub fn move_up(&mut self) { + if self.matches.is_empty() { + return; + } let len = self.matches.len(); let pos = ((self.cursor + len.saturating_sub(1)) % len) % len; self.cursor = pos; } pub fn move_down(&mut self) { + if self.matches.is_empty() { + return; + } let len = self.matches.len(); let pos = (self.cursor + 1) % len; self.cursor = pos; diff --git a/languages.toml b/languages.toml index fe473f89..e716b3dc 100644 --- a/languages.toml +++ b/languages.toml @@ -6,19 +6,11 @@ file-types = ["rs"] roots = [] auto-format = true comment-token = "//" -config = """ -{ - "cargo": { - "loadOutDirsFromCheck": true - }, - "procMacro": { - "enable": false - } -} -""" - language-server = { command = "rust-analyzer" } indent = { tab-width = 4, unit = " " } +[language.config] +cargo = { loadOutDirsFromCheck = true } +procMacro = { enable = false } [[language]] name = "toml" @@ -286,6 +278,15 @@ roots = [] indent = { tab-width = 2, unit = " " } language-server = { command = "svelteserver", args = ["--stdio"] } + +[[language]] +name = "vue" +scope = "source.vue" +injection-regex = "vue" +file-types = ["vue"] +roots = [] +indent = { tab-width = 2, unit = " " } + [[language]] name = "yaml" scope = "source.yaml" @@ -315,3 +316,15 @@ comment-token = "//" language-server = { command = "zls" } indent = { tab-width = 4, unit = " " } + +[[language]] +name = "prolog" +scope = "source.prolog" +roots = [] +file-types = ["pl", "prolog"] +comment-token = "%" + +language-server = { command = "swipl", args = [ + "-g", "use_module(library(lsp_server))", + "-g", "lsp_server:main", + "-t", "halt", "--", "stdio"] } diff --git a/runtime/queries/vue/highlights.scm b/runtime/queries/vue/highlights.scm new file mode 100644 index 00000000..f90ae429 --- /dev/null +++ b/runtime/queries/vue/highlights.scm @@ -0,0 +1,21 @@ +(tag_name) @tag +(end_tag) @tag + +(directive_name) @keyword +(directive_argument) @constant + +(attribute + (attribute_name) @attribute + (quoted_attribute_value + (attribute_value) @string) +) + +(comment) @comment + +[ + "<" + ">" + "</" + "{{" + "}}" +] @punctuation.bracket
\ No newline at end of file diff --git a/runtime/queries/vue/injections.scm b/runtime/queries/vue/injections.scm new file mode 100644 index 00000000..8ee34ffb --- /dev/null +++ b/runtime/queries/vue/injections.scm @@ -0,0 +1,17 @@ +(directive_attribute + (directive_name) @keyword + (quoted_attribute_value + (attribute_value) @injection.content) + (#set! injection.language "javascript")) + +((interpolation + (raw_text) @injection.content) + (#set! injection.language "javascript")) + +((script_element + (raw_text) @injection.content) + (#set! injection.language "javascript")) + +((style_element + (raw_text) @injection.content) + (#set! injection.language "css")) |