Skip to content

Commit ccd46e6

Browse files
authored
Merge pull request #115 from badsyntax/perf
Fix ER diagram, refresh improvements, add refresh icons to treeview
2 parents 9121b92 + d5d8cae commit ccd46e6

33 files changed

+1292
-865
lines changed

package.json

Lines changed: 24 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -72,22 +72,6 @@
7272
"dark": "icons/files_dark.svg"
7373
}
7474
},
75-
{
76-
"command": "entityframework.setStartupProject",
77-
"title": "Set as Startup Project",
78-
"icon": {
79-
"light": "icons/files_light.svg",
80-
"dark": "icons/files_dark.svg"
81-
}
82-
},
83-
{
84-
"command": "entityframework.setProject",
85-
"title": "Set as Project",
86-
"icon": {
87-
"light": "icons/files_light.svg",
88-
"dark": "icons/files_dark.svg"
89-
}
90-
},
9175
{
9276
"command": "entityframework.generateERD",
9377
"title": "Generate ER Diagram",
@@ -112,6 +96,14 @@
11296
"dark": "icons/refresh_dark.svg"
11397
}
11498
},
99+
{
100+
"command": "entityframework.refreshTreeNoCache",
101+
"title": "Refresh",
102+
"icon": {
103+
"light": "icons/refresh_light.svg",
104+
"dark": "icons/refresh_dark.svg"
105+
}
106+
},
115107
{
116108
"command": "entityframework.refreshDbContextTree",
117109
"title": "Refresh",
@@ -175,6 +167,10 @@
175167
"command": "entityframework.refreshTree",
176168
"when": "false"
177169
},
170+
{
171+
"command": "entityframework.refreshTreeNoCache",
172+
"when": "false"
173+
},
178174
{
179175
"command": "entityframework.refreshProjectTree",
180176
"when": "false"
@@ -227,7 +223,7 @@
227223
"group": "navigation"
228224
},
229225
{
230-
"command": "entityframework.refreshTree",
226+
"command": "entityframework.refreshTreeNoCache",
231227
"when": "view == entityframeworkTree",
232228
"group": "navigation"
233229
}
@@ -268,10 +264,15 @@
268264
"when": "viewItem =~ /^migration-.*\\|?can-undo\\|?.*$/",
269265
"group": "context@1"
270266
},
267+
{
268+
"command": "entityframework.refreshDbContextTree",
269+
"when": "viewItem == dbContext",
270+
"group": "inline@1"
271+
},
271272
{
272273
"command": "entityframework.addMigration",
273274
"when": "viewItem == dbContext",
274-
"group": "inline@4"
275+
"group": "inline@2"
275276
},
276277
{
277278
"command": "entityframework.addMigration",
@@ -297,6 +298,11 @@
297298
{
298299
"command": "entityframework.scaffold",
299300
"when": "viewItem == project",
301+
"group": "inline@2"
302+
},
303+
{
304+
"command": "entityframework.refreshProjectTree",
305+
"when": "viewItem == project",
300306
"group": "inline@1"
301307
},
302308
{
@@ -308,16 +314,6 @@
308314
"command": "entityframework.refreshProjectTree",
309315
"when": "viewItem == project",
310316
"group": "context@2"
311-
},
312-
{
313-
"command": "entityframework.setProject",
314-
"when": "viewItem == project",
315-
"group": "context@3"
316-
},
317-
{
318-
"command": "entityframework.setStartupProject",
319-
"when": "viewItem == project",
320-
"group": "context@4"
321317
}
322318
]
323319
},
0 Bytes
Binary file not shown.
48 KB
Binary file not shown.

src/actions/AddMigrationAction.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import * as vscode from 'vscode';
22
import { EFOutputParser } from '../cli/EFOutputParser';
3-
import { CommandProvider } from '../commands/CommandProvider';
4-
import { RefreshTreeCommand } from '../commands/RefreshTreeCommand';
53
import { getCommandsConfig } from '../config/config';
64
import { TREE_VIEW_ID } from '../constants/constants';
75

@@ -74,10 +72,7 @@ export class AddMigrationAction extends TerminalAction {
7472
'vscode.open',
7573
vscode.Uri.file(parsedData.migrationFile),
7674
);
77-
await vscode.commands.executeCommand(
78-
CommandProvider.getCommandName(RefreshTreeCommand.commandName),
79-
false,
80-
);
75+
8176
return output;
8277
},
8378
);

