-
-
Notifications
You must be signed in to change notification settings - Fork 111
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
feat(developer): support line numbers for LDML compiler errors #10622
Comments
Sorry, I was in file mode and didn't see this:
right, I'm not sure how we can get that out of the xml parser though. What I did for CLDR is have the parser record a xpath-to-line number mapping, with a custom SAX parser. If we had something similar here ( My point is that where the error actually occurs there isn't any context of the actual XML, but it might have enough section-relative data to be able to construct an xpath. The slightly-related topic here is that we could also deduplicate errors at that point as well, particularly errors on the same part of the XML. "This key has these errors.." What do you think? |
Relates to #8616 (comment) and choices we make in the future. Sounds like maintaining line/char position could be a required feature for our xml parser of choice?
So tracking context throughout the compiler would also be helpful -- whether we do that by xpath or by line/char, either will work. This is also going to be useful for interactive debugging, assuming we go there (which would be a new section in the KMXPlus format). |
Perhaps we could use JavaScript symbols for the Line information, similar to what I'm already doing for import information |
export interface CompilerEvent {
filename?: string;
line?: number;
code: number;
message: string;
/**
* an internal error occurred that should be captured with a stack trace
* e.g. to the Keyman sentry instance by kmc
*/
exceptionVar?: any;
}; filename/line aren't currently used, at least by ldml. I kind of wonder if they should be an array, that way there could be multiple lines/files with the same error? But, that could be coalesced later. Also an xpath or something could go into this struct. |
They are used by the other compilers though! I like the simplicity of this structure as it is. Adding an xpath could be useful but xpath needs to be translated back to file+line for editor use anyway. |
#10733 is a dup. Example of unhelpful message:
See comments on that issue for additional work here. |
Moving to A18S19, blocked by #5016 |
Our messages (errors, hints, and warnings) don't have line numbers at present, which is going to be quite painful for users!
Originally posted by @mcdurdin in #10614 (comment)
The text was updated successfully, but these errors were encountered: