Skip to content

Commit 6e884ba

Browse files
committed
Move keyword docs code into separate file
To make the state file less bloated.
1 parent f6b2c4d commit 6e884ba

File tree

3 files changed

+192
-188
lines changed

3 files changed

+192
-188
lines changed

src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ pub mod grammar {
33
}
44

55
pub mod server {
6+
pub mod keyword_docs;
67
pub mod server;
78
pub mod state;
89
}

src/server/keyword_docs.rs

+189
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
use std::collections::HashMap;
2+
3+
pub fn get_keyword_docs() -> HashMap<String, String> {
4+
[
5+
(
6+
"print".to_string(),
7+
include_str!("keyword_docs/print.txt").to_string(),
8+
),
9+
(
10+
"set".to_string(),
11+
include_str!("keyword_docs/set.txt").to_string(),
12+
),
13+
(
14+
"startfunction".to_string(),
15+
include_str!("keyword_docs/functions.txt").to_string(),
16+
),
17+
(
18+
"endfunction".to_string(),
19+
include_str!("keyword_docs/functions.txt").to_string(),
20+
),
21+
(
22+
"callfunction".to_string(),
23+
include_str!("keyword_docs/functions.txt").to_string(),
24+
),
25+
(
26+
"endian".to_string(),
27+
include_str!("keyword_docs/endian.txt").to_string(),
28+
),
29+
(
30+
"idstring".to_string(),
31+
include_str!("keyword_docs/idstring.txt").to_string(),
32+
),
33+
(
34+
"if".to_string(),
35+
include_str!("keyword_docs/if.txt").to_string(),
36+
),
37+
(
38+
"elif".to_string(),
39+
include_str!("keyword_docs/if.txt").to_string(),
40+
),
41+
(
42+
"else".to_string(),
43+
include_str!("keyword_docs/if.txt").to_string(),
44+
),
45+
(
46+
"endif".to_string(),
47+
include_str!("keyword_docs/if.txt").to_string(),
48+
),
49+
(
50+
"goto".to_string(),
51+
include_str!("keyword_docs/goto.txt").to_string(),
52+
),
53+
(
54+
"for".to_string(),
55+
include_str!("keyword_docs/for.txt").to_string(),
56+
),
57+
(
58+
"next".to_string(),
59+
include_str!("keyword_docs/for.txt").to_string(),
60+
),
61+
(
62+
"break".to_string(),
63+
include_str!("keyword_docs/label.txt").to_string(),
64+
),
65+
(
66+
"continue".to_string(),
67+
include_str!("keyword_docs/label.txt").to_string(),
68+
),
69+
(
70+
"cleanexit".to_string(),
71+
include_str!("keyword_docs/cleanexit.txt").to_string(),
72+
),
73+
(
74+
"findloc".to_string(),
75+
include_str!("keyword_docs/findloc.txt").to_string(),
76+
),
77+
(
78+
"get".to_string(),
79+
include_str!("keyword_docs/get.txt").to_string(),
80+
),
81+
(
82+
"math".to_string(),
83+
include_str!("keyword_docs/math.txt").to_string(),
84+
),
85+
(
86+
"log".to_string(),
87+
include_str!("keyword_docs/log.txt").to_string(),
88+
),
89+
(
90+
"asize".to_string(),
91+
include_str!("keyword_docs/asize.txt").to_string(),
92+
),
93+
(
94+
"long".to_string(),
95+
include_str!("keyword_docs/long.txt").to_string(),
96+
),
97+
(
98+
"string".to_string(),
99+
include_str!("keyword_docs/string.txt").to_string(),
100+
),
101+
(
102+
"getarray".to_string(),
103+
include_str!("keyword_docs/getarray.txt").to_string(),
104+
),
105+
(
106+
"putarray".to_string(),
107+
include_str!("keyword_docs/getarray.txt").to_string(),
108+
),
109+
(
110+
"encryption".to_string(),
111+
include_str!("keyword_docs/encryption.txt").to_string(),
112+
),
113+
(
114+
"reverseshort".to_string(),
115+
include_str!("keyword_docs/reverseshort.txt").to_string(),
116+
),
117+
(
118+
"reverselong".to_string(),
119+
include_str!("keyword_docs/reverselong.txt").to_string(),
120+
),
121+
(
122+
"reverselonglong".to_string(),
123+
include_str!("keyword_docs/reverselonglong.txt").to_string(),
124+
),
125+
(
126+
"filexor".to_string(),
127+
include_str!("keyword_docs/filexor.txt").to_string(),
128+
),
129+
(
130+
"append".to_string(),
131+
include_str!("keyword_docs/append.txt").to_string(),
132+
),
133+
(
134+
"getvarchr".to_string(),
135+
include_str!("keyword_docs/getvarchr.txt").to_string(),
136+
),
137+
(
138+
"putvarchr".to_string(),
139+
include_str!("keyword_docs/putvarchr.txt").to_string(),
140+
),
141+
(
142+
"byte".to_string(),
143+
include_str!("keyword_docs/byte.txt").to_string(),
144+
),
145+
(
146+
"comtype".to_string(),
147+
include_str!("keyword_docs/comtype.txt").to_string(),
148+
),
149+
(
150+
"clog".to_string(),
151+
include_str!("keyword_docs/clog.txt").to_string(),
152+
),
153+
(
154+
"padding".to_string(),
155+
include_str!("keyword_docs/padding.txt").to_string(),
156+
),
157+
(
158+
"savepos".to_string(),
159+
include_str!("keyword_docs/savepos.txt").to_string(),
160+
),
161+
(
162+
"extension".to_string(),
163+
include_str!("keyword_docs/extension.txt").to_string(),
164+
),
165+
(
166+
"getdstring".to_string(),
167+
include_str!("keyword_docs/getdstring.txt").to_string(),
168+
),
169+
(
170+
"do".to_string(),
171+
include_str!("keyword_docs/do.txt").to_string(),
172+
),
173+
(
174+
"while".to_string(),
175+
include_str!("keyword_docs/do.txt").to_string(),
176+
),
177+
(
178+
"short".to_string(),
179+
include_str!("keyword_docs/short.txt").to_string(),
180+
),
181+
(
182+
"open".to_string(),
183+
include_str!("keyword_docs/open.txt").to_string(),
184+
),
185+
]
186+
.iter()
187+
.cloned()
188+
.collect()
189+
}

