Skip to content
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

[WIP] Align pretty-printed diagnostic messages with source code that uses horizontal whitespace characters other than space (U+0020) #167

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

WowbaggersLiquidLunch
Copy link

I noticed a few problems with the pretty-printed diagnostics.

Given a short Tokamak program as follows:

import TokamakShim

struct TokamakApp: App {
	var body: some Scene {
		WindowGroup("Tokamak App") {
			ContentView()
		}
	}
}

struct ContentView: View {
	var body: some View {
		VStack {
			Button("foo", action: nil)
			Button("字符串", action: nil)
		}
	}
}

Ni!

TokamakApp.main()

carton dev provides the following diagnosis:

Screen Shot 2020-11-11 at 13 56 16

The most noticeable problem in the diagnostics is that the "^"s don't point to where the errors actually are. This pull request intends to address this problem by first stripping all leading whitespace in the pretty-printed source code, then copying any remaining whitespace verbatim to the indentation before each "^".

Some other problems include duplicated error messages and out-of-order diagnosis. I intend to address them in follow-up PRs.

@WowbaggersLiquidLunch WowbaggersLiquidLunch marked this pull request as draft November 11, 2020 19:12
@WowbaggersLiquidLunch
Copy link
Author

There are still some test cases to be added.

@WowbaggersLiquidLunch
Copy link
Author

There isn't much documentation to go by in the source. @carson-katri, since you are the author of #122, it will be great if you could take a look at the changes and see if things are done correctly.

@MaxDesiatov MaxDesiatov requested review from carson-katri and a team November 11, 2020 19:17
@MaxDesiatov MaxDesiatov added the bug Something isn't working label Nov 11, 2020
@MaxDesiatov MaxDesiatov removed the request for review from a team November 11, 2020 19:18
Copy link
Member

@carson-katri carson-katri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM except for the few linter errors, and the placeholders in the flush function's doc comment. Thanks for the fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants