Code Monkey home page Code Monkey logo

proc-macro2-diagnostics's People

Contributors

hellow554 avatar sergiobenitez avatar tamird avatar techcable avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

proc-macro2-diagnostics's Issues

version-check update

Hi Sergio ๐Ÿ‘‹
Could you cut a new release of this crate with the latest version of version-check? I'm running into a version conflict with a few other libraries and it looks like the root of it is this library being pinned on 0.9.1.
If you'd like me to put up a PR I'm happy to do that.

ASCII color codes are displayed inline for editors

I'm using Rocket (which is awesome, BTW) and noticed that sometimes error messages in my editor would be mangled with ASCII color codes, making the error messages very hard to read.

In terminal:

Screenshot from 2023-08-11 16-16-58

In editor:

Screenshot from 2023-08-11 10-51-47

I thought this was an issue with rust-analyzer, since I do not see the ASCII color codes printed if I pipe cargo build into cat, so I posted an issue there. But the people over there say that it is caused by your implementation of Display here:

impl fmt::Display for Line<'_> {
#[cfg(all(feature = "colors", not(nightly_diagnostics)))]
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
use yansi::{Paint, Color};
let style = match self.level {
Level::Error => Color::Red.bold(),
Level::Warning => Color::Yellow.bold(),
Level::Note => Color::Green.bold(),
Level::Help => Color::Cyan.bold(),
};
let ((prefix, suffix), msg) = (self.kind.split(), self.msg.primary());
write!(f, "{}{}{}{}", prefix, self.level.paint(style), suffix, msg.bold())
}
#[cfg(not(all(feature = "colors", not(nightly_diagnostics))))]
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let (prefix, suffix) = self.kind.split();
write!(f, "{}{}{}{}", prefix, self.level, suffix, self.msg)
}
}

You should really read rust-lang/rust-analyzer#15443 first to get all of the context.

I have not yet wrapped my head around all the parts involved here, since I am pretty new to Rust. But I thought I'd post this here to see what you think.

Steps to reproduce

  1. Create the following crate:
cargo new -q foo
cd foo
cargo add -q [email protected]
cat <<EOF > src/main.rs
use rocket::UriDisplayPath;

fn main() {
    println!("Hello, world!");
}

#[derive(UriDisplayPath)]
pub enum Foo {
    Bar,
}
EOF
  1. Optionally run cargo check.
  2. Open src/main.rs with 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.