1
1
mirror of https://github.com/oxalica/nil.git synced 2024-11-22 11:22:46 +03:00

Mass fix typos with typos

This commit is contained in:
oxalica 2023-08-06 22:20:45 +08:00
parent 175c791e62
commit 565472e8ae
16 changed files with 29 additions and 20 deletions

View File

@ -2,7 +2,7 @@
//! It locates uncessary or inaccessible bindings and expressions, based on name resolution. //! It locates uncessary or inaccessible bindings and expressions, based on name resolution.
//! //!
//! Our goals are, //! Our goals are,
//! - Applicatable. //! - Applicable.
//! Removing ALL unused items will work and be semantically identical. //! Removing ALL unused items will work and be semantically identical.
//! - Closed. //! - Closed.
//! If there is an unused binding, it either has no references, //! If there is an unused binding, it either has no references,

View File

@ -66,7 +66,7 @@ impl LowerCtx<'_> {
if let Some(expr) = expr { if let Some(expr) = expr {
return self.lower_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) self.module.exprs.alloc(Expr::Missing)
} }

View File

@ -226,7 +226,7 @@ pub struct NameResolution {
// `None` value for unresolved names. // `None` value for unresolved names.
resolve_map: HashMap<ExprId, Option<ResolveResult>>, resolve_map: HashMap<ExprId, Option<ResolveResult>>,
// All names from the common pattern `inherit (builtins) ...`. // 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<NameId>, inherited_builtins: HashSet<NameId>,
} }

View File

@ -17,7 +17,7 @@ stdenv.mkDerivation {
let (mut db, file) = TestDB::single_file(src).unwrap(); let (mut db, file) = TestDB::single_file(src).unwrap();
let module = db.module(file); 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); let new_src = src.replace(before, after);
assert_ne!(src, new_src); assert_ne!(src, new_src);
db.set_file_content(file, new_src.into()); db.set_file_content(file, new_src.into());

View File

@ -1,5 +1,5 @@
//! Flatten binding with Attrset RHS into multiple bindings of outer level. //! Flatten binding with Attrset RHS into multiple bindings of outer level.
//! FIXME: Indentations are not reformated well. //! FIXME: Indentations are not reformatted well.
//! //!
//! ```nix //! ```nix
//! { //! {

View File

@ -152,14 +152,14 @@ mod tests {
fixture: &str, fixture: &str,
expect: Expect, 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); expect.assert_eq(&got);
} }
#[track_caller] #[track_caller]
pub(crate) fn check_assist_no(handler: fn(&mut AssistsCtx) -> Option<()>, fixture: &str) { pub(crate) fn check_assist_no(handler: fn(&mut AssistsCtx) -> Option<()>, fixture: &str) {
if let Some(got) = try_apply_assist(handler, fixture) { if let Some(got) = try_apply_assist(handler, fixture) {
panic!("Unexpected applicatable:\n{got}"); panic!("Unexpected applicable:\n{got}");
} }
} }
} }

View File

@ -1,5 +1,5 @@
//! Pack multiple bindings with the same prefix into nested one. //! Pack multiple bindings with the same prefix into nested one.
//! FIXME: Indentations are not reformated well. //! FIXME: Indentations are not reformatted well.
//! //!
//! ```nix //! ```nix
//! { //! {

View File

@ -202,7 +202,7 @@ fn complete_expr(
.map(|kw| keyword_to_completion(kw, source_range)) .map(|kw| keyword_to_completion(kw, source_range))
.for_each(&mut feed); .for_each(&mut feed);
// Contectual keywords. // Contextual keywords.
if ref_node if ref_node
.syntax() .syntax()
.ancestors() .ancestors()
@ -298,7 +298,7 @@ fn complete_attrpath(
} }
// We are inside the first Attr of a Let. // 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 // ```nix
// let // let
// foo.bar = 42; // foo.bar = 42;

View File

