Git Product home page Git Product logo

rust-enhanced's Introduction

Rust Enhanced

About

Rust Enhanced is a Sublime Text package which adds extended support for the Rust Programming Language. This is a replacement for the built-in "Rust" package and provides several extensions:

  • Enhanced syntax highlighting which handles more recent language changes and improved highlighting.
  • A custom build system with complete configuration of running Cargo and supporting Rust's extended error messages.
  • Automatic checking every time you save a file.
  • Custom highlighting for Cargo output.

Running Tests with Rust Enhanced Highlighting errors and warnings with Rust Enhanced

Installation and Usage

See the Rust Enhanced User Guide for complete information on installing and using this package.

Contributing

Development is quite simple, first uninstall "Rust Enhanced" if you already have it installed. Then, check out this project to your Sublime Text Packages folder.

Syntax definitions are defined in the RustEnhanced.sublime-syntax file, and syntax tests are in the tests/syntax-rust directory.

The PackageDev package is highly recommended for doing development.

Credits

Created 2012 by Daniel Patterson, as a near complete from scratch rewrite of a package by Felix Martini.

This project is currently maintained by Eric Huss

License

This package is licensed under the MIT License.

rust-enhanced's People

Contributors

bonifaido avatar bors[bot] avatar brendanzab avatar brson avatar c0gent avatar dbp avatar derekchiang avatar dten avatar ehuss avatar gbersac avatar jacius avatar jasonwilliams avatar jhasse avatar keith-hall avatar kokakiwi avatar petrochenkov avatar pravic avatar pseitz avatar rprichard avatar rroels avatar spamwax avatar steveklabnik avatar tesuji avatar theironborn avatar thinkofname avatar tim3z avatar urschrei avatar uupis avatar wbond avatar whitequark avatar

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

rust-enhanced's Issues

More standard libc types/constants to be highlighted

Many standard libc types are already highlighted (e.g. c_int, ssize_t, FILE), however there's a lot more, like uint64_t etc: http://web.mit.edu/rust-lang_v0.11/doc/libc/index.html

The ones I noticed so far (mostly from stdint):

int8_t
int16_t
int32_t
int64_t
uint8_t
uint16_t
uint32_t
uint64_t
dirent_t
suseconds_t
wchar_t

Constants:

S_IFLNK

For the sake of consistency, maybe these constants as well:

pub use consts::os::posix88::{PROT_READ, PROT_WRITE, PROT_EXEC};
pub use consts::os::posix88::{MAP_FIXED, MAP_FILE, MAP_ANON, MAP_PRIVATE, MAP_FAILED};
pub use consts::os::posix88::{EACCES, EBADF, EINVAL, ENODEV, ENOMEM};
pub use consts::os::posix88::{ECONNREFUSED, ECONNRESET, EPERM, EPIPE};
pub use consts::os::posix88::{ENOTCONN, ECONNABORTED, EADDRNOTAVAIL, EINTR};
pub use consts::os::posix88::{EADDRINUSE, ENOENT, EISDIR, EAGAIN, EWOULDBLOCK};
pub use consts::os::posix88::{ECANCELED, SIGINT, EINPROGRESS};
pub use consts::os::posix88::{ENOSYS, ENOTTY, ETIMEDOUT, EMFILE};
pub use consts::os::posix88::{SIGTERM, SIGKILL, SIGPIPE, PROT_NONE};
pub use consts::os::posix01::{SIG_IGN};

Build using Cargo

I added a new issue for this seems it seems to be a different cause.

ST 3, Rust plugin, tried building using Cargo and I got this:

[Errno 2] No such file or directory: 'cargo'
[cmd: ['cargo', 'build']]
[dir: /Users/dutt/workspace/rust/gridwar/src/entities]
[path: /usr/bin:/bin:/usr/sbin:/sbin]
[Finished]

Which is understandable, since I get this:

dutt$ which cargo
/usr/local/bin/cargo

How do I edit the path used by the plugin?

Syntax checking doesn't account for light themes

I'm using the eiffel theme for my rust code and when I syntax check with a warning I get the following:

image

I'm sure it's possible but I'm not sure how to change the colour theme for these errors.

SSL issue when installing Rust via Package Control

Here's the error I get when trying to install this package via Package Control in the latest ST3 dev build:

Package Control: Error downloading package. HTTP exception InvalidCertificateException (Host codeload.github.com returned an invalid certificate ([SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:550)) ) downloading https://codeload.github.com/jhasse/sublime-rust/zip/master.

