mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-19 08:08:39 +01:00
Rework markdown update link glob (#164766)
* Rework markdown update link glob Fixes #164587 This changes the `externalFileGlobs` setting to instead be a include array of globs that should trigger link updates. I've split the globs into markdown files and image/video files This also makes it easier for users to add their own new globs to the list * Fix scopes
This commit is contained in:
@@ -12,14 +12,13 @@ import { MdLanguageClient } from '../client/client';
|
||||
import { Delayer } from '../util/async';
|
||||
import { noopToken } from '../util/cancellation';
|
||||
import { Disposable } from '../util/dispose';
|
||||
import { looksLikeMarkdownPath } from '../util/file';
|
||||
import { convertRange } from './fileReferences';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
const settingNames = Object.freeze({
|
||||
enabled: 'updateLinksOnFileMove.enabled',
|
||||
externalFileGlobs: 'updateLinksOnFileMove.externalFileGlobs',
|
||||
include: 'updateLinksOnFileMove.include',
|
||||
enableForDirectories: 'updateLinksOnFileMove.enableForDirectories',
|
||||
});
|
||||
|
||||
@@ -99,13 +98,13 @@ class UpdateLinksOnFileRenameHandler extends Disposable {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (looksLikeMarkdownPath(newUri)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const externalGlob = config.get<string>(settingNames.externalFileGlobs);
|
||||
if (!!externalGlob && picomatch.isMatch(newUri.fsPath, externalGlob)) {
|
||||
return true;
|
||||
const externalGlob = config.get<string[]>(settingNames.include);
|
||||
if (externalGlob) {
|
||||
for (const glob of externalGlob) {
|
||||
if (picomatch.isMatch(newUri.fsPath, glob)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const stat = await vscode.workspace.fs.stat(newUri);
|
||||
|
||||
Reference in New Issue
Block a user