Skip to content

Commit 043ffa0

Browse files
committed
test: add LSP integration test file
Add test file with comprehensive examples to verify TypeScript language server integration. File includes tests for: - Code completion - Hover information - Error detection - Function parameter hints - Jump to definition - Type inference - JSDoc support This file can be opened in Phoenix to manually verify all LSP features are working correctly.
1 parent 0d7081b commit 043ffa0

File tree

1 file changed

+71
-0
lines changed

1 file changed

+71
-0
lines changed

test-lsp.js

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
// Test file for TypeScript LSP
2+
// Open this file in Phoenix to test LSP features
3+
4+
// Test 1: Code Completion
5+
// Type the dot after 'arr' and press Ctrl+Space
6+
// You should see array methods: map, filter, reduce, etc.
7+
const arr = [1, 2, 3, 4, 5];
8+
arr
9+
10+
// Test 2: Hover Information
11+
// Hover your mouse over variables to see their types
12+
const name = "Phoenix";
13+
const count = 42;
14+
const isActive = true;
15+
16+
// Test 3: Error Detection
17+
// This should show a red squiggle (undefined variable)
18+
// Uncomment to test:
19+
// const result = undefinedVariable;
20+
21+
// Test 4: Function Parameter Hints
22+
// Type the opening parenthesis and you should see parameter info
23+
function greet(firstName, lastName, age) {
24+
return `Hello ${firstName} ${lastName}, age ${age}`;
25+
}
26+
27+
// Type: greet( and you should see parameter hints
28+
greet
29+
30+
// Test 5: Jump to Definition
31+
// Right-click on 'greet' below and select "Go to Definition"
32+
// It should jump to the function definition above
33+
const message = greet("John", "Doe", 30);
34+
35+
// Test 6: Object Property Completion
36+
// Type the dot after 'person' and press Ctrl+Space
37+
const person = {
38+
name: "Alice",
39+
age: 25,
40+
41+
};
42+
person
43+
44+
// Test 7: String Methods
45+
// Type the dot after 'str' and press Ctrl+Space
46+
const str = "Hello World";
47+
str
48+
49+
// Test 8: Import Suggestions (if you have other files)
50+
// Type: import { } from './
51+
// You should see file suggestions
52+
53+
// Test 9: Type Inference
54+
// Hover over 'numbers' - it should show: number[]
55+
const numbers = [1, 2, 3].map(n => n * 2);
56+
57+
// Test 10: JSDoc Support
58+
/**
59+
* Calculates the sum of two numbers
60+
* @param {number} a - First number
61+
* @param {number} b - Second number
62+
* @returns {number} The sum
63+
*/
64+
function add(a, b) {
65+
return a + b;
66+
}
67+
68+
// Type: add( and you should see the JSDoc information
69+
add
70+
71+
console.log("If you see LSP features working, the integration is successful! 🎉");

0 commit comments

Comments
 (0)