Repository navigation
Expand file tree
/
Copy pathextension.ts
More file actions
87 lines (73 loc) · 3.13 KB
/
Copy pathextension.ts
File metadata and controls
87 lines (73 loc) · 3.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/**
* @file extension entry
* @author netcon
*/
import * as vscode from 'vscode';
import { setExtensionContext } from '@/helpers/context';
// import { registerGitHub1sCommands } from '@/commands';
import { registerVSCodeProviders } from '@/providers';
import { registerCustomViews } from '@/views';
// import { GitHub1sFileSystemProvider } from '@/providers/fileSystemProvider';
// import { showSponsors } from '@/sponsors';
// import { showGitpod } from '@/gitpod';
// import { activateSourceControl } from '@/source-control';
// import { registerEventListeners } from '@/listeners';
import { registerPlatformAdapters } from './adapters';
import router from '@/router';
// import { PageType } from './router/types';
const browserUrlManager = {
getUrl: () => vscode.commands.executeCommand('github1s.vscode.get-browser-url') as Promise<string>,
setUrl: (url: string) => vscode.commands.executeCommand('github1s.vscode.replace-browser-url', url) as Promise<void>,
};
export async function activate(context: vscode.ExtensionContext) {
// set the global context for convenient
setExtensionContext(context);
// register platform adapters
await registerPlatformAdapters();
// Ensure the router has been initialized
await router.initialize(browserUrlManager);
// register VS Code providers
registerVSCodeProviders();
// // register the necessary event listeners
// registerEventListeners();
// // register custom views
registerCustomViews();
// // register GitHub1s Commands
// registerGitHub1sCommands();
// // activate SourceControl features,
// activateSourceControl();
// // sponsors in Status Bar
// showSponsors();
// showGitpod();
// // initialize the VSCode's state
// initialVSCodeState();
}
// initialize the VSCode's state according to the router url
// const initialVSCodeState = async () => {
// const routerState = await router.getState();
// const { filePath, pageType } = routerState;
// const scheme = 'github1s';
// if (filePath && pageType === PageType.TREE) {
// vscode.commands.executeCommand('revealInExplorer', vscode.Uri.parse('').with({ scheme, path: filePath }));
// } else if (filePath && pageType === PageType.BLOB) {
// const { startLineNumber, endLineNumber } = routerState;
// const start = new vscode.Position(startLineNumber - 1, 0);
// const end = new vscode.Position(endLineNumber - 1, 999999);
// const documentShowOptions: vscode.TextDocumentShowOptions = startLineNumber
// ? { selection: new vscode.Range(start, end) }
// : {};
// // TODO: the selection of the opening file may be cleared
// // when editor try to restore previous state in the same file
// vscode.commands.executeCommand(
// 'vscode.open',
// vscode.Uri.parse('').with({ scheme, path: filePath }),
// documentShowOptions
// );
// } else if (pageType === PageType.PULL_LIST) {
// vscode.commands.executeCommand('github1s.views.pull-request-list.focus');
// } else if (pageType === PageType.COMMIT_LIST) {
// vscode.commands.executeCommand('github1s.views.commit-list.focus');
// } else if ([PageType.PULL, PageType.COMMIT].includes(pageType)) {
// vscode.commands.executeCommand('workbench.scm.focus');
// }
// };