Browse Source

Copies only known properties from autolinks

Refs #2037
main
Eric Amodio 2 years ago
parent
commit
1dcf1bd011
1 changed files with 15 additions and 1 deletions
  1. +15
    -1
      src/annotations/autolinks.ts

+ 15
- 1
src/annotations/autolinks.ts View File

@ -63,7 +63,21 @@ export class Autolinks implements Disposable {
if (configuration.changed(e, '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 })) : [];
this._references =
autolinks
?.filter(a => a.prefix && a.url)
/**
* Only allow properties defined by {@link AutolinkReference}
*/
?.map(a => ({
prefix: a.prefix,
url: a.url,
title: a.title,
alphanumeric: a.alphanumeric,
ignoreCase: a.ignoreCase,
type: a.type,
description: a.description,
})) ?? [];
}
}

Loading…
Cancel
Save