-
Notifications
You must be signed in to change notification settings - Fork 562
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LS: Limit module import completion to visible members (#6566)
- Loading branch information
1 parent
89a00fe
commit a952721
Showing
3 changed files
with
72 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
crates/cairo-lang-language-server/tests/test_data/completions/module_items.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
//! > Test completing public members of a module. | ||
|
||
//! > test_runner_name | ||
test_completions_text_edits | ||
|
||
//! > cairo_project.toml | ||
[crate_roots] | ||
hello = "src" | ||
|
||
[config.global] | ||
edition = "2024_07" | ||
|
||
//! > cairo_code | ||
mod helper_module { | ||
pub trait Trait1<T> { | ||
fn some_method(self: @T); | ||
} | ||
|
||
pub const CONST: felt252 = 0x0; | ||
|
||
fn foo() {} | ||
pub fn bar() {} | ||
} | ||
|
||
mod not_exporting_module { | ||
const CONST: u32 = 0; | ||
fn foo() {} | ||
fn bar() {} | ||
} | ||
|
||
mod nested_module { | ||
pub mod inner {} | ||
} | ||
|
||
use helper_module::<caret>; | ||
use non_exporting_module::<caret>; | ||
use nested_module::<caret>; | ||
use non_existent_module::<caret>; | ||
|
||
//! > Completions #0 | ||
use helper_module::<caret>; | ||
-------------------------- | ||
Completion: Trait1 | ||
-------------------------- | ||
Completion: CONST | ||
-------------------------- | ||
Completion: bar | ||
|
||
//! > Completions #1 | ||
use non_exporting_module::<caret>; | ||
|
||
//! > Completions #2 | ||
use nested_module::<caret>; | ||
-------------------------- | ||
Completion: inner | ||
|
||
//! > Completions #3 | ||
use non_existent_module::<caret>; |