From 565472e8ae30e8a508de2ef3b26c9edda275fb3e Mon Sep 17 00:00:00 2001 From: oxalica Date: Sun, 6 Aug 2023 22:20:45 +0800 Subject: [PATCH] Mass fix typos with `typos` --- crates/ide/src/def/liveness.rs | 2 +- crates/ide/src/def/lower.rs | 2 +- crates/ide/src/def/nameres.rs | 2 +- crates/ide/src/def/tests.rs | 2 +- crates/ide/src/ide/assists/flatten_attrset.rs | 2 +- crates/ide/src/ide/assists/mod.rs | 4 ++-- crates/ide/src/ide/assists/pack_bindings.rs | 2 +- crates/ide/src/ide/completion.rs | 4 ++-- crates/nil/src/main.rs | 2 +- crates/nil/src/server.rs | 2 +- crates/ssr/Cargo.toml | 2 +- crates/syntax/src/parser.rs | 6 +++--- docs/code_actions.md | 4 ++-- docs/configuration.md | 2 +- docs/features.md | 2 +- typos.toml | 9 +++++++++ 16 files changed, 29 insertions(+), 20 deletions(-) create mode 100644 typos.toml diff --git a/crates/ide/src/def/liveness.rs b/crates/ide/src/def/liveness.rs index eff1fd9..9402e82 100644 --- a/crates/ide/src/def/liveness.rs +++ b/crates/ide/src/def/liveness.rs @@ -2,7 +2,7 @@ //! It locates uncessary or inaccessible bindings and expressions, based on name resolution. //! //! Our goals are, -//! - Applicatable. +//! - Applicable. //! Removing ALL unused items will work and be semantically identical. //! - Closed. //! If there is an unused binding, it either has no references, diff --git a/crates/ide/src/def/lower.rs b/crates/ide/src/def/lower.rs index 54fcb5e..3b63979 100644 --- a/crates/ide/src/def/lower.rs +++ b/crates/ide/src/def/lower.rs @@ -66,7 +66,7 @@ impl LowerCtx<'_> { if let Some(expr) = expr { return self.lower_expr(expr); } - // Synthetic syntax has no coresponding text. + // Synthetic syntax has no corresponding text. self.module.exprs.alloc(Expr::Missing) } diff --git a/crates/ide/src/def/nameres.rs b/crates/ide/src/def/nameres.rs index 4bc164d..d2932c0 100644 --- a/crates/ide/src/def/nameres.rs +++ b/crates/ide/src/def/nameres.rs @@ -226,7 +226,7 @@ pub struct NameResolution { // `None` value for unresolved names. resolve_map: HashMap>, // All names from the common pattern `inherit (builtins) ...`. - // This is used for tracking builtins names even through alising. + // This is used for tracking builtins names even through aliasing. inherited_builtins: HashSet, } diff --git a/crates/ide/src/def/tests.rs b/crates/ide/src/def/tests.rs index 0b722f5..f6d9f80 100644 --- a/crates/ide/src/def/tests.rs +++ b/crates/ide/src/def/tests.rs @@ -17,7 +17,7 @@ stdenv.mkDerivation { let (mut db, file) = TestDB::single_file(src).unwrap(); let module = db.module(file); - for (before, after) in [("comment", "editted cmt"), (";", " ; \n ")] { + for (before, after) in [("comment", "edited cmt"), (";", " ; \n ")] { let new_src = src.replace(before, after); assert_ne!(src, new_src); db.set_file_content(file, new_src.into()); diff --git a/crates/ide/src/ide/assists/flatten_attrset.rs b/crates/ide/src/ide/assists/flatten_attrset.rs index 4bb1e6d..9685949 100644 --- a/crates/ide/src/ide/assists/flatten_attrset.rs +++ b/crates/ide/src/ide/assists/flatten_attrset.rs @@ -1,5 +1,5 @@ //! Flatten binding with Attrset RHS into multiple bindings of outer level. -//! FIXME: Indentations are not reformated well. +//! FIXME: Indentations are not reformatted well. //! //! ```nix //! { diff --git a/crates/ide/src/ide/assists/mod.rs b/crates/ide/src/ide/assists/mod.rs index 4826a80..2ec1c39 100644 --- a/crates/ide/src/ide/assists/mod.rs +++ b/crates/ide/src/ide/assists/mod.rs @@ -152,14 +152,14 @@ mod tests { fixture: &str, expect: Expect, ) { - let got = try_apply_assist(handler, fixture).expect("Not applicatable"); + let got = try_apply_assist(handler, fixture).expect("Not applicable"); expect.assert_eq(&got); } #[track_caller] pub(crate) fn check_assist_no(handler: fn(&mut AssistsCtx) -> Option<()>, fixture: &str) { if let Some(got) = try_apply_assist(handler, fixture) { - panic!("Unexpected applicatable:\n{got}"); + panic!("Unexpected applicable:\n{got}"); } } } diff --git a/crates/ide/src/ide/assists/pack_bindings.rs b/crates/ide/src/ide/assists/pack_bindings.rs index 659cec3..a3aff10 100644 --- a/crates/ide/src/ide/assists/pack_bindings.rs +++ b/crates/ide/src/ide/assists/pack_bindings.rs @@ -1,5 +1,5 @@ //! Pack multiple bindings with the same prefix into nested one. -//! FIXME: Indentations are not reformated well. +//! FIXME: Indentations are not reformatted well. //! //! ```nix //! { diff --git a/crates/ide/src/ide/completion.rs b/crates/ide/src/ide/completion.rs index d90321f..703aaba 100644 --- a/crates/ide/src/ide/completion.rs +++ b/crates/ide/src/ide/completion.rs @@ -202,7 +202,7 @@ fn complete_expr( .map(|kw| keyword_to_completion(kw, source_range)) .for_each(&mut feed); - // Contectual keywords. + // Contextual keywords. if ref_node .syntax() .ancestors() @@ -298,7 +298,7 @@ fn complete_attrpath( } // We are inside the first Attr of a Let. - // Completes all static names in the same `Let` for splited definition. + // Completes all static names in the same `Let` for split definition. // ```nix // let // foo.bar = 42; diff --git a/crates/nil/src/main.rs b/crates/nil/src/main.rs index 2b6a264..eb52b45 100644 --- a/crates/nil/src/main.rs +++ b/crates/nil/src/main.rs @@ -187,7 +187,7 @@ fn main_parse(args: ParseArgs) { #[derive(Debug, FromArgs)] #[argh(subcommand, name = "ssr")] -/// Search structural patterns and optionaly replace them. +/// Search structural patterns and optionally replace them. /// WARNING: This functionality is experimental. struct SsrArgs { /// nix file to check, or read from stdin for `-`. diff --git a/crates/nil/src/server.rs b/crates/nil/src/server.rs index a4bfd1b..933dd52 100644 --- a/crates/nil/src/server.rs +++ b/crates/nil/src/server.rs @@ -303,7 +303,7 @@ impl Server { fn on_did_close(&mut self, params: DidCloseTextDocumentParams) -> NotifyResult { // N.B. Don't clear text here. - // `DidCloseTextDocument` means the client ends its maintainance to a file but + // `DidCloseTextDocument` means the client ends its maintenance to a file but // not deletes it. self.opened_files.remove(¶ms.text_document.uri); diff --git a/crates/ssr/Cargo.toml b/crates/ssr/Cargo.toml index b33dc3b..b7969f8 100644 --- a/crates/ssr/Cargo.toml +++ b/crates/ssr/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ssr" -description = "Structual search and replace" +description = "Structural search and replace" version.workspace = true edition.workspace = true license.workspace = true diff --git a/crates/syntax/src/parser.rs b/crates/syntax/src/parser.rs index 82c8fc0..324918f 100644 --- a/crates/syntax/src/parser.rs +++ b/crates/syntax/src/parser.rs @@ -183,7 +183,7 @@ impl<'i> Parser<'i> { } } - /// Expect the termination of an experssion by a followed `guard` token. + /// Expect the termination of an expression by a followed `guard` token. /// Return whether the expected token is consumed. fn require_expr_end(&mut self, guard: SyntaxKind) -> bool { if matches!(self.peek_non_ws(), Some(k) if k == guard) { @@ -192,7 +192,7 @@ impl<'i> Parser<'i> { } self.error(ErrorKind::ExpectToken(guard)); - // Try to consume more experssions as recovery. + // Try to consume more expressions as recovery. loop { match self.peek_non_ws() { Some(k) if k == guard => { @@ -675,7 +675,7 @@ impl<'i> Parser<'i> { self.want(T![;]); self.finish_node(); } - // Ensure we always consume somthing in the loop! + // Ensure we always consume something in the loop! Some(k) if k.can_start_attr() => { self.start_node(ATTR_PATH_VALUE); self.attrpath_opt(); diff --git a/docs/code_actions.md b/docs/code_actions.md index 6d151f8..f0d1def 100644 --- a/docs/code_actions.md +++ b/docs/code_actions.md @@ -43,7 +43,7 @@ it is allowed to have recursive references (but may not be infinite recursion). ### `flatten_attrset` Flatten binding with Attrset RHS into multiple bindings of outer level. -FIXME: Indentations are not reformated well. +FIXME: Indentations are not reformatted well. ```nix { @@ -64,7 +64,7 @@ foo.baz = 2; ### `pack_bindings` Pack multiple bindings with the same prefix into nested one. -FIXME: Indentations are not reformated well. +FIXME: Indentations are not reformatted well. ```nix { diff --git a/docs/configuration.md b/docs/configuration.md index 4aeb56d..0e17212 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -59,7 +59,7 @@ Default configuration: // Auto-archiving behavior which may use network. // // - null: Ask every time. - // - true: Automaticaly run `nix flake archive` when necessary. + // - true: Automatically run `nix flake archive` when necessary. // - false: Do not archive. Only load inputs that are already on disk. // Type: null | boolean // Example: true diff --git a/docs/features.md b/docs/features.md index b46c830..e5760fb 100644 --- a/docs/features.md +++ b/docs/features.md @@ -47,7 +47,7 @@ This incomplete list tracks noteble features currently implemented or planned. - [x] Syntax errors. - [x] Hard semantic errors reported as parse errors by Nix, like duplicated keys in attrsets. - - [x] Undefiend names. + - [x] Undefined names. - [x] Warnings of legacy syntax. - [x] Warnings of unnecessary syntax. - [x] Warnings of unused bindings, `with` and `rec`. diff --git a/typos.toml b/typos.toml new file mode 100644 index 0000000..559fa29 --- /dev/null +++ b/typos.toml @@ -0,0 +1,9 @@ +[files] +extend-exclude = [ + "crates/syntax/test_data", +] + +[default.extend-words] +froms = "froms" +regist = "regist" # coc.nvim `registLanguageClient` +withs = "withs"