Skip to content

Commit

Permalink
Suppress compiler warnings in .mops and .vessel directories (#274)
Browse files Browse the repository at this point in the history
* Hide warnings in '.mops' and '.vessel' directories

* Refactor

* 0.16.1
  • Loading branch information
rvanasa authored Mar 14, 2024
1 parent 1d256ba commit ca821be
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "vscode-motoko",
"displayName": "Motoko",
"description": "Motoko language support",
"version": "0.16.0",
"version": "0.16.1",
"publisher": "dfinity-foundation",
"repository": "https://github.com/dfinity/vscode-motoko",
"engines": {
Expand Down
8 changes: 8 additions & 0 deletions src/server/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ const ignoreGlobs = [
'**/.vessel/.tmp/**/*', // temporary Vessel files
];

const shouldHideWarnings = (uri: string) =>
uri.includes('/.vessel/') || uri.includes('/.mops/');

const packageSourceCache = new Map();
async function getPackageSources(
directory: string,
Expand Down Expand Up @@ -866,6 +869,11 @@ function checkImmediate(uri: string | TextDocument): boolean {
!new RegExp(settings!.hideWarningRegex).test(message),
);
}
if (resolvedUri && shouldHideWarnings(resolvedUri)) {
diagnostics = diagnostics.filter(
({ severity }) => severity === DiagnosticSeverity.Error,
);
}
}
const diagnosticMap: Record<string, Diagnostic[]> = {
[virtualPath]: [], // Start with empty diagnostics for the main file
Expand Down

0 comments on commit ca821be

Please sign in to comment.