|
1 | 1 | use crate::ast_nav; |
2 | | -use crate::builtins::builtins_file; |
3 | 2 | use crate::column_name::ColumnName; |
4 | | -use crate::db::{File, parse}; |
| 3 | +use crate::db::{File, list_files, parse}; |
5 | 4 | use crate::goto_definition::goto_definition; |
6 | 5 | use crate::infer::{Type, infer_type_from_expr, infer_type_from_ty}; |
7 | 6 | use crate::location::{Location, LocationKind}; |
@@ -216,7 +215,7 @@ pub(crate) fn create_table_as_columns_with_types( |
216 | 215 | file: File, |
217 | 216 | create_table_as: &ast::CreateTableAs, |
218 | 217 | ) -> Vec<(Name, Option<Type>)> { |
219 | | - for file in [file, builtins_file(db)] { |
| 218 | + for file in list_files(db, file) { |
220 | 219 | let columns = select_columns_with_types(db, file, &create_table_as.query()); |
221 | 220 | if !columns.is_empty() { |
222 | 221 | return columns; |
@@ -426,7 +425,7 @@ pub(crate) fn view_like_columns_with_types( |
426 | 425 | .collect(); |
427 | 426 |
|
428 | 427 | let mut base_columns = vec![]; |
429 | | - for file in [file, builtins_file(db)] { |
| 428 | + for file in list_files(db, file) { |
430 | 429 | base_columns = select_columns_with_types(db, file, &create_view.query()); |
431 | 430 | if !base_columns.is_empty() { |
432 | 431 | break; |
@@ -464,7 +463,7 @@ pub(crate) fn with_table_columns_with_types( |
464 | 463 | .collect(); |
465 | 464 |
|
466 | 465 | let mut base_columns = vec![]; |
467 | | - for file in [file, builtins_file(db)] { |
| 466 | + for file in list_files(db, file) { |
468 | 467 | base_columns = with_table_query_columns_with_types(db, file, with_table.clone()); |
469 | 468 | if !base_columns.is_empty() { |
470 | 469 | break; |
@@ -686,7 +685,7 @@ fn columns_for_star_from_table_ptr( |
686 | 685 | columns_for_star_from_alias(db, file, &from_item, &alias) |
687 | 686 | } |
688 | 687 | Some(ast_nav::ParentSouce::WithTable(with_table)) => { |
689 | | - for f in [file, builtins_file(db)] { |
| 688 | + for f in list_files(db, file) { |
690 | 689 | let columns = with_table_columns_with_types(db, f, with_table.clone()); |
691 | 690 | if !columns.is_empty() { |
692 | 691 | return columns; |
@@ -826,7 +825,7 @@ pub(crate) fn star_column_names(db: &dyn Db, file: File, table_ptr: &SyntaxNodeP |
826 | 825 | .filter_map(|column| column.name().map(|name| Name::from_node(&name))) |
827 | 826 | .collect(), |
828 | 827 | Some(ast_nav::ParentSouce::WithTable(with_table)) => { |
829 | | - for file in [file, builtins_file(db)] { |
| 828 | + for file in list_files(db, file) { |
830 | 829 | let columns: Vec<_> = with_table_columns_with_types(db, file, with_table.clone()) |
831 | 830 | .into_iter() |
832 | 831 | .map(|(name, _)| name) |
|
0 commit comments