diff --git a/CHANGELOG.md b/CHANGELOG.md index c2a237f..4c8f3a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## [Unreleased] + +## Fixed + +- Fixes [#2037](https://github.com/gitkraken/vscode-gitlens/issues/2037) - Autolinks can end up getting saved with invalid (cached) properties + ## [12.1.0] - 2022-06-14 ## Added @@ -4213,6 +4219,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p - Initial release but still heavily a work in progress. +[unreleased]: https://github.com/gitkraken/vscode-gitlens/compare/v12.1.0...HEAD [12.1.0]: https://github.com/gitkraken/vscode-gitlens/compare/v12.0.7...gitkraken:v12.1.0 [12.0.6]: https://github.com/gitkraken/vscode-gitlens/compare/v12.0.6...gitkraken:v12.0.7 [12.0.6]: https://github.com/gitkraken/vscode-gitlens/compare/v12.0.5...gitkraken:v12.0.6 diff --git a/src/annotations/autolinks.ts b/src/annotations/autolinks.ts index b1bd83a..2938feb 100644 --- a/src/annotations/autolinks.ts +++ b/src/annotations/autolinks.ts @@ -61,7 +61,9 @@ export class Autolinks implements Disposable { private onConfigurationChanged(e?: ConfigurationChangeEvent) { if (configuration.changed(e, 'autolinks')) { - this._references = this.container.config.autolinks ?? []; + const autolinks = configuration.get('autolinks'); + // Since VS Code's configuration objects are live we need to copy them to avoid writing back to the configuration + this._references = autolinks != null ? autolinks.map(a => ({ ...a })) : []; } } @@ -199,6 +201,7 @@ export class Autolinks implements Disposable { issuesOrPullRequests?: Map, ): ref is CacheableAutolinkReference | DynamicAutolinkReference { if (isDynamic(ref)) return true; + if (!ref.prefix || !ref.url) return false; try { if (ref.messageMarkdownRegex == null) {