Skip to content

Remove highlighting for prelude types #3

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

Closed
mahkoh opened this issue Jan 29, 2015 · 2 comments
Closed

Remove highlighting for prelude types #3

mahkoh opened this issue Jan 29, 2015 · 2 comments

Comments

@mahkoh
Copy link
Contributor

mahkoh commented Jan 29, 2015

Most of them are not even special cases in the compiler. E.g., giving Vec special highlighting makes no sense.


This looks like a reasonable subset:

" Things from the prelude (src/libstd/prelude.rs) {{{2
syn keyword rustTrait Copy Send Sized Sync
syn keyword rustTrait Add Sub Mul Div Rem Neg Not
syn keyword rustTrait BitAnd BitOr BitXor
syn keyword rustTrait Drop Deref DerefMut
syn keyword rustTrait Shl Shr Index IndexMut
syn keyword rustTrait PartialEq PartialOrd Eq Ord
syn keyword rustTrait Box

syn keyword rustSelf self
syn keyword rustBoolean true false
@blaenk
Copy link

blaenk commented Jan 29, 2015

YES! This always bothered me. Personally though, I'd rather not have rustTrait at all; they're just traits, and it's just as weird to me to special-case them, even Copy/Send/Sized/Sync.

@chris-morgan
Copy link
Member

self, true and false were never prelude items.

The current prelude items (excluding functions which are not treated specially) are these:

Copy Send Sized Sync
Drop Fn FnMut FnOnce
Box
CharExt
Clone
PartialEq PartialOrd Eq Ord
DoubleEndedIterator
ExactSizeIterator
Iterator IteratorExt Extend
Option
Some None
PtrExt MutPtrExt
Result
Ok Err
AsSlice
SliceExt SliceConcatExt
Str StrExt
String ToString
Vec

There are also Path, GenericPath, Buffer, Writer, Reader, Seek and BufferPrelude which are to be removed before 1.0.0.

When I first tidied up the list, it was a rather harum‐scarum list that had significant overlap with the prelude but both had and lacked certain items. Switching it to just the prelude was the easiest thing to do, and I think that it is still a good idea to have at least some of these things. If anyone like @blaenk wishes to remove the feature altogether, it’s not hard:

hi link rustTrait NONE
" Option and Result:
hi link rustEnum NONE
" Some, None, Ok and Err:
hi link rustEnumVariant NONE

The prelude was fairly diverse and bloated in the past; it has been tidied up a lot since this issue was filed in the Rust repository, though. There are now two categories of things in there as far as the traits are concerned: useful traits which you may wish to write, and extension traits to provide methods onto types (matching the form *Ext, plus ToString to a slightly lesser extent). I believe that of the items that remain, it is useful to highlight them specially, with the potential exception of the *Ext traits—but there is no harm in their remaining there.

Also, incidentally, Box and Vec are structs, not traits. Hmm. That should be fixed.

Overall my opinion is 👎 on removing the prelude items in part or in whole. I reckon that the *Ext traits are the only ones that could warrant removal, but there’s little point in doing so.

@chris-morgan chris-morgan changed the title Remove highlighting for prelude types (vim) Remove highlighting for prelude types Feb 4, 2015
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

No branches or pull requests

3 participants