| 14 | import { getCurrentRepo } from './parse-path'; |
| 15 | |
| 16 | export 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 | } |
nothing calls this directly
no outgoing calls
no test coverage detected