Rustup breaks this package

Switching from brew to rustup causes this package to break
by default this package checks the typical paths /bin:/usr/bin etc but rustup puts rust in ~/.cargo/bin

I've tryed adding that folder for the path: but it doesn't seem to be working for me.
Would love to see if anyone can get this working

Rust build paths:

    "osx":
    {
        "path": "/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin"
    },

When i try changing the path in https://github.com/rust-lang/sublime-rust/blob/master/Rust.sublime-build and reload the plugin, the path is still the same.

As you can see in the images, even though i add a new path to the end, it does not reflect when running the plugin. I've tried adding a lot of different paths.

screen shot 2016-10-05 at 11 41 29

screen shot 2016-10-05 at 11 40 22

Is this a bug within Sublime 3 itself? @FichteFoll @wbond
Build: 3125

Note:
This issue has also been mentioned in #22

Cargo build system fails

When I try to Build or Run using the Cargo build system, the status bar says "Building" but nothing shows up on the console.
Commenting out the "syntax" specification (line #4 in the Cargo.sublime-build file) fixes the issue, at least on my system.

Environment:
Windows 7 64-bit
rustc 0.12.0-nightly (740905042 2014-09-29 23:52:21 +0000)
cargo 0.0.1-pre-nightly (2d101e2 2014-10-09 19:44:57 +0000)
Sublime Text 2 Version 2.0.2, Build 2221

Module declaration shows "file not found"

When defining a module in a lib.rs or mod.rs file, the module name is always highlighted red. The corresponding error message is "Error: file not found for module xxx" with xxx beeing the name of the module. However, compiling and executing works just fine.

faild to build any rust source code

After I pressed ctrl+B or click the menu compile, nothing happend.
I checked the Rust.sublime-build, the file content was written like this
selector:source.rust
Is it a correct form? or I should change it to source.rs?
Also, how can I use cargo as a compile and run tool?
looking forward to any solution

Highlighting config conflicts with default Sublime Text highlight settings

Both the default syntax highlighting and the highlighting included in this package are named Rust, leading to a naming conflict where the built-in highlights take priority. Because they are named the same, any attempts to rebind back to the highlights included in this package fail. This could probably be fixed by renaming these highlights to "Rust Enhanced", removing the naming conflict.

Scope cargo build to just rust files

I have other projects in sublime in Go, PHP and Javascript. Therefore my build system is set to automatic.
Yet when I hit build (ctrl+b) cargo options always comes up instead of just building.

Can we scope cargo builds to just rust projects please?
Maybe add selector.rust in the cargo build file?

Looking for a new maintainer

I have switched to Atom for developing in Rust. Therefore would be great if someone else wants to maintain this package :)

Possible Rust error format updates and IDE support

Hi all,

Sorry to use the issue tracker as a message box, but I wanted to mention that we're working on a possible update to the compiler error output: rust-lang/rfcs#1644 This might have an impact on the sublime plugin if you all happen to be parsing the compiler output.

That said, we're also thinking about standardizing a JSON format, so IDEs can get more information from the compiler (and not have to parse the error).

Would love to chat and hear your thoughts.

print! and println! macros

Thanks for this package! I don't see the print! or println! macros in master but I think they would be handy.

<snippet>
    <content><![CDATA[
print!("${1}"${2:, ${3:args}})
]]></content>
    <scope>source.rust</scope>
    <tabTrigger>print!</tabTrigger>
    <description>print! macro</description>
</snippet>

and

<snippet>
    <content><![CDATA[
println!("${1}"${2:, ${3:args}})
]]></content>
    <scope>source.rust</scope>
    <tabTrigger>println!</tabTrigger>
    <description>println! macro</description>
</snippet>

`self` keyword is not highlighted

For example, given a function

fn distance(self, other: Vec3f) -> f64 {
    (self - other).length()
}

self does not appear highlighted as other keywords would.

Improve file mapping between Rust/Cargo and Sublime

Currently, the plugin can't always provide a good mapping between filenames associated with error messages and filenames open in the editor. Reasons this might fail:

  • Use of the #[path] attribute with ../ in it
  • Symbolic links
  • (possibly others)

Improve rust symbol define

Currently only the functions are defines as symbol (you can see them by using ctrl+r or ctrl+shift+r). It could be great to have function and [struct/enum] and functions.

so the following code :

struct Aaa {
    field1: i32,
}

impl Aaa {
    pub fn new (f1: i32) -> Aaa {
        // code here
    }

    fn another_fn() {
        // code here
    }
}

impl Display for Aaa
{
    fn fmt(&self, f: &mut Formatter) -> Result<(), Error> {
        // code here
    }
}

would be converted, on the goto symbol pallet :

struct Aaa
impl Aaa
    new
    another_fn
impl Display for Aaa
    fmt

Nested block comments

Hey, I just found, that Rust supports nested block comments like

/* a comment /* within a comment */ that's cool */

But the part that's cool */ is highlighted as if it was code. (Don't know if this is even possible to accomplish with Sublime's syntax definitions, a very quick google search didn't find anything)

create temp file automatically

when I edit rs file, sublime create a lot of temp file .menu tree like this
(fail to upload a picture :( ):
main.rs
tmp9tzn72
tmpaeu3zy
tmphhg8wt
tmprjw53i
tmpurpnft
tmpv63r4d
but when I edit other kinds of files,such as py and html,there is no temp file made;
so I afraid that I can do something with the sublime-rust settings.

Syntax highlighting breaks in #[doc=""] blocks

See the snippet below. This snippet is a documentation block in a Rust source file which contains a code example. As such the sublime-rust parser isn't able to recognize the code example separately. This is manageable. But a bigger issue is: since there is a ] present in the code block, the parser thinks that the #doc block has finished there itself. This breaks the syntax highlighting completely for the rest of the file. The solution I can think of at this moment is that [doc=" should be matched with "] for closing the documentation block. Don't know how is it implemented internally.

#[doc="Returns a 64-bit signed integer matrix whose entries are
picked up from a slice in column wise order.
    let m = matrix_i32(2,2, [1,2,3,4]);
    for i in range(0, 4){
        let c = i >> 1;
        let r = i & 1;            
        assert_eq!(m.get(r, c), (i + 1) as i32);
    }
"]

Console displays full path when building

Given I have a rust source file which would emit a warning,
When I trigger the build from within Sublime,
Then the console displays the whole path for the source file.

/Users/kostaskarachalios/Code/Learning/Rust/for Rubyists/fizzbuzz.rs:15:13: 15:23 warning: variable does not need to be mutable, #[warn(unused_mut)] on by default
/Users/kostaskarachalios/Code/Learning/Rust/for Rubyists/fizzbuzz.rs:15         let mut answer =
                                                                                    ^~~~~~~~~~

On the other hand, when I do the same with rustc, it only displays the file's name.

fizzbuzz.rs:15:13: 15:23 warning: variable does not need to be mutable, #[warn(unused_mut)] on by default
fizzbuzz.rs:15         let mut answer =
                           ^~~~~~~~~~

Disable single quote auto-pairing.

Because lifetimes.

{ "keys": ["'"], "command": "insert_snippet", "args": {"contents": "'"}, "context":
    [{ "key": "selector", "operator": "equal", "operand": "source.rust" }]
},

'let mut' snippet

please, add letm.sublime-snippet

<snippet>
    <content><![CDATA[let mut ${1:pat} = ${2:expr};]]></content>
    <tabTrigger>letm</tabTrigger>
    <scope>source.rust</scope>
    <description>let mut … = …;</description>
</snippet>

Syntax highlighting seems to have stopped working

I have no idea how to debug this further, but the plugin seems to have stopped working. I tried un-installing and re-installing but no joy. This happened a few days ago, before I installed the most recent Sublime update, no change after updating.

Post-save error highlight doesn't work when project contains both main.rs and lib.rs

Looks like if a project contains both src/main.rs and src/lib.rs, post-save error highlight doesn't work. If I run the cargo rustc command manually it just fails with the following error.

$ cargo rustc -- -Zno-trans -Zunstable-options --error-format=json
error: extra arguments to rustc can only be passed to one target, consider filtering
the package by passing e.g. --lib or --bin NAME to specify a single target

I have to add either --lib or --bin for the rustc command to work.

$ cargo rustc --lib -- -Zno-trans -Zunstable-options --error-format=json # works
$ cargo rustc --bin [BIN-NAME] -- -Zno-trans -Zunstable-options --error-format=json #works

Also setting RUSTFLAGS with "cargo build" seems to work -- should the plugin switch to it??

$ RUSTFLAGS="--error-format=json" cargo build # this also seems to work

Syntax highlight error

qq20141029-1 2x

The last line of doc has nothing after ///.

If I added something after that, such as a blank space: ///, or a blank line, the next line will not be treated as doc/comment.

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.