Skip to content

Commit

Permalink
Fixes #273
Browse files Browse the repository at this point in the history
  • Loading branch information
isc-bsaviano committed Apr 20, 2023
1 parent 41d42ac commit 6458806
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## [2.3.3] - 2023-XX-XX
- Fix issue [#271](https://github.com/intersystems/language-server/issues/271): Add setting to suppress syntax error Diagnostics for specific languages
- Fix issue [#272](https://github.com/intersystems/language-server/issues/272): Expand arguments when hovering over macro defined in the current file
- Fix issue [#273](https://github.com/intersystems/language-server/issues/273): False "Parameter value and type do not match" warning when value is a curly brace enclosed expression

## [2.3.2] - 2023-03-22
- Fix issue [#265](https://github.com/intersystems/language-server/issues/265): Support HTML spans in intellisense from class descriptions
Expand Down
29 changes: 15 additions & 14 deletions server/src/utils/functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -387,30 +387,31 @@ export async function computeDiagnostics(doc: TextDocument) {
(thistypedoc.name === "INTEGER" && (parsed[i][valuetkn].l !== ld.cls_langindex || parsed[i][valuetkn].s !== ld.cls_num_attrindex)) ||
(thistypedoc.name === "BOOLEAN" && (parsed[i][valuetkn].l !== ld.cls_langindex || parsed[i][valuetkn].s !== ld.cls_num_attrindex || (valtext !== "1" && valtext !== "0")))
) {
let diagnostic: Diagnostic = {
severity: DiagnosticSeverity.Warning,
range: valrange,
message: "Parameter value and type do not match.",
source: 'InterSystems Language Server'
};
diagnostics.push(diagnostic);
// Allow curly brace syntax for all types but COSEXPRESSION
if (thistypedoc.name == "COSEXPRESSION" || !valtext.startsWith("{")) {
diagnostics.push({
severity: DiagnosticSeverity.Warning,
range: valrange,
message: "Parameter value and type do not match.",
source: 'InterSystems Language Server'
});
}
}
else if (thistypedoc.name === "CLASSNAME" && settings.diagnostics.classes) {
// Validate the class name in the string
var classname: string = valtext.slice(1,-1);
if (classname.indexOf("%") === 0 && classname.indexOf(".") === -1) {
classname = "%Library.".concat(classname.slice(1));
let classname: string = valtext.slice(1,-1);
if (classname.startsWith("%") && !classname.includes(".")) {
classname = `%Library.${classname.slice(1)}`;
}
// Check if class exists
const filtered = files.filter(file => file.Name === classname+".cls");
if (filtered.length !== 1) {
let diagnostic: Diagnostic = {
if (filtered.length !== 1 && !classname.startsWith("%SYSTEM.")) {
diagnostics.push({
severity: DiagnosticSeverity.Warning,
range: valrange,
message: `Class '${classname}' does not exist in namespace '${baseNs}'.`,
source: 'InterSystems Language Server'
};
diagnostics.push(diagnostic);
});
}
}
}
Expand Down

0 comments on commit 6458806

Please sign in to comment.