mirror of
https://github.com/irmen/prog8.git
synced 2025-02-18 20:30:43 +00:00
reduce error clutter for undefined symbols
This commit is contained in:
parent
b014facbd3
commit
45fe1bb16e
@ -33,6 +33,19 @@ internal class ErrorReporter(val colors: IConsoleColors): IErrorReporter {
|
||||
var numErrors = 0
|
||||
var numWarnings = 0
|
||||
var numInfos = 0
|
||||
|
||||
// For undefined symbol errors, remove all other errors and warnings on the same source line,
|
||||
// because those are very likely caused by the unknown symbol. This reduces error clutter.
|
||||
val undefinedSymbolErrors = messages.filter { it.severity == MessageSeverity.ERROR && it.message.contains("undefined symbol") }
|
||||
for(e in undefinedSymbolErrors) {
|
||||
messages.removeIf {
|
||||
it !== e
|
||||
&& (it.severity == MessageSeverity.WARNING || it.severity == MessageSeverity.ERROR)
|
||||
&& it.position.file == e.position.file
|
||||
&& it.position.line == e.position.line
|
||||
}
|
||||
}
|
||||
|
||||
messages.sortedWith(compareBy({it.position.file}, {it.position.line}, {it.severity})).forEach {
|
||||
val printer = when(it.severity) {
|
||||
MessageSeverity.INFO -> System.out
|
||||
|
@ -10,7 +10,6 @@ TODO
|
||||
Future Things and Ideas
|
||||
^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
- reduce the number of collateral errors reported for undefined symbols
|
||||
- Kotlin: can we use inline value classes in certain spots?
|
||||
- Improve the SublimeText syntax file for prog8, you can also install this for 'bat': https://github.com/sharkdp/bat?tab=readme-ov-file#adding-new-syntaxes--language-definitions
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user