mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-25 11:08:51 +01:00
Finalize markdown diagnostics (#161427)
Fixes #146303 This moves the markdown diagnostic support out of `experimental` and to an official feature (however it remains off by default)
This commit is contained in:
@@ -16,21 +16,19 @@ interface Settings {
|
||||
};
|
||||
};
|
||||
|
||||
readonly experimental: {
|
||||
readonly validate: {
|
||||
readonly enabled: true;
|
||||
readonly referenceLinks: {
|
||||
readonly enabled: ValidateEnabled;
|
||||
};
|
||||
readonly fragmentLinks: {
|
||||
readonly enabled: ValidateEnabled;
|
||||
};
|
||||
readonly fileLinks: {
|
||||
readonly enabled: ValidateEnabled;
|
||||
readonly markdownFragmentLinks: ValidateEnabled;
|
||||
};
|
||||
readonly ignoreLinks: readonly string[];
|
||||
readonly validate: {
|
||||
readonly enabled: true;
|
||||
readonly referenceLinks: {
|
||||
readonly enabled: ValidateEnabled;
|
||||
};
|
||||
readonly fragmentLinks: {
|
||||
readonly enabled: ValidateEnabled;
|
||||
};
|
||||
readonly fileLinks: {
|
||||
readonly enabled: ValidateEnabled;
|
||||
readonly markdownFragmentLinks: ValidateEnabled;
|
||||
};
|
||||
readonly ignoredLinks: readonly string[];
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -56,4 +54,4 @@ export class ConfigurationManager extends Disposable {
|
||||
public getSettings(): Settings | undefined {
|
||||
return this._settings;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
|
||||
import { Connection, FullDocumentDiagnosticReport, TextDocuments, UnchangedDocumentDiagnosticReport } from 'vscode-languageserver';
|
||||
import * as md from 'vscode-markdown-languageservice';
|
||||
import { disposeAll } from 'vscode-markdown-languageservice/out/util/dispose';
|
||||
import { Disposable } from 'vscode-notebook-renderer/events';
|
||||
import { URI } from 'vscode-uri';
|
||||
import { ConfigurationManager, ValidateEnabled } from '../configuration';
|
||||
import { disposeAll } from '../util/dispose';
|
||||
|
||||
const defaultDiagnosticOptions: md.DiagnosticOptions = {
|
||||
validateFileLinks: md.DiagnosticLevel.ignore,
|
||||
@@ -34,11 +34,11 @@ function getDiagnosticsOptions(config: ConfigurationManager): md.DiagnosticOptio
|
||||
}
|
||||
|
||||
return {
|
||||
validateFileLinks: convertDiagnosticLevel(settings.markdown.experimental.validate.fileLinks.enabled),
|
||||
validateReferences: convertDiagnosticLevel(settings.markdown.experimental.validate.referenceLinks.enabled),
|
||||
validateFragmentLinks: convertDiagnosticLevel(settings.markdown.experimental.validate.fragmentLinks.enabled),
|
||||
validateMarkdownFileLinkFragments: convertDiagnosticLevel(settings.markdown.experimental.validate.fileLinks.markdownFragmentLinks),
|
||||
ignoreLinks: settings.markdown.experimental.validate.ignoreLinks,
|
||||
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),
|
||||
ignoreLinks: settings.markdown.validate.ignoredLinks,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ export function registerValidateSupport(
|
||||
connection.languages.diagnostics.on(async (params, token): Promise<FullDocumentDiagnosticReport | UnchangedDocumentDiagnosticReport> => {
|
||||
logger.log(md.LogLevel.Trace, 'Server: connection.languages.diagnostics.on', params.textDocument.uri);
|
||||
|
||||
if (!config.getSettings()?.markdown.experimental.validate.enabled) {
|
||||
if (!config.getSettings()?.markdown.validate.enabled) {
|
||||
return emptyDiagnosticsResponse;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user