1
0
Fork 0
mirror of synced 2024-11-15 21:48:57 -05:00
ultimate-vim/sources_non_forked/markdown-preview.nvim/app/nvim.js
2022-05-19 20:12:11 +08:00

26 lines
758 B
JavaScript

const attach = require('./lib/attach').default
const logger = require('./lib/util/logger')('app/nvim')
const MSG_PREFIX = '[markdown-preview.nvim]'
const plugin = attach({
reader: process.stdin,
writer: process.stdout
})
process.on('uncaughtException', function (err) {
let msg = `${MSG_PREFIX} uncaught exception: ` + err.stack
if (plugin.nvim) {
plugin.nvim.call('mkdp#util#echo_messages', ['Error', msg.split('\n')])
}
logger.error('uncaughtException', err.stack)
})
process.on('unhandledRejection', function (reason, p) {
if (plugin.nvim) {
plugin.nvim.call('mkdp#util#echo_messages', ['Error', [`${MSG_PREFIX} UnhandledRejection`, `${reason}`]])
}
logger.error('unhandledRejection ', p, reason)
})
exports.plugin = plugin