New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add option to control the message length in flycheck-error-list-mode #828
Comments
The error list does not constrain the length of error messages. The column has no maximum width, as such the message should never be truncated as long as there's still space left in the window. Can you show a screenshot of an undesired or faulty truncation? |
Here is a basic use case with pylint: https://i.imgur.com/E1LfKkr.png |
@vmalloc I'm sorry, but I do not see what the issue is in this screenshot. To me the message does not appear to be truncated; only the error ID is. Would you mind to annotate the screenshot to illustrate where exactly the problem appears? |
First, the ID is indeed truncated as well, but I'm not sure about the ellipsis in the error message. If it's not truncated - why the ellipsis? |
The full error for the first one should be |
Why do you think so? The text between the brackets is the error ID which we parse separately and not as part of the error message. The ellipsis comes from Tabulated List Mode; it does not indicate truncation. |
Don’t use ellipsis to not suggest truncation where none occurs. See GH-828
Yes! How do I configure it to appear that way?
|
@vmalloc You can't unfortunately. We change Flycheck to appear that way, but this change will only work on the not yet released Emacs 25 because the necessary customisation option is only available in this version. Implementing a similar change on earlier Emacs versions would amount to a re-write of parts of Tabulated List Mode, which is more effort than it is worth, at least as far as I'm concerned. @cpitclaudel If you agree I'd push this change. |
Looks good to me! (It's not obvious to me why |
This allows the message column to stretch arbitrarily far, without adding meaningless ellipsis. Fixes GH-828.
Btw, there may be a way to support this in Emacs 24.3 without duplicating code. IIUC the problem comes from the fact that we want the second to last column to be of unbounded width (instead of the last one, which has the checker). We thus declare it to be of width 0, which tricks truncate-string (called by tabluated-mode) into not actually truncating our string – but it still inserts these pesky "...". And IIUC, in Emacs 25 we can actually tell the string truncation function to use Here are potential solutions that would work in 24:
That last one is actually my favourite; I've implemented is in branch Note that this has one weakness: it doesn't let you sort by checker — that could well be a deal breaker. There might also be plugins out there that depend on the exact columns that flycheck's error list uses. |
Ok, I can wait until Emacs 25 ships for this. Thanks! |
@cpitclaudel I like the idea of combining both columns; in fact Flycheck used to do that initially, but moved to a separate column for the checker in #500. The reason was theming of the checker name, but if we can preserve that feature with a single column nothing stands against a single column, imho. |
@vmalloc The error message and the syntax checker are now in a single column, removing the redundant ellipsis. @cpitclaudel I merged your change, and updated the test cases accordingly. I took the opportunity to play with Buttercup; I found that it's really much much better than ERT for this kind of tests. I think I'll slowly port most—if not all—of our tests over to Buttercup specs, i.e. whenever I touch tests for a specific piece of Flycheck, I'll move them to buttercup first. It's really a lot easier to read and write |
Don’t use add-face-text-property, which was only introduced in 24.4 See GH-828
@lunaryorn Awesome! Thanks! |
@lunaryorn Thanks for polishing up the patch and merging it :) Indeed, the new tests look beautiful! |
@cpitclaudel You're welcome. Thanks for this nice solution! |
Currently messages are automatically truncated and often times make it hard to understand the issue. It seems that wider windows don't extend this truncation, so it would be very nice to have a configuration/customization option to change this behavior
The text was updated successfully, but these errors were encountered: