-
Notifications
You must be signed in to change notification settings - Fork 47
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
Use in-memory source code for diagnostic printing #217
Conversation
…ntents, and allowing in-memory files to be used, not failing when there is no content, and improving efficiency
src/ProgramBuilder.ts
Outdated
let severity = typeof diagnostic.severity === 'number' ? diagnostic.severity : DiagnosticSeverity.Error; | ||
//format output | ||
printDiagnostic(options, severity, filePath, lines, diagnostic); | ||
try { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should not be wrapping and then throwing away any runtime exceptions that happen here...that would cause even more confusion for plugin authors and developers because there wouldn't even be runtime error messages or stack traces if something went wrong.
//load the file text | ||
let fileText = await util.getFileContents(pathAbsolute); | ||
let lines = util.getLines(fileText); | ||
const file = this.program.getFileByPathAbsolute(pathAbsolute); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This loads the file contents from the in-memory BrsFile/XmlFile. Previously the contents were being loaded from disk, which does not work for in-memory-only files injected by plugins.
improves diagnostic printing, by going to program to retrieve file contents, and allowing in-memory files to be used, not failing when there is no content, and improving efficiency