Skip to content

Commit 4866587

Browse files
chore(logs): add extension tag in logs
1 parent 6a0f2fe commit 4866587

File tree

9 files changed

+38
-23
lines changed

9 files changed

+38
-23
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
# [1.3.0](https://github.com/robertohuertasm/vscode-open/compare/v1.1.7...v1.2.0) (2023-06-02)
2+
3+
4+
### Chore
5+
6+
* **logs:** add extension tag
7+
18
# [1.2.0](https://github.com/robertohuertasm/vscode-open/compare/v1.1.7...v1.2.0) (2023-01-22)
29

310

chrome_extension/scripts/content.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const DETAIL_PAGE_SEPARATOR = '/blob/';
22
const BTN_VSCODE = 'vscode';
33
const BTN_INSIDERS = 'vscode-insiders';
44

5-
console.log('Loading content script');
5+
console.log('[vscode-open]: Loading content script');
66

77
function addButton(text, link, node, id) {
88
const el = document.createElement('a');
@@ -15,7 +15,7 @@ function addButton(text, link, node, id) {
1515
const children = node.children;
1616
const last = children[children.length - 1];
1717
node.insertBefore(el, last.nextSibling);
18-
// console.log('Element added!');
18+
// console.log('[vscode-open]: Element added!');
1919
}
2020

2121
function addElement(time) {

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "open-vscode",
33
"displayName": "vscode-open",
44
"description": "Open Visual Studio Code with a URL",
5-
"version": "1.2.4",
5+
"version": "1.3.0",
66
"publisher": "robertohuertasm",
77
"license": "SEE LICENSE IN LICENSE",
88
"author": {

src/extension.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ async function getGitApi(): Promise<API | undefined> {
1313
const gitExtension =
1414
vscode.extensions.getExtension<GitExtension>('vscode.git');
1515
if (!gitExtension) {
16-
console.error('Git extension not found!');
16+
console.error('[vscode-open]: Git extension not found!');
1717
return undefined;
1818
}
1919
const gitApi = gitExtension.isActive
@@ -25,7 +25,7 @@ async function getGitApi(): Promise<API | undefined> {
2525
// this method is called when your extension is activated
2626
// your extension is activated the very first time the command is executed
2727
export async function activate(context: vscode.ExtensionContext) {
28-
console.log('vscode-open enabled!');
28+
console.log('[vscode-open]: vscode-open enabled!');
2929

3030
context.subscriptions.push(
3131
vscode.commands.registerCommand('vscode-open.reset', () => {

src/opener.ts

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,9 @@ export class Opener {
9797
// are we in the correct ref?
9898
const currentCommit = (await this.getCurrentCommit(gitRepo))?.commit;
9999
const repoRefCommit = await gitRepo.getCommit(this.repoRef);
100-
console.log(`CurrentCommit ${currentCommit} === ${repoRefCommit.hash}`);
100+
console.log(
101+
`[vscode-open]: CurrentCommit ${currentCommit} === ${repoRefCommit.hash}`,
102+
);
101103
if (
102104
currentCommit &&
103105
repoRefCommit &&
@@ -115,7 +117,7 @@ export class Opener {
115117
}
116118
}
117119
} else {
118-
console.log('NO GIT REPO????');
120+
console.log('[vscode-open]: NO GIT REPO????');
119121
}
120122

121123
if (!this.file) {
@@ -149,7 +151,7 @@ export class Opener {
149151
// has this repo been ever opened?
150152
const knownRepoInfo = await getOpenedRepoHistory(this.context);
151153
const knownRepo = knownRepoInfo[this.repoName];
152-
console.log(`knownRepo ${this.repoName}: ${knownRepo}`);
154+
console.log(`[vscode-open]: knownRepo ${this.repoName}: ${knownRepo}`);
153155
// if the repo is not found in the history, we're going to search for it in the config roots
154156
if (knownRepo) {
155157
return vscode.Uri.file(knownRepo);
@@ -185,10 +187,12 @@ export class Opener {
185187
res(repo.state.HEAD);
186188
}
187189
attempts += 1;
188-
console.log(`Attempt ${attempts} to get current commit`);
190+
console.log(`[vscode-open]: Attempt ${attempts} to get current commit`);
189191
}, 1000);
190192
});
191-
console.log(`Current commit: ${branch?.commit} - name: ${branch?.name}`);
193+
console.log(
194+
`[vscode-open]: Current commit: ${branch?.commit} - name: ${branch?.name}`,
195+
);
192196
return branch;
193197
}
194198

@@ -208,7 +212,9 @@ export class Opener {
208212
} catch (err) {
209213
// let's remove it from the knwon repos
210214
removeOpenedRepoFromHistory(this.repoName, this.context);
211-
console.error(`Known repo must have been deleted. Not found. ${err}`);
215+
console.error(
216+
`[vscode-open]: Known repo must have been deleted. Not found. ${err}`,
217+
);
212218
}
213219
}
214220
// 2. if folder doesn't exist, we're going to ask the user to select a folder or clone the repo (only if there's git support)
@@ -257,9 +263,9 @@ export class Opener {
257263
maxDepth: number,
258264
level = 0,
259265
): Promise<vscode.Uri | undefined> {
260-
console.info(`Searching ${this.repoName} in ${directory}`);
266+
console.info(`[vscode-open]: Searching ${this.repoName} in ${directory}`);
261267
if (level > maxDepth) {
262-
console.log(`Max depth reached ${maxDepth}`);
268+
console.log(`[vscode-open]: Max depth reached ${maxDepth}`);
263269
return;
264270
}
265271
const dir = vscode.Uri.file(directory);
@@ -288,7 +294,7 @@ export class Opener {
288294
}
289295
} catch (error) {
290296
// most probably the root is not ok.
291-
console.error(error);
297+
console.error(`[vscode-open]: ${error}`, error);
292298
}
293299
}
294300

src/repoHistory.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,11 @@ export async function addOpenedRepoToHistory(
2424
// re-check, there are some cases where this might not work
2525
const check = await getOpenedRepoHistory(context);
2626
if (!check[record.name]) {
27-
console.error(`Failed to save ${record.name} to repo history`);
27+
console.error(
28+
`[vscode-open]: Failed to save ${record.name} to repo history`,
29+
);
2830
} else {
29-
console.log(`Added repo ${record.name} to the repo history`);
31+
console.log(`[vscode-open]: Added repo ${record.name} to the repo history`);
3032
}
3133
}
3234

@@ -37,7 +39,7 @@ export async function removeOpenedRepoFromHistory(
3739
const repos = await getOpenedRepoHistory(context);
3840
delete repos[repoName];
3941
await context.globalState.update(OPENED_REPO_HISTORY_KEY, repos);
40-
console.log(`Removed repo ${repoName} from the repo history`);
42+
console.log(`[vscode-open]: Removed repo ${repoName} from the repo history`);
4143
}
4244

4345
export async function resetOpenedRepoHistory(

src/test/runTest.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ async function main() {
1515
// Download VS Code, unzip it and run the integration test
1616
await runTests({ extensionDevelopmentPath, extensionTestsPath });
1717
} catch (err) {
18-
console.error('Failed to run tests');
18+
console.error('[vscode-open]: Failed to run tests');
1919
process.exit(1);
2020
}
2121
}

src/vscodeUriHandler.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ export class VSCodeOpenUriHandler implements vscode.UriHandler {
1515
}
1616

1717
public async handleUri(uri: vscode.Uri) {
18-
console.log(`Handling URI: ${uri}`);
18+
console.log(`[vscode-open]: Handling URI: ${uri}`);
1919
const info = new Opener(uri, this.context, this.git);
2020
await info.open();
2121
}
2222

2323
private async storeFolderInformation(): Promise<void> {
2424
const folders = vscode.workspace.workspaceFolders;
2525
if (!folders) {
26-
console.log('NO FOLDER OPEN!');
26+
console.log('[vscode-open]: NO FOLDER OPEN!');
2727
return;
2828
}
2929
// check if the workspace folders are git repos.
@@ -42,7 +42,7 @@ export class VSCodeOpenUriHandler implements vscode.UriHandler {
4242
const pendingUriToOpen = getPendingUriToOpen(this.context);
4343
if (pendingUriToOpen) {
4444
console.log(
45-
`@@@@ Handler found pending uri to open! ${pendingUriToOpen}`,
45+
`[vscode-open]: @@@@ Handler found pending uri to open! ${pendingUriToOpen}`,
4646
);
4747
await resetPendingUriToOpen(this.context);
4848
const info = new Opener(

0 commit comments

Comments
 (0)