Skip to content

Commit

Permalink
All .mo files are MetaModelica for now.
Browse files Browse the repository at this point in the history
  • Loading branch information
AnHeuermann committed Apr 19, 2024
1 parent bd5c2a6 commit 5489ff1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions client/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ export function activate(context: ExtensionContext) {
if (getFileExtension(document) == '.mo') {
const lang = getLanguage(document);

// TODO: Fix this mess!
languages.setTextDocumentLanguage(document, 'metamodelica');
/*
switch (lang) {
case 'modelica':
languages.setTextDocumentLanguage(document, 'modelica');
Expand All @@ -69,6 +72,7 @@ export function activate(context: ExtensionContext) {
default:
break;
}
*/
}
});

Expand Down
2 changes: 2 additions & 0 deletions client/src/getLanguage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ export function getFileExtension(document: TextDocument): string | undefined {
}

function hasMetaModelicaKeywords(content: string): boolean {
// TODO: Improve this by parsing the file as MetaModelica and check if it has
// any MetaModelica only keywors in the tree.
const unionRegex = new RegExp('\\b(uniontype)\\s+(\\w+)\\s*(".*")*');

return unionRegex.test(content);
Expand Down

0 comments on commit 5489ff1

Please sign in to comment.