Skip to content

Commit 5dcc09f

Browse files
Blake EasleyBlake Easley
Blake Easley
authored and
Blake Easley
committed
Fix parsing of sourcing with quotes
when argumentNode.text == 'source "./issue206.sh"', argumentNode.namedChildren contains an element that is string_content with text=='"./issue206.sh"'
1 parent c34eb5e commit 5dcc09f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

server/src/util/sourcing.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,15 @@ function getSourcedPathInfoFromNode({
109109
}
110110

111111
if (argumentNode.type === 'string' || argumentNode.type === 'raw_string') {
112-
if (argumentNode.namedChildren.length === 0) {
112+
const children = argumentNode.namedChildren
113+
if (
114+
children.length === 0 ||
115+
(children.length === 1 && children[0].type === 'string_content')
116+
)
113117
return {
114118
sourcedPath: argumentNode.text.slice(1, -1),
115119
}
116-
}
117120
}
118-
119121
// TODO: we could try to parse any ShellCheck "source "directive
120122
// # shellcheck source=src/examples/config.sh
121123
return {

0 commit comments

Comments
 (0)