Skip to content

Add document symbol provider test #527

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@
"syntax": "js-yaml ./syntaxes/systemverilog.tmLanguage.yaml >./syntaxes/systemverilog.tmLanguage.json",
"makeBsv": "antlr4ts -visitor syntaxes/bsv.g4 -o src/bsvjs",
"pretest": "npm run compile-tests && npm run compile && npm run lint",
"test": "node ./out/src/test/bsv.js"
"test": "node ./out/src/test/runTest.js"
},
"dependencies": {
"antlr4": "^4.13.1-patch-1",
Expand Down
2 changes: 1 addition & 1 deletion src/test/runTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ async function main() {
try {
// The folder containing the Extension Manifest package.json
// Passed to `--extensionDevelopmentPath`
const extensionDevelopmentPath = path.resolve(__dirname, '../../');
const extensionDevelopmentPath = path.resolve(__dirname, '../../../');

// The path to test runner
// Passed to --extensionTestsPath
Expand Down
20 changes: 20 additions & 0 deletions src/test/suite/documentSymbol.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import * as assert from 'assert';
import * as vscode from 'vscode';
import * as path from 'path';

suite('VerilogDocumentSymbolProvider', () => {
test('returns symbols for simple verilog file', async () => {
const filePath = path.resolve(__dirname, '../../../language_examples/verilog_building_block/rtl/ram_sp.v');
const document = await vscode.workspace.openTextDocument(filePath);
await vscode.window.showTextDocument(document);

await vscode.workspace.getConfiguration('verilog').update('ctags.path', 'ctags', vscode.ConfigurationTarget.Global);
Copy link
Preview

Copilot AI Jun 12, 2025

Choose a reason for hiding this comment

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

Consider using the workspace configuration target rather than Global in tests to minimize unintended side effects on user settings.

Suggested change
await vscode.workspace.getConfiguration('verilog').update('ctags.path', 'ctags', vscode.ConfigurationTarget.Global);
await vscode.workspace.getConfiguration('verilog').update('ctags.path', 'ctags', vscode.ConfigurationTarget.Workspace);

Copilot uses AI. Check for mistakes.


const symbols = await vscode.commands.executeCommand<vscode.DocumentSymbol[]>(
'vscode.executeDocumentSymbolProvider',
document.uri
);

assert.ok(symbols && symbols.length > 0, 'Expected at least one document symbol');
});
});
Loading