@exercism/codemirror-lang-clojure 0.0.0-stage → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +34 -0
- package/LICENSE +13 -0
- package/README.md +81 -2
- package/dist/index.cjs +1018 -0
- package/dist/index.d.ts +36 -0
- package/dist/index.es.js +1010 -0
- package/package.json +66 -4
package/dist/index.es.js
ADDED
|
@@ -0,0 +1,1010 @@
|
|
|
1
|
+
import { LRParser } from '@lezer/lr';
|
|
2
|
+
import { NodeProp } from '@lezer/common';
|
|
3
|
+
import { styleTags, tags } from '@lezer/highlight';
|
|
4
|
+
import { syntaxTree, LanguageSupport, LRLanguage, indentNodeProp, foldNodeProp, foldInside } from '@codemirror/language';
|
|
5
|
+
import { snippetCompletion } from '@codemirror/autocomplete';
|
|
6
|
+
|
|
7
|
+
// TODO: naïvely restored to previoius NodeProp.flag() behaviour. Can we do any better?
|
|
8
|
+
let flag = () => new NodeProp({deserialize: str => true});
|
|
9
|
+
|
|
10
|
+
const coll = flag();
|
|
11
|
+
const prefixColl = flag();
|
|
12
|
+
const prefixEdge = flag();
|
|
13
|
+
const sameEdge = flag();
|
|
14
|
+
const prefixContainer = flag();
|
|
15
|
+
|
|
16
|
+
var props = /*#__PURE__*/Object.freeze({
|
|
17
|
+
__proto__: null,
|
|
18
|
+
coll: coll,
|
|
19
|
+
prefixColl: prefixColl,
|
|
20
|
+
prefixContainer: prefixContainer,
|
|
21
|
+
prefixEdge: prefixEdge,
|
|
22
|
+
sameEdge: sameEdge
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
// This file was generated by lezer-generator. You probably shouldn't edit it.
|
|
26
|
+
const spec_Symbol = {__proto__:null,true:186, false:186, nil:188, def:197, defonce:197, deftest:197, defcard:197, defmulti:197, defprotocol:197, defstruct:197, definterface:197, defn:205, "defn-":205, defmacro:205, definline:205, defrecord:217, deftype:217, defmethod:223, ns:229, let:233, loop:233, "when-let":233, "if-let":233, "when-some":233, "if-some":233, "when-first":233, "with-open":233, "with-local-vars":233, dotimes:233, doseq:233, for:233, letfn:241, fn:247, "fn*":247, "bound-fn":247, catch:251, if:257, do:257, quote:257, var:257, recur:257, throw:257, try:257, finally:257, "monitor-enter":257, "monitor-exit":257, new:257, "set!":257, ".":257, "..":257, when:257, "when-not":257, "if-not":257, cond:257, condp:257, case:257, and:257, or:257, "->":257, "->>":257, "as->":257, "cond->":257, "cond->>":257, "some->":257, "some->>":257, doto:257, binding:257, "with-redefs":257, "lazy-seq":257, delay:257, future:257, while:257, comment:257, declare:257, assert:257, time:257, locking:257, dosync:257, "with-out-str":257, "with-in-str":257, reify:257, proxy:257, "extend-type":257, "extend-protocol":257, import:257};
|
|
27
|
+
const spec_Keyword = {__proto__:null,":let":237};
|
|
28
|
+
const parser = LRParser.deserialize({
|
|
29
|
+
version: 14,
|
|
30
|
+
states: ":QQ]QPOOP!pOPOOOOQO'#ER'#ERQ]QPOOO!uQPO'#CcO!|QPO'#CfO]OPO'#ChO]OPO'#CjO]QPO'#CgOOQO'#Cl'#ClOOQO'#Cm'#CmO]QPO'#CnO]QPO'#CpO]QPO'#CrO]QPO'#CtO]QPO'#CvO#TOQO'#DTO%SQPO'#C|O%gOSO'#DpO%{OPO'#DrO&QOPO'#DuO&VOPO'#DwO&_OWO'#DyO]QPO'#D|O&dQPO'#EOOOQO'#E['#E[OOQO'#EZ'#EZP&lQPO'#C^POOO)C?})C?}OOQO-E8P-E8PO(PQPO,58}OOQO,58},58}O(WQPO,59QOOQO,59Q,59QOOQO,59S,59SOOQO,59U,59UOOQO,59R,59ROOQO,59Y,59YOOQO,59[,59[OOQO,59^,59^OOQO,59`,59`OOQO,59b,59bOOQO,59o,59oO(_OPO,59oO(dQPO'#FOO#]QPO'#CgOOQO'#Ea'#EaO(kQPO'#E`OOQO'#Ee'#EeO(kQPO'#EdOOQO'#Ek'#EkO(kQPO'#EjOOQO'#En'#EnO(vQPO'#EmOOQO'#Db'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#]#^#`#b#f#j#m#o#t#v#w#x#y#|$P$R$W$Y$[$_$a$b$e$g$i$m$u$w${a%Vk%O%P%Q%R%S%T%V#khORSTUVWZ[]^_agknp|}!f#W#Z#[#]#^#`#b#f#j#m#o#t#v#w#x#y#|$P$R$W$Y$[$_$a$b$e$g$i$m$u$w${%O%P%Q%R%S%T%VQROnmRnp|#j#m#v$R$W$_$b$e$g$u$wQnSQpTQ|aQ#j!fQ#m#WQ#v#[Q$R#^Q$W#`Q$_#fQ$b#oQ$e#tQ$g#wQ$u$[R$w$aQ$Y#bQ$i#xT$s$Y$i`#e!`#X#h#r#s#u$d$oR$^#eQ$P#]R$n$PQ$U#_R$q$U!^QORSTanp|!f#W#[#^#`#f#j#m#o#t#v#w$R$W$[$_$a$b$e$g$u$wQrUQsVUtW}%OSuZ%PSv[%QSw]%RSx^%SSy_%TS!wg%VQ!ykQ#u#ZV$k#|$m${#[jORSTUVWZ[]^_agknp|}!f#W#Z#[#^#`#f#j#m#o#t#v#w#|$R$W$[$_$a$b$e$g$m$u$w${%O%P%Q%R%S%T%V_#z#]#b#x#y$P$Y$iR!haR!gaQ!PaR!}}Q#W!PQ#X!RQ#Y!TQ#[!YR#l#UQ!RaR#O}Q#g!`Q#q#XQ$`#hS$c#r#sQ$f#uQ$x$dR$|$oQ#|#]W$X#b#x$Y$iQ$j#yR$m$PR$]#cQ!TaR#P}Q!VaR#Q}Q!YaR#R}T$O#]$PR$p$SQ!faR#S}",
|
|
33
|
+
nodeNames: "⚠ LineComment Discard #_ Symbol ] [ Vector } { Map Meta Metadata ^ ReaderMetadata #^ Boolean Nil Deref @ Quote ' SyntaxQuote ` Unquote ~ UnquoteSplice ~@ Number Keyword ) ( List DefLike Meta VarName Meta DocString \" String StringContent DefLike Meta Vector LocalName Map Meta List DefLike Meta DefLike Meta NS Meta LetLike Vector ForLet LetFn Vector List FnLike Catch Operator SpecialForm Meta Character Set # NamespacedMap KeywordPrefix RegExp Var #' ReaderConditional #? SymbolicValue ## AnonymousFunction TaggedLiteral ReaderTag ConstructorCall ConstructorPrefix Program",
|
|
34
|
+
maxTerm: 132,
|
|
35
|
+
nodeProps: [
|
|
36
|
+
[prefixEdge, -14,3,13,15,19,21,23,25,27,67,69,72,74,76,81,""],
|
|
37
|
+
["openedBy", 5,"[",8,"{",30,"(",38,"\""],
|
|
38
|
+
["closedBy", 6,"]",9,"}",31,")",38,"\""],
|
|
39
|
+
[coll, -9,7,10,32,43,45,47,55,58,59,""],
|
|
40
|
+
[prefixContainer, -11,11,34,36,42,46,49,51,53,64,78,80,""],
|
|
41
|
+
[prefixColl, -13,12,14,18,20,22,24,26,66,68,70,71,73,77,""],
|
|
42
|
+
[sameEdge, 38,""]
|
|
43
|
+
],
|
|
44
|
+
skippedNodes: [0,1,2,3],
|
|
45
|
+
repeatNodeCount: 5,
|
|
46
|
+
tokenData: "#Eb~R!^OX$}X^&d^p$}pq&dqr(crs-]st-btu1Wuv(cvw(cwx8gxy9Qyz9kz{(c{|:U|}&d}!O:U!O!P<n!P!Q*x!Q!R!=f!R![!EW![!]!KO!]!^##}!^!_(c!_!`(c!`!a(c!a!b(c!b!c#&c!c!}1W!}#O#&|#O#P#'g#P#Q#Ae#Q#R#BO#R#S1W#S#T#Bi#T#o1W#o#p#CS#p#q$}#q#r#Cm#r#s#DW#s#y$}#y#z&d#z$f$}$f$g&d$g##l1W##l#BY$}#BY#BZ&d#BZ$IS$}$IS$I_&d$I_$I|$}$I|$JO&d$JO$JT$}$JT$JU&d$JU$KV$}$KV$KW&d$KW&FU$}&FU&FV&d&FV;'S$};'S;=`&^<%lO$}Q%SUxQOr$}s#O$}#O#P%f#P;'S$};'S;=`&^<%lO$}Q%iRO;'S$};'S;=`%r;=`O$}Q%wVxQOr$}s#O$}#O#P%f#P;'S$};'S;=`&^;=`<%l$}<%lO$}Q&aP;=`<%l$}R&klxQ!|POX$}X^&d^p$}pq&dqr$}s|$}|}&d}#O$}#O#P%f#P#y$}#y#z&d#z$f$}$f$g&d$g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P;'S$};'S;=`&^<%lO$}R#CtUWPxQOr$}s#O$}#O#P%f#P;'S$};'S;=`&^<%lO$}R#D_WiPxQOr$}s!b$}!b!c#Dw!c#O$}#O#P%f#P;'S$};'S;=`&^<%lO$}R#EOUkPxQOr$}s#O$}#O#P%f#P;'S$};'S;=`&^<%lO$}",
|
|
47
|
+
tokenizers: [0, 1, 2, 3],
|
|
48
|
+
topRules: {"Program":[0,82]},
|
|
49
|
+
dynamicPrecedences: {"33":1,"41":1,"48":1,"50":1,"52":2,"54":1,"56":1,"57":1,"60":1,"61":1,"63":1},
|
|
50
|
+
specialized: [{term: 4, get: (value) => spec_Symbol[value] || -1},{term: 29, get: (value) => spec_Keyword[value] || -1}],
|
|
51
|
+
tokenPrec: 953
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
// These lists come from the public vars of Clojure 1.12.7's clojure.core, clojure.string
|
|
55
|
+
// and clojure.set namespaces.
|
|
56
|
+
|
|
57
|
+
const specialForms = [
|
|
58
|
+
"def",
|
|
59
|
+
"if",
|
|
60
|
+
"do",
|
|
61
|
+
"let",
|
|
62
|
+
"quote",
|
|
63
|
+
"var",
|
|
64
|
+
"fn",
|
|
65
|
+
"loop",
|
|
66
|
+
"recur",
|
|
67
|
+
"throw",
|
|
68
|
+
"try",
|
|
69
|
+
"catch",
|
|
70
|
+
"finally",
|
|
71
|
+
"monitor-enter",
|
|
72
|
+
"monitor-exit",
|
|
73
|
+
"new",
|
|
74
|
+
"set!"
|
|
75
|
+
];
|
|
76
|
+
|
|
77
|
+
const coreMacros = [
|
|
78
|
+
"->",
|
|
79
|
+
"->>",
|
|
80
|
+
"..",
|
|
81
|
+
"amap",
|
|
82
|
+
"and",
|
|
83
|
+
"areduce",
|
|
84
|
+
"as->",
|
|
85
|
+
"assert",
|
|
86
|
+
"binding",
|
|
87
|
+
"bound-fn",
|
|
88
|
+
"case",
|
|
89
|
+
"comment",
|
|
90
|
+
"cond",
|
|
91
|
+
"cond->",
|
|
92
|
+
"cond->>",
|
|
93
|
+
"condp",
|
|
94
|
+
"declare",
|
|
95
|
+
"definline",
|
|
96
|
+
"definterface",
|
|
97
|
+
"defmacro",
|
|
98
|
+
"defmethod",
|
|
99
|
+
"defmulti",
|
|
100
|
+
"defn",
|
|
101
|
+
"defn-",
|
|
102
|
+
"defonce",
|
|
103
|
+
"defprotocol",
|
|
104
|
+
"defrecord",
|
|
105
|
+
"deftype",
|
|
106
|
+
"delay",
|
|
107
|
+
"doseq",
|
|
108
|
+
"dosync",
|
|
109
|
+
"dotimes",
|
|
110
|
+
"doto",
|
|
111
|
+
"extend-protocol",
|
|
112
|
+
"extend-type",
|
|
113
|
+
"for",
|
|
114
|
+
"future",
|
|
115
|
+
"gen-class",
|
|
116
|
+
"gen-interface",
|
|
117
|
+
"if-let",
|
|
118
|
+
"if-not",
|
|
119
|
+
"if-some",
|
|
120
|
+
"import",
|
|
121
|
+
"io!",
|
|
122
|
+
"lazy-cat",
|
|
123
|
+
"lazy-seq",
|
|
124
|
+
"letfn",
|
|
125
|
+
"locking",
|
|
126
|
+
"memfn",
|
|
127
|
+
"ns",
|
|
128
|
+
"or",
|
|
129
|
+
"proxy",
|
|
130
|
+
"proxy-super",
|
|
131
|
+
"pvalues",
|
|
132
|
+
"refer-clojure",
|
|
133
|
+
"reify",
|
|
134
|
+
"some->",
|
|
135
|
+
"some->>",
|
|
136
|
+
"sync",
|
|
137
|
+
"time",
|
|
138
|
+
"vswap!",
|
|
139
|
+
"when",
|
|
140
|
+
"when-first",
|
|
141
|
+
"when-let",
|
|
142
|
+
"when-not",
|
|
143
|
+
"when-some",
|
|
144
|
+
"while",
|
|
145
|
+
"with-bindings",
|
|
146
|
+
"with-in-str",
|
|
147
|
+
"with-local-vars",
|
|
148
|
+
"with-open",
|
|
149
|
+
"with-out-str",
|
|
150
|
+
"with-precision",
|
|
151
|
+
"with-redefs"
|
|
152
|
+
];
|
|
153
|
+
|
|
154
|
+
const coreFunctions = [
|
|
155
|
+
"*",
|
|
156
|
+
"*'",
|
|
157
|
+
"+",
|
|
158
|
+
"+'",
|
|
159
|
+
"-",
|
|
160
|
+
"-'",
|
|
161
|
+
"/",
|
|
162
|
+
"<",
|
|
163
|
+
"<=",
|
|
164
|
+
"=",
|
|
165
|
+
"==",
|
|
166
|
+
">",
|
|
167
|
+
">=",
|
|
168
|
+
"NaN?",
|
|
169
|
+
"StackTraceElement->vec",
|
|
170
|
+
"Throwable->map",
|
|
171
|
+
"abs",
|
|
172
|
+
"aclone",
|
|
173
|
+
"add-tap",
|
|
174
|
+
"add-watch",
|
|
175
|
+
"agent",
|
|
176
|
+
"agent-error",
|
|
177
|
+
"agent-errors",
|
|
178
|
+
"aget",
|
|
179
|
+
"alength",
|
|
180
|
+
"alias",
|
|
181
|
+
"all-ns",
|
|
182
|
+
"alter",
|
|
183
|
+
"alter-meta!",
|
|
184
|
+
"alter-var-root",
|
|
185
|
+
"ancestors",
|
|
186
|
+
"any?",
|
|
187
|
+
"apply",
|
|
188
|
+
"array-map",
|
|
189
|
+
"aset",
|
|
190
|
+
"assoc",
|
|
191
|
+
"assoc!",
|
|
192
|
+
"assoc-in",
|
|
193
|
+
"associative?",
|
|
194
|
+
"atom",
|
|
195
|
+
"await",
|
|
196
|
+
"await-for",
|
|
197
|
+
"await1",
|
|
198
|
+
"bases",
|
|
199
|
+
"bean",
|
|
200
|
+
"bigdec",
|
|
201
|
+
"bigint",
|
|
202
|
+
"biginteger",
|
|
203
|
+
"bit-and",
|
|
204
|
+
"bit-and-not",
|
|
205
|
+
"bit-clear",
|
|
206
|
+
"bit-flip",
|
|
207
|
+
"bit-not",
|
|
208
|
+
"bit-or",
|
|
209
|
+
"bit-set",
|
|
210
|
+
"bit-shift-left",
|
|
211
|
+
"bit-shift-right",
|
|
212
|
+
"bit-test",
|
|
213
|
+
"bit-xor",
|
|
214
|
+
"boolean",
|
|
215
|
+
"boolean-array",
|
|
216
|
+
"boolean?",
|
|
217
|
+
"booleans",
|
|
218
|
+
"bound-fn*",
|
|
219
|
+
"bound?",
|
|
220
|
+
"bounded-count",
|
|
221
|
+
"butlast",
|
|
222
|
+
"byte",
|
|
223
|
+
"byte-array",
|
|
224
|
+
"bytes",
|
|
225
|
+
"bytes?",
|
|
226
|
+
"cast",
|
|
227
|
+
"cat",
|
|
228
|
+
"char",
|
|
229
|
+
"char-array",
|
|
230
|
+
"char?",
|
|
231
|
+
"chars",
|
|
232
|
+
"class",
|
|
233
|
+
"class?",
|
|
234
|
+
"clear-agent-errors",
|
|
235
|
+
"clojure-version",
|
|
236
|
+
"coll?",
|
|
237
|
+
"commute",
|
|
238
|
+
"comp",
|
|
239
|
+
"comparator",
|
|
240
|
+
"compare",
|
|
241
|
+
"compare-and-set!",
|
|
242
|
+
"compile",
|
|
243
|
+
"complement",
|
|
244
|
+
"completing",
|
|
245
|
+
"concat",
|
|
246
|
+
"conj",
|
|
247
|
+
"conj!",
|
|
248
|
+
"cons",
|
|
249
|
+
"constantly",
|
|
250
|
+
"contains?",
|
|
251
|
+
"count",
|
|
252
|
+
"counted?",
|
|
253
|
+
"create-ns",
|
|
254
|
+
"cycle",
|
|
255
|
+
"dec",
|
|
256
|
+
"dec'",
|
|
257
|
+
"decimal?",
|
|
258
|
+
"dedupe",
|
|
259
|
+
"delay?",
|
|
260
|
+
"deliver",
|
|
261
|
+
"denominator",
|
|
262
|
+
"deref",
|
|
263
|
+
"derive",
|
|
264
|
+
"descendants",
|
|
265
|
+
"disj",
|
|
266
|
+
"disj!",
|
|
267
|
+
"dissoc",
|
|
268
|
+
"dissoc!",
|
|
269
|
+
"distinct",
|
|
270
|
+
"distinct?",
|
|
271
|
+
"doall",
|
|
272
|
+
"dorun",
|
|
273
|
+
"double",
|
|
274
|
+
"double-array",
|
|
275
|
+
"double?",
|
|
276
|
+
"doubles",
|
|
277
|
+
"drop",
|
|
278
|
+
"drop-last",
|
|
279
|
+
"drop-while",
|
|
280
|
+
"eduction",
|
|
281
|
+
"empty",
|
|
282
|
+
"empty?",
|
|
283
|
+
"ensure",
|
|
284
|
+
"ensure-reduced",
|
|
285
|
+
"enumeration-seq",
|
|
286
|
+
"error-handler",
|
|
287
|
+
"error-mode",
|
|
288
|
+
"eval",
|
|
289
|
+
"even?",
|
|
290
|
+
"every-pred",
|
|
291
|
+
"every?",
|
|
292
|
+
"ex-cause",
|
|
293
|
+
"ex-data",
|
|
294
|
+
"ex-info",
|
|
295
|
+
"ex-message",
|
|
296
|
+
"extend",
|
|
297
|
+
"extenders",
|
|
298
|
+
"extends?",
|
|
299
|
+
"false?",
|
|
300
|
+
"ffirst",
|
|
301
|
+
"file-seq",
|
|
302
|
+
"filter",
|
|
303
|
+
"filterv",
|
|
304
|
+
"find",
|
|
305
|
+
"find-keyword",
|
|
306
|
+
"find-ns",
|
|
307
|
+
"find-var",
|
|
308
|
+
"first",
|
|
309
|
+
"flatten",
|
|
310
|
+
"float",
|
|
311
|
+
"float-array",
|
|
312
|
+
"float?",
|
|
313
|
+
"floats",
|
|
314
|
+
"flush",
|
|
315
|
+
"fn?",
|
|
316
|
+
"fnext",
|
|
317
|
+
"fnil",
|
|
318
|
+
"force",
|
|
319
|
+
"format",
|
|
320
|
+
"frequencies",
|
|
321
|
+
"future-call",
|
|
322
|
+
"future-cancel",
|
|
323
|
+
"future-cancelled?",
|
|
324
|
+
"future-done?",
|
|
325
|
+
"future?",
|
|
326
|
+
"gensym",
|
|
327
|
+
"get",
|
|
328
|
+
"get-in",
|
|
329
|
+
"get-method",
|
|
330
|
+
"get-thread-bindings",
|
|
331
|
+
"get-validator",
|
|
332
|
+
"group-by",
|
|
333
|
+
"halt-when",
|
|
334
|
+
"hash",
|
|
335
|
+
"hash-map",
|
|
336
|
+
"hash-ordered-coll",
|
|
337
|
+
"hash-set",
|
|
338
|
+
"hash-unordered-coll",
|
|
339
|
+
"ident?",
|
|
340
|
+
"identical?",
|
|
341
|
+
"identity",
|
|
342
|
+
"ifn?",
|
|
343
|
+
"inc",
|
|
344
|
+
"inc'",
|
|
345
|
+
"indexed?",
|
|
346
|
+
"infinite?",
|
|
347
|
+
"inst-ms",
|
|
348
|
+
"inst?",
|
|
349
|
+
"instance?",
|
|
350
|
+
"int",
|
|
351
|
+
"int-array",
|
|
352
|
+
"int?",
|
|
353
|
+
"integer?",
|
|
354
|
+
"interleave",
|
|
355
|
+
"intern",
|
|
356
|
+
"interpose",
|
|
357
|
+
"into",
|
|
358
|
+
"into-array",
|
|
359
|
+
"ints",
|
|
360
|
+
"isa?",
|
|
361
|
+
"iterate",
|
|
362
|
+
"iteration",
|
|
363
|
+
"iterator-seq",
|
|
364
|
+
"juxt",
|
|
365
|
+
"keep",
|
|
366
|
+
"keep-indexed",
|
|
367
|
+
"key",
|
|
368
|
+
"keys",
|
|
369
|
+
"keyword",
|
|
370
|
+
"keyword?",
|
|
371
|
+
"last",
|
|
372
|
+
"line-seq",
|
|
373
|
+
"list",
|
|
374
|
+
"list*",
|
|
375
|
+
"list?",
|
|
376
|
+
"load",
|
|
377
|
+
"load-reader",
|
|
378
|
+
"load-string",
|
|
379
|
+
"loaded-libs",
|
|
380
|
+
"long",
|
|
381
|
+
"long-array",
|
|
382
|
+
"longs",
|
|
383
|
+
"macroexpand",
|
|
384
|
+
"macroexpand-1",
|
|
385
|
+
"make-array",
|
|
386
|
+
"make-hierarchy",
|
|
387
|
+
"map",
|
|
388
|
+
"map-entry?",
|
|
389
|
+
"map-indexed",
|
|
390
|
+
"map?",
|
|
391
|
+
"mapcat",
|
|
392
|
+
"mapv",
|
|
393
|
+
"max",
|
|
394
|
+
"max-key",
|
|
395
|
+
"memoize",
|
|
396
|
+
"merge",
|
|
397
|
+
"merge-with",
|
|
398
|
+
"meta",
|
|
399
|
+
"methods",
|
|
400
|
+
"min",
|
|
401
|
+
"min-key",
|
|
402
|
+
"mod",
|
|
403
|
+
"name",
|
|
404
|
+
"namespace",
|
|
405
|
+
"nat-int?",
|
|
406
|
+
"neg-int?",
|
|
407
|
+
"neg?",
|
|
408
|
+
"newline",
|
|
409
|
+
"next",
|
|
410
|
+
"nfirst",
|
|
411
|
+
"nil?",
|
|
412
|
+
"nnext",
|
|
413
|
+
"not",
|
|
414
|
+
"not-any?",
|
|
415
|
+
"not-empty",
|
|
416
|
+
"not-every?",
|
|
417
|
+
"not=",
|
|
418
|
+
"ns-aliases",
|
|
419
|
+
"ns-imports",
|
|
420
|
+
"ns-interns",
|
|
421
|
+
"ns-map",
|
|
422
|
+
"ns-name",
|
|
423
|
+
"ns-publics",
|
|
424
|
+
"ns-refers",
|
|
425
|
+
"ns-resolve",
|
|
426
|
+
"ns-unalias",
|
|
427
|
+
"ns-unmap",
|
|
428
|
+
"nth",
|
|
429
|
+
"nthnext",
|
|
430
|
+
"nthrest",
|
|
431
|
+
"num",
|
|
432
|
+
"number?",
|
|
433
|
+
"numerator",
|
|
434
|
+
"object-array",
|
|
435
|
+
"odd?",
|
|
436
|
+
"parents",
|
|
437
|
+
"parse-boolean",
|
|
438
|
+
"parse-double",
|
|
439
|
+
"parse-long",
|
|
440
|
+
"parse-uuid",
|
|
441
|
+
"partial",
|
|
442
|
+
"partition",
|
|
443
|
+
"partition-all",
|
|
444
|
+
"partition-by",
|
|
445
|
+
"partitionv",
|
|
446
|
+
"partitionv-all",
|
|
447
|
+
"pcalls",
|
|
448
|
+
"peek",
|
|
449
|
+
"persistent!",
|
|
450
|
+
"pmap",
|
|
451
|
+
"pop",
|
|
452
|
+
"pop!",
|
|
453
|
+
"pop-thread-bindings",
|
|
454
|
+
"pos-int?",
|
|
455
|
+
"pos?",
|
|
456
|
+
"pr",
|
|
457
|
+
"pr-str",
|
|
458
|
+
"prefer-method",
|
|
459
|
+
"prefers",
|
|
460
|
+
"print",
|
|
461
|
+
"print-dup",
|
|
462
|
+
"print-method",
|
|
463
|
+
"print-str",
|
|
464
|
+
"printf",
|
|
465
|
+
"println",
|
|
466
|
+
"println-str",
|
|
467
|
+
"prn",
|
|
468
|
+
"prn-str",
|
|
469
|
+
"promise",
|
|
470
|
+
"push-thread-bindings",
|
|
471
|
+
"qualified-ident?",
|
|
472
|
+
"qualified-keyword?",
|
|
473
|
+
"qualified-symbol?",
|
|
474
|
+
"quot",
|
|
475
|
+
"rand",
|
|
476
|
+
"rand-int",
|
|
477
|
+
"rand-nth",
|
|
478
|
+
"random-sample",
|
|
479
|
+
"random-uuid",
|
|
480
|
+
"range",
|
|
481
|
+
"ratio?",
|
|
482
|
+
"rational?",
|
|
483
|
+
"rationalize",
|
|
484
|
+
"re-find",
|
|
485
|
+
"re-groups",
|
|
486
|
+
"re-matcher",
|
|
487
|
+
"re-matches",
|
|
488
|
+
"re-pattern",
|
|
489
|
+
"re-seq",
|
|
490
|
+
"read",
|
|
491
|
+
"read+string",
|
|
492
|
+
"read-line",
|
|
493
|
+
"read-string",
|
|
494
|
+
"reader-conditional",
|
|
495
|
+
"reader-conditional?",
|
|
496
|
+
"realized?",
|
|
497
|
+
"record?",
|
|
498
|
+
"reduce",
|
|
499
|
+
"reduce-kv",
|
|
500
|
+
"reduced",
|
|
501
|
+
"reduced?",
|
|
502
|
+
"reductions",
|
|
503
|
+
"ref",
|
|
504
|
+
"ref-history-count",
|
|
505
|
+
"ref-max-history",
|
|
506
|
+
"ref-min-history",
|
|
507
|
+
"ref-set",
|
|
508
|
+
"refer",
|
|
509
|
+
"release-pending-sends",
|
|
510
|
+
"rem",
|
|
511
|
+
"remove",
|
|
512
|
+
"remove-all-methods",
|
|
513
|
+
"remove-method",
|
|
514
|
+
"remove-ns",
|
|
515
|
+
"remove-tap",
|
|
516
|
+
"remove-watch",
|
|
517
|
+
"repeat",
|
|
518
|
+
"repeatedly",
|
|
519
|
+
"replace",
|
|
520
|
+
"require",
|
|
521
|
+
"requiring-resolve",
|
|
522
|
+
"reset!",
|
|
523
|
+
"reset-meta!",
|
|
524
|
+
"reset-vals!",
|
|
525
|
+
"resolve",
|
|
526
|
+
"rest",
|
|
527
|
+
"restart-agent",
|
|
528
|
+
"resultset-seq",
|
|
529
|
+
"reverse",
|
|
530
|
+
"reversible?",
|
|
531
|
+
"rseq",
|
|
532
|
+
"rsubseq",
|
|
533
|
+
"run!",
|
|
534
|
+
"satisfies?",
|
|
535
|
+
"second",
|
|
536
|
+
"select-keys",
|
|
537
|
+
"send",
|
|
538
|
+
"send-off",
|
|
539
|
+
"send-via",
|
|
540
|
+
"seq",
|
|
541
|
+
"seq?",
|
|
542
|
+
"seqable?",
|
|
543
|
+
"seque",
|
|
544
|
+
"sequence",
|
|
545
|
+
"sequential?",
|
|
546
|
+
"set",
|
|
547
|
+
"set-agent-send-executor!",
|
|
548
|
+
"set-agent-send-off-executor!",
|
|
549
|
+
"set-error-handler!",
|
|
550
|
+
"set-error-mode!",
|
|
551
|
+
"set-validator!",
|
|
552
|
+
"set?",
|
|
553
|
+
"short",
|
|
554
|
+
"short-array",
|
|
555
|
+
"shorts",
|
|
556
|
+
"shuffle",
|
|
557
|
+
"shutdown-agents",
|
|
558
|
+
"simple-ident?",
|
|
559
|
+
"simple-keyword?",
|
|
560
|
+
"simple-symbol?",
|
|
561
|
+
"slurp",
|
|
562
|
+
"some",
|
|
563
|
+
"some-fn",
|
|
564
|
+
"some?",
|
|
565
|
+
"sort",
|
|
566
|
+
"sort-by",
|
|
567
|
+
"sorted-map",
|
|
568
|
+
"sorted-map-by",
|
|
569
|
+
"sorted-set",
|
|
570
|
+
"sorted-set-by",
|
|
571
|
+
"sorted?",
|
|
572
|
+
"special-symbol?",
|
|
573
|
+
"spit",
|
|
574
|
+
"split-at",
|
|
575
|
+
"split-with",
|
|
576
|
+
"splitv-at",
|
|
577
|
+
"str",
|
|
578
|
+
"string?",
|
|
579
|
+
"subs",
|
|
580
|
+
"subseq",
|
|
581
|
+
"subvec",
|
|
582
|
+
"supers",
|
|
583
|
+
"swap!",
|
|
584
|
+
"swap-vals!",
|
|
585
|
+
"symbol",
|
|
586
|
+
"symbol?",
|
|
587
|
+
"tagged-literal",
|
|
588
|
+
"tagged-literal?",
|
|
589
|
+
"take",
|
|
590
|
+
"take-last",
|
|
591
|
+
"take-nth",
|
|
592
|
+
"take-while",
|
|
593
|
+
"tap>",
|
|
594
|
+
"test",
|
|
595
|
+
"the-ns",
|
|
596
|
+
"thread-bound?",
|
|
597
|
+
"to-array",
|
|
598
|
+
"to-array-2d",
|
|
599
|
+
"trampoline",
|
|
600
|
+
"transduce",
|
|
601
|
+
"transient",
|
|
602
|
+
"tree-seq",
|
|
603
|
+
"true?",
|
|
604
|
+
"type",
|
|
605
|
+
"unchecked-add",
|
|
606
|
+
"unchecked-add-int",
|
|
607
|
+
"unchecked-byte",
|
|
608
|
+
"unchecked-char",
|
|
609
|
+
"unchecked-dec",
|
|
610
|
+
"unchecked-dec-int",
|
|
611
|
+
"unchecked-divide-int",
|
|
612
|
+
"unchecked-double",
|
|
613
|
+
"unchecked-float",
|
|
614
|
+
"unchecked-inc",
|
|
615
|
+
"unchecked-inc-int",
|
|
616
|
+
"unchecked-int",
|
|
617
|
+
"unchecked-long",
|
|
618
|
+
"unchecked-multiply",
|
|
619
|
+
"unchecked-multiply-int",
|
|
620
|
+
"unchecked-negate",
|
|
621
|
+
"unchecked-negate-int",
|
|
622
|
+
"unchecked-remainder-int",
|
|
623
|
+
"unchecked-short",
|
|
624
|
+
"unchecked-subtract",
|
|
625
|
+
"unchecked-subtract-int",
|
|
626
|
+
"underive",
|
|
627
|
+
"unreduced",
|
|
628
|
+
"unsigned-bit-shift-right",
|
|
629
|
+
"update",
|
|
630
|
+
"update-in",
|
|
631
|
+
"update-keys",
|
|
632
|
+
"update-vals",
|
|
633
|
+
"uri?",
|
|
634
|
+
"use",
|
|
635
|
+
"uuid?",
|
|
636
|
+
"val",
|
|
637
|
+
"vals",
|
|
638
|
+
"var-get",
|
|
639
|
+
"var-set",
|
|
640
|
+
"var?",
|
|
641
|
+
"vary-meta",
|
|
642
|
+
"vec",
|
|
643
|
+
"vector",
|
|
644
|
+
"vector?",
|
|
645
|
+
"volatile!",
|
|
646
|
+
"volatile?",
|
|
647
|
+
"vreset!",
|
|
648
|
+
"with-bindings*",
|
|
649
|
+
"with-meta",
|
|
650
|
+
"with-redefs-fn",
|
|
651
|
+
"xml-seq",
|
|
652
|
+
"zero?",
|
|
653
|
+
"zipmap"
|
|
654
|
+
];
|
|
655
|
+
|
|
656
|
+
const coreVars = [
|
|
657
|
+
"*in*",
|
|
658
|
+
"*out*",
|
|
659
|
+
"*err*",
|
|
660
|
+
"*ns*",
|
|
661
|
+
"*1",
|
|
662
|
+
"*2",
|
|
663
|
+
"*3",
|
|
664
|
+
"*e",
|
|
665
|
+
"*print-length*",
|
|
666
|
+
"*print-level*",
|
|
667
|
+
"*clojure-version*",
|
|
668
|
+
"*command-line-args*",
|
|
669
|
+
"*assert*",
|
|
670
|
+
"*warn-on-reflection*",
|
|
671
|
+
"*unchecked-math*",
|
|
672
|
+
"*flush-on-newline*",
|
|
673
|
+
"*print-meta*",
|
|
674
|
+
"*print-readably*",
|
|
675
|
+
"*data-readers*",
|
|
676
|
+
"char-escape-string",
|
|
677
|
+
"char-name-string"
|
|
678
|
+
];
|
|
679
|
+
|
|
680
|
+
const stringFunctions = [
|
|
681
|
+
"blank?",
|
|
682
|
+
"capitalize",
|
|
683
|
+
"ends-with?",
|
|
684
|
+
"escape",
|
|
685
|
+
"includes?",
|
|
686
|
+
"index-of",
|
|
687
|
+
"join",
|
|
688
|
+
"last-index-of",
|
|
689
|
+
"lower-case",
|
|
690
|
+
"re-quote-replacement",
|
|
691
|
+
"replace",
|
|
692
|
+
"replace-first",
|
|
693
|
+
"reverse",
|
|
694
|
+
"split",
|
|
695
|
+
"split-lines",
|
|
696
|
+
"starts-with?",
|
|
697
|
+
"trim",
|
|
698
|
+
"trim-newline",
|
|
699
|
+
"triml",
|
|
700
|
+
"trimr",
|
|
701
|
+
"upper-case"
|
|
702
|
+
];
|
|
703
|
+
|
|
704
|
+
const setFunctions = [
|
|
705
|
+
"difference",
|
|
706
|
+
"index",
|
|
707
|
+
"intersection",
|
|
708
|
+
"join",
|
|
709
|
+
"map-invert",
|
|
710
|
+
"project",
|
|
711
|
+
"rename",
|
|
712
|
+
"rename-keys",
|
|
713
|
+
"select",
|
|
714
|
+
"subset?",
|
|
715
|
+
"superset?",
|
|
716
|
+
"union"
|
|
717
|
+
];
|
|
718
|
+
|
|
719
|
+
var builtins = /*#__PURE__*/Object.freeze({
|
|
720
|
+
__proto__: null,
|
|
721
|
+
coreFunctions: coreFunctions,
|
|
722
|
+
coreMacros: coreMacros,
|
|
723
|
+
coreVars: coreVars,
|
|
724
|
+
setFunctions: setFunctions,
|
|
725
|
+
specialForms: specialForms,
|
|
726
|
+
stringFunctions: stringFunctions
|
|
727
|
+
});
|
|
728
|
+
|
|
729
|
+
// A Clojure symbol, such as `map`, `swap!`, `->>` or `str/join`.
|
|
730
|
+
const Identifier = /^[^\s()\[\]{}",;`~@^\\:#'][^\s()\[\]{}",;`~@^\\]*$/;
|
|
731
|
+
|
|
732
|
+
// The cursor is in one of these when it is typing a symbol.
|
|
733
|
+
const wordNodes = new Set(["Symbol", "SpecialForm", "DefLike", "NS", "LetLike", "LetFn", "FnLike", "Catch"]);
|
|
734
|
+
|
|
735
|
+
// Nothing is offered inside these, or while a new name is being typed.
|
|
736
|
+
const dontComplete = new Set([
|
|
737
|
+
"String", "StringContent", "RegExp", "Character", "LineComment", "Discard",
|
|
738
|
+
"Keyword", "ForLet", "Number", "VarName", "LocalName"
|
|
739
|
+
]);
|
|
740
|
+
|
|
741
|
+
function inNode(node, names) {
|
|
742
|
+
for (let cur = node; cur; cur = cur.parent) if (names.has(cur.name)) return true
|
|
743
|
+
return false
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
const builtinOptions = [
|
|
747
|
+
...specialForms.map(label => ({label, type: "keyword", detail: "special form"})),
|
|
748
|
+
...coreMacros.map(label => ({label, type: "keyword", detail: "macro"})),
|
|
749
|
+
...coreFunctions.map(label => ({label, type: "function"})),
|
|
750
|
+
...coreVars.map(label => ({label, type: "variable"}))
|
|
751
|
+
];
|
|
752
|
+
|
|
753
|
+
// Each snippet is written without its outer parens. If the word being completed
|
|
754
|
+
// follows an open paren, the snippet goes inside it as it is. Otherwise the parens
|
|
755
|
+
// are added around it.
|
|
756
|
+
const snippetSpecs = [
|
|
757
|
+
["defn", "function", "defn ${name}\n\t[${params}]\n\t${}"],
|
|
758
|
+
["defn", "function with docstring", "defn ${name}\n\t\"${docstring}\"\n\t[${params}]\n\t${}"],
|
|
759
|
+
["defn-", "private function", "defn- ${name}\n\t[${params}]\n\t${}"],
|
|
760
|
+
["defn", "multi-arity function", "defn ${name}\n\t([${params}]\n\t ${})\n\t([${more-params}]\n\t ${})"],
|
|
761
|
+
["def", "var", "def ${name} ${value}"],
|
|
762
|
+
["fn", "anonymous function", "fn [${params}]\n\t${}"],
|
|
763
|
+
["let", "bindings", "let [${name} ${value}]\n\t${}"],
|
|
764
|
+
["if", "conditional", "if ${test}\n\t${then}\n\t${else}"],
|
|
765
|
+
["if-let", "conditional binding", "if-let [${name} ${value}]\n\t${then}\n\t${else}"],
|
|
766
|
+
["when", "conditional", "when ${test}\n\t${}"],
|
|
767
|
+
["when-let", "conditional binding", "when-let [${name} ${value}]\n\t${}"],
|
|
768
|
+
["cond", "conditional", "cond\n\t${test} ${result}\n\t:else ${default}"],
|
|
769
|
+
["case", "conditional", "case ${expr}\n\t${value} ${result}\n\t${default}"],
|
|
770
|
+
["condp", "conditional", "condp ${=} ${expr}\n\t${value} ${result}\n\t${default}"],
|
|
771
|
+
["loop", "loop with recur", "loop [${name} ${init}]\n\t(if ${test}\n\t\t${result}\n\t\t(recur ${next}))"],
|
|
772
|
+
["recur", "loop again", "recur ${}"],
|
|
773
|
+
["doseq", "loop for side effects", "doseq [${item} ${coll}]\n\t${}"],
|
|
774
|
+
["dotimes", "loop n times", "dotimes [${i} ${n}]\n\t${}"],
|
|
775
|
+
["for", "list comprehension", "for [${item} ${coll}]\n\t${}"],
|
|
776
|
+
["ns", "namespace", "ns ${name}\n\t(:require [${clojure.string} :as ${str}])"],
|
|
777
|
+
["defrecord", "record", "defrecord ${Name} [${fields}]"],
|
|
778
|
+
["defprotocol", "protocol", "defprotocol ${Name}\n\t(${method} [${this}])"],
|
|
779
|
+
["defmulti", "multimethod", "defmulti ${name} ${dispatch-fn}"],
|
|
780
|
+
["defmethod", "multimethod implementation", "defmethod ${name} ${dispatch-value}\n\t[${params}]\n\t${}"],
|
|
781
|
+
["try", "try / catch", "try\n\t${}\n\t(catch Exception ${e}\n\t\t${})"],
|
|
782
|
+
["->", "thread first", "-> ${x}\n\t${}"],
|
|
783
|
+
["->>", "thread last", "->> ${coll}\n\t${}"]
|
|
784
|
+
];
|
|
785
|
+
|
|
786
|
+
const snippetsInParens = snippetSpecs.map(([label, detail, body]) =>
|
|
787
|
+
snippetCompletion(body, {label, detail, type: "keyword", boost: -1}));
|
|
788
|
+
const snippetsWithParens = snippetSpecs.map(([label, detail, body]) =>
|
|
789
|
+
snippetCompletion("(" + body + ")", {label, detail, type: "keyword", boost: -1}));
|
|
790
|
+
|
|
791
|
+
/// Completes special forms, clojure.core names and snippets. After an alias
|
|
792
|
+
/// required in the `ns` form for clojure.string or clojure.set (such as `str/`),
|
|
793
|
+
/// it offers that namespace's functions.
|
|
794
|
+
function builtinCompletionSource(context) {
|
|
795
|
+
let inner = syntaxTree(context.state).resolveInner(context.pos, -1);
|
|
796
|
+
if (inNode(inner, dontComplete)) return null
|
|
797
|
+
let word = wordAt(context, inner);
|
|
798
|
+
if (!word) return null
|
|
799
|
+
let afterParen = context.state.sliceDoc(word.from - 1, word.from) == "(";
|
|
800
|
+
let options = builtinOptions.concat(afterParen ? snippetsInParens : snippetsWithParens);
|
|
801
|
+
for (let [alias, names] of requiredAliases(context.state)) {
|
|
802
|
+
for (let name of names) options.push({label: alias + "/" + name, type: "function"});
|
|
803
|
+
}
|
|
804
|
+
return {from: word.from, options, validFor: Identifier}
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
function wordAt(context, inner) {
|
|
808
|
+
if (wordNodes.has(inner.name) && inner.to - inner.from < 60) {
|
|
809
|
+
let text = context.state.sliceDoc(inner.from, context.pos);
|
|
810
|
+
if (Identifier.test(text)) return {from: inner.from}
|
|
811
|
+
}
|
|
812
|
+
return context.explicit ? {from: context.pos} : null
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
const aliasNamespaces = {"clojure.string": stringFunctions, "clojure.set": setFunctions};
|
|
816
|
+
|
|
817
|
+
// Finds `[clojure.string :as str]` in the ns form. The full namespace name
|
|
818
|
+
// works too, so `clojure.string/join` is always offered.
|
|
819
|
+
function requiredAliases(state) {
|
|
820
|
+
let result = Object.entries(aliasNamespaces);
|
|
821
|
+
let top = syntaxTree(state).topNode.firstChild;
|
|
822
|
+
if (!top || top.name != "List" || !top.getChild("NS")) return result
|
|
823
|
+
let text = state.sliceDoc(top.from, top.to);
|
|
824
|
+
for (let m of text.matchAll(/\[\s*(clojure\.(?:string|set))\b[^\]]*?:as\s+([^\s\]\)]+)/g)) {
|
|
825
|
+
result.push([m[2], aliasNamespaces[m[1]]]);
|
|
826
|
+
}
|
|
827
|
+
return result
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
const defTypes = {
|
|
831
|
+
def: "variable", defonce: "variable", deftest: "function", defcard: "variable",
|
|
832
|
+
defmulti: "function", defprotocol: "interface", defstruct: "class", definterface: "interface",
|
|
833
|
+
defn: "function", "defn-": "function", defmacro: "keyword", definline: "function",
|
|
834
|
+
defrecord: "class", deftype: "class"
|
|
835
|
+
};
|
|
836
|
+
|
|
837
|
+
// Names defined with def, defn and the like in the file. These are offered
|
|
838
|
+
// everywhere in the file. A defrecord also defines its ->Name and map->Name
|
|
839
|
+
// constructors.
|
|
840
|
+
function topLevelNames(state) {
|
|
841
|
+
let options = [];
|
|
842
|
+
let doc = state.doc;
|
|
843
|
+
for (let form = syntaxTree(state).topNode.firstChild; form; form = form.nextSibling) {
|
|
844
|
+
if (form.name != "List") continue
|
|
845
|
+
let defLike = form.getChild("DefLike") || form.getChild("Meta")?.getChild("DefLike");
|
|
846
|
+
let varName = form.getChild("VarName") || form.getChild("Meta")?.getChild("VarName");
|
|
847
|
+
if (!defLike || !varName) continue
|
|
848
|
+
let kind = doc.sliceString(defLike.from, defLike.to);
|
|
849
|
+
let symbol = varName.getChild("Symbol");
|
|
850
|
+
if (!symbol) continue
|
|
851
|
+
let label = doc.sliceString(symbol.from, symbol.to);
|
|
852
|
+
let type = defTypes[kind] || "variable";
|
|
853
|
+
options.push({label, type, range: [symbol.from, symbol.to]});
|
|
854
|
+
if (kind == "defrecord") {
|
|
855
|
+
options.push({label: "->" + label, type: "function", range: [symbol.from, symbol.to]});
|
|
856
|
+
options.push({label: "map->" + label, type: "function", range: [symbol.from, symbol.to]});
|
|
857
|
+
}
|
|
858
|
+
}
|
|
859
|
+
return options
|
|
860
|
+
}
|
|
861
|
+
|
|
862
|
+
const skipped = new Set(["(", ")", "[", "]", "{", "}", "LineComment", "Discard"]);
|
|
863
|
+
|
|
864
|
+
function children(node) {
|
|
865
|
+
let result = [];
|
|
866
|
+
for (let child = node.firstChild; child; child = child.nextSibling) {
|
|
867
|
+
if (!skipped.has(child.name)) result.push(child);
|
|
868
|
+
}
|
|
869
|
+
return result
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
// Every local name inside a binding form, such as the names in
|
|
873
|
+
// `{:keys [a b] :as m}`.
|
|
874
|
+
function namesIn(node, pos, add) {
|
|
875
|
+
if (node.name == "LocalName") {
|
|
876
|
+
if (node.to < pos) add(node);
|
|
877
|
+
} else if (node.name == "Vector" || node.name == "Map" || node.name == "Meta") {
|
|
878
|
+
for (let child of children(node)) namesIn(child, pos, add);
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
// In `[a 1 b (inc a)]`, each name is in scope once its value has ended.
|
|
883
|
+
// In a for or doseq, `:let [...]` adds more bindings in the same way.
|
|
884
|
+
function namesInBindings(vector, pos, add) {
|
|
885
|
+
let items = children(vector);
|
|
886
|
+
for (let i = 0; i < items.length; i += 2) {
|
|
887
|
+
let pattern = items[i], value = items[i + 1];
|
|
888
|
+
if (pattern.name == "ForLet") {
|
|
889
|
+
if (value && value.name == "Vector") namesInBindings(value, pos, add);
|
|
890
|
+
} else if (!value || value.to <= pos) {
|
|
891
|
+
namesIn(pattern, pos, add);
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
|
|
896
|
+
// Collects the local names bound by one list: a let or loop's bindings, a fn,
|
|
897
|
+
// defn or arity's parameters, a fn's own name, a catch's exception, a
|
|
898
|
+
// defrecord's fields, or a letfn's functions.
|
|
899
|
+
function localNamesOf(list, pos, add) {
|
|
900
|
+
let items = children(list);
|
|
901
|
+
let head = items[0] ? items[0].name : "";
|
|
902
|
+
for (let i = 0; i < items.length; i++) {
|
|
903
|
+
let item = items[i];
|
|
904
|
+
if (item.name == "LocalName") {
|
|
905
|
+
if (item.to < pos) add(item);
|
|
906
|
+
} else if (item.name == "Vector") {
|
|
907
|
+
if (head == "LetLike" && i == 1) namesInBindings(item, pos, add);
|
|
908
|
+
else if (head == "LetFn" && i == 1) {
|
|
909
|
+
for (let spec of children(item)) {
|
|
910
|
+
let name = spec.name == "List" && children(spec)[0];
|
|
911
|
+
if (name && name.name == "LocalName") add(name);
|
|
912
|
+
}
|
|
913
|
+
} else namesIn(item, pos, add);
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
/// Completes the names defined in the file. Local names (let bindings, loop
|
|
919
|
+
/// bindings, fn parameters and destructured names) are offered only inside
|
|
920
|
+
/// the form that binds them, after the place they are bound.
|
|
921
|
+
function localCompletionSource(context) {
|
|
922
|
+
let inner = syntaxTree(context.state).resolveInner(context.pos, -1);
|
|
923
|
+
if (inNode(inner, dontComplete)) return null
|
|
924
|
+
let word = wordAt(context, inner);
|
|
925
|
+
if (!word) return null
|
|
926
|
+
let doc = context.state.doc;
|
|
927
|
+
let seen = new Set();
|
|
928
|
+
let options = [];
|
|
929
|
+
let add = (label, type) => {
|
|
930
|
+
if (label == "&" || label == "_" || seen.has(label)) return
|
|
931
|
+
seen.add(label);
|
|
932
|
+
options.push({label, type});
|
|
933
|
+
};
|
|
934
|
+
for (let node = inner; node; node = node.parent) {
|
|
935
|
+
if (node.name != "List") continue
|
|
936
|
+
localNamesOf(node, context.pos, n => {
|
|
937
|
+
if (n.from <= context.pos && context.pos <= n.to) return
|
|
938
|
+
add(doc.sliceString(n.from, n.to), "variable");
|
|
939
|
+
});
|
|
940
|
+
}
|
|
941
|
+
for (let option of topLevelNames(context.state)) {
|
|
942
|
+
if (option.range[0] <= context.pos && context.pos <= option.range[1]) continue
|
|
943
|
+
add(option.label, option.type);
|
|
944
|
+
}
|
|
945
|
+
return {from: word.from, options, validFor: Identifier}
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
const clojureCompletionSources = [localCompletionSource, builtinCompletionSource];
|
|
949
|
+
|
|
950
|
+
// The indentation follows lang-clojure (https://github.com/nextjournal/lang-clojure) by
|
|
951
|
+
// Andrea Amantini. Inside a list that starts with an operator or a special form, the
|
|
952
|
+
// following lines are indented two columns from the opening paren. Inside any other
|
|
953
|
+
// collection, they line up with the first element.
|
|
954
|
+
const headNodes = new Set(["NS", "DefLike", "Operator", "LetLike", "LetFn", "FnLike", "Catch"]);
|
|
955
|
+
|
|
956
|
+
const clojureLanguage = LRLanguage.define({
|
|
957
|
+
name: "clojure",
|
|
958
|
+
parser: parser.configure({
|
|
959
|
+
props: [
|
|
960
|
+
styleTags({
|
|
961
|
+
"NS DefLike": tags.definitionKeyword,
|
|
962
|
+
"LetLike LetFn FnLike Catch SpecialForm": tags.keyword,
|
|
963
|
+
"Operator/Symbol": tags.function(tags.variableName),
|
|
964
|
+
"VarName/Symbol LocalName/Symbol": tags.definition(tags.variableName),
|
|
965
|
+
"Metadata/Symbol ConstructorPrefix": tags.typeName,
|
|
966
|
+
Symbol: tags.variableName,
|
|
967
|
+
Boolean: tags.bool,
|
|
968
|
+
Nil: tags.null,
|
|
969
|
+
Number: tags.number,
|
|
970
|
+
SymbolicValue: tags.number,
|
|
971
|
+
"Keyword ForLet KeywordPrefix": tags.atom,
|
|
972
|
+
"DocString/...": tags.docString,
|
|
973
|
+
"String StringContent \"\\\"\"": tags.string,
|
|
974
|
+
Character: tags.character,
|
|
975
|
+
"RegExp RegExp/String RegExp/String/StringContent RegExp/String/\"\\\"\"": tags.regexp,
|
|
976
|
+
LineComment: tags.lineComment,
|
|
977
|
+
"Discard!": tags.comment,
|
|
978
|
+
"ReaderTag": tags.meta,
|
|
979
|
+
"\"'\" \"`\" \"~\" \"~@\" \"@\" \"^\" \"#'\" \"#_\" \"#?\" \"#^\"": tags.operator,
|
|
980
|
+
"( )": tags.paren,
|
|
981
|
+
"[ ]": tags.squareBracket,
|
|
982
|
+
"{ }": tags.brace
|
|
983
|
+
}),
|
|
984
|
+
indentNodeProp.add(type => {
|
|
985
|
+
if (!type.prop(coll)) return () => 0
|
|
986
|
+
return context => {
|
|
987
|
+
let {node} = context;
|
|
988
|
+
let open = node.firstChild;
|
|
989
|
+
if (!open) return null
|
|
990
|
+
let base = context.column(open.to);
|
|
991
|
+
let head = open.nextSibling;
|
|
992
|
+
if (type.name == "List" && head && headNodes.has(head.type.name)) return base + 1
|
|
993
|
+
return base
|
|
994
|
+
}
|
|
995
|
+
}),
|
|
996
|
+
foldNodeProp.add({"Vector Map List": foldInside})
|
|
997
|
+
]
|
|
998
|
+
}),
|
|
999
|
+
languageData: {
|
|
1000
|
+
commentTokens: {line: ";;"},
|
|
1001
|
+
closeBrackets: {brackets: ["(", "[", "{", "\""]},
|
|
1002
|
+
wordChars: "-_!?*+<>=/.$%&"
|
|
1003
|
+
}
|
|
1004
|
+
});
|
|
1005
|
+
|
|
1006
|
+
function clojure() {
|
|
1007
|
+
return new LanguageSupport(clojureLanguage, clojureCompletionSources.map(source => clojureLanguage.data.of({autocomplete: source})))
|
|
1008
|
+
}
|
|
1009
|
+
|
|
1010
|
+
export { builtinCompletionSource, builtins, clojure, clojureLanguage, localCompletionSource, parser, props };
|