Conversation
53 tasks
olafurpg
suggested changes
Apr 20, 2021
Contributor
olafurpg
left a comment
There was a problem hiding this comment.
The fix looks good. Can we add some test case to reproduce the issue?
We may need to disable javafmt in the minimized project so that we can write tab characters in the source files.
lazy val minimized = project
.in(file("tests/minimized/.j11"))
.settings(minimizedSettings)
.dependsOn(agent, plugin)
+ .disablePlugins(JavaFormatterPlugin)
lazy val minimized8 = project
.in(file("tests/minimized/.j8"))
.settings(minimizedSettings, javaToolchainVersion := "8")
.dependsOn(agent, plugin)
+ .disablePlugins(JavaFormatterPlugin)
lazy val minimized15 = project
.in(file("tests/minimized/.j15"))
.settings(minimizedSettings, javaToolchainVersion := "15")
.dependsOn(agent, plugin)
+ .disablePlugins(JavaFormatterPlugin)| return Optional.empty(); | ||
| } | ||
|
|
||
| return Optional.empty(); |
Contributor
There was a problem hiding this comment.
My brain is not wired anymore for statements, I can only think in expressions.
Contributor
Author
|
@olafurpg I've added a snapshot example just now. Thankfully as we're emitting char offset ranges as opposed to column offset ranges, it didnt require any changes to the snapshot printer to make everything line up just right 🙂 |
48 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously, ranges would be wrong for files indented with tabs or tabs&spaces.
This happened because javac replaces every tab with 8 spaces in the linemap. As this is potentially inconsistent with the source file itself, we adjust for that when building ranges if the line is actually indented with tabs.
As for every tab there are 8 spaces, we remove 7 spaces for every tab to get the correct char offset (note: different to column offset your editor shows)
Closes #115 and closes #169