- go to your vscode extensions folder and find the extension script file:
.vscode\extensions\yassh.copy-with-line-numbers-0.0.4\out\src\copy-with-line-numbers.js - replace with next file
Below the diff. I've replaced the use of copy-paste lib for clipboard as it does not work correctly with Vscode through Windows WSL.
This change isn't mandatory.
--- C:\Users\.vscode\extensions\yassh.copy-with-line-numbers-0.0.4\out\src\copy-with-line-numbers - backup.js
+++ C:\Users\.vscode\extensions\yassh.copy-with-line-numbers-0.0.4\out\src\copy-with-line-numbers.js
@@ -3,7 +3,6 @@
const vscode = require("vscode");
const path = require("path");
const os_1 = require("os");
-const copy_paste_1 = require("copy-paste");
const leftPad = require("left-pad");
const COPY_WITH_LINE_NUMBERS = 'extension.copyWithLineNumbers';
const COPY_WITH_LINE_NUMBERS_WITHOUT_PATH = COPY_WITH_LINE_NUMBERS + '.withoutPath';
@@ -14,6 +13,7 @@
const OPTION_WITH_RELATIVE_PATH = 'withRelativePath';
const OPTION_WITH_FILE_NAME = 'withFileName';
const MULTI_SELECTION_SEPARATOR = '---';
+
function copyWithLineNumbers(option) {
const editor = vscode.window.activeTextEditor;
if (!editor) {
@@ -39,7 +39,8 @@
default:
break;
}
- let str = file ? `File: ${file}${os_1.EOL}` : '';
+ let str = "```solidity" + `${os_1.EOL}`
+ str += file ? `File: ${file}${os_1.EOL}` : '';
const selections = [...editor.selections].sort((a, b) => a.start.line - b.start.line);
const lastSelection = selections[selections.length - 1];
const largestLineNumber = lastSelection.end.line + 1;
@@ -52,14 +53,16 @@
const line = document.lineAt(n).text;
str += `${number}: ${line}${os_1.EOL}`;
}
+ str += "```"
+ });
- });
- copy_paste_1.copy(str, () => {
+ vscode.env.clipboard.writeText(str).then(() => {
const showSuccessMessage = vscode.workspace.getConfiguration('copyWithLineNumbers').get('showSuccessMessage');
if (showSuccessMessage)
vscode.window.showInformationMessage('Copied!');
});
}
+
exports.commands = {
[COPY_WITH_LINE_NUMBERS_WITHOUT_PATH]: () => {
copyWithLineNumbers();
@@ -74,6 +77,4 @@
copyWithLineNumbers(OPTION_WITH_FILE_NAME);
},
};
\ No newline at end of file