25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

542 lines
11 KiB

  1. 'use strict';
  2. import { TraceLevel } from './logger';
  3. export interface Config {
  4. autolinks: AutolinkReference[] | null;
  5. blame: {
  6. avatars: boolean;
  7. compact: boolean;
  8. dateFormat: string | null;
  9. format: string;
  10. heatmap: {
  11. enabled: boolean;
  12. location: 'left' | 'right';
  13. };
  14. highlight: {
  15. enabled: boolean;
  16. locations: BlameHighlightLocations[];
  17. };
  18. ignoreWhitespace: boolean;
  19. separateLines: boolean;
  20. toggleMode: AnnotationsToggleMode;
  21. };
  22. changes: {
  23. locations: ChangesLocations[];
  24. toggleMode: AnnotationsToggleMode;
  25. };
  26. codeLens: CodeLensConfig;
  27. currentLine: {
  28. dateFormat: string | null;
  29. enabled: boolean;
  30. format: string;
  31. pullRequests: {
  32. enabled: boolean;
  33. };
  34. scrollable: boolean;
  35. };
  36. debug: boolean;
  37. defaultDateFormat: string | null;
  38. defaultDateShortFormat: string | null;
  39. defaultDateSource: DateSource;
  40. defaultDateStyle: DateStyle;
  41. defaultGravatarsStyle: GravatarDefaultStyle;
  42. gitCommands: {
  43. closeOnFocusOut: boolean;
  44. search: {
  45. matchAll: boolean;
  46. matchCase: boolean;
  47. matchRegex: boolean;
  48. showResultsInView: boolean;
  49. };
  50. skipConfirmations: string[];
  51. };
  52. heatmap: {
  53. ageThreshold: number;
  54. coldColor: string;
  55. hotColor: string;
  56. toggleMode: AnnotationsToggleMode;
  57. };
  58. hovers: {
  59. annotations: {
  60. changes: boolean;
  61. details: boolean;
  62. enabled: boolean;
  63. over: 'line' | 'annotation';
  64. };
  65. autolinks: {
  66. enabled: boolean;
  67. enhanced: boolean;
  68. };
  69. currentLine: {
  70. changes: boolean;
  71. details: boolean;
  72. enabled: boolean;
  73. over: 'line' | 'annotation';
  74. };
  75. avatars: boolean;
  76. avatarSize: number;
  77. changesDiff: 'line' | 'hunk';
  78. detailsMarkdownFormat: string;
  79. enabled: boolean;
  80. pullRequests: {
  81. enabled: boolean;
  82. };
  83. };
  84. insiders: boolean;
  85. keymap: KeyMap;
  86. liveshare: {
  87. allowGuestAccess: boolean;
  88. };
  89. menus: boolean | MenuConfig;
  90. mode: {
  91. active: string;
  92. statusBar: {
  93. enabled: boolean;
  94. alignment: 'left' | 'right';
  95. };
  96. };
  97. modes: Record<string, ModeConfig>;
  98. outputLevel: TraceLevel;
  99. remotes: RemotesConfig[] | null;
  100. showWhatsNewAfterUpgrades: boolean;
  101. sortBranchesBy: BranchSorting;
  102. sortTagsBy: TagSorting;
  103. statusBar: {
  104. alignment: 'left' | 'right';
  105. command: StatusBarCommand;
  106. dateFormat: string | null;
  107. enabled: boolean;
  108. format: string;
  109. reduceFlicker: boolean;
  110. };
  111. strings: {
  112. codeLens: {
  113. unsavedChanges: {
  114. recentChangeAndAuthors: string;
  115. recentChangeOnly: string;
  116. authorsOnly: string;
  117. };
  118. };
  119. };
  120. views: ViewsConfig;
  121. advanced: AdvancedConfig;
  122. }
  123. export enum AnnotationsToggleMode {
  124. File = 'file',
  125. Window = 'window',
  126. }
  127. export interface AutolinkReference {
  128. prefix: string;
  129. url: string;
  130. title?: string;
  131. alphanumeric?: boolean;
  132. ignoreCase?: boolean;
  133. }
  134. export enum BlameHighlightLocations {
  135. Gutter = 'gutter',
  136. Line = 'line',
  137. Overview = 'overview',
  138. }
  139. export enum BranchSorting {
  140. NameDesc = 'name:desc',
  141. NameAsc = 'name:asc',
  142. DateDesc = 'date:desc',
  143. DateAsc = 'date:asc',
  144. }
  145. export enum ChangesLocations {
  146. Gutter = 'gutter',
  147. Overview = 'overview',
  148. }
  149. export enum CodeLensCommand {
  150. DiffWithPrevious = 'gitlens.diffWithPrevious',
  151. RevealCommitInView = 'gitlens.revealCommitInView',
  152. ShowCommitsInView = 'gitlens.showCommitsInView',
  153. ShowQuickCommitDetails = 'gitlens.showQuickCommitDetails',
  154. ShowQuickCommitFileDetails = 'gitlens.showQuickCommitFileDetails',
  155. ShowQuickCurrentBranchHistory = 'gitlens.showQuickRepoHistory',
  156. ShowQuickFileHistory = 'gitlens.showQuickFileHistory',
  157. ToggleFileBlame = 'gitlens.toggleFileBlame',
  158. }
  159. export enum CodeLensScopes {
  160. Document = 'document',
  161. Containers = 'containers',
  162. Blocks = 'blocks',
  163. }
  164. export enum CustomRemoteType {
  165. Bitbucket = 'Bitbucket',
  166. BitbucketServer = 'BitbucketServer',
  167. Custom = 'Custom',
  168. GitHub = 'GitHub',
  169. GitLab = 'GitLab',
  170. }
  171. export enum DateSource {
  172. Authored = 'authored',
  173. Committed = 'committed',
  174. }
  175. export enum DateStyle {
  176. Absolute = 'absolute',
  177. Relative = 'relative',
  178. }
  179. export enum FileAnnotationType {
  180. Blame = 'blame',
  181. Changes = 'changes',
  182. Heatmap = 'heatmap',
  183. }
  184. export enum GravatarDefaultStyle {
  185. Faces = 'wavatar',
  186. Geometric = 'identicon',
  187. Monster = 'monsterid',
  188. MysteryPerson = 'mp',
  189. Retro = 'retro',
  190. Robot = 'robohash',
  191. }
  192. export enum KeyMap {
  193. Alternate = 'alternate',
  194. Chorded = 'chorded',
  195. None = 'none',
  196. }
  197. export enum StatusBarCommand {
  198. DiffWithPrevious = 'gitlens.diffWithPrevious',
  199. DiffWithWorking = 'gitlens.diffWithWorking',
  200. RevealCommitInView = 'gitlens.revealCommitInView',
  201. ShowCommitsInView = 'gitlens.showCommitsInView',
  202. ShowQuickCommitDetails = 'gitlens.showQuickCommitDetails',
  203. ShowQuickCommitFileDetails = 'gitlens.showQuickCommitFileDetails',
  204. ShowQuickCurrentBranchHistory = 'gitlens.showQuickRepoHistory',
  205. ShowQuickFileHistory = 'gitlens.showQuickFileHistory',
  206. ToggleCodeLens = 'gitlens.toggleCodeLens',
  207. ToggleFileBlame = 'gitlens.toggleFileBlame',
  208. }
  209. export enum TagSorting {
  210. NameDesc = 'name:desc',
  211. NameAsc = 'name:asc',
  212. DateDesc = 'date:desc',
  213. DateAsc = 'date:asc',
  214. }
  215. export enum ViewBranchesLayout {
  216. List = 'list',
  217. Tree = 'tree',
  218. }
  219. export enum ViewFilesLayout {
  220. Auto = 'auto',
  221. List = 'list',
  222. Tree = 'tree',
  223. }
  224. export enum ViewShowBranchComparison {
  225. Branch = 'branch',
  226. Working = 'working',
  227. }
  228. export interface AdvancedConfig {
  229. abbreviatedShaLength: number;
  230. blame: {
  231. customArguments: string[] | null;
  232. delayAfterEdit: number;
  233. sizeThresholdAfterEdit: number;
  234. };
  235. caching: {
  236. enabled: boolean;
  237. };
  238. fileHistoryFollowsRenames: boolean;
  239. fileHistoryShowAllBranches: boolean;
  240. maxListItems: number;
  241. maxSearchItems: number;
  242. messages: {
  243. suppressCommitHasNoPreviousCommitWarning: boolean;
  244. suppressCommitNotFoundWarning: boolean;
  245. suppressFileNotUnderSourceControlWarning: boolean;
  246. suppressGitDisabledWarning: boolean;
  247. suppressGitVersionWarning: boolean;
  248. suppressLineUncommittedWarning: boolean;
  249. suppressNoRepositoryWarning: boolean;
  250. };
  251. quickPick: {
  252. closeOnFocusOut: boolean;
  253. };
  254. repositorySearchDepth: number;
  255. similarityThreshold: number | null;
  256. useSymmetricDifferenceNotation: boolean;
  257. }
  258. export interface CodeLensConfig {
  259. authors: {
  260. enabled: boolean;
  261. command: CodeLensCommand | false;
  262. };
  263. enabled: boolean;
  264. includeSingleLineSymbols: boolean;
  265. recentChange: {
  266. enabled: boolean;
  267. command: CodeLensCommand | false;
  268. };
  269. scopes: CodeLensScopes[];
  270. scopesByLanguage: CodeLensLanguageScope[] | null;
  271. symbolScopes: string[];
  272. }
  273. export interface CodeLensLanguageScope {
  274. language: string | undefined;
  275. scopes?: CodeLensScopes[];
  276. symbolScopes?: string[];
  277. }
  278. export interface MenuConfig {
  279. editor:
  280. | false
  281. | {
  282. blame: boolean;
  283. clipboard: boolean;
  284. compare: boolean;
  285. details: boolean;
  286. history: boolean;
  287. remote: boolean;
  288. };
  289. editorGroup:
  290. | false
  291. | {
  292. compare: boolean;
  293. history: boolean;
  294. };
  295. editorTab:
  296. | false
  297. | {
  298. clipboard: boolean;
  299. compare: boolean;
  300. history: boolean;
  301. remote: boolean;
  302. };
  303. explorer:
  304. | false
  305. | {
  306. clipboard: boolean;
  307. compare: boolean;
  308. history: boolean;
  309. remote: boolean;
  310. };
  311. scm:
  312. | false
  313. | {
  314. authors: boolean;
  315. };
  316. scmGroupInline:
  317. | false
  318. | {
  319. stash: boolean;
  320. };
  321. scmGroup:
  322. | false
  323. | {
  324. compare: boolean;
  325. openClose: boolean;
  326. stash: boolean;
  327. };
  328. scmItem:
  329. | false
  330. | {
  331. clipboard: boolean;
  332. compare: boolean;
  333. history: boolean;
  334. remote: boolean;
  335. stash: boolean;
  336. };
  337. }
  338. export interface ModeConfig {
  339. name: string;
  340. statusBarItemName?: string;
  341. description?: string;
  342. annotations?: 'blame' | 'changes' | 'heatmap';
  343. codeLens?: boolean;
  344. currentLine?: boolean;
  345. hovers?: boolean;
  346. statusBar?: boolean;
  347. views?: boolean;
  348. }
  349. export interface RemotesConfig {
  350. domain: string;
  351. name?: string;
  352. protocol?: string;
  353. type: CustomRemoteType;
  354. urls?: RemotesUrlsConfig;
  355. }
  356. export interface RemotesUrlsConfig {
  357. repository: string;
  358. branches: string;
  359. branch: string;
  360. commit: string;
  361. file: string;
  362. fileInBranch: string;
  363. fileInCommit: string;
  364. fileLine: string;
  365. fileRange: string;
  366. }
  367. export interface ViewsCommonConfig {
  368. commitFileDescriptionFormat: string;
  369. commitFileFormat: string;
  370. commitDescriptionFormat: string;
  371. commitFormat: string;
  372. defaultItemLimit: number;
  373. pageItemLimit: number;
  374. showRelativeDateMarkers: boolean;
  375. stashFileDescriptionFormat: string;
  376. stashFileFormat: string;
  377. stashDescriptionFormat: string;
  378. stashFormat: string;
  379. statusFileDescriptionFormat: string;
  380. statusFileFormat: string;
  381. }
  382. export const viewsCommonConfigKeys: (keyof ViewsCommonConfig)[] = [
  383. 'commitFileDescriptionFormat',
  384. 'commitFileFormat',
  385. 'commitDescriptionFormat',
  386. 'commitFormat',
  387. 'defaultItemLimit',
  388. 'pageItemLimit',
  389. 'showRelativeDateMarkers',
  390. 'stashFileDescriptionFormat',
  391. 'stashFileFormat',
  392. 'stashDescriptionFormat',
  393. 'stashFormat',
  394. 'statusFileDescriptionFormat',
  395. 'statusFileFormat',
  396. ];
  397. interface ViewsConfigs {
  398. branches: BranchesViewConfig;
  399. commits: CommitsViewConfig;
  400. compare: CompareViewConfig;
  401. contributors: ContributorsViewConfig;
  402. fileHistory: FileHistoryViewConfig;
  403. lineHistory: LineHistoryViewConfig;
  404. remotes: RemotesViewConfig;
  405. repositories: RepositoriesViewConfig;
  406. search: SearchViewConfig;
  407. stashes: StashesViewConfig;
  408. tags: TagsViewConfig;
  409. }
  410. export type ViewsConfigKeys = keyof ViewsConfigs;
  411. export const viewsConfigKeys: ViewsConfigKeys[] = [
  412. 'commits',
  413. 'repositories',
  414. 'fileHistory',
  415. 'lineHistory',
  416. 'branches',
  417. 'remotes',
  418. 'stashes',
  419. 'tags',
  420. 'contributors',
  421. 'search',
  422. 'compare',
  423. ];
  424. export type ViewsConfig = ViewsCommonConfig & ViewsConfigs;
  425. export interface BranchesViewConfig {
  426. avatars: boolean;
  427. branches: {
  428. layout: ViewBranchesLayout;
  429. };
  430. files: ViewsFilesConfig;
  431. showTrackingBranch: boolean;
  432. }
  433. export interface CommitsViewConfig {
  434. avatars: boolean;
  435. branches: undefined;
  436. files: ViewsFilesConfig;
  437. showBranchComparison: false | ViewShowBranchComparison;
  438. showTrackingBranch: boolean;
  439. }
  440. export interface CompareViewConfig {
  441. avatars: boolean;
  442. enabled: boolean;
  443. files: ViewsFilesConfig;
  444. }
  445. export interface ContributorsViewConfig {
  446. avatars: boolean;
  447. files: ViewsFilesConfig;
  448. }
  449. export interface FileHistoryViewConfig {
  450. avatars: boolean;
  451. enabled: boolean;
  452. }
  453. export interface LineHistoryViewConfig {
  454. avatars: boolean;
  455. enabled: boolean;
  456. }
  457. export interface RemotesViewConfig {
  458. avatars: boolean;
  459. branches: {
  460. layout: ViewBranchesLayout;
  461. };
  462. files: ViewsFilesConfig;
  463. showTrackingBranch: boolean;
  464. }
  465. export interface RepositoriesViewConfig {
  466. autoRefresh: boolean;
  467. autoReveal: boolean;
  468. avatars: boolean;
  469. branches: {
  470. layout: ViewBranchesLayout;
  471. };
  472. compact: boolean;
  473. enabled: boolean;
  474. files: ViewsFilesConfig;
  475. includeWorkingTree: boolean;
  476. showBranchComparison: false | ViewShowBranchComparison;
  477. showTrackingBranch: boolean;
  478. }
  479. export interface SearchViewConfig {
  480. avatars: boolean;
  481. enabled: boolean;
  482. files: ViewsFilesConfig;
  483. }
  484. export interface StashesViewConfig {
  485. avatars: boolean;
  486. files: ViewsFilesConfig;
  487. }
  488. export interface TagsViewConfig {
  489. avatars: boolean;
  490. branches: {
  491. layout: ViewBranchesLayout;
  492. };
  493. files: ViewsFilesConfig;
  494. }
  495. export interface ViewsFilesConfig {
  496. compact: boolean;
  497. layout: ViewFilesLayout;
  498. threshold: number;
  499. }