Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new keywords #282

Merged
merged 2 commits into from Nov 29, 2018
Merged

Add new keywords #282

merged 2 commits into from Nov 29, 2018

Conversation

hcpl
Copy link
Contributor

@hcpl hcpl commented Nov 24, 2018

* `async` from rust-lang/rfcs#2394;
* `existential` from rust-lang/rfcs#2071.
@rust-highfive
Copy link

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @steveklabnik (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@hcpl
Copy link
Contributor Author

hcpl commented Nov 25, 2018

cc @da-x

@da-x
Copy link
Member

da-x commented Nov 25, 2018

Hi,

existential is a weak keyword, meaning it has special meaning only in specific contexts. In other contexts it can be a valid variable name. So we should identify these contexts and highlight it only then. Can you please make that change?

@hcpl
Copy link
Contributor Author

hcpl commented Nov 25, 2018

Hi, @da-x!

existential is a weak keyword, meaning it has special meaning only in specific contexts. In other contexts it can be a valid variable name.

I didn't know this was a thing. I searched for places where "existential is a weak keyword" was mentioned in https://github.com/rust-lang/rust and https://github.com/rust-lang/rfcs, but couldn't find any. Could you provide the source?

Copy link

@dlrobertson dlrobertson left a comment

Choose a reason for hiding this comment

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

You could treat existential like union (which is also a weak keyword) and add a match line that only highlights it if it is followed by a typedef such that the following works.

existential type Adder: Fn(usize) -> usize; // highlighted
let existential = 42; // not highlighted

Feel free to use #284 as inspiration 😄

@hcpl
Copy link
Contributor Author

hcpl commented Nov 29, 2018

Thanks @dlrobertson! I was thinking to learn more vimscript on this weekend to understand advanced concepts involved in rust.vim, but your PR showed be that it's pretty easy to begin with and you've already done all the hard work anyway. 🎉

@da-x da-x merged commit fabad27 into rust-lang:master Nov 29, 2018
@da-x
Copy link
Member

da-x commented Nov 29, 2018

Thanks!

alok added a commit to alok/rust.vim that referenced this pull request Feb 5, 2019
* remotes/original/master: (423 commits)
  Use 'setfiletype' to avoid load 'ftplugin/rust.vim' twice  (rust-lang#301)
  avoid setting `isfname`
  allow 'pub use'
  Set `include` and improve `includeexpr`
  Revert "BufWritePre should be <buffer>"
  Recognize edition2015 and edition2018 doc test specifiers
  Revert "RustTest: specify module name to run exact one test case"
  RustTest: specify module name to run exact one test case
  RustTest: use :terminal for running tests
  ftplugin/rust.vim: Better to narrow augroup scope
  rustfmt: remove incorrect version check
  rustfmt: simplify regex tests
  Improve 'async' contextual keyword highlighting (rust-lang#290)
  RustFmt: fix non-existant temp file
  Add new keywords (rust-lang#282)
  Add SyntasticInfo if exists to the output of RustInfo
  Check that Syntastic is new enough
  Update rust.txt
  Add `cargo#guessrun` function & `Cgrun` command
  Fix RunRustfmt() for Vim 7.x
  ...
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.

None yet

5 participants