@ -187,7 +187,7 @@ fn main_parse(args: ParseArgs) {
#[derive(Debug, FromArgs)] #[derive(Debug, FromArgs)]
#[argh(subcommand, name = "ssr")] #[argh(subcommand, name = "ssr")]
/// Search structural patterns and optionaly replace them. /// Search structural patterns and optionally replace them.
/// WARNING: This functionality is experimental. /// WARNING: This functionality is experimental.
struct SsrArgs { struct SsrArgs {
/// nix file to check, or read from stdin for `-`. /// nix file to check, or read from stdin for `-`.

View File

@ -303,7 +303,7 @@ impl Server {
fn on_did_close(&mut self, params: DidCloseTextDocumentParams) -> NotifyResult { fn on_did_close(&mut self, params: DidCloseTextDocumentParams) -> NotifyResult {
// N.B. Don't clear text here. // 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. // not deletes it.
self.opened_files.remove(&params.text_document.uri); self.opened_files.remove(&params.text_document.uri);

View File

@ -1,6 +1,6 @@
[package] [package]
name = "ssr" name = "ssr"
description = "Structual search and replace" description = "Structural search and replace"
version.workspace = true version.workspace = true
edition.workspace = true edition.workspace = true
license.workspace = true license.workspace = true

View File

@ -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. /// Return whether the expected token is consumed.
fn require_expr_end(&mut self, guard: SyntaxKind) -> bool { fn require_expr_end(&mut self, guard: SyntaxKind) -> bool {
if matches!(self.peek_non_ws(), Some(k) if k == guard) { if matches!(self.peek_non_ws(), Some(k) if k == guard) {
@ -192,7 +192,7 @@ impl<'i> Parser<'i> {
} }
self.error(ErrorKind::ExpectToken(guard)); self.error(ErrorKind::ExpectToken(guard));
// Try to consume more experssions as recovery. // Try to consume more expressions as recovery.
loop { loop {
match self.peek_non_ws() { match self.peek_non_ws() {
Some(k) if k == guard => { Some(k) if k == guard => {
@ -675,7 +675,7 @@ impl<'i> Parser<'i> {
self.want(T![;]); self.want(T![;]);
self.finish_node(); 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() => { Some(k) if k.can_start_attr() => {
self.start_node(ATTR_PATH_VALUE); self.start_node(ATTR_PATH_VALUE);
self.attrpath_opt(); self.attrpath_opt();

View File

@ -43,7 +43,7 @@ it is allowed to have recursive references (but may not be infinite recursion).
### `flatten_attrset` ### `flatten_attrset`
Flatten binding with Attrset RHS into multiple bindings of outer level. Flatten binding with Attrset RHS into multiple bindings of outer level.
FIXME: Indentations are not reformated well. FIXME: Indentations are not reformatted well.
```nix ```nix
{ {
@ -64,7 +64,7 @@ foo.baz = 2;
### `pack_bindings` ### `pack_bindings`
Pack multiple bindings with the same prefix into nested one. Pack multiple bindings with the same prefix into nested one.
FIXME: Indentations are not reformated well. FIXME: Indentations are not reformatted well.
```nix ```nix
{ {

View File

@ -59,7 +59,7 @@ Default configuration:
// Auto-archiving behavior which may use network. // Auto-archiving behavior which may use network.
// //
// - null: Ask every time. // - 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. // - false: Do not archive. Only load inputs that are already on disk.
// Type: null | boolean // Type: null | boolean
// Example: true // Example: true

View File

@ -47,7 +47,7 @@ This incomplete list tracks noteble features currently implemented or planned.
- [x] Syntax errors. - [x] Syntax errors.
- [x] Hard semantic errors reported as parse errors by Nix, like duplicated keys in attrsets. - [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 legacy syntax.
- [x] Warnings of unnecessary syntax. - [x] Warnings of unnecessary syntax.
- [x] Warnings of unused bindings, `with` and `rec`. - [x] Warnings of unused bindings, `with` and `rec`.

9
typos.toml Normal file
View File

@ -0,0 +1,9 @@
[files]
extend-exclude = [
"crates/syntax/test_data",
]
[default.extend-words]
froms = "froms"
regist = "regist" # coc.nvim `registLanguageClient`
withs = "withs"