Skip to content

Commit b6948af

Browse files
committed
Fixed "Copy GitHub URL with selection" doesn't work #2
1 parent 00dc5af commit b6948af

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

extension.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,16 @@ Workspace Root: ${workspaceRootPath}`;
111111
function executeCommand1(commandName, fileUri, pullLines) {
112112
try {
113113
const workspaceRootPath = vscode.workspace.rootPath;
114-
const lineInfo = pullLines ? {
115-
start: editor.selection.start.line + 1,
116-
end: editor.selection.end.line + 1,
117-
} : null;
114+
let lineInfo = null;
115+
if (pullLines) {
116+
let editor = vscode.window.activeTextEditor;
117+
if (editor) {
118+
lineInfo = {
119+
start: editor.selection.start.line + 1,
120+
end: editor.selection.end.line + 1,
121+
};
122+
}
123+
}
118124

119125
let filePath;
120126
if (fileUri && fileUri.fsPath) {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vscode-github-file-folder-url",
3-
"version": "1.1.6",
3+
"version": "1.1.8",
44
"publisher": "cycloware",
55
"displayName": "VsCode - Github-File-Folder-Url",
66
"description": "VsCode Extension that gets a Github url with optional line selection for files and folders.",

0 commit comments

Comments
 (0)