Skip to content

Conversation

van800
Copy link
Member

@van800 van800 commented Oct 7, 2025

I am investigating an issue with the following codes.
It seems that parser remaps DEDENT-s inside func(): too agressively thus in GdStmtParser#suite we exit on the second line if (!b.nextTokenIs(NEW_LINE)).

func asd():
	print(
		func():
			if 0 > 0:
				pass
			elif 0 < 0:
				pass
	)

and

	lifetime.timeout.connect(func():
		if is_instance_valid(projectile):
			projectile.queue_free()
			print("Projectile freed")
	)

@van800 van800 requested a review from Copilot October 7, 2025 12:24
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a parsing issue where inline lambda functions as constructor arguments were causing errors when parsing subsequent arguments in GDScript.

  • Improved argument list parsing to properly handle whitespace and newlines after commas
  • Added a dedicated method for skipping whitespace within argument lists
  • Added test coverage for the callable constructor scenario

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
callableInCtor.gd Test case demonstrating inline lambda in constructor call
callableInCtor.txt Expected parse tree output for the test case
GdGodotTest.kt Added test method for the callable constructor scenario
GdArgListParser.kt Fixed whitespace handling in argument lists to resolve parsing errors

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@van800 van800 force-pushed the RIDER-130140-GDScript-Inline-lambdas branch from b2987b0 to 87b32b7 Compare October 7, 2025 14:13
@van800 van800 requested a review from Copilot October 7, 2025 14:13
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 26 out of 26 changed files in this pull request and generated 2 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@van800 van800 force-pushed the RIDER-130140-GDScript-Inline-lambdas branch from 87b32b7 to 4c4ee55 Compare October 7, 2025 14:15
@van800 van800 requested a review from Copilot October 7, 2025 14:18
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 26 out of 26 changed files in this pull request and generated no new comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@van800 van800 requested a review from ForNeVeR October 7, 2025 14:21
@van800 van800 changed the title fix RIDER-130140 GDScript: Inline lambdas as callable args cause pars… fix RIDER-130140 GDScript: Inline lambdas parsing Oct 7, 2025
@DSteve595
Copy link
Contributor

This seems to fix broken lambda parsing in my project! Haven't checked every single lambda yet (still lots of red in my project) but it's a big improvement.

@DSteve595
Copy link
Contributor

I did find another lambda parsing issue, filed RIDER-131046

@JetBrains JetBrains deleted a comment from Copilot AI Oct 8, 2025
@van800 van800 changed the title fix RIDER-130140 GDScript: Inline lambdas parsing fix RIDER-130140 GDScript: parsing fixes Oct 8, 2025
@van800 van800 marked this pull request as draft October 8, 2025 13:47
@van800
Copy link
Member Author

van800 commented Oct 10, 2025

likely need to change gd.frlex
in a way that inside lambdas and brakets, curly brakets indentation is ignored until we are in a statement like "if"

	d = {22:

        "value"

	,

   "some_key"

		: 		func():
			if 0 > 0:
				pass
				pass
			elif 0 < 0:
				pass
				pass
				,
		"other_key": [2, 3, 4],
		"more_key": "Hello"
	}

@van800 van800 mentioned this pull request Oct 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants