@@ -1,58 +0,0 @@ |
| 1 | | -/home/espadon/src/fackr/test_lsp/02_completion.py |
| 2 | | -# LSP Test 2: Code Completion (Ctrl+Space) |
| 3 | | -# ========================================= |
| 4 | | -# |
| 5 | | -# Instructions: |
| 6 | | -# 1. Place cursor after a dot or partial word |
| 7 | | -# 2. Press Ctrl+Space to trigger completion |
| 8 | | -# 3. Use Up/Down arrows to navigate suggestions |
| 9 | | -# 4. Press Enter or Tab to accept a completion |
| 10 | | -# 5. Press Escape to dismiss without completing |
| 11 | | -# |
| 12 | | -# Try completing at the marked positions below: |
| 13 | | - |
| 14 | | -import os |
| 15 | | -import json |
| 16 | | -from pathlib import Path |
| 17 | | - |
| 18 | | -# Test 1: Module completions |
| 19 | | -# Place cursor after "os." and press Ctrl+Space |
| 20 | | -path = os. # <- complete here (try: getcwd, path, environ) |
| 21 | | - |
| 22 | | -# Test 2: String method completions |
| 23 | | -# Place cursor after "text." and press Ctrl+Space |
| 24 | | -text = "hello world" |
| 25 | | -upper = text. # <- complete here (try: upper, lower, split, strip) |
| 26 | | - |
| 27 | | -# Test 3: List method completions |
| 28 | | -numbers = [3, 1, 4, 1, 5] |
| 29 | | -numbers. # <- complete here (try: append, sort, reverse, pop) |
| 30 | | - |
| 31 | | -# Test 4: Dict method completions |
| 32 | | -data = {"name": "test", "value": 42} |
| 33 | | -keys = data. # <- complete here (try: keys, values, items, get) |
| 34 | | - |
| 35 | | -# Test 5: Path object completions |
| 36 | | -p = Path("/tmp") |
| 37 | | -p. # <- complete here (try: exists, is_file, read_text, mkdir) |
| 38 | | - |
| 39 | | -# Test 6: Partial word completion |
| 40 | | -# Type "pri" and press Ctrl+Space to complete to "print" |
| 41 | | -# pri # <- uncomment and complete |
| 42 | | - |
| 43 | | -# Test 7: Import completion |
| 44 | | -# from pathlib import P # <- complete after P (Path, PurePath, etc.) |
| 45 | | - |
| 46 | | - |
| 47 | | -class MyClass: |
| 48 | | - def __init__(self): |
| 49 | | - self.value = 100 |
| 50 | | - self.name = "test" |
| 51 | | - |
| 52 | | - def process(self): |
| 53 | | - # Test 8: Self completions |
| 54 | | - return self. # <- complete here (try: value, name) |
| 55 | | - |
| 56 | | - |
| 57 | | -obj = MyClass() |
| 58 | | -obj. # <- complete here (try: value, name, process) |