Skip to content
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

LexErrorlist fixes #293

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

eranif
Copy link

@eranif eranif commented Nov 29, 2024

I have been using LexErrorList as the lexer for the CodeLite's terminal emulator. I noticed some problems, mainly because the diff styling assumptions are a bit "aggressive": If a line starts with - then it is probably the output of git diff or diff .. command. This is true for many cases, but there are cases where this can be improved a bit.

Two case that I noticed:

  • When running ls -l command and the entry does not has the execute permission, then it will start with -
  • When running cmake and the output produces CMake's status message (generated by cmake's message(STATUS "something") calls

I have added 4 screenshots, 2 showing the problems before the fix, and 2 after the fix

  1. CMake status messages are styled as "DIFF_DELETE"
  2. ls -la output lines starting with -r are styled as "DIFF_DELETE"
cmake-status-bad ls-l-bad

After the fix:

cmake-status-good ls-l-good

- Better handling for CMake status messages
- Do not consider 'ls -l' output as "Diff deleted messages"

Signed-off-by: Eran Ifrah <[email protected]>
@nyamatongwe nyamatongwe added the errorlist Caused by the errorlist lexer label Nov 29, 2024
@nyamatongwe
Copy link
Member

This change is likely to reduce the usefulness of diff detection. "-r" will occur when there is a diff that includes changing or deleting lines that start with "r". "-- " occurs with diffs of diffs and diffs for languages that start lines with "-" like Objective C and Erlang. Diff highlighting is very useful to me and I suspect others.

This is part of the problem with context free styling of arbitrary command line sessions. There could be a property to turn off or deprioritize diff detection.

ls tabular output could be detected with high selectivity. Something like: at start exactly 10 of [-drwx], space, ... .

@eranif
Copy link
Author

eranif commented Nov 29, 2024

The same could be said about "line staring with ---... but this was still excluded and assumed as a "diff message", whats the difference here?

One could also claim that: ls -l is much more popular than running git diff or just plain diff, no?

ls tabular output could be detected with high selectivity. Something like: at start exactly 10 of [-drwx], space, ... .

The hyphen at the start means that that it is not a directory (d), otherwise the line would have start with d and not with -, i.e. this can happen only for non directory files. The next bit will always be r (if there is a "read" attribute to the file otherwise it will be --).

We could extend the pattern to something more unique than 2 chars, like -r- or -rw

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
errorlist Caused by the errorlist lexer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants