Commit a5581a2
authored
Invalidate Visible Range, Responsive Language Update (#238)
### Description
- Updates the visible set of indices when text storage happens, fixing
the linked issue.
- When setting a new language on the highlighter, adds a small "reset"
that clears all current highlights. This makes the language update feel
snappier, as the user receives immediate feedback. Before the ts parser
could take a few seconds to begin highlighting, so there would be a
delay making it seem like the language update was not happening.
- Adds a missing `throw` to the tree-sitter client that made edits
always run synchronously (didn't feel big enough for a whole PR, found
while debugging).
- Only updates the font if the font is new, making text layouts occur
much less frequently (also doesn't feel big enough for a separate PR)
### Related Issues
* #235
### Checklist
- [x] I read and understood the [contributing
guide](https://github.com/CodeEditApp/CodeEdit/blob/main/CONTRIBUTING.md)
as well as the [code of
conduct](https://github.com/CodeEditApp/CodeEdit/blob/main/CODE_OF_CONDUCT.md)
- [x] The issues this PR addresses are related to each other
- [x] My changes generate no new warnings
- [x] My code builds and runs on my machine
- [x] My changes are all related to the related issue above
- [x] I documented my code
### Screenshots
https://github.com/CodeEditApp/CodeEditSourceEditor/assets/35942988/e719178e-bc9a-4830-9ca5-8d113dcb9d8b1 parent 63dcea1 commit a5581a2
File tree
3 files changed
+21
-8
lines changed- Sources/CodeEditSourceEditor
- Highlighting
- TreeSitter
3 files changed
+21
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
156 | 156 | | |
157 | 157 | | |
158 | 158 | | |
159 | | - | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
160 | 163 | | |
161 | 164 | | |
162 | 165 | | |
163 | 166 | | |
164 | 167 | | |
| 168 | + | |
165 | 169 | | |
166 | 170 | | |
167 | 171 | | |
| |||
173 | 177 | | |
174 | 178 | | |
175 | 179 | | |
| 180 | + | |
176 | 181 | | |
177 | 182 | | |
178 | 183 | | |
| 184 | + | |
179 | 185 | | |
180 | 186 | | |
181 | 187 | | |
| 188 | + | |
182 | 189 | | |
183 | 190 | | |
184 | 191 | | |
| 192 | + | |
185 | 193 | | |
186 | 194 | | |
187 | 195 | | |
| |||
Lines changed: 11 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | 39 | | |
44 | 40 | | |
45 | 41 | | |
| |||
114 | 110 | | |
115 | 111 | | |
116 | 112 | | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
117 | 122 | | |
118 | 123 | | |
119 | 124 | | |
| |||
304 | 309 | | |
305 | 310 | | |
306 | 311 | | |
| 312 | + | |
| 313 | + | |
307 | 314 | | |
308 | 315 | | |
309 | 316 | | |
310 | | - | |
311 | | - | |
312 | 317 | | |
313 | 318 | | |
314 | 319 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
218 | 218 | | |
219 | 219 | | |
220 | 220 | | |
221 | | - | |
| 221 | + | |
222 | 222 | | |
223 | 223 | | |
224 | 224 | | |
| |||
0 commit comments