eclipse-xtext / eclipse-xtext/xtext

Formatting partially selected lines does not correct indentation

Open
#2,300 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug confirmed
Dominant language
Java
Stars
831
Forks
330
Avg merge
3d 7h
Merged PRs (30d)
12

Description

class Test {
	def void main() {
	println("Foo");
	println("Bar");
	}
}

If you select the third line from println up until println on the fourth line and format the file, only the indentation of the fourth line will be fixed.

In Java the indentation of both lines would be fixed. Is there a particular reason why you chose not to follow the same behaviour? In my opinion it would be better if both lines were indented. It seems natural to me that when you're "randomly" selecting multiple lines you want to perform an operation on all of these lines.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with the Java-like snippet by selecting from the third line through the fourth and formatting the file. Trace the formatting behavior for partially selected lines; done means both selected lines receive corrected indentation, matching the described Java behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.