Skip to content

Commit 220c068

Browse files
committed
Minor refactor
1 parent 22b8bdf commit 220c068

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/languageProvider.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,7 @@ export class JsonPathLanguageProvider {
7575
return emptyResult;
7676
}
7777

78-
// Get the actual JSON for parsing.
79-
const response = await this.datasource.metadataRequest(context, timeRange);
80-
78+
// Suggest operators inside brackets.
8179
if (enterBrackets.test(toCursor)) {
8280
return {
8381
suggestions: [
@@ -105,6 +103,9 @@ export class JsonPathLanguageProvider {
105103
? toCursor.slice(0, toCursor.lastIndexOf('[') + 1) + ':]'
106104
: currentLine.slice(0, currentLine.lastIndexOf('.'));
107105

106+
// Get the actual JSON for parsing.
107+
const response = await this.datasource.metadataRequest(context, timeRange);
108+
108109
const values = JSONPath({ path, json: response });
109110

110111
// Don't attempt to suggest if this is a leaf node, e.g. strings, numbers, and booleans.

0 commit comments

Comments
 (0)