-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_simple_completion.py
More file actions
63 lines (49 loc) · 2.08 KB
/
test_simple_completion.py
File metadata and controls
63 lines (49 loc) · 2.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/env python3
"""
Simple test to check completion generation directly.
"""
import sys
from pathlib import Path
# Add current directory to path
script_dir = Path(__file__).parent.absolute()
sys.path.insert(0, str(script_dir))
from completions import get_contextual_completions, PSEINT_KEYWORDS_DEFINITIONS
from lsprotocol.types import CompletionItemKind
def main():
# Test document content
test_code = """Proceso Test
Definir x Como Entero
"""
# Get completions at line 2 (inside process)
completions = get_contextual_completions(test_code, 2, 4)
print(f"Total completions: {len(completions)}")
# Check the specific problematic commands
target_commands = [
"FinPara", "FinSegun", "FinSi", "FinMientras", "Repetir",
"BorrarPantalla", "EsperarTecla"
]
print("\nChecking problematic commands:")
print("-" * 50)
for completion in completions:
if completion.label in target_commands:
# Print details about this completion
print(f"Label: {completion.label}")
print(f" Kind: {completion.kind}")
print(f" Insert Text: '{completion.insert_text}'")
print(f" Insert Format: {completion.insert_text_format}")
# Check if this would trigger parentheses
if completion.kind == CompletionItemKind.Function:
print(f" ⚠️ WARNING: Marked as Function - LSP clients may add ()")
elif completion.kind == CompletionItemKind.Keyword:
print(f" ✅ OK: Marked as Keyword - no automatic ()")
print()
# Also check for any duplicate or conflicting definitions
print("\nAll completions containing target commands:")
print("-" * 50)
for completion in completions:
label_lower = completion.label.lower()
for target in target_commands:
if target.lower() in label_lower or label_lower in target.lower():
print(f"{completion.label} -> {completion.kind} -> '{completion.insert_text}'")
if __name__ == "__main__":
main()