-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add line number magic comment support #23549
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
base: main
Are you sure you want to change the base?
Conversation
@lihaoyi did you say you need two markers now? one for the end as well? |
for the mill use case in the past at least it needed 1 marker to tell the reporter the "original file" (where reporter should say error occurs only when its after the marker) and then one for start of user code, but mill also does insert code after the user script (so i guess another marker would tell the reporter that code after that is in the augmented file) |
I see. So the reporter should report file location according to that marker as well. |
I am not quite sure whether this PR is the right direction. The special handling logic is in |
@bishabosha we only really care about the marker for the start of the file's user-code, since the goal is to appropriately offset the line numbers, and a marker to indicate the full path of the original source file the user-code originated from. Mill uses separate markers for each: //SOURCECODE_ORIGINAL_FILE_PATH=/Users/lihaoyi/Github/mill/build.mill
//SOURCECODE_ORIGINAL_CODE_START_MARKER But I suppose we could just have a single marker that serves both purposes. We don't really need to have an marker for the end of the user-code, since that doesn't affect line numbers in user code @Linyxus to satisfy the original ticket, we should change the source position not just for error messages, but also info, warning, as well as macros like |
@@ -341,6 +341,7 @@ private sealed trait XSettings: | |||
val Xdumpclasses: Setting[String] = StringSetting(AdvancedSetting, "Xdump-classes", "dir", "Dump the generated bytecode to .class files (useful for reflective compilation that utilizes in-memory classloaders).", "") | |||
val XjarCompressionLevel: Setting[Int] = IntChoiceSetting(AdvancedSetting, "Xjar-compression-level", "compression level to use when writing jar files", Deflater.DEFAULT_COMPRESSION to Deflater.BEST_COMPRESSION, Deflater.DEFAULT_COMPRESSION) | |||
val XkindProjector: Setting[String] = ChoiceSetting(AdvancedSetting, "Xkind-projector", "[underscores, enable, disable]", "Allow `*` as type lambda placeholder to be compatible with kind projector. When invoked as -Xkind-projector:underscores will repurpose `_` to be a type parameter placeholder, this will disable usage of underscore as a wildcard.", List("disable", "", "underscores"), "disable", legacyArgs = true) | |||
val XmagicOffsetHeader: Setting[String] = StringSetting(AdvancedSetting, "Xmagic-offset-header", "header", "Specify the magic header comment that marks the start of the actual code in generated wrapper scripts. Example: -Xmagic-offset-header:///SOURCE_CODE_START", "") |
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.
I feel like it should be the in the Y
category, so the experimental and tooling specific
fixes #21919.