Skip to content

Commit

Permalink
Problem matching and adding tree-sitter-metamodelica (#2)
Browse files Browse the repository at this point in the history
* Problem matching and adding tree-sitter-metamodelica

  - Adding problem matcher
  - tree-sitter-metamodelica.wasm will be build from tree-sitter-metamodelica dependency.
  - Updating package versions to match tree-sitter-metamodelica

* Bumping version to 0.2.0
  • Loading branch information
AnHeuermann authored Apr 19, 2024
1 parent b9e8a81 commit 7a61a7e
Show file tree
Hide file tree
Showing 20 changed files with 3,805 additions and 597 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ features:

![Outline](images/outline_demo.png)

- Diagnostics:

![Diagnostics](images/problemMatching.png)

## Installation

### Via Marketplace
Expand Down
56 changes: 28 additions & 28 deletions client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"name": "metamodelica-language-server-client",
"description": "VSCode part of a language server",
"author": "Andreas Heuermann",
"license": "OSMC-PL-1-8",
"version": "0.1.0",
"license": "See ../OSMC-License.txt",
"version": "0.2.0",
"publisher": "vscode",
"repository": {
"type": "git",
Expand All @@ -14,10 +14,10 @@
"node": "20"
},
"dependencies": {
"vscode-languageclient": "^8.1.0"
"vscode-languageclient": "^9.0.1"
},
"devDependencies": {
"@types/vscode": "^1.75.1",
"@vscode/test-electron": "^2.3.8"
"@types/vscode": "^1.88.0",
"@vscode/test-electron": "^2.3.9"
}
}
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
Binary file modified images/outline_demo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/problemMatching.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 7a61a7e

Please sign in to comment.