facsimile Public
Code
Use Git or checkout with SVN using the web URL.
No matching headings.
LSP Feature Test Files
These files are designed to test all LSP features in fac. Each file contains intentional errors and cross-references for comprehensive testing.
Files Overview
Python Files
-
calculator.py - Math functions with intentional errors
- Undefined variable errors (
resltinstead ofresult) - Missing import errors (
mathmodule) - Multiple functions for testing navigation
- Undefined variable errors (
-
main.py - Main program importing calculator
- Cross-file references for testing F12
- Class structure for Document Symbols
- Missing import error (
dividefunction)
Fortran Files
-
math_utils.f90 - Math utilities module
- Vector operations (add, dot product, magnitude)
- Matrix multiplication
- Intentional errors (uninitialized variables)
-
test_program.f90 - Program using math_utils
- Cross-file references to test F12
- Undefined variable error
C Files
-
utils.c - Utility functions
- Factorial, fibonacci, array operations
- Intentional errors (undefined variables, type mismatches)
-
main.c - Main program using utils
- Cross-file function calls
- Structure definition
- Multiple intentional errors
Testing LSP Features
1. Diagnostics (F8)
Test: Open any file and check for error markers in the gutter.
Expected errors:
- calculator.py:
resltundefined,mathnot imported - main.py:
dividenot imported - math_utils.f90:
undefined_varinbroken_routine - test_program.f90:
undefined_resultnot declared - utils.c:
undefined_var, type mismatch, missing return - main.c:
undefined_function, type mismatch,undeclared_var
How to test:
fac calculator.py
# Press F8 to open diagnostics panel
# Navigate with j/k or ↑/↓
# Press Enter to jump to error
2. Go to Definition (F12)
Test: Cross-file navigation between importing files.
In main.py:
- Put cursor on
addon line ~15 - Press
F12 - Should jump to
def add()in calculator.py
In test_program.f90:
- Put cursor on
vector_addon line ~23 - Press
F12 - Should jump to
subroutine vector_addin math_utils.f90
In main.c:
- Put cursor on
factorialon line ~28 - Press
F12 - Should jump to
int factorial()in utils.c
Return: Press Alt+, to jump back!
3. Find References (Shift+F12)
Test: Find all usages of a function.
In calculator.py:
- Put cursor on
calculate_totalfunction name - Press
Shift+F12 - Should show:
- Definition in calculator.py
- Usage in main.py (imported and called)
In math_utils.f90:
- Put cursor on
vector_dot - Press
Shift+F12 - Should show usage in test_program.f90
4. Code Actions (Ctrl+.)
Test: Quick fixes for errors.
In calculator.py line ~48:
- Put cursor on
reslt(undefined error) - Press
Ctrl+. - Should offer to fix the typo or define
reslt
In main.py line ~45:
- Put cursor on
divide(not imported error) - Press
Ctrl+. - Should offer to add
divideto imports
5. Rename Symbol (F2)
Test: Rename across files.
In calculator.py:
- Put cursor on
addfunction name - Press
F2 - Type new name (e.g.,
add_numbers) - Press Enter
- Check:
- Function renamed in calculator.py
- Import statement updated in main.py
- Function call updated in main.py
Undo: Press Ctrl+Z repeatedly to revert
6. Document Symbols (F4)
Test: See file outline.
In calculator.py:
- Press
F4 - Should see:
addfunctionsubtractfunctionmultiplyfunctiondividefunction- etc.
- Type "broken" to filter
- Press Enter to jump to function
In main.py:
- Press
F4 - Should see:
DataProcessorclassprocess_datafunctionmainfunction
7. Workspace Symbols (F6)
Test: Search symbols across ALL files.
- Press
F6 - Type "add"
- Should see:
addfunction in calculator.pyvector_addin math_utils.f90- Maybe
sum_arrayin utils.c (fuzzy match)
- Navigate with j/k
- Press Enter to jump (opens file if needed)
Try different searches:
- "calc" → finds
calculate_total,calculator, etc. - "vector" → finds all vector functions
- "fact" → finds
factorial
8. Signature Help
Test: Parameter hints while typing.
In any Python file:
- Type:
calculate_total( - Should see tooltip:
calculate_total(items) - As you type, current parameter is highlighted
In Fortran:
- Type:
call vector_add( - Should see signature with parameters
9. Document Formatting (Shift+Alt+F)
Test: Auto-format code.
In calculator.py:
- Mess up the formatting (add extra spaces, wrong indentation)
- Press
Shift+Alt+F - Code should be auto-formatted to PEP 8 style
In utils.c:
- Mess up braces and indentation
- Press
Shift+Alt+F - Code should be formatted with clang-format
10. Command Palette (Ctrl+P)
Test: Access commands without keybindings.
- Press
Ctrl+P - Type "format"
- Select "Format Document"
- Same as Shift+Alt+F
Or:
- Press
Ctrl+P - Type "def"
- Select "Go to Definition"
- Same as F12
Language Server Setup
To test these files, you need language servers installed:
Python:
pip install python-lsp-server
Fortran:
pip install fortls
C/C++:
# macOS
brew install llvm
# Linux
sudo apt install clangd
Expected Behavior
With Language Server Installed:
- ✅ Red/yellow error markers in gutter
- ✅ F12 jumps to definitions (even across files)
- ✅ Shift+F12 shows all references
- ✅ Ctrl+. offers quick fixes
- ✅ F2 renames across files
- ✅ F4 shows file outline
- ✅ F6 searches all symbols
- ✅ Shift+Alt+F formats code
Without Language Server:
- ❌ No error markers
- ❌ LSP features won't work
- ✅ Basic editing still works
- ✅ Syntax highlighting may work (if implemented separately)
Known Issues to Test
- Syntax highlighting for Fortran - Check if keywords are colored
- F8 vs Ctrl+D - Check if modifier keys work correctly
- Cross-file tabs - Check if F12 opens new tabs correctly
- Jump stack - Check if Alt+, returns to previous location
Quick Test Checklist
- Open calculator.py and see diagnostics (red/yellow markers)
- Press F8 and see error list
- F12 on
addin main.py → jumps to calculator.py - Alt+, → jumps back
- Shift+F12 on
calculate_total→ shows references - F2 on
multiply→ rename and see it update in both files - F4 → see file outline
- F6, type "vector" → find Fortran functions
- Ctrl+. on an error → see quick fixes
- Shift+Alt+F → format code