Skip to content

Commit

Permalink
rename push_completions -> datamodel_completions
Browse files Browse the repository at this point in the history
formatting
  • Loading branch information
Druue committed Mar 15, 2023
1 parent 4142420 commit b8d6880
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion prisma-fmt/src/text_document_completion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ fn push_ast_completions(ctx: CompletionContext<'_>, completion_list: &mut Comple
datasource::url_quotes_completion(completion_list);
}

position => ctx.connector().push_completions(ctx.db, position, completion_list),
position => ctx.connector().datamodel_completions(ctx.db, position, completion_list),
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ impl Connector for CockroachDatamodelConnector {
Ok(())
}

fn push_completions(
fn datamodel_completions(
&self,
_db: &ParserDatabase,
position: SchemaPosition<'_>,
Expand Down
2 changes: 1 addition & 1 deletion psl/builtin-connectors/src/mssql_datamodel_connector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ impl Connector for MsSqlDatamodelConnector {
Ok(())
}

fn push_completions(
fn datamodel_completions(
&self,
_db: &ParserDatabase,
position: ast::SchemaPosition<'_>,
Expand Down
3 changes: 2 additions & 1 deletion psl/builtin-connectors/src/postgres_datamodel_connector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ impl PostgresDatasourceProperties {
span: ast::Span::empty(),
});
}

// Validation for property existence
pub fn extensions_defined(&self) -> bool {
self.extensions.is_some()
Expand Down Expand Up @@ -449,7 +450,7 @@ impl Connector for PostgresDatamodelConnector {
Ok(())
}

fn push_completions(
fn datamodel_completions(
&self,
db: &ParserDatabase,
position: ast::SchemaPosition<'_>,
Expand Down
5 changes: 5 additions & 0 deletions psl/psl-core/src/configuration/datasource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,18 +250,23 @@ impl Datasource {
pub fn provider_defined(&self) -> bool {
!self.provider.is_empty()
}

pub fn url_defined(&self) -> bool {
self.url_span.end > self.url_span.start
}

pub fn direct_url_defined(&self) -> bool {
self.direct_url.is_some()
}

pub fn shadow_url_defined(&self) -> bool {
self.shadow_database_url.is_some()
}

pub fn relation_mode_defined(&self) -> bool {
self.relation_mode.is_some()
}

pub fn schemas_defined(&self) -> bool {
self.schemas_span.is_some()
}
Expand Down
7 changes: 6 additions & 1 deletion psl/psl-core/src/datamodel_connector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,12 @@ pub trait Connector: Send + Sync {

fn validate_url(&self, url: &str) -> Result<(), String>;

fn push_completions(&self, _db: &ParserDatabase, _position: SchemaPosition<'_>, _completions: &mut CompletionList) {
fn datamodel_completions(
&self,
_db: &ParserDatabase,
_position: SchemaPosition<'_>,
_completions: &mut CompletionList,
) {
}

fn datasource_completions(&self, _config: &Configuration, _completion_list: &mut CompletionList) {}
Expand Down

0 comments on commit b8d6880

Please sign in to comment.