We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4c9a218 commit 420417aCopy full SHA for 420417a
server/src/analyser.ts
@@ -785,13 +785,7 @@ export default class Analyzer {
785
}
786
787
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
- ) {
+ if (TreeSitterUtil.isVariableInReadCommand(node)) {
795
return {
796
word: node.text,
797
range: TreeSitterUtil.range(node),
server/src/util/declarations.ts
@@ -361,6 +361,16 @@ export function findDeclarationUsingGlobalSemantics({
361
return true
362
363
364
+ if (
365
+ kind === LSP.SymbolKind.Variable &&
366
+ TreeSitterUtil.isVariableInReadCommand(n) &&
367
+ n.text === word
368
+ ) {
369
+ declaration = n
370
+ continueSearching = false
371
+ return false
372
+ }
373
+
374
if (
375
kind === LSP.SymbolKind.Function &&
376
n.type === 'function_definition' &&
server/src/util/tree-sitter.ts
@@ -43,6 +43,20 @@ export function isReference(n: SyntaxNode): boolean {
43
44
45
46
+export function isVariableInReadCommand(n: SyntaxNode): boolean {
47
48
+ n.type === 'word' &&
49
+ n.parent?.type === 'command' &&
50
+ n.parent.firstChild?.text === 'read' &&
51
+ !n.text.startsWith('-') &&
52
+ !/^-.*[dinNptu]$/.test(n.previousSibling?.text ?? '')
53
54
+ return true
55
56
57
58
+}
59
60
export function findParent(
61
start: SyntaxNode,
62
predicate: (n: SyntaxNode) => boolean,
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
0 commit comments