Skip to content

Commit ff605ff

Browse files
committed
Polishing
1 parent 69da476 commit ff605ff

File tree

6 files changed

+30
-13
lines changed

6 files changed

+30
-13
lines changed

.vscode/settings.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,8 @@
77
"out": true // set this to false to include "out" folder in search results
88
},
99
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
10-
"typescript.tsc.autoDetect": "off"
10+
"typescript.tsc.autoDetect": "off",
11+
"cSpell.words": [
12+
"luxon"
13+
]
1114
}

package-lock.json

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

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,7 @@
385385
"test": "vscode-test"
386386
},
387387
"devDependencies": {
388+
"@types/luxon": "^3.6.2",
388389
"@types/mocha": "^10.0.9",
389390
"@types/node": "20.x",
390391
"@types/vscode": "^1.93.1",
@@ -396,8 +397,8 @@
396397
"typescript": "^5.6.3"
397398
},
398399
"dependencies": {
399-
"luxon": "^3.6.1",
400400
"axios": "^1.7.7",
401+
"luxon": "^3.6.1",
401402
"openapi-typescript": "^7.4.3"
402403
}
403-
}
404+
}

src/sidebarActivity.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { repository } from './repository';
66
import { ProjectActivity, ProjectDetails } from './apiTypes';
77
import { DateTime } from 'luxon';
88

9-
109
export function registerSidebarActivity(context: vscode.ExtensionContext) {
1110

1211
const onDidChangeTreeData: vscode.EventEmitter<ProjectEntry | undefined | void> = new vscode.EventEmitter<ProjectEntry | undefined | void>();
@@ -63,7 +62,7 @@ export function registerSidebarActivity(context: vscode.ExtensionContext) {
6362
const mapActivityToEntry = (entry: ProjectActivity): vscode.TreeItem | null => {
6463
const activityType = entry?.type ?? "unknown";
6564
const item = new vscode.TreeItem(activityType, vscode.TreeItemCollapsibleState.None);
66-
item.description = formatAsRelative(entry?.createdAt!);
65+
item.description = formatAsRelative(entry?.createdAt!) ?? "";
6766
switch (activityType) {
6867
case "IMPORT":
6968
item.label = "Import";

src/sidebarProject.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { getProjectApiKey, onContentChanged, onProjectChanged } from './extensio
44
import { createMessageEntry } from './utils';
55
import { repository } from './repository';
66
import { ProjectDetails } from './apiTypes';
7-
import { c } from 'openapi-typescript/dist/index.js';
87

98
enum ProjectEntryType {
109
PROJECT_NAME = 'project-name',
@@ -41,9 +40,11 @@ export function registerSidebarProject(context: vscode.ExtensionContext) {
4140
return languages.map((language: any) => {
4241
const item = new vscode.TreeItem(language.name, vscode.TreeItemCollapsibleState.None);
4342
item.description = language.key;
44-
item.languageKey = language.key;
4543
item.contextValue = ProjectEntryType.LANGUAGE + language.key;
46-
return item;
44+
return {
45+
languageKey: language.key,
46+
...item
47+
};
4748
});
4849
}
4950

@@ -329,5 +330,6 @@ export function registerSidebarProject(context: vscode.ExtensionContext) {
329330
}
330331

331332
interface ProjectEntry extends vscode.TreeItem {
333+
languageKey?: string;
332334
path?: string;
333335
}

src/sidebarTranslations.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ interface SimpleLocalizeTranslationKeyItem extends vscode.TreeItem {
2727
}
2828

2929
interface SimpleLocalizeOptionsItem extends vscode.TreeItem {
30-
keyNamespace: KeyNamespace;
31-
type: TreeKeyType;
30+
keyNamespace?: KeyNamespace;
3231
keyDetails?: any;
32+
type?: TreeKeyType;
3333
}
3434

3535
interface SimpleLocalizeTranslationItem extends vscode.TreeItem {
@@ -95,8 +95,11 @@ export function registerSidebarTranslations(context: vscode.ExtensionContext) {
9595
const descriptionItem = new vscode.TreeItem(description, vscode.TreeItemCollapsibleState.None);
9696
descriptionItem.iconPath = new vscode.ThemeIcon('note');
9797
descriptionItem.tooltip = description;
98-
descriptionItem.type = TreeKeyType.ViewDescription;
99-
element.children.push(descriptionItem);
98+
element.children.push({
99+
keyNamespace,
100+
type: TreeKeyType.ViewDescription,
101+
...descriptionItem,
102+
});
100103
}
101104
return Promise.resolve(element?.children ?? []);
102105
}
@@ -346,7 +349,8 @@ export function registerSidebarTranslations(context: vscode.ExtensionContext) {
346349
if (item || isSingleElement) {
347350

348351
if (item.type === TreeKeyType.ViewDescription) {
349-
await vscode.env.clipboard.writeText(item?.description || "");
352+
const itemDescription = item?.description as string;
353+
await vscode.env.clipboard.writeText(itemDescription ?? "");
350354
vscode.window.showInformationMessage(`Copied description to clipboard.`);
351355
return;
352356
}

0 commit comments

Comments
 (0)