irongit

A simpler way to view django projects

still need to figure if django project

huncholanehuncholaneauthored
parent e6d13abcommit 8331f876ca25f636dc01e33c7db78ce4c3514f81Browse files

4 files changed, +44 -8

+10-2package.json
@@ -12,6 +12,14 @@
1212 "activationEvents": [],
1313 "main": "./out/extension.js",
1414 "contributes": {
15+ "commands": [
16+ {
17+ "command": "django-overview.managePyExists",
18+ "title": "Check if manage.py exists",
19+ "category": "Django Overview",
20+ "icon": "resources/django.svg"
21+ }
22+ ],
1523 "viewsContainers": {
1624 "activitybar": [
1725 {
@@ -28,8 +36,8 @@
2836 "name": "Current Project"
2937 },
3038 {
31- "id": "django-overview.commands",
32- "name": "Commands"
39+ "id": "django-overview.manage",
40+ "name": "Manage"
3341 }
3442 ]
3543 }
+21-0src/commands.ts
@@ -0,0 +1,21 @@
1+import * as vscode from "vscode";
2+
3+const managePyExists = () => {
4+ vscode.workspace
5+ .findFiles("**/manage.py", "**/node_modules/**", 1)
6+ .then((files) => {
7+ let managePyExists = files.length > 0;
8+ vscode.commands.executeCommand(
9+ "setContext",
10+ "managePyExists",
11+ managePyExists
12+ );
13+ });
14+};
15+
16+export default [
17+ vscode.commands.registerCommand(
18+ "django-overview.managePyExists",
19+ managePyExists
20+ ),
21+];
+4-6src/extension.ts
@@ -1,13 +1,11 @@
11 import * as vscode from "vscode";
22 import ProjectDataProvider from "./providers/project";
3+import providers from "./providers";
4+import commands from "./commands";
35
46 export function activate(context: vscode.ExtensionContext) {
5- context.subscriptions.concat([
6- vscode.window.registerTreeDataProvider(
7- "django-overview.project",
8- new ProjectDataProvider()
9- ),
10- ]);
7+ context.subscriptions.concat(providers);
8+ context.subscriptions.concat(commands);
119 }
1210
1311 // This method is called when your extension is deactivated
+9-0src/providers/index.ts
@@ -0,0 +1,9 @@
1+import * as vscode from "vscode";
2+import ProjectDataProvider from "./project";
3+
4+export default [
5+ vscode.window.registerTreeDataProvider(
6+ "django-overview.project",
7+ new ProjectDataProvider()
8+ ),
9+];