Skip to content

Commit 197a4ab

Browse files
committed
Fixes issue with insiders caused by new SymbolInformation API changes
1 parent 11dc8f3 commit 197a4ab

File tree

4 files changed

+21
-6
lines changed

4 files changed

+21
-6
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).
66

7+
## [Unreleased]
8+
- Fixes issue with insiders builds because of the new `SymbolInformation` API changes (see [Microsoft/vscode#34968](https://github.com/Microsoft/vscode/issues/34968))
9+
710
## [8.4.0] - 2018-06-19
811
### Added
912
- Adds completely revamped heatmap annotations

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
- Fixes [#400](https://github.com/eamodio/vscode-gitlens/issues/412) - GitLens logging to debug console when debugging different extension
2727
- Fixes [#409](https://github.com/eamodio/vscode-gitlens/issues/409) - Literal $(ellipsis) inserted into commit QuickPick menu entry placeholder text
2828
- Fixes [#415](https://github.com/eamodio/vscode-gitlens/issues/415) - Branch names get mangled by color escapes — thanks to [PR #416](https://github.com/eamodio/vscode-gitlens/pull/416) by Roy Ivy III ([@rivy](https://github.com/rivy))
29+
- Fixes issue with insiders builds because of the new `SymbolInformation` API changes (see [Microsoft/vscode#34968](https://github.com/Microsoft/vscode/issues/34968))
2930

3031
See the [release notes](https://github.com/eamodio/vscode-gitlens/blob/master/CHANGELOG.md "Open Release Notes") for the full set of changes
3132

src/gitCodeLensProvider.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ export class GitCodeLensProvider implements CodeLensProvider {
165165
blameForRangeFn,
166166
blameRange,
167167
true,
168-
fileSymbol.location.range,
168+
getRangeFromSymbol(fileSymbol),
169169
cfg.recentChange.command,
170170
dirtyCommand
171171
));
@@ -182,7 +182,7 @@ export class GitCodeLensProvider implements CodeLensProvider {
182182
blameForRangeFn,
183183
blameRange,
184184
true,
185-
fileSymbol.location.range,
185+
getRangeFromSymbol(fileSymbol),
186186
cfg.authors.command
187187
));
188188
}
@@ -216,7 +216,7 @@ export class GitCodeLensProvider implements CodeLensProvider {
216216

217217
if (valid) {
218218
// Adjust the range to be for the whole file
219-
if (symbol.location.range.start.line === 0 && symbol.location.range.end.line === 0) {
219+
if (getRangeFromSymbol(symbol).start.line === 0 && getRangeFromSymbol(symbol).end.line === 0) {
220220
range = documentRangeFn();
221221
}
222222
}
@@ -248,14 +248,14 @@ export class GitCodeLensProvider implements CodeLensProvider {
248248
break;
249249
}
250250

251-
return valid ? range || symbol.location.range : undefined;
251+
return valid ? range || getRangeFromSymbol(symbol) : undefined;
252252
}
253253

254254
private provideCodeLens(lenses: CodeLens[], document: TextDocument, symbol: SymbolInformation, languageScope: Required<CodeLensLanguageScope>, documentRangeFn: () => Range, blame: GitBlame | undefined, gitUri: GitUri | undefined, cfg: ICodeLensConfig, dirty: boolean, dirtyCommand: Command | undefined): void {
255255
const blameRange = this.validateSymbolAndGetBlameRange(symbol, languageScope, documentRangeFn);
256256
if (blameRange === undefined) return;
257257

258-
const line = document.lineAt(symbol.location.range.start);
258+
const line = document.lineAt(getRangeFromSymbol(symbol).start);
259259
// Make sure there is only 1 lens per line
260260
if (lenses.length && lenses[lenses.length - 1].range.start.line === line.lineNumber) return;
261261

@@ -433,4 +433,9 @@ export class GitCodeLensProvider implements CodeLensProvider {
433433
if (cfg.recentChange.enabled) return Container.config.strings.codeLens.unsavedChanges.recentChangeOnly;
434434
return Container.config.strings.codeLens.unsavedChanges.authorsOnly;
435435
}
436+
}
437+
438+
function getRangeFromSymbol(symbol: SymbolInformation) {
439+
// Normalize the range to deal with the new api
440+
return (symbol.location && symbol.location.range) || (symbol as any).range;
436441
}

src/ui/welcome/index.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ <h2 class="changelog__title">What's New in
7676
<a title="Maxim Pekurin (@pmaxim25)" href="https://github.com/pmaxim25">Maxim Pekurin</a>
7777
<div class="changelog__details"></div>
7878
</li>
79-
8079
<li>
8180
<span class="changelog__badge changelog__badge--added">NEW</span>
8281
Adds
@@ -122,6 +121,13 @@ <h2 class="changelog__title">What's New in
122121
<a title="Roy Ivy III (@rivy)" href="https://github.com/rivy">Roy Ivy III</a>
123122
<div class="changelog__details"></div>
124123
</li>
124+
<li>
125+
<span class="changelog__badge changelog__badge--fixed">FIXED</span>
126+
Fixes issue with insiders builds because of the new
127+
<code>SymbolInformation</code> API changes (see
128+
<a title="Open Microsoft/vscode Issue #34968" href="https://github.com/Microsoft/vscode/issues/34968">Microsoft/vscode#34968</a>)
129+
<div class="changelog__details"></div>
130+
</li>
125131

126132
<li class="changelog__list-item--version">
127133
<span class="changelog__badge changelog__badge--version">8.3</span>

0 commit comments

Comments
 (0)