mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-23 01:58:53 +01:00
Rename skipPaths to ignoreLinks (#150064)
This change renames the experimental skipPaths setting to ignoreLinks. This setting applies to all types of links, and can also be used to ignore links to headers
This commit is contained in:
@@ -26,7 +26,7 @@ async function getComputedDiagnostics(doc: InMemoryDocument, workspaceContents:
|
||||
validateFilePaths: DiagnosticLevel.warning,
|
||||
validateOwnHeaders: DiagnosticLevel.warning,
|
||||
validateReferences: DiagnosticLevel.warning,
|
||||
skipPaths: [],
|
||||
ignoreLinks: [],
|
||||
}, noopToken)
|
||||
).diagnostics;
|
||||
}
|
||||
@@ -44,7 +44,7 @@ class MemoryDiagnosticConfiguration implements DiagnosticConfiguration {
|
||||
|
||||
constructor(
|
||||
private readonly enabled: boolean = true,
|
||||
private readonly skipPaths: string[] = [],
|
||||
private readonly ignoreLinks: string[] = [],
|
||||
) { }
|
||||
|
||||
getOptions(_resource: vscode.Uri): DiagnosticOptions {
|
||||
@@ -54,7 +54,7 @@ class MemoryDiagnosticConfiguration implements DiagnosticConfiguration {
|
||||
validateFilePaths: DiagnosticLevel.ignore,
|
||||
validateOwnHeaders: DiagnosticLevel.ignore,
|
||||
validateReferences: DiagnosticLevel.ignore,
|
||||
skipPaths: this.skipPaths,
|
||||
ignoreLinks: this.ignoreLinks,
|
||||
};
|
||||
}
|
||||
return {
|
||||
@@ -62,7 +62,7 @@ class MemoryDiagnosticConfiguration implements DiagnosticConfiguration {
|
||||
validateFilePaths: DiagnosticLevel.warning,
|
||||
validateOwnHeaders: DiagnosticLevel.warning,
|
||||
validateReferences: DiagnosticLevel.warning,
|
||||
skipPaths: this.skipPaths,
|
||||
ignoreLinks: this.ignoreLinks,
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -196,7 +196,7 @@ suite('markdown: Diagnostics', () => {
|
||||
assert.deepStrictEqual(diagnostics.length, 0);
|
||||
});
|
||||
|
||||
test('skipPaths should allow skipping non-existent file', async () => {
|
||||
test('ignoreLinks should allow skipping link to non-existent file', async () => {
|
||||
const doc1 = new InMemoryDocument(workspacePath('doc1.md'), joinLines(
|
||||
`[text](/no-such-file#header)`,
|
||||
));
|
||||
@@ -206,7 +206,7 @@ suite('markdown: Diagnostics', () => {
|
||||
assert.deepStrictEqual(diagnostics.length, 0);
|
||||
});
|
||||
|
||||
test('skipPaths should not consider link fragment', async () => {
|
||||
test('ignoreLinks should not consider link fragment', async () => {
|
||||
const doc1 = new InMemoryDocument(workspacePath('doc1.md'), joinLines(
|
||||
`[text](/no-such-file#header)`,
|
||||
));
|
||||
@@ -216,7 +216,7 @@ suite('markdown: Diagnostics', () => {
|
||||
assert.deepStrictEqual(diagnostics.length, 0);
|
||||
});
|
||||
|
||||
test('skipPaths should support globs', async () => {
|
||||
test('ignoreLinks should support globs', async () => {
|
||||
const doc1 = new InMemoryDocument(workspacePath('doc1.md'), joinLines(
|
||||
``,
|
||||
``,
|
||||
@@ -227,4 +227,33 @@ suite('markdown: Diagnostics', () => {
|
||||
const { diagnostics } = await manager.recomputeDiagnosticState(doc1, noopToken);
|
||||
assert.deepStrictEqual(diagnostics.length, 0);
|
||||
});
|
||||
|
||||
test('ignoreLinks should support ignoring header', async () => {
|
||||
const doc1 = new InMemoryDocument(workspacePath('doc1.md'), joinLines(
|
||||
``,
|
||||
));
|
||||
|
||||
const manager = createDiagnosticsManager(new InMemoryWorkspaceMarkdownDocuments([doc1]), new MemoryDiagnosticConfiguration(true, ['#no-such']));
|
||||
const { diagnostics } = await manager.recomputeDiagnosticState(doc1, noopToken);
|
||||
assert.deepStrictEqual(diagnostics.length, 0);
|
||||
});
|
||||
|
||||
test('ignoreLinks should support ignoring header in file', async () => {
|
||||
const doc1 = new InMemoryDocument(workspacePath('doc1.md'), joinLines(
|
||||
``,
|
||||
));
|
||||
const doc2 = new InMemoryDocument(workspacePath('doc2.md'), joinLines(''));
|
||||
|
||||
const contents = new InMemoryWorkspaceMarkdownDocuments([doc1, doc2]);
|
||||
{
|
||||
const manager = createDiagnosticsManager(contents, new MemoryDiagnosticConfiguration(true, ['/doc2.md#no-such']));
|
||||
const { diagnostics } = await manager.recomputeDiagnosticState(doc1, noopToken);
|
||||
assert.deepStrictEqual(diagnostics.length, 0);
|
||||
}
|
||||
{
|
||||
const manager = createDiagnosticsManager(contents, new MemoryDiagnosticConfiguration(true, ['/doc2.md#*']));
|
||||
const { diagnostics } = await manager.recomputeDiagnosticState(doc1, noopToken);
|
||||
assert.deepStrictEqual(diagnostics.length, 0);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user