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.

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