some deletions
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / lib / errorHandler.js
diff --git a/.config/coc/extensions/node_modules/coc-prettier/lib/errorHandler.js b/.config/coc/extensions/node_modules/coc-prettier/lib/errorHandler.js
deleted file mode 100644 (file)
index 71870ac..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
-const coc_nvim_1 = require("coc.nvim");
-let outputChannel;
-/**
- * Adds the filepath to the error message
- *
- * @param msg The original error message
- * @param fileName The path to the file
- * @returns {string} enhanced message with the filename
- */
-function addFilePath(msg, fileName) {
-    const lines = msg.split('\n');
-    if (lines.length > 0) {
-        lines[0] = lines[0].replace(/(\d*):(\d*)/g, `${fileName}:$1:$2`);
-        return lines.join('\n');
-    }
-    return msg;
-}
-/**
- * Append messages to the output channel and format it with a title
- *
- * @param message The message to append to the output channel
- */
-function addToOutput(message, type = 'Trace') {
-    if (!outputChannel)
-        return;
-    const title = `${type} - ${new Date().toLocaleString()}:`;
-    // Create a sort of title, to differentiate between messages
-    outputChannel.appendLine('');
-    // Append actual output
-    outputChannel.appendLine(`[${title}] ${message}\n`);
-}
-exports.addToOutput = addToOutput;
-/**
- * Execute a callback safely, if it doesn't work, return default and log messages.
- *
- * @param cb The function to be executed,
- * @param defaultText The default value if execution of the cb failed
- * @param fileName The filename of the current document
- * @returns {string} formatted text or defaultText
- */
-function safeExecution(cb, defaultText, fileName) {
-    if (cb instanceof Promise) {
-        return cb
-            .then(returnValue => {
-            // updateStatusBar('Prettier: $(check)')
-            return returnValue;
-        })
-            .catch((err) => {
-            addToOutput(addFilePath(err.message, fileName), 'Error');
-            // updateStatusBar('Prettier: $(x)')
-            return defaultText;
-        });
-    }
-    try {
-        const returnValue = cb();
-        // updateStatusBar('Prettier: $(check)')
-        return returnValue;
-    }
-    catch (err) {
-        addToOutput(addFilePath(err.message, fileName), 'Error');
-        // updateStatusBar('Prettier: $(x)')
-        return defaultText;
-    }
-}
-exports.safeExecution = safeExecution;
-/**
- * Setup the output channel and the statusBarItem.
- * Create a command to show the output channel
- *
- * @returns {Disposable} The command to open the output channel
- */
-function setupErrorHandler() {
-    // Setup the outputChannel
-    outputChannel = coc_nvim_1.workspace.createOutputChannel('prettier');
-    return coc_nvim_1.commands.registerCommand('prettier.open-output', () => {
-        outputChannel.show();
-    });
-}
-exports.setupErrorHandler = setupErrorHandler;
-//# sourceMappingURL=errorHandler.js.map
\ No newline at end of file