feat: Add "Copy as SQL List" context menu commands for SQL editors#529
Open
bobcozzi wants to merge 1 commit intocodefori:mainfrom
Open
feat: Add "Copy as SQL List" context menu commands for SQL editors#529bobcozzi wants to merge 1 commit intocodefori:mainfrom
bobcozzi wants to merge 1 commit intocodefori:mainfrom
Conversation
Adds two new right-click editor commands for SQL files when text is selected: - 'Copy as SQL List' - instant clipboard copy using user settings - 'Copy as SQL List (Prompt Format)' - QuickPick with format options Values are single-quoted and internal single quotes are escaped (SQL-safe). When the selection contains numeric values, additional unquoted variants are offered in the prompt. New settings: vscode-db2i.delimitedList.quoteNumbers (default: true) vscode-db2i.delimitedList.wrapInParentheses (default: false) Addresses community request: https://chat.ibmioss.org/#narrow/channel/8-vscode/topic/Seb's.20Extension.20Example.20Part.20deux/with/4188
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds two new right-click context menu commands to SQL editors, available whenever text is selected. This addresses a feature request from the IBM i OSS community where users wanted a quick way to convert a plain newline-separated list of values (e.g. product codes, order numbers) into a SQL-friendly quoted, comma-separated list for use in
INclauses and similar constructs — without leaving VS Code to use another tool like dBeaver.New Commands
Db2 for i: Copy as SQL ListInstantly copies the selected newline-separated values to the clipboard using the user's current settings. No prompt — fast path for users who code quickly and want a single keystroke-style experience.
Db2 for i: Copy as SQL List (Prompt Format)Shows a QuickPick menu with format options before copying. When the selection contains numeric values, additional unquoted variants are offered:
'S10_1678', 'S10_1949', 'S10_2016''ABC', 123, 'DEF'('S10_1678', 'S10_1949', 'S10_2016')('ABC', 123, 'DEF')Both commands only appear in the context menu and command palette when a SQL file has an active text selection (
editorLangId == sql && editorHasSelection).New Settings
vscode-db2i.delimitedList.quoteNumberstruevscode-db2i.delimitedList.wrapInParenthesesfalseImplementation Notes
''(e.g.O'Brien→'O''Brien')clipboard.writeText()failures surface a descriptive error message rather than failing silentlysrc/language/clipboard.ts— follows the sameinitialise(context)pattern assrc/language/json.ts