Closed kenlefeb closed 3 years ago
I too need some multi-line settings for my Factorio Mod Debug extension, which has templates for two auto-generated commit messages in settings (in the version i'm about to upload...). Same problem with \n
- it works fine if you set it directly in settings.json, but the GUI strips them and has no way to enter a newline.
I downloaded the top 2.5k extensions and did a search to see how string settings with \n
as part of the default value were being used. The settings are being used in one of three ways:
"wxapp-helper.component.script": {
"type": [
"string",
"null"
],
"default": "Component({\n data: {},\n properties: {},\n methods: {}\n})",
"description": "%ext.config.component.script%"
}
Another example is jupyter.runStartupCommands
, which could take in a block of Python commands.
In this case, we want to render a Monaco editor.
"todo.file.defaultContent": {
"type": "string",
"description": "New todo files default content",
"default": "\nTodo:\n ☐ Item\n"
}
Other examples include gitlens.hovers.detailsMarkdownFormat
and gitstash.explorer.labels.stashTooltipFormat
.
In this case, we want to render a multiline textarea.
"npm-intellisense.importLinebreak": {
"type": "string",
"default": ";\r\n",
"description": "For import command. The linebreak used after the snippet"
}
In this case, we want to render the \r and \n explicitly, rather than display a textarea with a trailing newline.
The others I saw which may be beyond the 2.5k top:
ctf0.laravel-goto-view
: laravelGotoView.viewDefaultValue
(default text for a file)flydreame.docblocker
: docBlocker.defaultTpl
(a template value)kortina.vscode-markdown-notes
: vscodeMarkdownNotes.newNoteTemplate
vscodeMarkdownNotes.newNoteFromSelectionReplacementTemplate
looks similarmikey.vscode-fileheader
: fileheader.tpl
(file header template)neptune-design.vs-html-to-css
: vs-html-to-css.append
(text to insert)seancheung.wxapp-helper
skip1.go-swagger
: swagger.tpl
TaoKlerks.poor-mans-t-sql-formatter-vscode
: poor-mans-t-sql-formatter.errorOutputPrefix
And several that are configuring line endings and are just \n
Just a note that for the line break settings, I assume most of them can do the following instead:
An example setting that can be remodelled to this pattern is npm-intellisense.importLinebreak
(from https://github.com/microsoft/vscode/issues/79571#issuecomment-864326119).
Edit: Or, the extension author can use a singleline text setting and parse the input like a regex. For example, the user could input \\r\\n
to get \r\n
newlines.
\closedWith be81d88
Issue Type: Bug
This is very similar to #39969, but for the new Settings UI.
I use an extension (
vscode-journal
) that allows you to define a template (settingjournal.tpl-entry
) for creating new files, and these require the use of\n
characters to specify new lines, however the Settings UI won't let me enter\n
(it gets escaped), let alone an actual newline character.VS Code version: Code 1.37.1 (f06011ac164ae4dc8e753a3fe7f9549844d15e35, 2019-08-15T16:17:55.855Z) OS version: Windows_NT x64 10.0.17763
System Info
|Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz (8 x 2112)| |GPU Status|2d_canvas: enabledflash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: disabled_software
oop_rasterization: disabled_off
protected_video_decode: enabled
rasterization: enabled
skia_deferred_display_list: disabled_off
skia_renderer: disabled_off
surface_synchronization: enabled_on
video_decode: enabled
viz_display_compositor: disabled_off
webgl: enabled
webgl2: enabled| |Load (avg)|undefined| |Memory (System)|15.81GB (5.67GB free)| |Process Argv|.| |Screen Reader|no| |VM|0%|
Extensions (25)
Extension|Author (truncated)|Version ---|---|--- whitespace-plus|dav|0.0.5 xml|Dot|2.5.0 EditorConfig|Edi|0.13.0 prettier-vscode|esb|1.9.0 markdown-table-formatter|fcr|1.4.3 gc-excelviewer|Gra|2.1.32 vscode-journal-view|Gru|0.0.25 vscode-guid|hea|1.4.15 vscode-peacock|joh|3.1.2 json-escaper|jos|1.1.0 chat|kar|0.21.0 vscode-language-babel|mgm|0.0.23 vscode-docker|ms-|0.7.0 remote-wsl|ms-|0.39.2 csharp|ms-|1.21.0 powershell|ms-|2019.5.0 vsliveshare|ms-|1.0.721 vsliveshare-audio|ms-|0.1.64 vsliveshare-pack|ms-|0.3.3 debugger-for-chrome|msj|4.11.7 debugger-for-edge|msj|1.0.11 vscode-journal|paj|0.9.1 vscode-redis|vit|1.2.0 markdown-pdf|yza|1.2.0 markdown-all-in-one|yzh|2.4.2 (1 theme extensions excluded)