nextflow-io / nextflow-io/language-server

Wrap long lines based on line length

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

Nobody has claimed this yet.

formatting
Dominant language
Java
Stars
31
Forks
8
Avg merge
1d 10h
Merged PRs (30d)
2

Description

Primarily for list and map expressions, but could also apply to function calls and property chains. The best heuristic for deciding whether to wrap a statement seems to be if the statement is "too long" e.g. greater than 80 characters. But the visitor + string builder approach makes this difficult, because you don't know the line length until you already appended the line.

A simple approach would be to (1) produce the line with no wrapping (2) check the length of the line (3) re-do the line with wrapping if the unwrapped line was too long.

Ideally we would reuse the pieces instead of computing them twice, and also be able to handle nested expressions intelligently. Not yet sure what all that entails.

Until then, a simpler heuristic is the number of elements (e.g. wrap if more than 3 elements), but I suspect it might be just wrong enough to be annoying.

Contributor guide

No contributing guide indexed for this repository

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

Start by tracing the visitor and string builder responsible for rendering list and map expressions, then check how function calls and property chains are handled. The work is complete when statements exceeding the chosen line-length threshold wrap consistently, including nested expressions, with tests covering the supported expression types.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
devtools
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.