src/actions/ConfigureAction.ts

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,10 @@ import * as vscode from 'vscode';
22
import { getProjectsConfig } from '../config/config';
33
import { EXTENSION_NAMESPACE } from '../constants/constants';
44
import { ProjectFilesProvider } from '../solution/ProjectFilesProvider';
5-
65
import { InputWizard } from '../util/InputWizard';
7-
86
import type { IAction } from './IAction';
97

10-
export type ScaffoldResult = {
11-
contextFile: string;
12-
entityTypeFiles: string[];
13-
};
14-
158
export class ConfigureAction implements IAction {
16-
constructor() {}
17-
189
public async run() {
1910
const { projectFiles } = await ProjectFilesProvider.getProjectFiles();
2011

@@ -32,7 +23,7 @@ export class ConfigureAction implements IAction {
3223
items: projects,
3324
value: configProject,
3425
options: {
35-
title: 'Select Project (1/2)',
26+
title: 'Select Project',
3627
ignoreFocusOut: true,
3728
},
3829
required: true,
@@ -42,7 +33,7 @@ export class ConfigureAction implements IAction {
4233
items: projects,
4334
value: configStartupProject,
4435
options: {
45-
title: 'Select Startup Project (2/2)',
36+
title: 'Select Startup Project',
4637
ignoreFocusOut: true,
4738
},
4839
required: true,

src/actions/DBContextInfoCommandAction.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import * as vscode from 'vscode';
33
import { EFOutputParser } from '../cli/EFOutputParser';
44
import { getCommandsConfig } from '../config/config';
55
import { TREE_VIEW_ID } from '../constants/constants';
6-
76
import type { TerminalProvider } from '../terminal/TerminalProvider';
87
import { TextDocumentProvider } from '../util/TextDocumentProvider';
98
import { TerminalAction } from './TerminalAction';

src/actions/GenerateERDAction.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ export class GenerateERDAction extends TerminalAction {
107107
options: {
108108
title: 'Connection String',
109109
value: '',
110+
prompt: 'EG: Data Source=blogging.db',
110111
},
111112
required: true,
112113
},

src/actions/IAction.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ export interface IAction {
44
run(
55
params?: { [key: string]: string },
66
execArgs?: Partial<ExecOpts>,
7-
): Promise<string | void>;
7+
): Promise<string | number | void>;
88
}

src/actions/RefreshTreeAction.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@ import type { TreeDataProvider } from '../treeView/TreeDataProvider';
22
import type { IAction } from './IAction';
33

44
export class RefreshTreeAction implements IAction {
5-
constructor(private readonly treeDataProvider: TreeDataProvider) {}
5+
constructor(
6+
private readonly treeDataProvider: TreeDataProvider,
7+
private readonly clearCache: boolean,
8+
) {}
69

710
public async run() {
8-
this.treeDataProvider.refresh();
11+
this.treeDataProvider.refresh(this.clearCache);
912
}
1013
}

src/actions/RemoveMigrationAction.ts

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,15 @@
11
import * as vscode from 'vscode';
2-
import { CommandProvider } from '../commands/CommandProvider';
3-
import { RefreshTreeCommand } from '../commands/RefreshTreeCommand';
42
import { getCommandsConfig } from '../config/config';
53
import { TREE_VIEW_ID } from '../constants/constants';
64
import type { TerminalProvider } from '../terminal/TerminalProvider';
7-
import {
8-
dbContextsCache,
9-
DbContextTreeItem,
10-
} from '../treeView/DbContextTreeItem';
115
import { TerminalAction } from './TerminalAction';
126

137
export class RemoveMigrationAction extends TerminalAction {
148
constructor(
159
terminalProvider: TerminalProvider,
16-
private readonly workspaceRoot: string,
17-
private readonly dbContext: string,
18-
private readonly project: string,
19-
private readonly refresh?: boolean,
10+
readonly workspaceRoot: string,
11+
readonly dbContext: string,
12+
readonly project: string,
2013
) {
2114
super(
2215
terminalProvider,
@@ -41,21 +34,7 @@ export class RemoveMigrationAction extends TerminalAction {
4134
this.cancel();
4235
});
4336
await this.start();
44-
const output = await this.getOutput();
45-
const cacheId = DbContextTreeItem.getCacheId(
46-
this.workspaceRoot,
47-
this.project,
48-
this.dbContext,
49-
);
50-
dbContextsCache.clear(cacheId);
51-
const refresh = this.refresh || this.refresh === undefined;
52-
if (refresh) {
53-
await vscode.commands.executeCommand(
54-
CommandProvider.getCommandName(RefreshTreeCommand.commandName),
55-
false,
56-
);
57-
}
58-
return output;
37+
return await this.getOutput();
5938
},
6039
);
6140
}

0 commit comments

Comments
 (0)