Skip to content
This repository was archived by the owner on Aug 7, 2023. It is now read-only.
This repository was archived by the owner on Aug 7, 2023. It is now read-only.

Lint errors make it difficult to see code #83

Open
@sunjay

Description

@sunjay

screenshot from 2016-10-08 22-03-30

This is a screenshot of a function I'm in the middle of writing.

Here's the actual code in question:

    fn match_advanced_token(&mut self, start: char) -> TokenResult {
        if start.is_whitespace() {
            let spaces = String::new();

            let mut next_char = Some(start);
            while next_char.is_some() {
                let c = next_char.unwrap();
                if !c.is_whitespace() {
                    break;
                }

                spaces.push(c);
                next_char = self.scanner.get_char();
            }

            Ok(Token::Whitespace(spaces))
        }
    }

I'm not done writing the function yet, so there are a number of problems with it. The error being shown is complaining that not every return path results in the expected return type. This is a valid complaint, but because the error takes over the entire function and the bubble is impossible to dismiss, it's really difficult to write code.

Would it be possible to make the bubble dismissable somehow? Like just hit esc or something and tell it to leave me alone. Also, instead of highlighting every line in the function, could you just highlight one part and tell me the error?

For this specific error for example, you could just highlight the return type or the function name and complain that I'm not returning the same type in every control path. This is what a lot of linters like ESLint do.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions