Skip to content

Long error message in ConciseView #10760

Closed

Description

@iSazonov

Come from #10746

image

Make sense to print error message on new line?

ParserError:
Line |
   1 | $a=Get-Process -Id $PID | Format-List * | Out-Default | Select-String "Container" | 0/1
     |                                                                                     ^ 
     | Expressions are only allowed as the first element of a pipeline.

Screenshot after I decrease windows width
image

Activity

  1. added
    Issue-Question
    WG-Engine
    on Oct 10, 2019
  2. SteveL-MSFT commented on Oct 10, 2019

    @SteveL-MSFT
    Member

    It may be worth considering also truncating lines longer than console width (adding ellipsis to indicate truncation) so that the relevant section is in the middle

  3. iSazonov commented on Oct 10, 2019

    @iSazonov
    CollaboratorAuthor

    Truncating error message? It makes it useless.

  4. SteveL-MSFT commented on Oct 10, 2019

    @SteveL-MSFT
    Member

    In most of these cases, you would already have the line of code on your screen so not necessary to repeat it.

  5. iSazonov commented on Oct 11, 2019

    @iSazonov
    CollaboratorAuthor

    My request is only about error message - to place it starting on new line.

  6. iSazonov commented on Nov 1, 2019

    @iSazonov
    CollaboratorAuthor

    Steve Lee (@SteveL-MSFT) Can you make a conclusion about my last comment?

  7. SteveL-MSFT commented on Nov 1, 2019

    @SteveL-MSFT
    Member

    cc Jason Helmick (@theJasonHelmick)

    When the position of the caret in the line is left of middle, I think it's better to have the message following the caret. However, I agree that when the caret is right of the middle, the wrapping makes it less pleasant. Perhaps one option is to use the middle to decide if the text should start on the next line?

  8. iSazonov commented on Nov 1, 2019

    @iSazonov
    CollaboratorAuthor

    Perhaps one option is to use the middle to decide if the text should start on the next line?

    I'd prefer a simple rule that I proposed above. With more complex logic we will catch many bugs - console output is not easy to make reliable for all terminals and all use cases.

  9. SteveL-MSFT commented on Nov 1, 2019

    @SteveL-MSFT
    Member

    Would like to get some more feedback before making any change

  10. SteveL-MSFT commented on Dec 18, 2019

    @SteveL-MSFT
    Member

    Note that with #11398, ConciseView now uses the pre-formatted PositionMessage which does truncation, so long lines will now be truncated. However, if the error is at the end of the line, then it's still not ideal:

    img

  11. rkeithhill commented on Dec 18, 2019

    @rkeithhill
    Collaborator

    Maybe you add another line here. Have the error position indicator on a line by itself (in red) and then on the next line always left justify the error message (in red)?

    ParserError:
    Line |
       1 | $a=get-process -id $pid | format-list * | out-default | select-string "container" | 0/1
         |                                                                                -----^----- 
         | Expressions are only allowed as the first element of a pipeline.
    

    Mocked up in notepad so I lost the coloring but you get the idea.

    Or maybe:

    ParserError:
    Line |
       1 | $a=get-process -id $pid | format-list * | out-default | select-string "container" | 0/1
         |                                                                                -----^----- 
    Expressions are only allowed as the first element of a pipeline.
    
  12. iSazonov commented on Dec 18, 2019

    @iSazonov
    CollaboratorAuthor

    First better.

  13. rkeithhill commented on Dec 18, 2019

    @rkeithhill
    Collaborator

    Also that indicator would need to be adjusted for begining (or near beginning) of the line to something like ^----- and at the end maybe -----^. You could get rid of the ----- chars and use just ^ but that might be a bit hard to spot.

  14. SteveL-MSFT commented on Dec 18, 2019

    @SteveL-MSFT
    Member

    Since I was using the pre-rendered PositionMessage anyways for a different fix, it sort of made sense to just use it for this one. So now with the PR, it looks like:

    img

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-QuestionResolution-FixedWG-Engine

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions