sql-formatter-org / sql-formatter-org/sql-formatter

Feature Request: Line break before or after "+"

Open
#796 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature
Dominant language
TypeScript
Stars
2.9k
Forks
456
Avg merge
3d 4h
Merged PRs (30d)
3

Description

Describe the Feature
When building a long string in a script for insert or update, I like to break it into logical chunks for readability and easy maintenance. Also, VSCode does not like really long single-line strings. Something like this:

declare @longString nvarchar(max) = '';

set
    @longString = @longString +
	'{"JsonObject": [{' +
	'"JsonField1": {"Name": "JsonValue1"},' +
	'"JsonField2": {"Name": "JsonValue2"},' +
	'"JsonField3": {"Name": "JsonValue3"},' +
	'"JsonField4": {"Name": "JsonValue4"}' + 
	'}]}';


update MyTable set MyColumn = @longString where...

At this time, when formatting with this extension, the formatter joins all these lines onto a single line.

Why do you want this feature?
I'd like to keep my strings readable and not have the issue with VSCode an long strings.

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

No files or tests are named in the issue. Reproduce the formatter's output with the provided SQL string, then locate the string-concatenation formatting entry point. Done means formatting preserves or supports readable line breaks around "+" without joining the example into one long line, with regression coverage for that case.

Written by the indexing model from the issue text.

Assessment

Tech stack
sql, typescript
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.