From 3af83930f219c2f0bed8dd0fbcc431e63d60e7c8 Mon Sep 17 00:00:00 2001 From: iamcco Date: Mon, 29 Mar 2021 11:50:44 +0800 Subject: [PATCH] fix(notification): fix async stack and message maybe include \n --- src/lib/notification/floatwindow.ts | 16 ++++++++-------- src/lib/notification/index.ts | 3 ++- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/lib/notification/floatwindow.ts b/src/lib/notification/floatwindow.ts index 4e6c889..83ef4c4 100644 --- a/src/lib/notification/floatwindow.ts +++ b/src/lib/notification/floatwindow.ts @@ -42,14 +42,14 @@ export class FloatWindow extends Dispose { this.win = win; nvim.pauseNotification(); - await win.setOption('number', false); - await win.setOption('wrap', true); - await win.setOption('relativenumber', false); - await win.setOption('cursorline', false); - await win.setOption('cursorcolumn', false); - await win.setOption('conceallevel', 2); - await win.setOption('signcolumn', 'no'); - await win.setOption('winhighlight', 'FoldColumn:NormalFloat'); + win.setOption('number', false); + win.setOption('wrap', true); + win.setOption('relativenumber', false); + win.setOption('cursorline', false); + win.setOption('cursorcolumn', false); + win.setOption('conceallevel', 2); + win.setOption('signcolumn', 'no'); + win.setOption('winhighlight', 'FoldColumn:NormalFloat'); await nvim.resumeNotification(); try { // vim and neovim < 0.5.0 foldcolumn is number diff --git a/src/lib/notification/index.ts b/src/lib/notification/index.ts index 351efeb..9c6edb7 100644 --- a/src/lib/notification/index.ts +++ b/src/lib/notification/index.ts @@ -1,4 +1,5 @@ import { window, workspace } from 'coc.nvim'; +import { formatMessage } from '../../util'; import { Dispose } from '../../util/dispose'; import { Message } from './message'; @@ -63,7 +64,7 @@ class Notification extends Dispose { } show(message: string | string[], showTime: number = messageDefaultShowTime) { - const messages = ([] as string[]).concat(message); + const messages = typeof message === 'string' ? formatMessage(message) : message; if (messages.length === 0) { return; }