From 015e2ecd1956d7247f66f2b1ee23c01a8a4a482f Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Mon, 15 Apr 2024 10:47:01 -0700 Subject: [PATCH] Remove built-in Nu support in favor of extension (#10570) Release Notes: - Removed built-in Nu language support in favor of an extension. --------- Co-authored-by: Marshall --- Cargo.lock | 10 - Cargo.toml | 1 - crates/extensions_ui/src/extension_suggest.rs | 1 + crates/languages/Cargo.toml | 1 - crates/languages/src/lib.rs | 3 - crates/languages/src/nu.rs | 52 ---- crates/languages/src/nu/brackets.scm | 4 - crates/languages/src/nu/config.toml | 10 - crates/languages/src/nu/highlights.scm | 284 ------------------ crates/languages/src/nu/indents.scm | 3 - 10 files changed, 1 insertion(+), 368 deletions(-) delete mode 100644 crates/languages/src/nu.rs delete mode 100644 crates/languages/src/nu/brackets.scm delete mode 100644 crates/languages/src/nu/config.toml delete mode 100644 crates/languages/src/nu/highlights.scm delete mode 100644 crates/languages/src/nu/indents.scm diff --git a/Cargo.lock b/Cargo.lock index 00cda1909b..5f7fae9a06 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5516,7 +5516,6 @@ dependencies = [ "tree-sitter-jsdoc", "tree-sitter-json 0.20.0", "tree-sitter-markdown", - "tree-sitter-nu", "tree-sitter-proto", "tree-sitter-python", "tree-sitter-regex", @@ -10596,15 +10595,6 @@ dependencies = [ "tree-sitter", ] -[[package]] -name = "tree-sitter-nu" -version = "0.0.1" -source = "git+https://github.com/nushell/tree-sitter-nu?rev=7dd29f9616822e5fc259f5b4ae6c4ded9a71a132#7dd29f9616822e5fc259f5b4ae6c4ded9a71a132" -dependencies = [ - "cc", - "tree-sitter", -] - [[package]] name = "tree-sitter-proto" version = "0.0.2" diff --git a/Cargo.toml b/Cargo.toml index b763ed706e..6f191bb75d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -334,7 +334,6 @@ tree-sitter-html = "0.19.0" tree-sitter-jsdoc = { git = "https://github.com/tree-sitter/tree-sitter-jsdoc", ref = "6a6cf9e7341af32d8e2b2e24a37fbfebefc3dc55" } tree-sitter-json = { git = "https://github.com/tree-sitter/tree-sitter-json", rev = "40a81c01a40ac48744e0c8ccabbaba1920441199" } tree-sitter-markdown = { git = "https://github.com/MDeiml/tree-sitter-markdown", rev = "330ecab87a3e3a7211ac69bbadc19eabecdb1cca" } -tree-sitter-nu = { git = "https://github.com/nushell/tree-sitter-nu", rev = "7dd29f9616822e5fc259f5b4ae6c4ded9a71a132" } tree-sitter-proto = { git = "https://github.com/rewinfrey/tree-sitter-proto", rev = "36d54f288aee112f13a67b550ad32634d0c2cb52" } tree-sitter-python = "0.20.2" tree-sitter-regex = "0.20.0" diff --git a/crates/extensions_ui/src/extension_suggest.rs b/crates/extensions_ui/src/extension_suggest.rs index 0553a504dd..86a7534cc8 100644 --- a/crates/extensions_ui/src/extension_suggest.rs +++ b/crates/extensions_ui/src/extension_suggest.rs @@ -48,6 +48,7 @@ const SUGGESTIONS_BY_EXTENSION_ID: &[(&str, &[&str])] = &[ ("lua", &["lua"]), ("make", &["Makefile"]), ("nix", &["nix"]), + ("nu", &["nu"]), ("ocaml", &["ml", "mli"]), ("php", &["php"]), ("prisma", &["prisma"]), diff --git a/crates/languages/Cargo.toml b/crates/languages/Cargo.toml index 1c0a722fae..0b299f171c 100644 --- a/crates/languages/Cargo.toml +++ b/crates/languages/Cargo.toml @@ -48,7 +48,6 @@ tree-sitter-heex.workspace = true tree-sitter-jsdoc.workspace = true tree-sitter-json.workspace = true tree-sitter-markdown.workspace = true -tree-sitter-nu.workspace = true tree-sitter-proto.workspace = true tree-sitter-python.workspace = true tree-sitter-regex.workspace = true diff --git a/crates/languages/src/lib.rs b/crates/languages/src/lib.rs index 6262ee1c0e..4b10cb0de1 100644 --- a/crates/languages/src/lib.rs +++ b/crates/languages/src/lib.rs @@ -22,7 +22,6 @@ mod deno; mod elixir; mod go; mod json; -mod nu; mod python; mod ruby; mod rust; @@ -69,7 +68,6 @@ pub fn init( ("jsdoc", tree_sitter_jsdoc::language()), ("json", tree_sitter_json::language()), ("markdown", tree_sitter_markdown::language()), - ("nu", tree_sitter_nu::language()), ("proto", tree_sitter_proto::language()), ("python", tree_sitter_python::language()), ("regex", tree_sitter_regex::language()), @@ -272,7 +270,6 @@ pub fn init( "yaml", vec![Arc::new(yaml::YamlLspAdapter::new(node_runtime.clone()))] ); - language!("nu", vec![Arc::new(nu::NuLanguageServer {})]); language!("proto"); languages.register_secondary_lsp_adapter( diff --git a/crates/languages/src/nu.rs b/crates/languages/src/nu.rs deleted file mode 100644 index 58c8e30dc3..0000000000 --- a/crates/languages/src/nu.rs +++ /dev/null @@ -1,52 +0,0 @@ -use anyhow::{anyhow, Result}; -use async_trait::async_trait; -use language::{LanguageServerName, LspAdapter, LspAdapterDelegate}; -use lsp::LanguageServerBinary; -use std::{any::Any, path::PathBuf}; - -pub struct NuLanguageServer; - -#[async_trait(?Send)] -impl LspAdapter for NuLanguageServer { - fn name(&self) -> LanguageServerName { - LanguageServerName("nu".into()) - } - - async fn fetch_latest_server_version( - &self, - _: &dyn LspAdapterDelegate, - ) -> Result> { - Ok(Box::new(())) - } - - async fn fetch_server_binary( - &self, - _version: Box, - _container_dir: PathBuf, - _: &dyn LspAdapterDelegate, - ) -> Result { - Err(anyhow!( - "nu v0.87.0 or greater must be installed and available in your $PATH" - )) - } - - async fn cached_server_binary( - &self, - _: PathBuf, - _: &dyn LspAdapterDelegate, - ) -> Option { - Some(LanguageServerBinary { - path: "nu".into(), - env: None, - arguments: vec!["--lsp".into()], - }) - } - - fn can_be_reinstalled(&self) -> bool { - false - } - - async fn installation_test_binary(&self, _: PathBuf) -> Option { - None - } -} diff --git a/crates/languages/src/nu/brackets.scm b/crates/languages/src/nu/brackets.scm deleted file mode 100644 index 7ede7a6192..0000000000 --- a/crates/languages/src/nu/brackets.scm +++ /dev/null @@ -1,4 +0,0 @@ -("(" @open ")" @close) -("[" @open "]" @close) -("{" @open "}" @close) -(parameter_pipes "|" @open "|" @close) diff --git a/crates/languages/src/nu/config.toml b/crates/languages/src/nu/config.toml deleted file mode 100644 index 23f19cdcd2..0000000000 --- a/crates/languages/src/nu/config.toml +++ /dev/null @@ -1,10 +0,0 @@ -name = "Nu" -grammar = "nu" -path_suffixes = ["nu"] -line_comments = ["# "] -autoclose_before = ";:.,=}])>` \n\t\"" -brackets = [ - { start = "{", end = "}", close = true, newline = true }, - { start = "[", end = "]", close = true, newline = true }, - { start = "(", end = ")", close = true, newline = true }, -] diff --git a/crates/languages/src/nu/highlights.scm b/crates/languages/src/nu/highlights.scm deleted file mode 100644 index 66a3058405..0000000000 --- a/crates/languages/src/nu/highlights.scm +++ /dev/null @@ -1,284 +0,0 @@ -;;; --- -;;; keywords -[ - "def" - "alias" - "export-env" - "export" - "extern" - "module" - - "let" - "let-env" - "mut" - "const" - - "hide-env" - - "source" - "source-env" - - "overlay" - "register" - - "loop" - "while" - "error" - - "do" - "if" - "else" - "try" - "catch" - "match" - - "break" - "continue" - "return" - -] @keyword - -(hide_mod "hide" @keyword) -(decl_use "use" @keyword) - -(ctrl_for - "for" @keyword - "in" @keyword -) -(overlay_list "list" @keyword.storage.modifier) -(overlay_hide "hide" @keyword.storage.modifier) -(overlay_new "new" @keyword.storage.modifier) -(overlay_use - "use" @keyword.storage.modifier - "as" @keyword -) -(ctrl_error "make" @keyword.storage.modifier) - -;;; --- -;;; literals -(val_number) @constant.numeric -(val_duration - unit: [ - "ns" "µs" "us" "ms" "sec" "min" "hr" "day" "wk" - ] @variable.parameter -) -(val_filesize - unit: [ - "b" "B" - - "kb" "kB" "Kb" "KB" - "mb" "mB" "Mb" "MB" - "gb" "gB" "Gb" "GB" - "tb" "tB" "Tb" "TB" - "pb" "pB" "Pb" "PB" - "eb" "eB" "Eb" "EB" - - "kib" "kiB" "kIB" "kIb" "Kib" "KIb" "KIB" - "mib" "miB" "mIB" "mIb" "Mib" "MIb" "MIB" - "gib" "giB" "gIB" "gIb" "Gib" "GIb" "GIB" - "tib" "tiB" "tIB" "tIb" "Tib" "TIb" "TIB" - "pib" "piB" "pIB" "pIb" "Pib" "PIb" "PIB" - "eib" "eiB" "eIB" "eIb" "Eib" "EIb" "EIB" - ] @variable.parameter -) -(val_binary - [ - "0b" - "0o" - "0x" - ] @constant.numeric - "[" @punctuation.bracket - digit: [ - "," @punctuation.delimiter - (hex_digit) @constant.number - ] - "]" @punctuation.bracket -) @constant.numeric -(val_bool) @constant.builtin -(val_nothing) @constant.builtin -(val_string) @string -(val_date) @constant.number -(inter_escape_sequence) @constant.character.escape -(escape_sequence) @constant.character.escape -(val_interpolated [ - "$\"" - "$\'" - "\"" - "\'" -] @string) -(unescaped_interpolated_content) @string -(escaped_interpolated_content) @string -(expr_interpolated ["(" ")"] @variable.parameter) - -;;; --- -;;; operators -(expr_binary [ - "+" - "-" - "*" - "/" - "mod" - "//" - "++" - "**" - "==" - "!=" - "<" - "<=" - ">" - ">=" - "=~" - "!~" - "and" - "or" - "xor" - "bit-or" - "bit-xor" - "bit-and" - "bit-shl" - "bit-shr" - "in" - "not-in" - "starts-with" - "ends-with" -] @operator ) - -(where_command [ - "+" - "-" - "*" - "/" - "mod" - "//" - "++" - "**" - "==" - "!=" - "<" - "<=" - ">" - ">=" - "=~" - "!~" - "and" - "or" - "xor" - "bit-or" - "bit-xor" - "bit-and" - "bit-shl" - "bit-shr" - "in" - "not-in" - "starts-with" - "ends-with" -] @operator) - -(assignment [ - "=" - "+=" - "-=" - "*=" - "/=" - "++=" -] @operator) - -(expr_unary ["not" "-"] @operator) - -(val_range [ - ".." - "..=" - "..<" -] @operator) - -["=>" "=" "|"] @operator - -[ - "o>" "out>" - "e>" "err>" - "e+o>" "err+out>" - "o+e>" "out+err>" -] @special - -;;; --- -;;; punctuation -[ - "," - ";" -] @punctuation.delimiter - -(param_short_flag "-" @punctuation.delimiter) -(param_long_flag ["--"] @punctuation.delimiter) -(long_flag ["--"] @punctuation.delimiter) -(param_rest "..." @punctuation.delimiter) -(param_type [":"] @punctuation.special) -(param_value ["="] @punctuation.special) -(param_cmd ["@"] @punctuation.special) -(param_opt ["?"] @punctuation.special) - -[ - "(" ")" - "{" "}" - "[" "]" -] @punctuation.bracket - -(val_record - (record_entry ":" @punctuation.delimiter)) -;;; --- -;;; identifiers -(param_rest - name: (_) @variable.parameter) -(param_opt - name: (_) @variable.parameter) -(parameter - param_name: (_) @variable.parameter) -(param_cmd - (cmd_identifier) @string) -(param_long_flag) @variable.parameter -(param_short_flag) @variable.parameter - -(short_flag) @variable.parameter -(long_flag) @variable.parameter - -(scope_pattern [(wild_card) @function]) - -(cmd_identifier) @function - -(command - "^" @punctuation.delimiter - head: (_) @function -) - -"where" @function - -(path - ["." "?"] @punctuation.delimiter -) @variable.parameter - -(val_variable - "$" @variable.parameter - [ - (identifier) @namespace - "in" - "nu" - "env" - "nothing" - ] @special -) -;;; --- -;;; types -(flat_type) @type.builtin -(list_type - "list" @type.enum - ["<" ">"] @punctuation.bracket -) -(collection_type - ["record" "table"] @type.enum - "<" @punctuation.bracket - key: (_) @variable.parameter - ["," ":"] @punctuation.delimiter - ">" @punctuation.bracket -) - -(shebang) @comment -(comment) @comment diff --git a/crates/languages/src/nu/indents.scm b/crates/languages/src/nu/indents.scm deleted file mode 100644 index 112b414aa4..0000000000 --- a/crates/languages/src/nu/indents.scm +++ /dev/null @@ -1,3 +0,0 @@ -(_ "[" "]" @end) @indent -(_ "{" "}" @end) @indent -(_ "(" ")" @end) @indent