MCPcopy
hub / github.com/conwnet/github1s / GitLab1sAdapter

Class GitLab1sAdapter

extensions/github1s/src/adapters/gitlab1s/index.ts:16–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14import { getCurrentRepo } from './parse-path';
15
16export class GitLab1sAdapter implements Adapter {
17 public scheme: string = 'gitlab1s';
18 public platformName = PlatformName.GitLab;
19 public codeReviewType = CodeReviewType.MergeRequest;
20
21 resolveDataSource() {
22 return Promise.resolve(GitLab1sDataSource.getInstance());
23 }
24
25 resolveRouterParser() {
26 return Promise.resolve(GitLab1sRouterParser.getInstance());
27 }
28
29 activateAsDefault() {
30 // register settings view and show it in activity bar
31 setVSCodeContext('github1s:views:settings:visible', true);
32 setVSCodeContext('github1s:views:codeReviewList:visible', true);
33 setVSCodeContext('github1s:views:commitList:visible', true);
34 setVSCodeContext('github1s:views:fileHistory:visible', true);
35 setVSCodeContext('github1s:features:gutterBlame:enabled', true);
36
37 vscode.window.registerWebviewViewProvider(
38 GitLab1sSettingsViewProvider.viewType,
39 new GitLab1sSettingsViewProvider(),
40 );
41 vscode.commands.registerCommand('github1s.commands.openGitLab1sAuthPage', () => {
42 return GitLab1sAuthenticationView.getInstance().open();
43 });
44 vscode.commands.registerCommand('github1s.commands.syncSourcegraphRepository', async () => {
45 const dataSource = SourcegraphDataSource.getInstance('gitlab');
46 const randomRef = (Math.random() + 1).toString(36).slice(2);
47 return dataSource.provideCommit(await getCurrentRepo(), randomRef);
48 });
49 }
50
51 deactivateAsDefault() {
52 setVSCodeContext('github1s:views:settings:visible', false);
53 setVSCodeContext('github1s:views:codeReviewList:visible', false);
54 setVSCodeContext('github1s:views:commitList:visible', false);
55 setVSCodeContext('github1s:views:fileHistory:visible', false);
56 setVSCodeContext('github1s:features:gutterBlame:enabled', false);
57 }
58}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected