redhat-developer / redhat-developer/quarkus-ls

PropertiesParser: Inconsistent Property and PropertyKey end offset

Open
#260 2 comments 0 reactions 2 assignees View on GitHub

@datho7561 is already working on this.

Since Jun 16, 2021.

bug properties
Dominant language
Java
Stars
50
Forks
18
Avg merge
22h 11m
Merged PRs (30d)
3

Description

If the application.properties file looks like this:

exampleKey********

, where * represents whitespace, the Property and PropertyKey end offsets are different.

In the case above, the PropertyKey's start offset would be 0 and end offset would be 10. This range correctly captures the property key: exampleKey.

However, the Property's start offset would be 0 and end offset would be 18, which captures the property key and the whitespace that follows it.

To keep things consistent, it would be great if the Property's end offset matched the PropertyKey's end offset.

If this issue is fixed, here is a test case that should pass in com.redhat.microprofile.parser.PropertiesModelTest:

	@Test
	public void parsePropertyKeyWithTrailingSpaces() {
		String text = "exampleKey        ";
		PropertiesModel model = PropertiesModel.parse(text, "application.properties");
		assertModel(model, text.length(), 1);

		Node firstPropertyNode = model.getChildren().get(0);
		assertProperty(firstPropertyNode, 0, 10, 0, 10, "exampleKey", -1, -1, -1, null);
	}

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.