Skip to content

Commit cc4a96b

Browse files
committed
move two declarative language files
to folder `declaratives` Signed-off-by: Qingpeng Li <qingpeng9802@gmail.com>
1 parent 5f0d463 commit cc4a96b

File tree

9 files changed

+247
-243
lines changed

9 files changed

+247
-243
lines changed

.vscodeignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
!syntaxes/commonlisp.tmLanguage.json
1414
!syntaxes/cl_codeblock.tmLanguage.json
1515

16-
!language-configuration.json
17-
!snippets/commonlisp_snippets.json
16+
!declaratives/language-configuration.json
17+
!declaratives/commonlisp_snippets.json
1818

1919
!README.md
2020
!CHANGELOG.md

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,9 @@ The recommended workflow is:
138138
4. If the changes are what you expect, run `npm run accept` to accept the new baselines.
139139

140140
### Snippet
141-
In `./snippets`.
141+
In `./declaratives/commonlisp_snippets.json`.
142142
See [Snippet Guide](https://code.visualstudio.com/api/language-extensions/snippet-guide) and [creating-your-own-snippets](https://code.visualstudio.com/docs/editor/userdefinedsnippets#_creating-your-own-snippets).
143143

144144
### Language Configuration
145-
In `./language-configuration.json`.
145+
In `./declaratives/language-configuration.json`.
146146
See [Language Configuration Guide](https://code.visualstudio.com/api/language-extensions/language-configuration-guide).
Lines changed: 193 additions & 193 deletions
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
1-
{
2-
"comments": {
3-
// symbol used for single line comment. Remove this entry if your language does not support line comments
4-
"lineComment": ";",
5-
// symbols used for start and end a block comment. Remove this entry if your language does not support block comments
6-
"blockComment": [ "#|", "|#" ]
7-
},
8-
// symbols used as brackets
9-
"brackets": [
10-
[ "{", "}" ],
11-
[ "[", "]" ],
12-
[ "(", ")" ]
13-
],
14-
// symbols that are auto closed when typing
15-
"autoClosingPairs": [
16-
[ "{", "}" ],
17-
[ "[", "]" ],
18-
[ "(", ")" ],
19-
[ "\"", "\"" ],
20-
[ "#|", " |#" ]
21-
],
22-
// symbols that can be used to surround a selection
23-
"surroundingPairs": [
24-
[ "{", "}" ],
25-
[ "[", "]" ],
26-
[ "(", ")" ],
27-
[ "\"", "\"" ],
28-
],
29-
// wordPattern defines what's considered as a word in the programming language.
30-
// Code suggestion features will use this setting to determine word boundaries if wordPattern is set.
31-
// Note this setting won't affect word-related editor commands,
32-
// which are controlled by the editor setting editor.wordSeparators.
33-
"wordPattern": "([#:A-Za-z0-9\\+\\-\\*\\/\\@\\$\\%\\^\\&\\_\\=\\<\\>\\~\\!\\?\\[\\]\\{\\}\\.]+)"
34-
}
1+
{
2+
"comments": {
3+
// symbol used for single line comment. Remove this entry if your language does not support line comments
4+
"lineComment": ";",
5+
// symbols used for start and end a block comment. Remove this entry if your language does not support block comments
6+
"blockComment": [ "#|", "|#" ]
7+
},
8+
// symbols used as brackets
9+
"brackets": [
10+
[ "{", "}" ],
11+
[ "[", "]" ],
12+
[ "(", ")" ]
13+
],
14+
// symbols that are auto closed when typing
15+
"autoClosingPairs": [
16+
[ "{", "}" ],
17+
[ "[", "]" ],
18+
[ "(", ")" ],
19+
[ "\"", "\"" ],
20+
[ "#|", " |#" ]
21+
],
22+
// symbols that can be used to surround a selection
23+
"surroundingPairs": [
24+
[ "{", "}" ],
25+
[ "[", "]" ],
26+
[ "(", ")" ],
27+
[ "\"", "\"" ],
28+
],
29+
// wordPattern defines what's considered as a word in the programming language.
30+
// Code suggestion features will use this setting to determine word boundaries if wordPattern is set.
31+
// Note this setting won't affect word-related editor commands,
32+
// which are controlled by the editor setting editor.wordSeparators.
33+
"wordPattern": "([#:A-Za-z0-9\\+\\-\\*\\/\\@\\$\\%\\^\\&\\_\\=\\<\\>\\~\\!\\?\\[\\]\\{\\}\\.]+)"
34+
}

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
".asd",
5050
".asdf"
5151
],
52-
"configuration": "./language-configuration.json",
52+
"configuration": "./declaratives/language-configuration.json",
5353
"icon": {
5454
"light": "./images/commonlisp_file_icon.svg",
5555
"dark": "./images/commonlisp_file_icon.svg"
@@ -83,7 +83,7 @@
8383
"snippets": [
8484
{
8585
"language": "commonlisp",
86-
"path": "./snippets/commonlisp_snippets.json"
86+
"path": "./declaratives/commonlisp_snippets.json"
8787
}
8888
],
8989
"configuration": {

syntaxes/scripts/build_grammar.mjs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ import { promises as fsPromises } from 'fs';
44

55
import { load } from 'js-yaml';
66

7-
const INPUT_GRAM_PATH = 'syntaxes/commonlisp.yaml';
8-
const OUTPUT_GRAM_PATH = 'syntaxes/commonlisp.tmLanguage.json';
9-
const INPUT_INJMD_GRAM_PATH = 'syntaxes/cl_codeblock.yaml';
10-
const OUTPUT_INJMD_GRAM_PATH = 'syntaxes/cl_codeblock.tmLanguage.json';
7+
const syntaxes_root = 'syntaxes/';
8+
const INPUT_GRAM_PATH = `${syntaxes_root}commonlisp.yaml`;
9+
const OUTPUT_GRAM_PATH = `${syntaxes_root}commonlisp.tmLanguage.json`;
10+
const INPUT_INJMD_GRAM_PATH = `${syntaxes_root}cl_codeblock.yaml`;
11+
const OUTPUT_INJMD_GRAM_PATH = `${syntaxes_root}cl_codeblock.tmLanguage.json`;
1112

1213
/**
1314
* @param {string} inputFilePath

syntaxes/scripts/gen_record.mjs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@ var GrammarScopeName;
3838
const grammarFileNames = new Map([
3939
[GrammarScopeName.lisp, 'commonlisp.tmLanguage.json']
4040
]);
41+
const syntaxes_root = './syntaxes/';
4142
/** get the path of the grammar file */
42-
const getGrammarPath = (scopeName) => path.join('./syntaxes', grammarFileNames.get(scopeName));
43+
const getGrammarPath = (scopeName) => path.join(syntaxes_root, grammarFileNames.get(scopeName));
4344
// Part 2: get vscode-textmate registry
4445
/** get vscode-textmate registry */
4546
async function getRegistery() {
@@ -96,7 +97,7 @@ function generateScopesWorker(mainGrammar, oriLineArr) {
9697
for (const oriLine of oriLineArr) {
9798
// console.log(`\nTokenizing line: ${oriLine}`);
9899
cleanCodeLines.push(oriLine);
99-
recordLines.push('>' + oriLine);
100+
recordLines.push(`>${oriLine}`);
100101
let prevScope = '';
101102
const mainLineTokens = tokenizeLine(mainGrammar, oriLine);
102103
for (const token of mainLineTokens) {

syntaxes/scripts/gen_record.mts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,10 @@ enum GrammarScopeName {
4242
const grammarFileNames: Map<GrammarScopeName, string> = new Map([
4343
[GrammarScopeName.lisp, 'commonlisp.tmLanguage.json']
4444
]);
45+
const syntaxes_root = './syntaxes/';
4546
/** get the path of the grammar file */
4647
const getGrammarPath = (scopeName: GrammarScopeName) =>
47-
path.join('./syntaxes', grammarFileNames.get(scopeName)!);
48+
path.join(syntaxes_root, grammarFileNames.get(scopeName)!);
4849

4950
// Part 2: get vscode-textmate registry
5051

syntaxes/scripts/test_util.mjs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ import * as path from 'path';
55

66
import { generateScopes, getRegistery, GrammarScopeName } from './gen_record.mjs';
77

8-
const generatedFolder = 'syntaxes/test/generated';
9-
const baselineFolder = 'syntaxes/test/baselines';
10-
const casesFolder = 'syntaxes/test/cases';
8+
const syntaxes_root = 'syntaxes/';
9+
const generatedFolder = `${syntaxes_root}test/generated`;
10+
const baselineFolder = `${syntaxes_root}test/baselines`;
11+
const casesFolder = `${syntaxes_root}test/cases`;
1112

1213
/**
1314
* @param {string} file

0 commit comments

Comments
 (0)