src/server/state.rs

+2-188
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ use lsp_types::{
1111

1212
use crate::grammar::parsing::{get_quickbms_language, parse, PointLike, RangeLike};
1313

14+
use crate::server::keyword_docs::get_keyword_docs;
15+
1416
pub struct ServerState {
1517
files: HashMap<Url, (String, Tree)>,
1618
keyword_docs: HashMap<String, String>,
@@ -363,191 +365,3 @@ impl ServerState {
363365
Some(folding_ranges)
364366
}
365367
}
366-
367-
pub fn get_keyword_docs() -> HashMap<String, String> {
368-
[
369-
(
370-
"print".to_string(),
371-
include_str!("keyword_docs/print.txt").to_string(),
372-
),
373-
(
374-
"set".to_string(),
375-
include_str!("keyword_docs/set.txt").to_string(),
376-
),
377-
(
378-
"startfunction".to_string(),
379-
include_str!("keyword_docs/functions.txt").to_string(),
380-
),
381-
(
382-
"endfunction".to_string(),
383-
include_str!("keyword_docs/functions.txt").to_string(),
384-
),
385-
(
386-
"callfunction".to_string(),
387-
include_str!("keyword_docs/functions.txt").to_string(),
388-
),
389-
(
390-
"endian".to_string(),
391-
include_str!("keyword_docs/endian.txt").to_string(),
392-
),
393-
(
394-
"idstring".to_string(),
395-
include_str!("keyword_docs/idstring.txt").to_string(),
396-
),
397-
(
398-
"if".to_string(),
399-
include_str!("keyword_docs/if.txt").to_string(),
400-
),
401-
(
402-
"elif".to_string(),
403-
include_str!("keyword_docs/if.txt").to_string(),
404-
),
405-
(
406-
"else".to_string(),
407-
include_str!("keyword_docs/if.txt").to_string(),
408-
),
409-
(
410-
"endif".to_string(),
411-
include_str!("keyword_docs/if.txt").to_string(),
412-
),
413-
(
414-
"goto".to_string(),
415-
include_str!("keyword_docs/goto.txt").to_string(),
416-
),
417-
(
418-
"for".to_string(),
419-
include_str!("keyword_docs/for.txt").to_string(),
420-
),
421-
(
422-
"next".to_string(),
423-
include_str!("keyword_docs/for.txt").to_string(),
424-
),
425-
(
426-
"break".to_string(),
427-
include_str!("keyword_docs/label.txt").to_string(),
428-
),
429-
(
430-
"continue".to_string(),
431-
include_str!("keyword_docs/label.txt").to_string(),
432-
),
433-
(
434-
"cleanexit".to_string(),
435-
include_str!("keyword_docs/cleanexit.txt").to_string(),
436-
),
437-
(
438-
"findloc".to_string(),
439-
include_str!("keyword_docs/findloc.txt").to_string(),
440-
),
441-
(
442-
"get".to_string(),
443-
include_str!("keyword_docs/get.txt").to_string(),
444-
),
445-
(
446-
"math".to_string(),
447-
include_str!("keyword_docs/math.txt").to_string(),
448-
),
449-
(
450-
"log".to_string(),
451-
include_str!("keyword_docs/log.txt").to_string(),
452-
),
453-
(
454-
"asize".to_string(),
455-
include_str!("keyword_docs/asize.txt").to_string(),
456-
),
457-
(
458-
"long".to_string(),
459-
include_str!("keyword_docs/long.txt").to_string(),
460-
),
461-
(
462-
"string".to_string(),
463-
include_str!("keyword_docs/string.txt").to_string(),
464-
),
465-
(
466-
"getarray".to_string(),
467-
include_str!("keyword_docs/getarray.txt").to_string(),
468-
),
469-
(
470-
"putarray".to_string(),
471-
include_str!("keyword_docs/getarray.txt").to_string(),
472-
),
473-
(
474-
"encryption".to_string(),
475-
include_str!("keyword_docs/encryption.txt").to_string(),
476-
),
477-
(
478-
"reverseshort".to_string(),
479-
include_str!("keyword_docs/reverseshort.txt").to_string(),
480-
),
481-
(
482-
"reverselong".to_string(),
483-
include_str!("keyword_docs/reverselong.txt").to_string(),
484-
),
485-
(
486-
"reverselonglong".to_string(),
487-
include_str!("keyword_docs/reverselonglong.txt").to_string(),
488-
),
489-
(
490-
"filexor".to_string(),
491-
include_str!("keyword_docs/filexor.txt").to_string(),
492-
),
493-
(
494-
"append".to_string(),
495-
include_str!("keyword_docs/append.txt").to_string(),
496-
),
497-
(
498-
"getvarchr".to_string(),
499-
include_str!("keyword_docs/getvarchr.txt").to_string(),
500-
),
501-
(
502-
"putvarchr".to_string(),
503-
include_str!("keyword_docs/putvarchr.txt").to_string(),
504-
),
505-
(
506-
"byte".to_string(),
507-
include_str!("keyword_docs/byte.txt").to_string(),
508-
),
509-
(
510-
"comtype".to_string(),
511-
include_str!("keyword_docs/comtype.txt").to_string(),
512-
),
513-
(
514-
"clog".to_string(),
515-
include_str!("keyword_docs/clog.txt").to_string(),
516-
),
517-
(
518-
"padding".to_string(),
519-
include_str!("keyword_docs/padding.txt").to_string(),
520-
),
521-
(
522-
"savepos".to_string(),
523-
include_str!("keyword_docs/savepos.txt").to_string(),
524-
),
525-
(
526-
"extension".to_string(),
527-
include_str!("keyword_docs/extension.txt").to_string(),
528-
),
529-
(
530-
"getdstring".to_string(),
531-
include_str!("keyword_docs/getdstring.txt").to_string(),
532-
),
533-
(
534-
"do".to_string(),
535-
include_str!("keyword_docs/do.txt").to_string(),
536-
),
537-
(
538-
"while".to_string(),
539-
include_str!("keyword_docs/do.txt").to_string(),
540-
),
541-
(
542-
"short".to_string(),
543-
include_str!("keyword_docs/short.txt").to_string(),
544-
),
545-
(
546-
"open".to_string(),
547-
include_str!("keyword_docs/open.txt").to_string(),
548-
),
549-
]
550-
.iter()
551-
.cloned()
552-
.collect()
553-
}

0 commit comments

Comments
 (0)