Skip to content

Commit 4c9a218

Browse files
committed
Allow renaming variables within read command
1 parent 98e7d11 commit 4c9a218

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

server/src/analyser.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -785,6 +785,20 @@ export default class Analyzer {
785785
}
786786
}
787787

788+
if (
789+
node.type === 'word' &&
790+
node.parent?.type === 'command' &&
791+
node.parent.firstChild?.text === 'read' &&
792+
!node.text.startsWith('-') &&
793+
!/^-.*[dinNptu]$/.test(node.previousSibling?.text ?? '')
794+
) {
795+
return {
796+
word: node.text,
797+
range: TreeSitterUtil.range(node),
798+
kind: LSP.SymbolKind.Variable,
799+
}
800+
}
801+
788802
return null
789803
}
790804

0 commit comments

Comments
 (0)