Skip to content

Fix incorrect line reporting for mixed indentation errors#118111

Open
vixxi77 wants to merge 1 commit intogodotengine:masterfrom
vixxi77:fix-indent-error-line
Open

Fix incorrect line reporting for mixed indentation errors#118111
vixxi77 wants to merge 1 commit intogodotengine:masterfrom
vixxi77:fix-indent-error-line

Conversation

@vixxi77
Copy link
Copy Markdown

@vixxi77 vixxi77 commented Apr 2, 2026

Fixes #118004

Tokenizer did append correct error data to the token, but the parser ignored the errors location and only forwarded the error message. As a result the reported line would come from the parsers current location rather than the location of the actual error.

This change adds a push_error(const GDScriptTokenizer::Token &p_token) overload function, without touching the old API, allowing for the full use of the error tokens data.

Also tested:

  • Mixed indentation inside functions, if blocks, and lambdas.
  • Standard parser errors still report correct locations.

Steps to reproduce

  1. Create a new project and a script.
  2. Add this code to the script:
gdscript
func foo() -> int:
	var bar: int = 2 # Tab  <- Error shown here
    return bar # 4 spaces   <- But should be here

Screenshots

Before:
2026-04-02-124313_1089x295_scrot

After:
2026-04-02-123838_1084x295_scrot

@vixxi77 vixxi77 requested a review from a team as a code owner April 2, 2026 10:23
@dalexeev dalexeev added this to the 4.7 milestone Apr 2, 2026
@vixxi77 vixxi77 force-pushed the fix-indent-error-line branch from f988f8e to a8e7125 Compare April 2, 2026 11:23
@vixxi77 vixxi77 force-pushed the fix-indent-error-line branch from a8e7125 to c6f9cb0 Compare April 2, 2026 11:29
@vixxi77 vixxi77 force-pushed the fix-indent-error-line branch from c6f9cb0 to b9a0db2 Compare April 2, 2026 11:31
Copy link
Copy Markdown
Member

@dalexeev dalexeev left a comment

Choose a reason for hiding this comment

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

Looks good to me. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect error line when using spaces instead of tabs for indentation.

2 participants