|
1 | 1 | 'use strict'; |
2 | 2 | import { ExtensionContext, extensions, languages, window, workspace } from 'vscode'; |
3 | 3 | import { AnnotationController } from './annotations/annotationController'; |
4 | | -import { CodeLensLocations, Configuration, IConfig, LineHighlightLocations } from './configuration'; |
| 4 | +import { Configuration, IConfig } from './configuration'; |
5 | 5 | import { ApplicationInsightsKey, CommandContext, ExtensionKey, GlobalState, QualifiedExtensionId, setCommandContext } from './constants'; |
6 | 6 | import { CodeLensController } from './codeLensController'; |
7 | 7 | import { configureCommands } from './commands'; |
8 | | -import { CurrentLineController, LineAnnotationType } from './currentLineController'; |
| 8 | +import { CurrentLineController } from './currentLineController'; |
9 | 9 | import { GitContentProvider } from './gitContentProvider'; |
10 | 10 | import { GitExplorer } from './views/gitExplorer'; |
11 | 11 | import { GitRevisionCodeLensProvider } from './gitRevisionCodeLensProvider'; |
@@ -49,7 +49,6 @@ export async function activate(context: ExtensionContext) { |
49 | 49 | telemetryContext['git.version'] = gitVersion; |
50 | 50 | Telemetry.setContext(telemetryContext); |
51 | 51 |
|
52 | | - await migrateSettings(context); |
53 | 52 | notifyOnUnsupportedGitVersion(context, gitVersion); |
54 | 53 | notifyOnNewGitLensVersion(context, gitlensVersion); |
55 | 54 |
|
@@ -88,127 +87,6 @@ export async function activate(context: ExtensionContext) { |
88 | 87 | // this method is called when your extension is deactivated |
89 | 88 | export function deactivate() { } |
90 | 89 |
|
91 | | -async function migrateSettings(context: ExtensionContext) { |
92 | | - const previousVersion = context.globalState.get<string>(GlobalState.GitLensVersion); |
93 | | - if (previousVersion === undefined) return; |
94 | | - |
95 | | - const [major] = previousVersion.split('.'); |
96 | | - if (parseInt(major, 10) >= 4) return; |
97 | | - |
98 | | - try { |
99 | | - const cfg = workspace.getConfiguration(ExtensionKey); |
100 | | - const prevCfg = workspace.getConfiguration().get<any>(ExtensionKey)!; |
101 | | - |
102 | | - if (prevCfg.blame !== undefined && prevCfg.blame.annotation !== undefined) { |
103 | | - switch (prevCfg.blame.annotation.activeLine) { |
104 | | - case 'off': |
105 | | - await cfg.update('blame.line.enabled', false, true); |
106 | | - break; |
107 | | - case 'hover': |
108 | | - await cfg.update('blame.line.annotationType', LineAnnotationType.Hover, true); |
109 | | - break; |
110 | | - } |
111 | | - |
112 | | - if (prevCfg.blame.annotation.activeLineDarkColor != null) { |
113 | | - await cfg.update('theme.annotations.line.trailing.dark.foregroundColor', prevCfg.blame.annotation.activeLineDarkColor, true); |
114 | | - } |
115 | | - |
116 | | - if (prevCfg.blame.annotation.activeLineLightColor != null) { |
117 | | - await cfg.update('theme.annotations.line.trailing.light.foregroundColor', prevCfg.blame.annotation.activeLineLightColor, true); |
118 | | - } |
119 | | - |
120 | | - switch (prevCfg.blame.annotation.highlight) { |
121 | | - case 'none': |
122 | | - await cfg.update('blame.file.lineHighlight.enabled', false); |
123 | | - break; |
124 | | - case 'gutter': |
125 | | - await cfg.update('blame.file.lineHighlight.locations', [LineHighlightLocations.Gutter, LineHighlightLocations.OverviewRuler], true); |
126 | | - break; |
127 | | - case 'line': |
128 | | - await cfg.update('blame.file.lineHighlight.locations', [LineHighlightLocations.Line, LineHighlightLocations.OverviewRuler], true); |
129 | | - break; |
130 | | - case 'both': |
131 | | - } |
132 | | - |
133 | | - if (prevCfg.blame.annotation.dateFormat != null) { |
134 | | - await cfg.update('annotations.file.gutter.dateFormat', prevCfg.blame.annotation.dateFormat, true); |
135 | | - await cfg.update('annotations.line.trailing.dateFormat', prevCfg.blame.annotation.dateFormat, true); |
136 | | - } |
137 | | - } |
138 | | - |
139 | | - if (prevCfg.codeLens !== undefined) { |
140 | | - switch (prevCfg.codeLens.visibility) { |
141 | | - case 'ondemand': |
142 | | - case 'off': |
143 | | - await cfg.update('codeLens.enabled', false); |
144 | | - } |
145 | | - |
146 | | - switch (prevCfg.codeLens.location) { |
147 | | - case 'all': |
148 | | - await cfg.update('codeLens.locations', [CodeLensLocations.Document, CodeLensLocations.Containers, CodeLensLocations.Blocks], true); |
149 | | - break; |
150 | | - case 'document+containers': |
151 | | - await cfg.update('codeLens.locations', [CodeLensLocations.Document, CodeLensLocations.Containers], true); |
152 | | - break; |
153 | | - case 'document': |
154 | | - await cfg.update('codeLens.locations', [CodeLensLocations.Document], true); |
155 | | - break; |
156 | | - } |
157 | | - |
158 | | - if (prevCfg.codeLens.locationCustomSymbols != null) { |
159 | | - await cfg.update('codeLens.customLocationSymbols', prevCfg.codeLens.locationCustomSymbols, true); |
160 | | - } |
161 | | - } |
162 | | - |
163 | | - if ((prevCfg.menus && prevCfg.menus.diff && prevCfg.menus.diff.enabled) === false) { |
164 | | - await cfg.update('advanced.menus', { |
165 | | - editorContext: { |
166 | | - blame: true, |
167 | | - copy: true, |
168 | | - details: true, |
169 | | - fileDiff: false, |
170 | | - history: true, |
171 | | - lineDiff: false, |
172 | | - remote: true |
173 | | - }, |
174 | | - editorTitle: { |
175 | | - blame: true, |
176 | | - fileDiff: false, |
177 | | - history: true, |
178 | | - remote: true, |
179 | | - status: true |
180 | | - }, |
181 | | - editorTitleContext: { |
182 | | - blame: true, |
183 | | - fileDiff: false, |
184 | | - history: true, |
185 | | - remote: true |
186 | | - }, |
187 | | - explorerContext: { |
188 | | - fileDiff: false, |
189 | | - history: true, |
190 | | - remote: true |
191 | | - } |
192 | | - }, true); |
193 | | - } |
194 | | - |
195 | | - switch (prevCfg.statusBar && prevCfg.statusBar.date) { |
196 | | - case 'off': |
197 | | - await cfg.update('statusBar.format', '${author}', true); |
198 | | - break; |
199 | | - case 'absolute': |
200 | | - await cfg.update('statusBar.format', '${author}, ${date}', true); |
201 | | - break; |
202 | | - } |
203 | | - } |
204 | | - catch (ex) { |
205 | | - Logger.error(ex, 'migrateSettings'); |
206 | | - } |
207 | | - finally { |
208 | | - window.showInformationMessage(`GitLens v4 adds many new settings and removes a few old ones, so please review your settings to ensure they are configured properly.`); |
209 | | - } |
210 | | -} |
211 | | - |
212 | 90 | async function notifyOnNewGitLensVersion(context: ExtensionContext, version: string) { |
213 | 91 | if (context.globalState.get(SuppressedKeys.UpdateNotice, false)) return; |
214 | 92 |
|
|
0 commit comments