Open
Conversation
20a53f4 to
78c1ca4
Compare
20ccf8b to
31d55e9
Compare
mkessler001
reviewed
Apr 12, 2026
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); | ||
| }); |
Collaborator
There was a problem hiding this comment.
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); | |
| }); |
Owner
Author
There was a problem hiding this comment.
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
add feature to navigate across the #include directives