Skip to content

Commit

Permalink
Rename extensions to fileExtensions
Browse files Browse the repository at this point in the history
  • Loading branch information
msujew committed Jul 20, 2021
1 parent 89beafd commit e9f0b2d
Show file tree
Hide file tree
Showing 13 changed files with 25 additions and 18 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Change Log

## v0.2.0

<a name="breaking_changes_0.2.0">[Breaking Changes:](#breaking_changes_0.2.0)</a>

- [langium-cli] The `extensions` field in langium configs was renamed to `fileExtensions`. [#173](https://github.com/langium/langium/pull/173)
2 changes: 1 addition & 1 deletion examples/arithmetics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions examples/arithmetics/src/language-server/generated/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { ArithmeticsAstReflection } from './ast';
import { ArithmeticsGrammarAccess } from './grammar-access';
import { Parser } from './parser';

const metaData = {
export const languageMetaData = {
languageId: 'arithmetics',
fileExtensions: ['.calc']
};
Expand All @@ -19,5 +19,5 @@ export const ArithmeticsGeneratedModule: Module<LangiumServices, LangiumGenerate
},
GrammarAccess: () => new ArithmeticsGrammarAccess(),
AstReflection: () => new ArithmeticsAstReflection(),
LanguageMetaData: () => metaData
LanguageMetaData: () => languageMetaData
};
2 changes: 1 addition & 1 deletion examples/domainmodel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions examples/domainmodel/src/language-server/generated/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { DomainModelAstReflection } from './ast';
import { DomainModelGrammarAccess } from './grammar-access';
import { Parser } from './parser';

const metaData = {
export const languageMetaData = {
languageId: 'domain-model',
fileExtensions: ['.dmodel']
};
Expand All @@ -19,5 +19,5 @@ export const DomainModelGeneratedModule: Module<LangiumServices, LangiumGenerate
},
GrammarAccess: () => new DomainModelGrammarAccess(),
AstReflection: () => new DomainModelAstReflection(),
LanguageMetaData: () => metaData
LanguageMetaData: () => languageMetaData
};
2 changes: 1 addition & 1 deletion examples/statemachine/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions examples/statemachine/src/language-server/generated/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { StatemachineAstReflection } from './ast';
import { StatemachineGrammarAccess } from './grammar-access';
import { Parser } from './parser';

const metaData = {
export const languageMetaData = {
languageId: 'statemachine',
fileExtensions: ['.statemachine']
};
Expand All @@ -19,5 +19,5 @@ export const StatemachineGeneratedModule: Module<LangiumServices, LangiumGenerat
},
GrammarAccess: () => new StatemachineGrammarAccess(),
AstReflection: () => new StatemachineAstReflection(),
LanguageMetaData: () => metaData
LanguageMetaData: () => languageMetaData
};
2 changes: 1 addition & 1 deletion packages/generator-langium/langium-template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 3 additions & 3 deletions packages/langium-cli/src/generator/module-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion packages/langium-cli/src/generator/textmate-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
};
Expand Down
2 changes: 1 addition & 1 deletion packages/langium-cli/src/package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
2 changes: 1 addition & 1 deletion packages/langium/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"langium": {
"languageId": "langium",
"grammar": "src/grammar/langium-grammar.langium",
"extensions": [
"fileExtensions": [
"langium"
],
"out": "src/grammar/generated",
Expand Down
4 changes: 2 additions & 2 deletions packages/langium/src/grammar/generated/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { LangiumGrammarAstReflection } from './ast';
import { LangiumGrammarGrammarAccess } from './grammar-access';
import { Parser } from './parser';

const metaData = {
export const languageMetaData = {
languageId: 'langium',
fileExtensions: ['.langium']
};
Expand All @@ -20,5 +20,5 @@ export const LangiumGrammarGeneratedModule: Module<LangiumServices, LangiumGener
},
GrammarAccess: () => new LangiumGrammarGrammarAccess(),
AstReflection: () => new LangiumGrammarAstReflection(),
LanguageMetaData: () => metaData
LanguageMetaData: () => languageMetaData
};

0 comments on commit e9f0b2d

Please sign in to comment.