Skip to content

Commit ee06aab

Browse files
committed
Merge branch 'main' into merogge/trap-focus
2 parents ca091e2 + 31acde2 commit ee06aab

File tree

9 files changed

+11004
-13
lines changed

9 files changed

+11004
-13
lines changed

extensions/configuration-editing/package.json

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@
4141
".code-workspace",
4242
"language-configuration.json",
4343
"icon-theme.json",
44-
"color-theme.json",
45-
".code-snippets"
44+
"color-theme.json"
4645
],
4746
"filenames": [
4847
"settings.json",
@@ -54,10 +53,6 @@
5453
"profiles.json",
5554
"devcontainer.json",
5655
".devcontainer.json"
57-
],
58-
"filenamePatterns": [
59-
"**/User/snippets/*.json",
60-
"**/User/profiles/*/snippets/*.json"
6156
]
6257
}, {
6358
"id": "json",

extensions/json/build/update-grammars.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@
66

77
var updateGrammar = require('vscode-grammar-updater');
88

9-
function adaptJSON(grammar, name, replacementScope) {
9+
function adaptJSON(grammar, name, replacementScope, replaceeScope = 'json') {
1010
grammar.name = name;
1111
grammar.scopeName = `source${replacementScope}`;
12-
12+
const regex = new RegExp(`\.${replaceeScope}`, 'g');
1313
var fixScopeNames = function (rule) {
1414
if (typeof rule.name === 'string') {
15-
rule.name = rule.name.replace(/\.json/g, replacementScope);
15+
rule.name = rule.name.replace(regex, replacementScope);
1616
}
1717
if (typeof rule.contentName === 'string') {
18-
rule.contentName = rule.contentName.replace(/\.json/g, replacementScope);
18+
rule.contentName = rule.contentName.replace(regex, replacementScope);
1919
}
2020
for (var property in rule) {
2121
var value = rule[property];
@@ -35,3 +35,5 @@ var tsGrammarRepo = 'microsoft/vscode-JSON.tmLanguage';
3535
updateGrammar.update(tsGrammarRepo, 'JSON.tmLanguage', './syntaxes/JSON.tmLanguage.json');
3636
updateGrammar.update(tsGrammarRepo, 'JSON.tmLanguage', './syntaxes/JSONC.tmLanguage.json', grammar => adaptJSON(grammar, 'JSON with Comments', '.json.comments'));
3737
updateGrammar.update(tsGrammarRepo, 'JSON.tmLanguage', './syntaxes/JSONL.tmLanguage.json', grammar => adaptJSON(grammar, 'JSON Lines', '.json.lines'));
38+
39+
updateGrammar.update('jeff-hykin/better-snippet-syntax', 'autogenerated/jsonc.tmLanguage.json', './syntaxes/snippets.tmLanguage.json', grammar => adaptJSON(grammar, 'Snippets', '.json.comments.snippets', 'json.comments'));

extensions/json/cgmanifest.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,18 @@
1111
},
1212
"license": "MIT",
1313
"version": "0.0.0"
14+
},
15+
{
16+
"component": {
17+
"type": "git",
18+
"git": {
19+
"name": "jeff-hykin/better-snippet-syntax",
20+
"repositoryUrl": "https://github.com/jeff-hykin/better-snippet-syntax",
21+
"commitHash": "2b1bb124cb2b9c75c3c80eae1b8f3a043841d654"
22+
}
23+
},
24+
"license": "MIT",
25+
"version": "1.0.2"
1426
}
1527
],
1628
"version": 1

extensions/json/package.json

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
".jslintrc",
3232
".jsonld",
3333
".geojson",
34-
".ipynb",
34+
".ipynb",
3535
".vuerc"
3636
],
3737
"filenames": [
@@ -77,6 +77,20 @@
7777
],
7878
"filenames": [],
7979
"configuration": "./language-configuration.json"
80+
},
81+
{
82+
"id": "snippets",
83+
"aliases": [
84+
"Code Snippets"
85+
],
86+
"extensions": [
87+
".code-snippets"
88+
],
89+
"filenamePatterns": [
90+
"**/User/snippets/*.json",
91+
"**/User/profiles/*/snippets/*.json"
92+
],
93+
"configuration": "./language-configuration.json"
8094
}
8195
],
8296
"grammars": [
@@ -94,6 +108,11 @@
94108
"language": "jsonl",
95109
"scopeName": "source.json.lines",
96110
"path": "./syntaxes/JSONL.tmLanguage.json"
111+
},
112+
{
113+
"language": "snippets",
114+
"scopeName": "source.json.comments.snippets",
115+
"path": "./syntaxes/snippets.tmLanguage.json"
97116
}
98117
]
99118
},

extensions/json/syntaxes/snippets.tmLanguage.json

Lines changed: 7463 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
// Each snippet is defined under a snippet name and has a scope, prefix, body and
3+
// description. The scope defines in watch languages the snippet is applicable. The prefix is what is
4+
// used to trigger the snippet and the body will be expanded and inserted.Possible variables are:
5+
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
6+
// Placeholders with the same ids are connected.
7+
// Example:
8+
"MSFT Copyright Header": {
9+
"scope": "javascript,typescript,css",
10+
"prefix": [
11+
"header",
12+
"stub",
13+
"copyright"
14+
],
15+
"body": [
16+
"/*---------------------------------------------------------------------------------------------",
17+
" * Copyright (c) Microsoft Corporation. All rights reserved.",
18+
" * Licensed under the MIT License. See License.txt in the project root for license information.",
19+
" *--------------------------------------------------------------------------------------------*/",
20+
"",
21+
"$0"
22+
],
23+
"description": "Insert Copyright Statement"
24+
},
25+
"TS -> Inject Service": {
26+
"scope": "typescript",
27+
"description": "Constructor Injection Pattern",
28+
"prefix": "@inject",
29+
"body": "@$1 private readonly _$2: ${1},$0"
30+
},
31+
"TS -> Event & Emitter": {
32+
"scope": "typescript",
33+
"prefix": "emitter",
34+
"description": "Add emitter and event properties",
35+
"body": [
36+
"private readonly _onDid$1 = new Emitter<$2>();",
37+
"readonly onDid$1: Event<$2> = this._onDid$1.event;"
38+
],
39+
}
40+
}

0 commit comments

Comments
 (0)