Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem matching and adding tree-sitter-metamodelica #2

Merged
merged 5 commits into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading