Coder Social home page Coder Social logo

rust.vim's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rust.vim's Issues

Error on Write

I've installed the vim plugin with Pathogen and get the following error on initial write:

"main.rs" 4L, 77C written
Error detected while processing function 245..191:
line    9:
E700: Unknown function: SyntaxCheckers_rust_rustc_IsAvailable
Error detected while processing function <SNR>43_UpdateErrors..<SNR>43_CacheErrors..248..250..256..196:
line    1:
E15: Invalid expression: self._isAvailableFunc()
E15: Invalid expression: self._isAvailableFunc()

Subsequent writes to the same file produce:

"main.rs" 4L, 77C written
Error detected while processing function <SNR>43_UpdateErrors..<SNR>43_CacheErrors..248..250..256..196:
line    1:
E15: Invalid expression: self._isAvailableFunc()
E15: Invalid expression: self._isAvailableFunc()

incorrect indentation

If you select the following code block in visual mode and hit == (automatic indentation)

    let philosophers = vec![
        Philosopher::new("Judith Butler"),
        Philosopher::new("Gilles Deleuze"),
        Philosopher::new("Karl Marx"),
        Philosopher::new("Emma Goldman"),
        Philosopher::new("Michel Foucault"),
    ];

It closing vec bracket is not correctly indented.

        let philosophers = vec![
        Philosopher::new("Judith Butler"),
        Philosopher::new("Gilles Deleuze"),
        Philosopher::new("Karl Marx"),
        Philosopher::new("Emma Goldman"),
        Philosopher::new("Michel Foucault"),
        ];

rustfmt support behaves badly in conjunction with :wq when it returns an error

I very much like having rustfmt fix my formatting when I save, but sometimes I make syntax errors because I'm human. rustfmt proactively tries to tell me about that, and rust.vim helpfully shows me the error. However, if I've done :wq rather than merely :w Vim ends up in a strange state where the only thing open is the quickfix list with the error in it, the things I type are written into the buffer, but when I hit enter the command I typed is executed.

Possible solutions:

  • Don't open the quickfix list with errors if the program is quitting.
  • Interrupt the quitting if there's an error the user needs to see so they can fix their code, resave and then quit.

Explain how to install rustfmt

As a new Rust user, I was very confused about why Rustfmt wasn't working. I enabled it to run automatically on save, but if you don't have Rustfmt installed then it just echo's the source file to the terminal - no error messages or anything. So it would be really helpful if you could either add an error message or a note in the docs telling people to install rustfmt using cargo install rustfmt. Thanks!

Add rustfmt as Syntastic syntax checker

Autoformatting is great, but I can see the changes it made only when reviewing the diff.

I think the possibility to see the style errors and fix them manually will helps to write well-formatted code from the start.

Triple slash comments cannot be wrapped automatically

Stackoverflow has a working solution for that, but I don't know how to integrate it into the files in this repository.

It says I should add this to my .vimrc:

autocmd Filetype c,cpp set comments^=:///

This works (after replacing c,cpp with rust), but ftplugin/rust.vim already adds :/// to the set of possible comments. Moving it to the end does not help either.

matchit.vim fails to load with latest neovim

ftplugin/rust.vim will source $VIMRUNTIME/macros/matchit.vim regardless of whether or not it needs to be loaded, and always assumes it's in the macros dir.

This is not true as of neovim/neovim#2723. That PR made matchit.vim always loaded by default and moved matchit.vim: runtime/macros/matchit.vim → runtime/plugin/matchit.vim. I believe that a solution would be to instead perform the following:

if !exists('loaded_matchit')
    source $VIMRUNTIME/macros/matchit.vim
endif

But I'm still relatively new to vim so I'm not really sure. This appears to work on my machine though.

nvim details:

~
❯ nvim -v
NVIM 0.0.0-alpha+201506222256 (compiled Jun 23 2015 20:42:16)
Commit: 20a57c497b55bb3632f0d4bcd76c18628cfa5f43
Build type: RelWithDebInfo
Compilation: /usr/local/Library/ENV/4.3/clang -Wconversion -O2 -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -DINCLUDE_GENERATED_DECLARATIONS -DHAVE_CONFIG_H -I/tmp/neovim20150623-23404-1k8l993/build/config -I/tmp/neovim20150623-23404-1k8l993/src -I/tmp/neovim20150623-23404-1k8l993/.deps/usr/include -I/tmp/neovim20150623-23404-1k8l993/.deps/usr/include -I/tmp/neovim20150623-23404-1k8l993/.deps/usr/include/luajit-2.0 -I/tmp/neovim20150623-23404-1k8l993/.deps/usr/include -I/tmp/neovim20150623-23404-1k8l993/.deps/usr/include -I/tmp/neovim20150623-23404-1k8l993/.deps/usr/include -I/tmp/neovim20150623-23404-1k8l993/.deps/usr/include -I/Library/Frameworks/Mono.framework/Headers -I/usr/include -I/tmp/neovim20150623-23404-1k8l993/build/src/nvim/auto -I/tmp/neovim20150623-23404-1k8l993/build/include
Compiled by [email protected]

Optional features included (+) or not (-): +acl   +iconv    +jemalloc
For differences from Vim, see :help vim-differences

   system vimrc file: "$VIM/nvimrc"
     user vimrc file: "~/.nvimrc"
 2nd user vimrc file: "~/.nvim/nvimrc"
      user exrc file: "~/.exrc"
  fall-back for $VIM: "/usr/local/Cellar/neovim/HEAD/share/nvim"

License?

What is the license? Is it a free/libre one?

Remove highlighting for prelude types

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

Contextual keyword `default`

Rust's got a new contextual keyword, only an unstable feature so far, default that is used by specialization.

struct indent misaligned

struct Circle {
    x: f64, 
    y: f64, 
    radius: f64,
}

is now indented as

struct Circle {
    x: f64, 
        y: f64, 
            radius: f64,
}

screen redrawing issue

There is a very annoying issue with VIM not redrawing on certain TERM values with a dark background after returning from :RustRun. According to the VIM experts,

"this only happens with :! and :shell. use system() instead. This will avoid the curses mucking that results in the required redraw."

Support for file checking beyond syntactic correctness

Currently, the syntastic integration (which will hopefully soon also be used by neomake) runs rustc with -Zparse-only to check a particular file. While this is fine, it doesn't catch the vast majority of errors that come up during development.

Obviously, just dropping -Zparse-only won't work, as the compiler will complain about missing imports/types, but maybe some kind of integration with cargo could work? Maybe look up the file tree to find Cargo.toml, run cargo build, and parse out any warning/error that pertains to the currently open file? It's not pretty, but would be extremely useful!

:RustFmt pager

Hi, it appears as if the output generated by :RustFmt gets loaded into the pager, and I have to hit q to have it disappear and continue editing. Is there a way to avoid that happening?

Opening additional buffers causes error message

Steps to reproduce:

  1. Open a rust buffer

  2. Open a second rust buffer
    See error message:

    Error detected while processing function delimitMate#Get..<SNR>74_get:                                                                  
    line    7:                                                                                                                              
    E716: Key not present in Dictionary: 3.excluded_regions                                                                                 
    E15: Invalid expression: s:options.3.excluded_regions
    
  3. Open a third buffer
    See error message:

    Error detected while processing function delimitMate#Get..<SNR>74_get:                                                                  
    line    7:                                                                                                                              
    E716: Key not present in Dictionary: 4.excluded_regions                                                                                 
    E15: Invalid expression: s:options.4.excluded_regions
    
  4. And so on...

:RustFmt fail

Trying to format some code and:

Error detected while processing function rustfmt#Format:
line    7:
E117: Unknown function: systemlist
E15: Invalid expression: systemlist(command . g:rustfmt_options . " " . shellescape(l:tmpname))

