Skip to content

Commit

Permalink
no fancy features allowed
Browse files Browse the repository at this point in the history
  • Loading branch information
Druue committed Mar 14, 2023
1 parent 3e97ef0 commit 108cad8
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions prisma-fmt/src/text_document_completion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<PostgresDatasourceProperties>() {
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::<PostgresDatasourceProperties>() {
return connector_data.extensions().is_some();
}

false
false
}
_ => false,
}
_ => false,
} else {
false
}
}

Expand Down

0 comments on commit 108cad8

Please sign in to comment.