You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

426 lines
8.6 KiB

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