The cause of this - CentOS base repository vim version 7.4.160. Please add to requirement vim minimal version 7.4.568.
Thanks!
P.S. On CentOS 7 you can build fresh version of vim from Fedora repo:

rpmbuild --rebuild https://download.fedoraproject.org/pub/fedora/linux/releases/22/Everything/source/SRPMS/v/vim-7.4.640-4.fc22.src.rpm

Error message update RFC and IDE impact

Hey all,

Sorry for using an issue as a message box, but I wasn't sure who to contact.

I/we are currently working on an RFC that will change up the compiler error output a bit: rust-lang/rfcs#1644 This may have some IDE impacts, if the plugin is doing a match against the output.

We've also been talking about standardizing a JSON output for the compiler so that IDEs can get more information that way.

Would love to get your feedback on what impact it has on the vim plugin.

*.rs is recognized as hercules files

In vim's official filetype.vim, I found that in line 860:

au BufNewFile,BufRead *.vc,*.ev,*.rs,*.sum,*.errsum setf hercules

Maybe it is better to move ftdetect to after/ftdetect?

Highlighting incorrect on scroll

For most of the tests in the rust-lang/cargo repo, if I open the file and then use G to go to the end of the file, the syntax highlighting ends up getting messed up. For example, when opening the file:

https://i.imgur.com/ZixHFcN.png

and after G:

https://i.imgur.com/1Vx56Y7.png

vim shows whole file (with "--- More ---" scrolling) when saving

So, I have some weird issues when saving files using rust.vim. Whenever I changed a file and want to save it, vim displays the whole file in that scrollable mode (--- More --- at the bottom line, scrolling with arrow keys) and only when I scroll to the bottom, the file gets saved. This does not happen without rust.vim.

I use pathogen and have nerdtree, youcompleteme, syntastic and rust.vim in my bundle folder.

vim --version:

$ vim --version
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Mar 19 2016 22:56:19)
Included patches: 1-1000
Compiled by jan@jan-laptop
Huge version with GTK2 GUI.  Features included (+) or not (-):
+acl             +farsi           +mouse_netterm   +syntax
+arabic          +file_in_path    +mouse_sgr       +tag_binary
+autocmd         +find_in_path    -mouse_sysmouse  +tag_old_static
+balloon_eval    +float           +mouse_urxvt     -tag_any_white
+browse          +folding         +mouse_xterm     -tcl
++builtin_terms  -footer          +multi_byte      +terminfo
+byte_offset     +fork()          +multi_lang      +termresponse
+cindent         +gettext         -mzscheme        +textobjects
+clientserver    -hangul_input    +netbeans_intg   +title
+clipboard       +iconv           +path_extra      +toolbar
+cmdline_compl   +insert_expand   -perl            +user_commands
+cmdline_hist    +jumplist        +persistent_undo +vertsplit
+cmdline_info    +keymap          +postscript      +virtualedit
+comments        +langmap         +printer         +visual
+conceal         +libcall         +profile         +visualextra
+cryptv          +linebreak       +python          +viminfo
+cscope          +lispindent      -python3         +vreplace
+cursorbind      +listcmds        +quickfix        +wildignore
+cursorshape     +localmap        +reltime         +wildmenu
+dialog_con_gui  -lua             +rightleft       +windows
+diff            +menu            -ruby            +writebackup
+digraphs        +mksession       +scrollbind      +X11
+dnd             +modify_fname    +signs           -xfontset
-ebcdic          +mouse           +smartindent     +xim
+emacs_tags      +mouseshape      -sniff           +xsmp_interact
+eval            +mouse_dec       +startuptime     +xterm_clipboard
+ex_extra        -mouse_gpm       +statusline      -xterm_save
+extra_search    -mouse_jsbterm   -sun_workshop    +xpm
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  system gvimrc file: "$VIM/gvimrc"
    user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
    system menu file: "$VIMRUNTIME/menu.vim"
  fall-back for $VIM: "/usr/local/share/vim"
 f-b for $VIMRUNTIME: "/usr/share/vim/vim74"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK  -pthread -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/libdrm -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng16 -I/usr/include/pango-1.0 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include   -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1       
Linking: gcc   -L/usr/local/lib -Wl,--as-needed -o vim   -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lfontconfig -lfreetype -lXt -lX11 -lSM -lICE  -lm -lncurses -lacl -L/usr/lib/python2.7/config -lpython2.7 -ldl -lutil -lm -Xlinker -export-dynamic 

Inconsistent highlighting of `super` in imports

In imports like use super::super::math::{Vec3, Mat3}; the second (and possible 3rd, 4th, ...) super is highlighted like a keyword although the first one is highlighted like a module name.

Causes Vim to hang if a parent directory contains spaces

Opened up a Rust file somewhere in the current directory while a few parent directories up had a space in it. I'm not sure where the hang happens but I think the plugin gets stuck in a loop while processing the whole path. Replacing the spaces with a different character makes the issue go away.

comment inside attribute not highlighted

The following code

#[cfg(all(test,                       // for testing ...
          not(feature = "nightly")))] // ... on beta/stable ...
#[macro_use]                          // ... we use the macros ...
#[no_link]                            // ... but no code ...
extern crate static_cond;             // ... from static-cond

renders like this

screenshot

Provide a fold for doc comments

Having documentation inline in a source file is a blessing when working in a new codebase, but when working in a familiar file large amounts of comments between each piece of code only serve to obscure clarity. A way to fold them up would go a long way towards alleviating this problem.

incorrect completion

If you type std::pro and then tab, the first suggestion that comes up is Process, which is wrong according to racer:

racer complete std::pro
MATCH process,1,0,/Users/kaiyin/rust_source/rust/src/libstd/process.rs,Module,/Users/kaiyin/rust_source/rust/src/libstd/process.rs

multiline string should be left as is by indenter

If you want to write a multiline string in a way that lets you edit it exactly as it's printed on the terminal, it's common to write something like this:

fn printsomething() {
    println!(
"line__1
line______2
line________3
line___________4"
        );
}

Unfortunately the indenter does not leave this as is but tries and indents it into something that makes it impossible to edit, unless you remember to not indent the string (or the region containing it).

Syntax checker doesn't work

I have syntastic installed, it works for other filetypes. Can't get it to work with this plugin. I don't get any errors, it just doesn't work.

Here's example:

fn main() {
    let x: i32 = "test";
}

When I'm trying to compile, I get:

test.rs:2:18: 2:24 error: mismatched types:
 expected `i32`,
    found `&'static str`
(expected i32,
    found &-ptr) [E0308]
test.rs:2     let x: i32 = "test";
                           ^~~~~~
error: aborting due to previous error

Saving file or running :SyntasticCheck doesn't do anything.

Here's :SyntasticInfo output:

Syntastic version: 3.6.0-86 (Vim 704, Darwin)
Info for filetype: rust
Global mode: active
Filetype rust is active
The current file will be checked automatically
Available checker: rustc
Currently enabled checker: rustc

Mention that syntastic is required

In gentoo, as root, I had to do:
time emerge -nav app-vim/syntastic (took ~46 seconds)
or else there were no errors in vim, but only syntax highlighting was working.

Having syntastic installed, syntax errors are now detected on save. (ie. rustc is ran with -Zparse-only on the saved file)

Rust conceal not work

let g:rust_conceal = 1 
let g:rust_conceal_mod_path = 1 

How to fix it?

How to bind it?
!= to ≢ or ≠
== to ≡
<= to ≤

= to ≥
=> to ⇒
-> to →
in to ∈
/ to ÷
|| to ∨
&& to ∧

How to deal with "for x in iterator"? ∀

does not work with neovim out of the box

Just trying to open a file with the hello_world example.

"hw.rs" 3L, 45C
Error detected while processing /Users/chr0n1x/.vim/bundle/rust.vim/ftplugin/rust.vim:
line   93:
E484: Can't open file /usr/local/Cellar/neovim/HEAD/share/nvim/runtime/macros/matchit.vim

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.