From 108cad80c8638d655c36aa2964e6357ba1526f57 Mon Sep 17 00:00:00 2001 From: Sophie Atkins Date: Mon, 13 Mar 2023 19:02:45 +0100 Subject: [PATCH] no fancy features allowed --- prisma-fmt/src/text_document_completion.rs | 32 ++++++++++++---------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/prisma-fmt/src/text_document_completion.rs b/prisma-fmt/src/text_document_completion.rs index 663b71e218ef..2e24ab139ecb 100644 --- a/prisma-fmt/src/text_document_completion.rs +++ b/prisma-fmt/src/text_document_completion.rs @@ -188,23 +188,25 @@ fn push_ast_completions(ctx: CompletionContext<'_>, completion_list: &mut Comple } fn ds_has_prop(ctx: CompletionContext<'_>, prop: &str) -> bool { - let Some(ds) = ctx.datasource() else { return false }; - - match prop { - "schemas" => ds.schemas_span.is_some(), - "relationMode" => ds.relation_mode.is_some(), - "directurl" => ds.direct_url.is_some(), - "shadowDatabaseUrl" => ds.shadow_database_url.is_some(), - "url" => ds.url_span.end > ds.url_span.start, - "provider" => !ds.provider.is_empty(), - "extensions" => { - if let Some(connector_data) = ds.connector_data.downcast_ref::() { - return connector_data.extensions().is_some(); - } + if let Some(ds) = ctx.datasource() { + match prop { + "schemas" => ds.schemas_span.is_some(), + "relationMode" => ds.relation_mode.is_some(), + "directurl" => ds.direct_url.is_some(), + "shadowDatabaseUrl" => ds.shadow_database_url.is_some(), + "url" => ds.url_span.end > ds.url_span.start, + "provider" => !ds.provider.is_empty(), + "extensions" => { + if let Some(connector_data) = ds.connector_data.downcast_ref::() { + return connector_data.extensions().is_some(); + } - false + false + } + _ => false, } - _ => false, + } else { + false } }