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

[VSCODE] Not working with Format Selection and Format Selection With

Open
#232 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

<Transferred from inferrinizzard/prettier-sql#88>

Describe the bug

It doesn't work with partial text selection to format.

When using "Format Selection" and prettier-sql is your default formatter for sql I get the following warning/error:
"Visual Studio Code
Configure Default Formatter
Extension 'Prettier SQL VSCode' is configured as formatter but it cannot format 'SQL'-files
[Configure...] [Cancel]"

When using "Format Selection With..." The option to use "prettier-sql" don't show up in VSCode dialog to choose a formatter

To Reproduce
Steps to reproduce the behavior:

  1. Set Prettier SQL as default formatter in VSCODE settings JSON:
    "[sql]": {
    "editor.defaultFormatter": "inferrinizzard.prettier-sql-vscode"
    }

  2. Open or create an SQL document

  3. Select some text on the document

  4. Click mouse right button for context menu

  5. Select "Format Selection"

  6. See Warning/error

  7. Choose "Cancel"

  8. Repeat step 3 and 4

  9. Select "Format Selection With..."

  10. check that "prettier-sql" don't show up in VSCODE dialog

Expected behavior
prettier-sql should be able to format selected text on the sql documet

Screenshots
N/A

Usage

  • What SQL language(s) does this apply to? any
  • What VSCode version are you using? 1.67.2
  • What are your currently configured VSCode settings for the prettier-sql extension, if relevant to the issue? Not relevant

Additional context
N/A

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

Start by reproducing the problem in VS Code using the shown [sql] default-formatter setting, a SQL document, and a partial selection. Investigate how the Prettier SQL VSCode extension registers formatting support for SQL selections and verify both “Format Selection” and “Format Selection With...” workflows. Done means selected SQL can be formatted and the extension appears as an available formatter.

Written by the indexing model from the issue text.

Assessment

Tech stack
sql, typescript, vscode
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.