Skip to content

Commit e590a70

Browse files
committed
Fixed ReferenceError for name variable for repos with submodules
1 parent d74325c commit e590a70

File tree

3 files changed

+20
-18
lines changed

3 files changed

+20
-18
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ Usage: `Ctrl+Alt+Z` gets url for all open files and copies them to clipboard
1111
Full git sub-module support now included.
1212

1313
# Version History
14+
- `1.2.3:` Fixed ReferenceError for `name` variable for repos with submodules.
15+
- `1.2.2:` Fixed bug in exception handlers, upgraded `vsce` to `1.1.0`.
1416
- `1.2.0:` RAW url commands, bug fix for preview windows.
1517
- `1.1.0:` Sub-Module Support
1618
- `1.0.0:` Initial Release

extension.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,9 @@ Workspace Root: ${workspaceRootPath}`;
143143
}
144144
catch (e) {
145145
const errorMessage = `${extensionName} extension failed to execute command '${commandName}'. See debug console for details.`;
146-
if (e.name && e.message) {
147-
errorMessage += `\n\n(${extensionName}) ${e.name}: ${e.message}`
148-
};
146+
if (e) {
147+
errorMessage += `\n\nErr: ${e}`;
148+
}
149149
console.log(errorMessage);
150150
vscode.window.showErrorMessage(errorMessage);
151151
return;
@@ -182,11 +182,11 @@ function executeCommand1(commandName, fileUri, pullLines, simpleFormat) {
182182
filePath = editor.document.fileName;
183183
}
184184

185-
if (!fs.existsSync(filePath)) {
186-
// we generate a warning but still generate the url
187-
const errorMessage = `The file '${filePath}' does not exist locally, so no url was generated.`;
188-
allWarnings.push(errorMessage);
189-
}
185+
if (!fs.existsSync(filePath)) {
186+
// we generate a warning but still generate the url
187+
const errorMessage = `The file '${filePath}' does not exist locally, so no url was generated.`;
188+
allWarnings.push(errorMessage);
189+
}
190190

191191
const result = generateGithubUrl(commandName, workspaceRootPath, filePath, lineInfo);
192192
if (result) {
@@ -195,7 +195,7 @@ function executeCommand1(commandName, fileUri, pullLines, simpleFormat) {
195195
{
196196
const url = result.url;
197197
const relativeFilePath = result.relativePathFromGitRoot;
198-
const urlMarkdownLink = simpleFormat ? url :`[${relativeFilePath}](${url})`;
198+
const urlMarkdownLink = simpleFormat ? url : `[${relativeFilePath}](${url})`;
199199
copyPaste.copy(urlMarkdownLink);
200200
}
201201
return;
@@ -223,9 +223,9 @@ Workspace Root: ${workspaceRootPath}`;
223223
}
224224
catch (e) {
225225
const errorMessage = `${extensionName} extension failed to execute command '${commandName}'. See debug console for details.`;
226-
if (e.name && e.message) {
227-
errorMessage += `\n\n(${extensionName}) ${e.name}: ${e.message}`
228-
};
226+
if (e) {
227+
errorMessage += `\n\nErr: ${e}`;
228+
}
229229
console.log(errorMessage);
230230
vscode.window.showErrorMessage(errorMessage);
231231
return;
@@ -307,9 +307,9 @@ Filepath: ${filePath}`;
307307
}
308308
catch (e) {
309309
let errorMessage = `${extensionName} extension failed to run 'generateGithubUrl' due to an unhandled error. See debug console for details.`;
310-
if (e.name && e.message) {
311-
errorMessage += `\n\n(${extensionName}) ${e.name}: ${e.message}`
312-
};
310+
if (e) {
311+
errorMessage += `\n\nErr: ${e}`;
312+
}
313313
return {
314314
type: 'error',
315315
errorMessage,
@@ -352,7 +352,7 @@ function findAndParseConfig(rootPath) {
352352
const modName = match1[1];
353353
const modFullpath = path.join(currentPath, modName).replace(/\\/g, '/');
354354
if (!subUrl) {
355-
console.warn(`subModule '${name}' at '${modFullpath}' is missing a url, it will be skipped`);
355+
console.warn(`subModule '${modName}' at '${modFullpath}' is missing a url, it will be skipped`);
356356
} else {
357357
const metaInfo = {
358358
path: modFullpath,

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vscode-github-file-folder-url",
3-
"version": "1.2.1",
3+
"version": "1.2.3",
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.",
@@ -89,7 +89,7 @@
8989
"postinstall": "node ./node_modules/vscode/bin/install"
9090
},
9191
"devDependencies": {
92-
"vscode": "1.0.3"
92+
"vscode": "1.1.0"
9393
},
9494
"dependencies": {
9595
"copy-paste": "1.3.0",

0 commit comments

Comments
 (0)