Skip to content

fix: no complete keyword colons before colons#22489

Open
A4-Tacks wants to merge 1 commit into
rust-lang:masterfrom
A4-Tacks:no-kw-colon-before-colon
Open

fix: no complete keyword colons before colons#22489
A4-Tacks wants to merge 1 commit into
rust-lang:masterfrom
A4-Tacks:no-kw-colon-before-colon

Conversation

@A4-Tacks
Copy link
Copy Markdown
Member

@A4-Tacks A4-Tacks commented May 29, 2026

Related #22479

Example

fn foo() { $0::bar }

Before this PR

fn foo() { self::::bar }

After this PR

fn foo() { self::bar }

Example
---
```rust
fn foo() { $0::bar }
```

**Before this PR**

```rust
fn foo() { self::::bar }
```

**After this PR**

```rust
fn foo() { self::bar }
```
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 29, 2026
Copy link
Copy Markdown
Contributor

@ChayimFriedman2 ChayimFriedman2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the label should also not include ::.

View changes since this review

@A4-Tacks
Copy link
Copy Markdown
Member Author

I think the label should also not include ::.

This will be difficult to distinguish between self (local) and self:: (module)

@ChayimFriedman2
Copy link
Copy Markdown
Contributor

Given they complete exactly the same, I don't think we should show both.

@A4-Tacks
Copy link
Copy Markdown
Member Author

Users can choose whether to complete the colons by selecting the completion item, This feature should not be compromised

@ChayimFriedman2
Copy link
Copy Markdown
Contributor

What I mean is, when we do not complete colons we should not show both.

@A4-Tacks
Copy link
Copy Markdown
Member Author

Cases that do not complete the colons seem to only occur before the colons

This should be irrelevant

@ChayimFriedman2
Copy link
Copy Markdown
Contributor

There, or when the user opted out in the settings. In both cases it's confusing that colons are shown but not completed.

@A4-Tacks
Copy link
Copy Markdown
Member Author

There

This is irrelevant because colons is exists

or when the user opted out in the settings. In both cases it's confusing that colons are shown but not completed.

Colons shown and completed

My consideration for this is:
When users want to completely return to their old behavior by changing settings, not completing :: will break, but perhaps this is a good thing?

@A4-Tacks
Copy link
Copy Markdown
Member Author

fn main() {
    s$0
    s$0::bar
}

Old: self:: self::
New: self:: self
New addColonsToModule: false: self:: self
New addColonsToModule: false: self self (perhaps this is better?)

@ChayimFriedman2
Copy link
Copy Markdown
Contributor

Your table of behaviors is correct. The only thing I said is that when we don't complete the colons, we should not show them in the label either, and that when we do that and also have a self completion, we should not show both since it's the same completion.

@A4-Tacks
Copy link
Copy Markdown
Member Author

A4-Tacks commented Jun 1, 2026

The only thing I said is that when we don't complete the colons, we should not show them in the label either,

This will make it difficult to distinguish between local and module in both user and testing scenarios

and that when we do that and also have a self completion, we should not show both since it's the same completion.

This is difficult to implement and has little impact

Although the completion content is the same, CompletionRelevance is different

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants