Skip to content

Commit 173bdbd

Browse files
committed
Rename keyvalue3 to keyvalue. Fixes #110
1 parent 33eb9d9 commit 173bdbd

File tree

8 files changed

+38
-41
lines changed

8 files changed

+38
-41
lines changed
File renamed without changes.

package.json

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
},
4545
"main": "./out/main.js",
4646
"activationEvents": [
47-
"onLanguage:keyvalue3",
47+
"onLanguage:keyvalue",
4848
"onLanguage:vmt",
4949
"onLanguage:captions",
5050
"onLanguage:qc",
@@ -62,7 +62,7 @@
6262
"path": "./snippets/vmt-snippets.json"
6363
},
6464
{
65-
"language": "keyvalue3",
65+
"language": "keyvalue",
6666
"path": "./snippets/gameinfo-snippets.json"
6767
},
6868
{
@@ -84,11 +84,12 @@
8484
],
8585
"languages": [
8686
{
87-
"id": "keyvalue3",
88-
"configuration": "./lang-config-kv3.json",
87+
"id": "keyvalue",
88+
"configuration": "./lang-config-kv.json",
8989
"aliases": [
90-
"Valve Keyvalue 3",
91-
"keyvalue3"
90+
"Valve KeyValue",
91+
"keyvalue",
92+
"KV"
9293
],
9394
"extensions": [
9495
".kv",
@@ -100,15 +101,11 @@
100101
".vmf",
101102
".vmm",
102103
".vmx"
103-
],
104-
"filenames": [
105-
"gameinfo.txt"
106-
],
107-
"firstLine": "^([\\w ]+|\"[\\w ]+\")"
104+
]
108105
},
109106
{
110107
"id": "vmt",
111-
"configuration": "./lang-config-kv3.json",
108+
"configuration": "./lang-config-kv.json",
112109
"aliases": [
113110
"Valve Material Type",
114111
"vmt"
@@ -119,7 +116,7 @@
119116
},
120117
{
121118
"id": "fgd",
122-
"configuration": "./lang-config-kv3.json",
119+
"configuration": "./lang-config-kv.json",
123120
"aliases": [
124121
"FGD",
125122
"Forge Game Data",
@@ -131,7 +128,7 @@
131128
},
132129
{
133130
"id": "captions",
134-
"configuration": "./lang-config-kv3.json",
131+
"configuration": "./lang-config-kv.json",
135132
"aliases": [
136133
"Source Engine Captions",
137134
"Source Engine Subtitles"
@@ -144,7 +141,7 @@
144141
},
145142
{
146143
"id": "cfg",
147-
"configuration": "./lang-config-kv3.json",
144+
"configuration": "./lang-config-kv.json",
148145
"aliases": [
149146
"Source Engine Configuration",
150147
"Source Engine Commands"
@@ -155,7 +152,7 @@
155152
},
156153
{
157154
"id": "vpc",
158-
"configuration": "./lang-config-kv3.json",
155+
"configuration": "./lang-config-kv.json",
159156
"aliases": [
160157
"Valve Project Creator"
161158
],
@@ -166,7 +163,7 @@
166163
},
167164
{
168165
"id": "qc",
169-
"configuration": "./lang-config-kv3.json",
166+
"configuration": "./lang-config-kv.json",
170167
"aliases": [
171168
"Valve QC",
172169
"Valve MC",
@@ -188,7 +185,7 @@
188185
},
189186
{
190187
"id": "soundscript",
191-
"configuration": "./lang-config-kv3.json",
188+
"configuration": "./lang-config-kv.json",
192189
"aliases": [
193190
"Valve Soundscript",
194191
"Source Soundscript"
@@ -222,14 +219,14 @@
222219
],
223220
"grammars": [
224221
{
225-
"language": "keyvalue3",
222+
"language": "keyvalue",
226223
"scopeName": "source.kv",
227-
"path": "./syntaxes/keyvalue3.tmLanguage.json"
224+
"path": "./syntaxes/keyvalue.tmLanguage.json"
228225
},
229226
{
230227
"language": "soundscript",
231228
"scopeName": "source.kv",
232-
"path": "./syntaxes/keyvalue3.tmLanguage.json"
229+
"path": "./syntaxes/keyvalue.tmLanguage.json"
233230
},
234231
{
235232
"language": "vmt",
@@ -389,7 +386,7 @@
389386
}
390387
},
391388
"configurationDefaults": {
392-
"[keyvalue3]": {
389+
"[keyvalue]": {
393390
"editor.semanticHighlighting.enabled": true
394391
}
395392
}

src/KvFileDetection.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,28 @@ function isAutoDetectEnabled(): boolean {
66
return main.config.get<boolean>("kvAutoDetect.enabled", false);
77
}
88

9-
type DetectableLanguageId = "keyvalue3" | "soundscript" | "captions";
9+
type DetectableLanguageId = "keyvalue" | "soundscript" | "captions";
1010

1111
interface CommonFileName {
1212
regex: RegExp;
1313
languageId: DetectableLanguageId;
1414
}
1515

1616
const commonKvFileNames: CommonFileName[] = [
17-
{ regex: /gameinfo\.txt/i, languageId: "keyvalue3" },
17+
{ regex: /gameinfo\.txt/i, languageId: "keyvalue" },
1818
{ regex: /subtitles_.+\.txt/i, languageId: "captions" },
1919
{ regex: /captions_.+\.txt/i, languageId: "captions" },
20-
{ regex: /basemodui_.+\.txt/i, languageId: "keyvalue3" },
21-
{ regex: /instructor_lessons\.txt/i, languageId: "keyvalue3" },
22-
{ regex: /instructor_textures\.txt/i, languageId: "keyvalue3" },
20+
{ regex: /basemodui_.+\.txt/i, languageId: "keyvalue" },
21+
{ regex: /instructor_lessons\.txt/i, languageId: "keyvalue" },
22+
{ regex: /instructor_textures\.txt/i, languageId: "keyvalue" },
2323
{ regex: /game_sounds_.+\.txt/i, languageId: "soundscript" },
2424
{ regex: /npc_sounds_.+\.txt/i, languageId: "soundscript" },
2525
{ regex: /level_sounds_.+\.txt/i, languageId: "soundscript" },
2626
{ regex: /soundscapes_.+\.txt/i, languageId: "soundscript" },
27-
{ regex: /surfaceproperties_.+\.txt/i, languageId: "keyvalue3" },
28-
{ regex: /weapon_.+\.txt/i, languageId: "keyvalue3" },
29-
{ regex: /vgui_screens\.txt/i, languageId: "keyvalue3" },
30-
{ regex: /credits\.txt/i, languageId: "keyvalue3" }
27+
{ regex: /surfaceproperties_.+\.txt/i, languageId: "keyvalue" },
28+
{ regex: /weapon_.+\.txt/i, languageId: "keyvalue" },
29+
{ regex: /vgui_screens\.txt/i, languageId: "keyvalue" },
30+
{ regex: /credits\.txt/i, languageId: "keyvalue" }
3131
];
3232

3333
function getCommonFileNameMatch(fileName: string): CommonFileName | undefined {
@@ -78,7 +78,7 @@ function detectKeyvalueFile(editor: vscode.TextEditor, context: vscode.Extension
7878
return;
7979
}
8080

81-
main.debugOutput.appendLine(`Changing document language of (${editor.document.uri.fsPath}) to keyvalue3`);
81+
main.debugOutput.appendLine(`Changing document language of (${editor.document.uri.fsPath}) to keyvalue`);
8282
vscode.languages.setTextDocumentLanguage(editor.document, langId);
8383
}
8484
}

src/language/LangKv.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export class KeyvalueSemanticTokensProvider extends KvTokensProviderBase {
3636
];
3737

3838
constructor() {
39-
super(KvDocument.tokenLegend, vscode.languages.createDiagnosticCollection("keyvalue3"));
39+
super(KvDocument.tokenLegend, vscode.languages.createDiagnosticCollection("keyvalue"));
4040
}
4141

4242
processValueNumber(params: KvSemanticProcessorParams): boolean {

src/language/Shared.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { DocumentFilter } from "vscode";
22

3-
export const languageIdKeyvalue = "keyvalue3";
3+
export const languageIdKeyvalue = "keyvalue";
44
export const languageIdVmt = "vmt";
55
export const languageIdSoundscript = "soundscript";
66
export const languageIdCaptions = "captions";

syntaxes/captions.tmLanguage.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
},
3131
{
3232
"match": "\"?(?i)tokens(?-i)\"?",
33-
"name": "variable.name.keyvalue3"
33+
"name": "variable.name.keyvalue"
3434
},
3535
{
3636
"include": "#data"

syntaxes/keyvalue3.tmLanguage.json renamed to syntaxes/keyvalue.tmLanguage.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,23 @@
2121
],
2222
"repository": {
2323
"comment": {
24-
"name": "comment.line.keyvalue3",
24+
"name": "comment.line.keyvalue",
2525
"match": "//.*"
2626
},
2727
"boolean": {
28-
"name": "constant.numeric.keyvalue3",
28+
"name": "constant.numeric.keyvalue",
2929
"match": "\\b(true|false)\\b"
3030
},
3131
"number": {
32-
"name": "constant.numeric.keyvalue3",
32+
"name": "constant.numeric.keyvalue",
3333
"match": "-?([0-9]+)?\\.?[0-9]+"
3434
},
3535
"stringUnquoted": {
36-
"name": "string.unquoted.keyvalue3",
36+
"name": "string.unquoted.keyvalue",
3737
"match": "[\\w|\\*\\.\\\\/$%#-\\[\\]]+"
3838
},
3939
"stringQuoted": {
40-
"name": "string.quoted.double.keyvalue3",
40+
"name": "string.quoted.double.keyvalue",
4141
"begin": "\"",
4242
"end": "\"",
4343
"patterns": [{

vsc-extension-quickstart.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
* This folder contains all of the files necessary for your extension.
66
* `package.json` - this is the manifest file in which you declare your language support and define the location of the grammar file that has been copied into your extension.
7-
* `syntaxes/keyvalue3.tmLanguage.json` - this is the Text mate grammar file that is used for tokenization.
7+
* `syntaxes/keyvalue.tmLanguage.json` - this is the Text mate grammar file that is used for tokenization.
88
* `language-configuration.json` - this is the language configuration, defining the tokens that are used for comments and brackets.
99

1010
## Get up and running straight away

0 commit comments

Comments
 (0)