vscode-swift icon indicating copy to clipboard operation
vscode-swift copied to clipboard

Report errors in Package.swift in problems view

Open adam-fowler opened this issue 3 years ago • 5 comments

If swift package describe returns errors we should report these in the problems view

adam-fowler avatar Dec 08 '21 09:12 adam-fowler

This could be resolved by #25 which posts errors created by the resolve operation

adam-fowler avatar Dec 09 '21 16:12 adam-fowler

This is problematic as swift package resolve does not return errors in a standard format. We cannot extract the file name for the Package.swift from the error given it only includes the folder the Package.swift is in

adam-fowler avatar Dec 24 '21 11:12 adam-fowler

@adam-fowler can you tell us more about the kind of structured information you would want? maybe that is something we can add / change in SwiftPM

cc @abertelrud

tomerd avatar Jan 04 '22 17:01 tomerd

@adam-fowler can you tell us more about the kind of structured information you would want? maybe that is something we can add / change in SwiftPM

cc @abertelrud

Most error strings are of the format.

${filename}:${linenumber}:${column}: [error/warning]: ${message}

This is the kind of error a problem matcher is expecting. It uses regular expressions to extract all the details it needs. Syntax errors in a Package.swift produce something similar.

If you have something like a version clash or bad dependency in a Package.swift you get an error in a different form

$(folder) error: ${message}

I can't extract the Package.swift filename from this.

There are two things that'd help here

  1. The error string should always include the full filename (not just the folder). This is a simple change
  2. If you can extract the offending line, column numbers for version clashes etc report that as well. This I imagine is not so easy

adam-fowler avatar Jan 04 '22 18:01 adam-fowler