From b69a0a427e48e5c9dd7adbb364d1da5055e4316f Mon Sep 17 00:00:00 2001 From: Mark Sujew Date: Tue, 20 Jul 2021 11:32:32 +0200 Subject: [PATCH] Rename `extensions` to `fileExtensions` --- examples/arithmetics/package.json | 2 +- examples/domainmodel/package.json | 2 +- examples/statemachine/package.json | 2 +- packages/generator-langium/langium-template/package.json | 2 +- packages/langium-cli/src/generator/module-generator.ts | 6 +++--- packages/langium-cli/src/generator/textmate-generator.ts | 2 +- packages/langium-cli/src/package.ts | 2 +- packages/langium/package.json | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/examples/arithmetics/package.json b/examples/arithmetics/package.json index 1bb33e5d0..b0b0ab462 100644 --- a/examples/arithmetics/package.json +++ b/examples/arithmetics/package.json @@ -37,7 +37,7 @@ "langium": { "languageId": "arithmetics", "grammar": "src/language-server/arithmetics.langium", - "extensions": [".calc"], + "fileExtensions": [".calc"], "out": "src/language-server/generated", "textMate": { "out": "syntaxes/arithmetics.tmLanguage.json" diff --git a/examples/domainmodel/package.json b/examples/domainmodel/package.json index 1b4dda7b7..63366d72a 100644 --- a/examples/domainmodel/package.json +++ b/examples/domainmodel/package.json @@ -30,7 +30,7 @@ "langium": { "languageId": "domain-model", "grammar": "src/language-server/domain-model.langium", - "extensions": [".dmodel"], + "fileExtensions": [".dmodel"], "out": "src/language-server/generated", "textMate": { "out": "syntaxes/domain-model.tmLanguage.json" diff --git a/examples/statemachine/package.json b/examples/statemachine/package.json index 1778d24fb..01515509c 100644 --- a/examples/statemachine/package.json +++ b/examples/statemachine/package.json @@ -29,7 +29,7 @@ "langium": { "languageId": "statemachine", "grammar": "src/language-server/statemachine.langium", - "extensions": [".statemachine"], + "fileExtensions": [".statemachine"], "out": "src/language-server/generated", "textMate": { "out": "./syntaxes/statemachine.tmLanguage.json" diff --git a/packages/generator-langium/langium-template/package.json b/packages/generator-langium/langium-template/package.json index 465f07e4b..9b22b87a8 100644 --- a/packages/generator-langium/langium-template/package.json +++ b/packages/generator-langium/langium-template/package.json @@ -29,7 +29,7 @@ "langium": { "languageId": "<%= language-id %>", "grammar": "src/language-server/<%= language-id %>.langium", - "extensions": <%= file-extension %>, + "fileExtensions": <%= file-extension %>, "out": "src/language-server/generated", "textMate": { "out": "syntaxes/<%= language-id %>.tmLanguage.json" diff --git a/packages/langium-cli/src/generator/module-generator.ts b/packages/langium-cli/src/generator/module-generator.ts index 3c66de065..8801caee3 100644 --- a/packages/langium-cli/src/generator/module-generator.ts +++ b/packages/langium-cli/src/generator/module-generator.ts @@ -24,10 +24,10 @@ export function generateModule(grammar: langium.Grammar, config: LangiumConfig): "import { Parser } from './parser';", NL, NL ); - node.append('const metaData = {', NL); + node.append('export const languageMetaData = {', NL); node.indent(metaData => { metaData.append(`languageId: '${config.languageId}',`, NL); - metaData.append(`fileExtensions: [${config.extensions && config.extensions.map(e => appendQuotesAndDot(e)).join(', ')}]`, NL); + metaData.append(`fileExtensions: [${config.fileExtensions && config.fileExtensions.map(e => appendQuotesAndDot(e)).join(', ')}]`, NL); }); node.append('};', NL, NL); @@ -41,7 +41,7 @@ export function generateModule(grammar: langium.Grammar, config: LangiumConfig): '},', NL, 'GrammarAccess: () => new ', grammar.name, 'GrammarAccess(),', NL, 'AstReflection: () => new ', grammar.name, 'AstReflection(),', NL, - 'LanguageMetaData: () => metaData', NL + 'LanguageMetaData: () => languageMetaData', NL ); }); node.append('};', NL); diff --git a/packages/langium-cli/src/generator/textmate-generator.ts b/packages/langium-cli/src/generator/textmate-generator.ts index e0636f0f1..ce0c9096b 100644 --- a/packages/langium-cli/src/generator/textmate-generator.ts +++ b/packages/langium-cli/src/generator/textmate-generator.ts @@ -49,7 +49,7 @@ export function generateTextMate(grammar: langium.Grammar, config: LangiumConfig const json: TextMateGrammar = { name: config.languageId, scopeName: `source.${config.languageId}`, - fileTypes: config.extensions ?? [], + fileTypes: config.fileExtensions ?? [], patterns: getPatterns(grammar, config), repository: getRepository(grammar, config) }; diff --git a/packages/langium-cli/src/package.ts b/packages/langium-cli/src/package.ts index 34439792f..95b8d5bc1 100644 --- a/packages/langium-cli/src/package.ts +++ b/packages/langium-cli/src/package.ts @@ -16,7 +16,7 @@ export interface LangiumConfig { /** Path to the grammar file */ grammar?: string /** File extensions with leading `.` */ - extensions?: string[] + fileExtensions?: string[] /** Main output directory for TypeScript code */ out?: string /** Enable generating a TextMate syntax highlighting file */ diff --git a/packages/langium/package.json b/packages/langium/package.json index d15ad9757..fd5152dc3 100644 --- a/packages/langium/package.json +++ b/packages/langium/package.json @@ -31,7 +31,7 @@ "langium": { "languageId": "langium", "grammar": "src/grammar/langium-grammar.langium", - "extensions": [ + "fileExtensions": [ "langium" ], "out": "src/grammar/generated",