Skip to content

feat/includes#5

Open
andy9a9 wants to merge 1 commit intomainfrom
feat/includes
Open

feat/includes#5
andy9a9 wants to merge 1 commit intomainfrom
feat/includes

Conversation

@andy9a9
Copy link
Copy Markdown
Owner

@andy9a9 andy9a9 commented Mar 22, 2026

add feature to navigate across the #include directives

@andy9a9 andy9a9 requested a review from mkessler001 March 22, 2026 08:46
@andy9a9 andy9a9 force-pushed the feat/includes branch 2 times, most recently from 20a53f4 to 78c1ca4 Compare March 26, 2026 11:07
@andy9a9 andy9a9 force-pushed the feat/includes branch 2 times, most recently from 20ccf8b to 31d55e9 Compare April 10, 2026 12:49
Comment thread src/diagnostics.ts Outdated
Comment thread src/test/links.test.ts
Comment on lines +230 to +245
test('Should warn for missing include file', async () => {
const content = '#include "missing.dtsi"\n/ {\n};';
const mainFile = path.join(tempDir, 'test-missing.dts');
fs.writeFileSync(mainFile, content);

const doc = await vscode.workspace.openTextDocument(mainFile);

// Wait for diagnostics
await new Promise(resolve => setTimeout(resolve, 600));

const diagnostics = vscode.languages.getDiagnostics(doc.uri);
const includeDiag = diagnostics.find(d => d.message.includes('was not found'));

assert.ok(includeDiag, 'Should have diagnostic for missing include');
assert.strictEqual(includeDiag.severity, vscode.DiagnosticSeverity.Warning);
});
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An event-driven approach would be nicer than a hard-coded timeout.

Suggested change
test('Should warn for missing include file', async () => {
const content = '#include "missing.dtsi"\n/ {\n};';
const mainFile = path.join(tempDir, 'test-missing.dts');
fs.writeFileSync(mainFile, content);
const doc = await vscode.workspace.openTextDocument(mainFile);
// Wait for diagnostics
await new Promise(resolve => setTimeout(resolve, 600));
const diagnostics = vscode.languages.getDiagnostics(doc.uri);
const includeDiag = diagnostics.find(d => d.message.includes('was not found'));
assert.ok(includeDiag, 'Should have diagnostic for missing include');
assert.strictEqual(includeDiag.severity, vscode.DiagnosticSeverity.Warning);
});
// Helper to wait for diagnostics on a specific URI
function waitForDiagnostics(uri: vscode.Uri): Promise<vscode.Diagnostic[]> {
return new Promise(resolve => {
const disposable = vscode.languages.onDidChangeDiagnostics(e => {
if (e.uris.some(u => u.toString() === uri.toString())) {
disposable.dispose();
resolve(vscode.languages.getDiagnostics(uri));
}
});
});
}
test('Should warn for missing include file', async () => {
const content = '#include "missing.dtsi"\n/ {\n};';
const mainFile = path.join(tempDir, 'test-missing.dts');
fs.writeFileSync(mainFile, content);
const uri = vscode.Uri.file(mainFile);
const diagnosticsPromise = waitForDiagnostics(uri);
await vscode.workspace.openTextDocument(uri);
const diagnostics = await diagnosticsPromise;
const includeDiag = diagnostics.find(d => d.message.includes('was not
found'));
assert.ok(includeDiag, 'Should have diagnostic for missing include');
assert.strictEqual(includeDiag.severity,
vscode.DiagnosticSeverity.Warning);
});

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, then we should change it in all other places. But I would see it rather as a separated MR with refactoring as the same mechanism is used in other tests.

- sort extension options
- allow zero warnings
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants