Commit 3485ae6
committed
Add position/range conversion infrastructure for multi-document support
Introduce new infrastructure to support converting positions and ranges
for documents that may map to multiple URIs (like notebook cells):
- Add Db trait with document() and notebook_document() queries
- Provides access to document metadata needed for conversion
- notebook_document() returns notebook info for a file if it exists
- Add LspRange and LspPosition types for deferred LSP conversion
- Stores file, offset/range, db reference, and encoding
- Allows callers to choose conversion strategy:
* to_local_range()/to_local_position(): For use within same document/cell
* to_location(): For cross-document references with URI
- Critical for notebooks where one file maps to multiple cell URIs
- Update conversion traits (RangeExt, PositionExt, etc.)
- Add methods to create LspRange/LspPosition from internal types
- Support both notebook cells and regular files
This infrastructure prepares the codebase for notebook support where
position/range conversions must account for cell boundaries and URIs.1 parent f790444 commit 3485ae6
File tree
22 files changed
+384
-278
lines changed- crates/ty_server/src
- document
- server/api
- requests
22 files changed
+384
-278
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | 3 | | |
5 | 4 | | |
6 | | - | |
7 | | - | |
8 | 5 | | |
9 | | - | |
| 6 | + | |
10 | 7 | | |
11 | 8 | | |
12 | 9 | | |
| |||
21 | 18 | | |
22 | 19 | | |
23 | 20 | | |
24 | | - | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
25 | 24 | | |
26 | 25 | | |
27 | 26 | | |
| |||
31 | 30 | | |
32 | 31 | | |
33 | 32 | | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | 33 | | |
38 | | - | |
39 | | - | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
40 | 40 | | |
41 | | - | |
42 | | - | |
43 | | - | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
44 | 46 | | |
45 | | - | |
46 | | - | |
| 47 | + | |
47 | 48 | | |
48 | 49 | | |
49 | | - | |
| 50 | + | |
50 | 51 | | |
51 | 52 | | |
52 | 53 | | |
| |||
56 | 57 | | |
57 | 58 | | |
58 | 59 | | |
59 | | - | |
| 60 | + | |
60 | 61 | | |
61 | 62 | | |
62 | 63 | | |
| |||
65 | 66 | | |
66 | 67 | | |
67 | 68 | | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
73 | 75 | | |
74 | 76 | | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
| 77 | + | |
81 | 78 | | |
82 | 79 | | |
83 | | - | |
| 80 | + | |
84 | 81 | | |
85 | 82 | | |
86 | 83 | | |
| |||
0 commit comments