Skip to content

Commit 6496c8f

Browse files
authored
Textmate improvements (#168)
* fix multiple cases in-out * fix one line function parameters * add type name infos * fix type detection in parameters * fix variadic detection in parameters * fix type detction in parameters * simplify texmate
1 parent 543c4f8 commit 6496c8f

File tree

1 file changed

+41
-39
lines changed

1 file changed

+41
-39
lines changed

syntaxes/nushell.tmLanguage.json

Lines changed: 41 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@
224224
"types": {
225225
"patterns": [
226226
{
227+
"name": "meta.list.nushell",
227228
"begin": "\\b(list)\\s*<",
228229
"beginCaptures": {
229230
"1": { "name": "entity.name.type.nushell" }
@@ -234,6 +235,7 @@
234235
]
235236
},
236237
{
238+
"name": "meta.record.nushell",
237239
"begin": "\\b(record)\\s*<",
238240
"beginCaptures": {
239241
"1": { "name": "entity.name.type.nushell" }
@@ -255,20 +257,15 @@
255257
}
256258
]
257259
},
258-
"function-parameter-default-value": {
259-
"begin": "=\\s*",
260-
"end": "(?=\\])|,|$",
261-
"patterns": [{ "include": "#value" }]
262-
},
263-
"function-parameter-declare": {
260+
"function-parameter": {
264261
"patterns": [
265262
{
266-
"match": "(-{0,2}[\\w-]+|\\.{3})(?:\\((-[\\w?])\\))?",
263+
"match": "((?:-{0,2}|\\.{3})[\\w-]+)(?:\\((-[\\w?])\\))?",
267264
"name": "variable.parameter.nushell"
268265
},
269266
{
270267
"begin": "\\??:\\s*",
271-
"end": "\\s*(?=,|@|#|$)",
268+
"end": "(?=(?:\\s+(?:-{0,2}|\\.{3})[\\w-]+)|(?:\\s*(?:,|\\]|@|=|#|$)))",
272269
"patterns": [
273270
{ "include": "#types" }
274271
]
@@ -277,15 +274,15 @@
277274
"begin": "@(?=\"|')",
278275
"end": "(?<=\"|')",
279276
"patterns": [ {"include": "#string"} ]
277+
},
278+
{
279+
"name": "default.value.nushell",
280+
"begin": "=\\s*",
281+
"end": "(?=(?:\\s+-{0,2}[\\w-]+)|(?:\\s*(?:,|\\]|#|$)))",
282+
"patterns": [{ "include": "#value" }]
280283
}
281284
]
282285
},
283-
"function-parameter": {
284-
"patterns": [
285-
{ "include": "#function-parameter-declare" },
286-
{ "include": "#function-parameter-default-value" }
287-
]
288-
},
289286
"function-parameters": {
290287
"begin": "\\[",
291288
"beginCaptures": {
@@ -301,31 +298,40 @@
301298
],
302299
"name": "meta.function.parameters.nushell"
303300
},
304-
"inout": {
301+
"function-multiple-inout": {
302+
"begin": "(?<=]\\s*)(:)\\s+(\\[)",
303+
"beginCaptures": {
304+
"1": { "name": "punctuation.definition.in-out.nushell" },
305+
"2": { "name": "meta.brace.square.begin.nushell" }
306+
},
307+
"end": "\\]",
308+
"endCaptures": {
309+
"0": { "name": "meta.brace.square.end.nushell" }
310+
},
311+
"patterns": [
312+
{ "include": "#types" },
313+
{
314+
"match": "\\s*(,)\\s*",
315+
"captures": {
316+
"1": { "name": "punctuation.separator.nushell" }
317+
}
318+
},
319+
{
320+
"match": "\\s+(->)\\s+",
321+
"captures": {
322+
"1": { "name": "keyword.operator.nushell" }
323+
}
324+
}
325+
]
326+
},
327+
"function-inout": {
305328
"patterns": [
306329
{ "include": "#types" },
307330
{
308331
"match": "->",
309332
"name": "keyword.operator.nushell"
310-
}
311-
]
312-
},
313-
"function-inout": {
314-
"begin": "(?<=]\\s*)(:)\\s+(\\[)",
315-
"beginCaptures": {
316-
"1": { "name": "punctuation.definition.in-out.nushell" },
317-
"2": { "name": "meta.brace.square.end.nushell" }
318-
},
319-
"end": "\\]",
320-
"endCaptures": {
321-
"0": { "name": "meta.brace.square.end.nushell" }
322-
},
323-
"patterns": [
324-
{ "include": "#inout" },
325-
{
326-
"match": ",",
327-
"name": "punctuation.separator.nushell"
328-
}
333+
},
334+
{ "include": "#function-multiple-inout" }
329335
]
330336
},
331337
"function-body": {
@@ -348,14 +354,10 @@
348354
"3": { "name": "entity.name.function.nushell" }
349355
},
350356
"end": "(?<=\\})",
351-
"endCaptures": {
352-
"0": { "name": "punctuation.definition.function.end.nushell" }
353-
},
354357
"patterns": [
355358
{ "include": "#function-parameters" },
356359
{ "include": "#function-body" },
357-
{ "include": "#function-inout" },
358-
{ "include": "#inout" }
360+
{ "include": "#function-inout" }
359361
]
360362
},
361363
"extern": {

0 commit comments

Comments
 (0)