Skip to content

Commit 98f38c2

Browse files
committed
docs: Add comprehensive verification steps for tree-sitter integration
- Added detailed verification section with 10 step-by-step checks - Included commands to verify WASM file generation and distribution - Added test file examples for ABL and DF languages - Provided debugging steps for console verification - Created verification checklist for easy tracking - Added common issues and solutions table - Included performance and fallback testing steps This addresses the request from @adamhill to add verification steps to ensure the tree-sitter integration is working correctly.
1 parent f36aa76 commit 98f38c2

File tree

1 file changed

+193
-0
lines changed

1 file changed

+193
-0
lines changed

docs/ADD_TREE_SITTER_LANGUAGES.md

Lines changed: 193 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,199 @@ pnpm test
300300
pnpm bundle
301301
```
302302

303+
## Verification Steps
304+
305+
After completing the integration, follow these steps to verify that the tree-sitter parsers are working correctly:
306+
307+
### 1. Verify WASM Files Are Built
308+
309+
Check that the WASM files were successfully generated:
310+
311+
```bash
312+
# Check for ABL WASM file
313+
ls -la deps/tree-sitter-abl/tree-sitter-abl.wasm
314+
315+
# Check for DF WASM file
316+
ls -la deps/tree-sitter-df/tree-sitter-df.wasm
317+
318+
# Files should exist and be non-zero size
319+
```
320+
321+
### 2. Verify Build Process
322+
323+
Ensure the WASM files are copied to the distribution directory:
324+
325+
```bash
326+
# Build the project
327+
pnpm build
328+
329+
# Check that WASM files are in dist
330+
ls -la src/dist/tree-sitter-*.wasm | grep -E "(abl|df)"
331+
332+
# Should see:
333+
# tree-sitter-abl.wasm
334+
# tree-sitter-df.wasm
335+
```
336+
337+
### 3. Test File Extension Recognition
338+
339+
Create test files to verify extension handling:
340+
341+
```bash
342+
# Create test ABL files
343+
echo "PROCEDURE test: END." > test.p
344+
echo "/* Include file */" > test.i
345+
echo "/* Window file */" > test.w
346+
echo "CLASS TestClass: END CLASS." > test.cls
347+
348+
# Create test DF file
349+
echo "ADD TABLE \"Customer\"" > test.df
350+
351+
# Run the extension and verify these files are recognized
352+
# Check the output panel for parsing activity
353+
```
354+
355+
### 4. Verify Parser Loading
356+
357+
Check the browser console when opening ABL/DF files in VSCode:
358+
359+
1. Open VSCode Developer Tools: `Help > Toggle Developer Tools`
360+
2. Go to the Console tab
361+
3. Open an ABL or DF file
362+
4. Look for messages like:
363+
- `Loading language parser for extension: .p`
364+
- `Successfully loaded tree-sitter-abl.wasm`
365+
- No error messages about missing WASM files
366+
367+
### 5. Test Query Functionality
368+
369+
Create a test ABL file with various constructs:
370+
371+
```abl
372+
/* test-verification.p */
373+
PROCEDURE validateCustomer:
374+
DEFINE INPUT PARAMETER custNum AS INTEGER NO-UNDO.
375+
DEFINE VARIABLE isValid AS LOGICAL NO-UNDO.
376+
377+
isValid = custNum > 0.
378+
RETURN isValid.
379+
END PROCEDURE.
380+
381+
FUNCTION calculateDiscount RETURNS DECIMAL (INPUT orderTotal AS DECIMAL):
382+
IF orderTotal > 1000 THEN
383+
RETURN orderTotal * 0.1.
384+
ELSE
385+
RETURN 0.
386+
END FUNCTION.
387+
388+
CLASS OrderProcessor:
389+
METHOD PUBLIC VOID processOrder():
390+
/* Processing logic */
391+
END METHOD.
392+
END CLASS.
393+
```
394+
395+
Then verify the parser captures these definitions:
396+
397+
- The outline view should show: `validateCustomer`, `calculateDiscount`, `OrderProcessor`
398+
- Code navigation (Ctrl+Shift+O) should list all definitions
399+
- Go to Definition (F12) should work for these constructs
400+
401+
### 6. Run Unit Tests
402+
403+
Execute the specific tests for the new languages:
404+
405+
```bash
406+
# Run ABL parser tests
407+
pnpm test -- parseSourceCodeDefinitions.abl
408+
409+
# Run DF parser tests (if created)
410+
pnpm test -- parseSourceCodeDefinitions.df
411+
412+
# All tests should pass
413+
```
414+
415+
### 7. Verify CI/CD Pipeline
416+
417+
Check that GitHub Actions handles the submodules correctly:
418+
419+
```bash
420+
# Push changes to a test branch
421+
git checkout -b test-abl-df-integration
422+
git add .
423+
git commit -m "test: Verify ABL/DF integration"
424+
git push origin test-abl-df-integration
425+
426+
# Check GitHub Actions:
427+
# - Workflow should checkout submodules
428+
# - WASM build step should succeed
429+
# - All tests should pass
430+
```
431+
432+
### 8. Test with Real ABL/DF Files
433+
434+
If you have actual ABL/DF files:
435+
436+
1. Open them in VSCode with the extension
437+
2. Verify:
438+
- Syntax highlighting works (if implemented)
439+
- Code folding works at procedure/function boundaries
440+
- Outline view shows correct structure
441+
- Search functionality finds definitions
442+
- No parsing errors in the output panel
443+
444+
### 9. Performance Verification
445+
446+
Check that the parsers perform adequately:
447+
448+
```bash
449+
# Create a large test file
450+
for i in {1..100}; do
451+
echo "PROCEDURE proc$i: END PROCEDURE." >> large-test.p
452+
done
453+
454+
# Open the file and verify:
455+
# - File opens without significant delay
456+
# - Parsing completes within reasonable time
457+
# - No memory issues or crashes
458+
```
459+
460+
### 10. Fallback Verification
461+
462+
If you added extensions to fallback list, test that fallback works:
463+
464+
1. Temporarily rename/remove the WASM file
465+
2. Open an ABL/DF file
466+
3. Verify the file still opens and basic chunking works
467+
4. Check console for fallback messages
468+
5. Restore the WASM file
469+
470+
### Common Issues and Solutions
471+
472+
| Issue | Solution |
473+
| ------------------- | ---------------------------------------------------------------- |
474+
| WASM file not found | Ensure submodules are initialized: `git submodule update --init` |
475+
| Parser not loading | Check file extension mapping in `languageParser.ts` |
476+
| Queries not working | Verify query syntax matches the grammar's node types |
477+
| Build failures | Update tree-sitter CLI: `npm update -g tree-sitter-cli` |
478+
| Tests failing | Ensure test files use correct language identifier |
479+
| CI/CD issues | Verify `.github/workflows` includes submodule checkout |
480+
481+
### Verification Checklist
482+
483+
- [ ] WASM files built successfully
484+
- [ ] WASM files copied to dist directory
485+
- [ ] File extensions recognized
486+
- [ ] Parser loads without errors
487+
- [ ] Queries capture expected definitions
488+
- [ ] Unit tests pass
489+
- [ ] CI/CD pipeline succeeds
490+
- [ ] Real files parse correctly
491+
- [ ] Performance is acceptable
492+
- [ ] Fallback mechanism works (if configured)
493+
494+
If all verification steps pass, the tree-sitter integration is working correctly!
495+
303496
## Maintenance
304497

305498
### Updating Submodules

0 commit comments

Comments
 (0)