From eb72156094ce88c85c55e821026686c66bd0736d Mon Sep 17 00:00:00 2001 From: Greg Date: Mon, 11 Nov 2019 22:55:10 -0500 Subject: Implement postfix completions feature flag --- crates/ra_ide_api/src/completion/complete_postfix.rs | 4 ++++ crates/ra_ide_api/src/feature_flags.rs | 1 + docs/user/README.md | 2 ++ 3 files changed, 7 insertions(+) diff --git a/crates/ra_ide_api/src/completion/complete_postfix.rs b/crates/ra_ide_api/src/completion/complete_postfix.rs index 4f9565441..a3e9e5f46 100644 --- a/crates/ra_ide_api/src/completion/complete_postfix.rs +++ b/crates/ra_ide_api/src/completion/complete_postfix.rs @@ -13,6 +13,10 @@ use crate::{ }; pub(super) fn complete_postfix(acc: &mut Completions, ctx: &CompletionContext) { + if ctx.db.feature_flags.get("completions.enable-postfix") == false { + return; + } + let dot_receiver = match &ctx.dot_receiver { Some(it) => it, None => return, diff --git a/crates/ra_ide_api/src/feature_flags.rs b/crates/ra_ide_api/src/feature_flags.rs index d3ca7be03..de4ae513d 100644 --- a/crates/ra_ide_api/src/feature_flags.rs +++ b/crates/ra_ide_api/src/feature_flags.rs @@ -54,6 +54,7 @@ impl Default for FeatureFlags { FeatureFlags::new(&[ ("lsp.diagnostics", true), ("completion.insertion.add-call-parenthesis", true), + ("completion.enable-postfix", true), ("notifications.workspace-loaded", true), ]) } diff --git a/docs/user/README.md b/docs/user/README.md index eb1d5ed14..1861c69ab 100644 --- a/docs/user/README.md +++ b/docs/user/README.md @@ -107,6 +107,8 @@ host. "lsp.diagnostics": true, // Automatically insert `()` and `<>` when completing functions and types. "completion.insertion.add-call-parenthesis": true, + // Enable completions like `.if`, `.match`, etc. + "completion.enable-postfix": true, // Show notification when workspace is fully loaded "notifications.workspace-loaded": true, } -- cgit v1.2.3 From 088e5e172138f9bcaabd022113d92857fa0411e2 Mon Sep 17 00:00:00 2001 From: Greg Date: Mon, 11 Nov 2019 22:56:39 -0500 Subject: fix typo --- crates/ra_ide_api/src/completion/complete_postfix.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/ra_ide_api/src/completion/complete_postfix.rs b/crates/ra_ide_api/src/completion/complete_postfix.rs index a3e9e5f46..99fed8689 100644 --- a/crates/ra_ide_api/src/completion/complete_postfix.rs +++ b/crates/ra_ide_api/src/completion/complete_postfix.rs @@ -13,7 +13,7 @@ use crate::{ }; pub(super) fn complete_postfix(acc: &mut Completions, ctx: &CompletionContext) { - if ctx.db.feature_flags.get("completions.enable-postfix") == false { + if ctx.db.feature_flags.get("completion.enable-postfix") == false { return; } -- cgit v1.2.3