From 17f236c2b041de7abd8ec3be208b8eff75fd7ffb Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 10 Dec 2020 17:41:57 +0300 Subject: Normalize spelling to American English --- crates/assists/src/assist_config.rs | 6 +++--- crates/assists/src/handlers/merge_imports.rs | 6 +++--- .../completion/src/completions/unqualified_path.rs | 10 +++++----- crates/completion/src/config.rs | 6 +++--- crates/completion/src/item.rs | 6 +++--- crates/completion/src/lib.rs | 2 +- crates/ide_db/src/helpers/insert_use.rs | 20 ++++++++++---------- crates/ide_db/src/helpers/insert_use/tests.rs | 16 ++++++++-------- crates/rust-analyzer/src/config.rs | 14 +++++++------- 9 files changed, 43 insertions(+), 43 deletions(-) (limited to 'crates') diff --git a/crates/assists/src/assist_config.rs b/crates/assists/src/assist_config.rs index 786224cfa..c458d9054 100644 --- a/crates/assists/src/assist_config.rs +++ b/crates/assists/src/assist_config.rs @@ -5,7 +5,7 @@ //! assists if we are allowed to. use hir::PrefixKind; -use ide_db::helpers::insert_use::MergeBehaviour; +use ide_db::helpers::insert_use::MergeBehavior; use crate::AssistKind; @@ -39,12 +39,12 @@ impl Default for AssistConfig { #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub struct InsertUseConfig { - pub merge: Option, + pub merge: Option, pub prefix_kind: PrefixKind, } impl Default for InsertUseConfig { fn default() -> Self { - InsertUseConfig { merge: Some(MergeBehaviour::Full), prefix_kind: PrefixKind::Plain } + InsertUseConfig { merge: Some(MergeBehavior::Full), prefix_kind: PrefixKind::Plain } } } diff --git a/crates/assists/src/handlers/merge_imports.rs b/crates/assists/src/handlers/merge_imports.rs index b7e853994..2f0dc7831 100644 --- a/crates/assists/src/handlers/merge_imports.rs +++ b/crates/assists/src/handlers/merge_imports.rs @@ -1,4 +1,4 @@ -use ide_db::helpers::insert_use::{try_merge_imports, try_merge_trees, MergeBehaviour}; +use ide_db::helpers::insert_use::{try_merge_imports, try_merge_trees, MergeBehavior}; use syntax::{ algo::{neighbor, SyntaxRewriter}, ast, AstNode, @@ -30,7 +30,7 @@ pub(crate) fn merge_imports(acc: &mut Assists, ctx: &AssistContext) -> Option<() if let Some(use_item) = tree.syntax().parent().and_then(ast::Use::cast) { let (merged, to_delete) = next_prev().filter_map(|dir| neighbor(&use_item, dir)).find_map(|use_item2| { - try_merge_imports(&use_item, &use_item2, MergeBehaviour::Full).zip(Some(use_item2)) + try_merge_imports(&use_item, &use_item2, MergeBehavior::Full).zip(Some(use_item2)) })?; rewriter.replace_ast(&use_item, &merged); @@ -42,7 +42,7 @@ pub(crate) fn merge_imports(acc: &mut Assists, ctx: &AssistContext) -> Option<() } else { let (merged, to_delete) = next_prev().filter_map(|dir| neighbor(&tree, dir)).find_map(|use_tree| { - try_merge_trees(&tree, &use_tree, MergeBehaviour::Full).zip(Some(use_tree)) + try_merge_trees(&tree, &use_tree, MergeBehavior::Full).zip(Some(use_tree)) })?; rewriter.replace_ast(&tree, &merged); diff --git a/crates/completion/src/completions/unqualified_path.rs b/crates/completion/src/completions/unqualified_path.rs index 4e4e2b36f..3372fb1a2 100644 --- a/crates/completion/src/completions/unqualified_path.rs +++ b/crates/completion/src/completions/unqualified_path.rs @@ -45,7 +45,7 @@ pub(crate) fn complete_unqualified_path(acc: &mut Completions, ctx: &CompletionC }); if ctx.config.enable_autoimport_completions && ctx.config.resolve_additional_edits_lazily() { - fuzzy_completion(acc, ctx).unwrap_or_default() + fuzzy_completion(acc, ctx); } } @@ -100,10 +100,10 @@ fn complete_enum_variants(acc: &mut Completions, ctx: &CompletionContext, ty: &T // To avoid an excessive amount of the results returned, completion input is checked for inclusion in the identifiers only // (i.e. in `HashMap` in the `std::collections::HashMap` path), also not in the module indentifiers. // -// .Merge Behaviour +// .Merge Behavior // -// It is possible to configure how use-trees are merged with the `importMergeBehaviour` setting. -// Mimics the corresponding behaviour of the `Auto Import` feature. +// It is possible to configure how use-trees are merged with the `importMergeBehavior` setting. +// Mimics the corresponding behavior of the `Auto Import` feature. // // .LSP and performance implications // @@ -150,7 +150,7 @@ fn fuzzy_completion(acc: &mut Completions, ctx: &CompletionContext) -> Option<() ImportEdit { import_path: import_path.clone(), import_scope: import_scope.clone(), - merge_behaviour: ctx.config.merge, + merge_behavior: ctx.config.merge, }, &definition, ) diff --git a/crates/completion/src/config.rs b/crates/completion/src/config.rs index 5175b9d69..30577dc11 100644 --- a/crates/completion/src/config.rs +++ b/crates/completion/src/config.rs @@ -4,7 +4,7 @@ //! module, and we use to statically check that we only produce snippet //! completions if we are allowed to. -use ide_db::helpers::insert_use::MergeBehaviour; +use ide_db::helpers::insert_use::MergeBehavior; use rustc_hash::FxHashSet; #[derive(Clone, Debug, PartialEq, Eq)] @@ -14,7 +14,7 @@ pub struct CompletionConfig { pub add_call_parenthesis: bool, pub add_call_argument_snippets: bool, pub snippet_cap: Option, - pub merge: Option, + pub merge: Option, /// A set of capabilities, enabled on the client and supported on the server. pub active_resolve_capabilities: FxHashSet, } @@ -56,7 +56,7 @@ impl Default for CompletionConfig { add_call_parenthesis: true, add_call_argument_snippets: true, snippet_cap: Some(SnippetCap { _private: () }), - merge: Some(MergeBehaviour::Full), + merge: Some(MergeBehavior::Full), active_resolve_capabilities: FxHashSet::default(), } } diff --git a/crates/completion/src/item.rs b/crates/completion/src/item.rs index bd94402d7..83166df4e 100644 --- a/crates/completion/src/item.rs +++ b/crates/completion/src/item.rs @@ -4,7 +4,7 @@ use std::fmt; use hir::{Documentation, ModPath, Mutability}; use ide_db::helpers::{ - insert_use::{self, ImportScope, MergeBehaviour}, + insert_use::{self, ImportScope, MergeBehavior}, mod_path_to_ast, }; use syntax::{algo, TextRange}; @@ -271,7 +271,7 @@ impl CompletionItem { pub struct ImportEdit { pub import_path: ModPath, pub import_scope: ImportScope, - pub merge_behaviour: Option, + pub merge_behavior: Option, } impl ImportEdit { @@ -283,7 +283,7 @@ impl ImportEdit { let rewriter = insert_use::insert_use( &self.import_scope, mod_path_to_ast(&self.import_path), - self.merge_behaviour, + self.merge_behavior, ); let old_ast = rewriter.rewrite_root()?; let mut import_insert = TextEdit::builder(); diff --git a/crates/completion/src/lib.rs b/crates/completion/src/lib.rs index f60f87243..6a4b3c167 100644 --- a/crates/completion/src/lib.rs +++ b/crates/completion/src/lib.rs @@ -153,7 +153,7 @@ pub fn resolve_completion_edits( }) .find(|mod_path| mod_path.to_string() == full_import_path)?; - ImportEdit { import_path, import_scope, merge_behaviour: config.merge } + ImportEdit { import_path, import_scope, merge_behavior: config.merge } .to_text_edit() .map(|edit| vec![edit]) } diff --git a/crates/ide_db/src/helpers/insert_use.rs b/crates/ide_db/src/helpers/insert_use.rs index 040843990..9be36d59b 100644 --- a/crates/ide_db/src/helpers/insert_use.rs +++ b/crates/ide_db/src/helpers/insert_use.rs @@ -93,7 +93,7 @@ fn is_inner_comment(token: SyntaxToken) -> bool { pub fn insert_use<'a>( scope: &ImportScope, path: ast::Path, - merge: Option, + merge: Option, ) -> SyntaxRewriter<'a> { let _p = profile::span("insert_use"); let mut rewriter = SyntaxRewriter::default(); @@ -183,7 +183,7 @@ fn eq_visibility(vis0: Option, vis1: Option) - pub fn try_merge_imports( lhs: &ast::Use, rhs: &ast::Use, - merge_behaviour: MergeBehaviour, + merge_behavior: MergeBehavior, ) -> Option { // don't merge imports with different visibilities if !eq_visibility(lhs.visibility(), rhs.visibility()) { @@ -191,14 +191,14 @@ pub fn try_merge_imports( } let lhs_tree = lhs.use_tree()?; let rhs_tree = rhs.use_tree()?; - let merged = try_merge_trees(&lhs_tree, &rhs_tree, merge_behaviour)?; + let merged = try_merge_trees(&lhs_tree, &rhs_tree, merge_behavior)?; Some(lhs.with_use_tree(merged)) } pub fn try_merge_trees( lhs: &ast::UseTree, rhs: &ast::UseTree, - merge: MergeBehaviour, + merge: MergeBehavior, ) -> Option { let lhs_path = lhs.path()?; let rhs_path = rhs.path()?; @@ -220,7 +220,7 @@ pub fn try_merge_trees( fn recursive_merge( lhs: &ast::UseTree, rhs: &ast::UseTree, - merge: MergeBehaviour, + merge: MergeBehavior, ) -> Option { let mut use_trees = lhs .use_tree_list() @@ -301,7 +301,7 @@ fn recursive_merge( } } Err(_) - if merge == MergeBehaviour::Last + if merge == MergeBehavior::Last && use_trees.len() > 0 && rhs_t.use_tree_list().is_some() => { @@ -438,20 +438,20 @@ fn path_segment_cmp(a: &ast::PathSegment, b: &ast::PathSegment) -> Ordering { /// What type of merges are allowed. #[derive(Copy, Clone, Debug, PartialEq, Eq)] -pub enum MergeBehaviour { +pub enum MergeBehavior { /// Merge everything together creating deeply nested imports. Full, /// Only merge the last import level, doesn't allow import nesting. Last, } -impl MergeBehaviour { +impl MergeBehavior { #[inline] fn is_tree_allowed(&self, tree: &ast::UseTree) -> bool { match self { - MergeBehaviour::Full => true, + MergeBehavior::Full => true, // only simple single segment paths are allowed - MergeBehaviour::Last => { + MergeBehavior::Last => { tree.use_tree_list().is_none() && tree.path().map(path_len) <= Some(1) } } diff --git a/crates/ide_db/src/helpers/insert_use/tests.rs b/crates/ide_db/src/helpers/insert_use/tests.rs index 86bfa5b41..9e194354e 100644 --- a/crates/ide_db/src/helpers/insert_use/tests.rs +++ b/crates/ide_db/src/helpers/insert_use/tests.rs @@ -533,7 +533,7 @@ fn merge_last_fail() { check_merge_only_fail( r"use foo::bar::{baz::{Qux, Fez}};", r"use foo::bar::{baaz::{Quux, Feez}};", - MergeBehaviour::Last, + MergeBehavior::Last, ); } @@ -542,7 +542,7 @@ fn merge_last_fail1() { check_merge_only_fail( r"use foo::bar::{baz::{Qux, Fez}};", r"use foo::bar::baaz::{Quux, Feez};", - MergeBehaviour::Last, + MergeBehavior::Last, ); } @@ -551,7 +551,7 @@ fn merge_last_fail2() { check_merge_only_fail( r"use foo::bar::baz::{Qux, Fez};", r"use foo::bar::{baaz::{Quux, Feez}};", - MergeBehaviour::Last, + MergeBehavior::Last, ); } @@ -560,7 +560,7 @@ fn merge_last_fail3() { check_merge_only_fail( r"use foo::bar::baz::{Qux, Fez};", r"use foo::bar::baaz::{Quux, Feez};", - MergeBehaviour::Last, + MergeBehavior::Last, ); } @@ -568,7 +568,7 @@ fn check( path: &str, ra_fixture_before: &str, ra_fixture_after: &str, - mb: Option, + mb: Option, module: bool, ) { let mut syntax = ast::SourceFile::parse(ra_fixture_before).tree().syntax().clone(); @@ -589,18 +589,18 @@ fn check( } fn check_full(path: &str, ra_fixture_before: &str, ra_fixture_after: &str) { - check(path, ra_fixture_before, ra_fixture_after, Some(MergeBehaviour::Full), false) + check(path, ra_fixture_before, ra_fixture_after, Some(MergeBehavior::Full), false) } fn check_last(path: &str, ra_fixture_before: &str, ra_fixture_after: &str) { - check(path, ra_fixture_before, ra_fixture_after, Some(MergeBehaviour::Last), false) + check(path, ra_fixture_before, ra_fixture_after, Some(MergeBehavior::Last), false) } fn check_none(path: &str, ra_fixture_before: &str, ra_fixture_after: &str) { check(path, ra_fixture_before, ra_fixture_after, None, false) } -fn check_merge_only_fail(ra_fixture0: &str, ra_fixture1: &str, mb: MergeBehaviour) { +fn check_merge_only_fail(ra_fixture0: &str, ra_fixture1: &str, mb: MergeBehavior) { let use0 = ast::SourceFile::parse(ra_fixture0) .tree() .syntax() diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs index 8d37638f4..1f4b5c24c 100644 --- a/crates/rust-analyzer/src/config.rs +++ b/crates/rust-analyzer/src/config.rs @@ -12,7 +12,7 @@ use std::{convert::TryFrom, ffi::OsString, path::PathBuf}; use flycheck::FlycheckConfig; use hir::PrefixKind; use ide::{AssistConfig, CompletionConfig, DiagnosticsConfig, HoverConfig, InlayHintsConfig}; -use ide_db::helpers::insert_use::MergeBehaviour; +use ide_db::helpers::insert_use::MergeBehavior; use itertools::Itertools; use lsp_types::{ClientCapabilities, MarkupKind}; use project_model::{CargoConfig, ProjectJson, ProjectJsonData, ProjectManifest}; @@ -25,7 +25,7 @@ use crate::{caps::enabled_completions_resolve_capabilities, diagnostics::Diagnos config_data! { struct ConfigData { /// The strategy to use when inserting new imports or merging imports. - assist_importMergeBehaviour: MergeBehaviourDef = "\"full\"", + assist_importMergeBehaviour: MergeBehaviorDef = "\"full\"", /// The path structure for newly inserted paths to use. assist_importPrefix: ImportPrefixDef = "\"plain\"", @@ -447,9 +447,9 @@ impl Config { }; self.assist.insert_use.merge = match data.assist_importMergeBehaviour { - MergeBehaviourDef::None => None, - MergeBehaviourDef::Full => Some(MergeBehaviour::Full), - MergeBehaviourDef::Last => Some(MergeBehaviour::Last), + MergeBehaviorDef::None => None, + MergeBehaviorDef::Full => Some(MergeBehavior::Full), + MergeBehaviorDef::Last => Some(MergeBehavior::Last), }; self.assist.insert_use.prefix_kind = match data.assist_importPrefix { ImportPrefixDef::Plain => PrefixKind::Plain, @@ -606,7 +606,7 @@ enum ManifestOrProjectJson { #[derive(Deserialize)] #[serde(rename_all = "snake_case")] -enum MergeBehaviourDef { +enum MergeBehaviorDef { None, Full, Last, @@ -740,7 +740,7 @@ fn field_props(field: &str, ty: &str, doc: &[&str], default: &str) -> serde_json "type": ["null", "array"], "items": { "type": "string" }, }, - "MergeBehaviourDef" => set! { + "MergeBehaviorDef" => set! { "type": "string", "enum": ["none", "full", "last"], "enumDescriptions": [ -- cgit v1.2.3