Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to newline in vscode.window.showInformationMessage

I want to use vscode.window.showInformationMessage to show some message. But I cannot newline in it.

What I want:

title:xxx
description:xxx

I actual get:

title:xxx description:xxx

My code:

vscode.window.showInformationMessage("title:xxx\ndescription:xxx");

enter image description here

like image 946
CoreZz Avatar asked Jan 22 '19 01:01

CoreZz


People also ask

How do I print a new line in Visual Studio Code?

In the local searchbox ( ctrl + f ) you can insert newlines by pressing ctrl + enter . If you use the global search ( ctrl + shift + f ) you can insert newlines by pressing shift + enter . If you want to search for multilines by the character literal, remember to check the rightmost regex icon. Save this answer.

How do you fold lines in VS Code?

Fold (Ctrl+Shift+[) folds the innermost uncollapsed region at the cursor. Unfold (Ctrl+Shift+]) unfolds the collapsed region at the cursor. Toggle Fold (Ctrl+K Ctrl+L) folds or unfolds the region at the cursor.


1 Answers

This is not exactly the solution but you can use modal dialog option.

vscode.window.showInformationMessage('First line\nSecond line\nThird line', { modal: true });

enter image description here

With the custom dialog enabled in settings.json it looks like:

"window.dialogStyle": "custom",// VSCode >= 1.50.0

enter image description here

like image 165
Alex Avatar answered Oct 13 '22 09:10

Alex