Commit 27b6e7f
authored
refactor: drop change.rs <3 (#447)

as per PR title. notable changes:
- drop `change.rs` in favour of a simple `update_document` api that
replaces the content
- simplify `StatementId` to just be a simple wrapper around the actual
statement string. The content is wrapped in an `Arc<str>` to make
cloning cheap. turns out string interning only makes sense when we have
a lot of duplicate strings. `Arc<str>` is much more efficient and
simpler in our case.
- Remove `document.rs` and merge it into `parsed_document` to then
rename it to `Document`
- replaces the `strum` usage to get the available command because it
didn't feel right to make an empty string the default for a StatementId.
replaced it with a simple manual implementation.
I ran a few benchmarks and the statement splitter performance seems to
be good enough to run it on every keystroke on the entire file.
```sh
large statement with length 863000
time: [23.180 ms 23.278 ms 23.386 ms]
small statement with length 19000
time: [886.69 µs 890.91 µs 896.35 µs]
```
ToDo
- [ ] add some tests
- [x] cleanup1 parent 155272a commit 27b6e7f
File tree
17 files changed
+690
-2545
lines changed- .claude
- crates
- pgt_cli/src/execute/process_file
- pgt_lsp/src
- handlers
- pgt_statement_splitter
- benches
- pgt_workspace/src
- features
- workspace
- server
17 files changed
+690
-2545
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 2 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
57 | 58 | | |
58 | 59 | | |
59 | 60 | | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | 61 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
| |||
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
10 | | - | |
11 | | - | |
12 | 11 | | |
13 | 12 | | |
14 | 13 | | |
| |||
54 | 53 | | |
55 | 54 | | |
56 | 55 | | |
57 | | - | |
58 | 56 | | |
59 | 57 | | |
60 | 58 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | 1 | | |
3 | 2 | | |
4 | 3 | | |
5 | 4 | | |
6 | 5 | | |
7 | | - | |
| 6 | + | |
8 | 7 | | |
9 | 8 | | |
10 | 9 | | |
| |||
48 | 47 | | |
49 | 48 | | |
50 | 49 | | |
51 | | - | |
52 | 50 | | |
53 | 51 | | |
54 | 52 | | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
| 53 | + | |
| 54 | + | |
62 | 55 | | |
63 | 56 | | |
64 | 57 | | |
65 | 58 | | |
66 | | - | |
| 59 | + | |
67 | 60 | | |
68 | 61 | | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
69 | 66 | | |
70 | 67 | | |
71 | 68 | | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
| 69 | + | |
81 | 70 | | |
82 | 71 | | |
83 | | - | |
84 | | - | |
85 | 72 | | |
86 | 73 | | |
87 | 74 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
0 commit comments