diff --git a/CHANGELOG.md b/CHANGELOG.md index b7f2b09..7ae46fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## [2.5.1] - 2024-XX-XX - Fix issue [#328](https://github.com/intersystems/language-server/issues/328): Fix namespace detection for Diagnostic computation - Fix issue [#331](https://github.com/intersystems/language-server/issues/331): Fix display of method arguments with a colon in the default value +- Fix issue [#333](https://github.com/intersystems/language-server/issues/333): Fix folding ranges when routine labels that don't appear in the first column - Parser changes: - DP-430950: Support new `Requires` Query keyword diff --git a/server/src/providers/foldingRange.ts b/server/src/providers/foldingRange.ts index 244d0e3..c27f440 100644 --- a/server/src/providers/foldingRange.ts +++ b/server/src/providers/foldingRange.ts @@ -157,8 +157,8 @@ export async function onFoldingRanges(params: FoldingRangeParams) { } } if ( - parsed[line][0].l === ld.cos_langindex && parsed[line][0].s === ld.cos_label_attrindex && - firsttokentext !== routinename && (doc.languageId === "objectscript" || doc.languageId === "objectscript-int") + parsed[line][0].l == ld.cos_langindex && parsed[line][0].s == ld.cos_label_attrindex && parsed[line][0].p == 0 && + firsttokentext != routinename && (doc.languageId == "objectscript" || doc.languageId == "objectscript-int") ) { // This line starts with a routine label @@ -195,7 +195,7 @@ export async function onFoldingRanges(params: FoldingRangeParams) { // Don't fold comments that immediately precede the next label precedingcomments++; } - else if (parsed[nl][0].l === ld.cos_langindex && parsed[nl][0].s === ld.cos_label_attrindex) { + else if (parsed[nl][0].l == ld.cos_langindex && parsed[nl][0].s == ld.cos_label_attrindex && parsed[nl][0].p == 0) { // This is the next label openranges[openranges.length-1].endLine = nl-precedingcomments-1; if (openranges[openranges.length-1].startLine < openranges[openranges.length-1].endLine) {