Skip to content

Conversation

@Veykril
Copy link
Member

@Veykril Veykril commented Mar 20, 2021

This adds basic lifetime completion, basic in the sense that the completions for lifetimes are only shown when the user enters ' followed by a char. Showing them when nothing is entered is kind of a pain, as we would want them to only show up where they are useful which in turn requires a lot of tree traversal and cursor position checking to verify whether the position is valid for a lifetime. This in itself doesn't seem too bad as usually when you know you want to write a lifetime putting ' to ask for lifetime completions seems fine.

I'll take a look at whether its possible to lift the restriction of having to put a char after '. This actually already works so I guess this is the clients responsibility, in which case VSCode doesn't like it.

TYH9gIlyVo

@Veykril
Copy link
Member Author

Veykril commented Mar 20, 2021

bors r+

bors bot added a commit that referenced this pull request Mar 20, 2021
8124: Add basic lifetime completion r=Veykril a=Veykril

This adds basic lifetime completion, basic in the sense that the completions for lifetimes are only shown when the user enters `'` followed by a char. Showing them when nothing is entered is kind of a pain, as we would want them to only show up where they are useful which in turn requires a lot of tree traversal and cursor position checking to verify whether the position is valid for a lifetime. This in itself doesn't seem to bad as usually when you know you want to write a lifetime putting `'` to ask for lifetime completions seems fine.

~~I'll take a look at whether its possible to lift the restriction of having to put a char after `'`.~~ This actually already works so I guess this is the clients responsibility, in which case VSCode doesn't like it.

![TYH9gIlyVo](https://user-images.githubusercontent.com/3757771/111886437-c9b02f80-89cd-11eb-9bee-340f1536b0de.gif)


Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
@bors
Copy link
Contributor

bors bot commented Mar 20, 2021

Canceled.

@Veykril Veykril force-pushed the lifetime-completions branch from 547389a to 4d8ddd5 Compare March 20, 2021 21:55
@Veykril
Copy link
Member Author

Veykril commented Mar 20, 2021

bors retry

bors bot added a commit that referenced this pull request Mar 20, 2021
8124: Add basic lifetime completion r=Veykril a=Veykril

This adds basic lifetime completion, basic in the sense that the completions for lifetimes are only shown when the user enters `'` followed by a char. Showing them when nothing is entered is kind of a pain, as we would want them to only show up where they are useful which in turn requires a lot of tree traversal and cursor position checking to verify whether the position is valid for a lifetime. This in itself doesn't seem to bad as usually when you know you want to write a lifetime putting `'` to ask for lifetime completions seems fine.

~~I'll take a look at whether its possible to lift the restriction of having to put a char after `'`.~~ This actually already works so I guess this is the clients responsibility, in which case VSCode doesn't like it.

![TYH9gIlyVo](https://user-images.githubusercontent.com/3757771/111886437-c9b02f80-89cd-11eb-9bee-340f1536b0de.gif)


Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
@bors
Copy link
Contributor

bors bot commented Mar 20, 2021

Build failed:

@Veykril Veykril force-pushed the lifetime-completions branch from 4d8ddd5 to 3c000c6 Compare March 20, 2021 22:25
@Veykril
Copy link
Member Author

Veykril commented Mar 20, 2021

bors retry

@bors
Copy link
Contributor

bors bot commented Mar 20, 2021

@bors bors bot merged commit 090e013 into rust-lang:master Mar 20, 2021
@Veykril Veykril deleted the lifetime-completions branch March 20, 2021 22:40
@flodiebold
Copy link
Member

@Veykril
Copy link
Member Author

Veykril commented Mar 21, 2021

Works like a charm 👍 (Well almost)

@Veykril
Copy link
Member Author

Veykril commented Mar 21, 2021

changelog feature add lifetime completion

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants