Skip to content

Commit

Permalink
Fixes #347
Browse files Browse the repository at this point in the history
  • Loading branch information
isc-bsaviano committed Oct 1, 2024
1 parent e005922 commit c96ec98
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## [2.6.2] - 2024-XX-XX
- Fix issue [#347](https://github.com/intersystems/language-server/issues/347): Setting a variable's subscript should not affect the type of that variable

## [2.6.1] - 2024-08-30
- Fix issue [#343](https://github.com/intersystems/language-server/issues/343): foldingRange fails on some C-style block comments
- Fix issue [#344](https://github.com/intersystems/language-server/issues/344): Prevent errors during hover when no data was returned from the server
Expand Down
13 changes: 9 additions & 4 deletions server/src/utils/functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1615,9 +1615,7 @@ async function parseSetCommand(
let firstExprTuple: [number, number] | undefined = undefined;
let lastMemTuple: [number, number] | undefined = undefined;
for (let ln = line; ln < parsed.length; ln++) {
if (parsed[ln] == undefined || parsed[ln].length == 0) {
continue;
}
if (!parsed[ln]?.length) continue;
for (let tkn = (ln == line ? token + 1 : 0); tkn < parsed[ln].length; tkn++) {
if (parsed[ln][tkn].l == ld.cos_langindex && (parsed[ln][tkn].s === ld.cos_command_attrindex || parsed[ln][tkn].s === ld.cos_zcom_attrindex)) {
// This is the next command, so stop looping
Expand Down Expand Up @@ -1658,7 +1656,14 @@ async function parseSetCommand(
parsed[ln][tkn].s == ld.cos_localdec_attrindex || parsed[ln][tkn].s == ld.cos_localvar_attrindex
) &&
doc.getText(Range.create(ln,parsed[ln][tkn].p,ln,parsed[ln][tkn].p+parsed[ln][tkn].c)) == selector &&
!(tkn+1 < parsed[ln].length && parsed[ln][tkn+1].l == ld.cos_langindex && parsed[ln][tkn+1].s == ld.cos_objdot_attrindex) &&
// Variable isn't followed by a dot or a subscript
!(tkn+1 < parsed[ln].length && parsed[ln][tkn+1].l == ld.cos_langindex && (
parsed[ln][tkn+1].s == ld.cos_objdot_attrindex || (
parsed[ln][tkn+1].s == ld.cos_delim_attrindex &&
doc.getText(Range.create(ln,parsed[ln][tkn+1].p,ln,parsed[ln][tkn+1].p+parsed[ln][tkn+1].c)) == "("
)
)) &&
// Variable isn't preceded by the indirection operator
!(tkn-1 >= 0 && parsed[ln][tkn-1].l == ld.cos_langindex && parsed[ln][tkn-1].s == ld.cos_indir_attrindex)
) {
// We found the variable, so now look for the assignment operator
Expand Down

0 comments on commit c96ec98

Please sign in to comment.