mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-08 09:08:48 +01:00
Add explicit "inherit" setting for fragments links (#162231)
Fixes #162129
This commit is contained in:
@@ -477,8 +477,9 @@
|
||||
"type": "string",
|
||||
"scope": "resource",
|
||||
"markdownDescription": "%configuration.markdown.validate.fileLinks.markdownFragmentLinks.description%",
|
||||
"default": "ignore",
|
||||
"default": "inherit",
|
||||
"enum": [
|
||||
"inherit",
|
||||
"ignore",
|
||||
"warning",
|
||||
"error"
|
||||
|
||||
@@ -64,7 +64,7 @@ The server supports the following settings:
|
||||
- `enabled` — Enable/disable validation of links to fragments in the current files: `[text](#head)`
|
||||
- `fileLinks`
|
||||
- `enabled` — Enable/disable validation of links to file in the workspace.
|
||||
- `markdownFragmentLinks` — Enable/disable validation of links to headers in other Markdown files.
|
||||
- `markdownFragmentLinks` — Enable/disable validation of links to headers in other Markdown files. Use `inherit` to inherit the `fragmentLinks` setting.
|
||||
- `ignoredLinks` — Array of glob patterns for files that should not be validated.
|
||||
|
||||
### Custom requests
|
||||
|
||||
@@ -26,7 +26,7 @@ interface Settings {
|
||||
};
|
||||
readonly fileLinks: {
|
||||
readonly enabled: ValidateEnabled;
|
||||
readonly markdownFragmentLinks: ValidateEnabled;
|
||||
readonly markdownFragmentLinks: ValidateEnabled | 'inherit';
|
||||
};
|
||||
readonly ignoredLinks: readonly string[];
|
||||
};
|
||||
|
||||
@@ -33,11 +33,12 @@ function getDiagnosticsOptions(config: ConfigurationManager): md.DiagnosticOptio
|
||||
return defaultDiagnosticOptions;
|
||||
}
|
||||
|
||||
const validateFragmentLinks = convertDiagnosticLevel(settings.markdown.validate.fragmentLinks.enabled);
|
||||
return {
|
||||
validateFileLinks: convertDiagnosticLevel(settings.markdown.validate.fileLinks.enabled),
|
||||
validateReferences: convertDiagnosticLevel(settings.markdown.validate.referenceLinks.enabled),
|
||||
validateFragmentLinks: convertDiagnosticLevel(settings.markdown.validate.fragmentLinks.enabled),
|
||||
validateMarkdownFileLinkFragments: convertDiagnosticLevel(settings.markdown.validate.fileLinks.markdownFragmentLinks),
|
||||
validateFragmentLinks,
|
||||
validateMarkdownFileLinkFragments: settings.markdown.validate.fileLinks.markdownFragmentLinks === 'inherit' ? validateFragmentLinks : convertDiagnosticLevel(settings.markdown.validate.fileLinks.markdownFragmentLinks),
|
||||
ignoreLinks: settings.markdown.validate.ignoredLinks,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user