Commit 2d29997b by Andrej Ocenas Committed by GitHub

CloudWatch/Logs: Fix suggestions of fields after comma (#24520)

parent 9dd68dae
......@@ -40,6 +40,10 @@ describe('CloudWatchLanguageProvider', () => {
await runSuggestionTest('fields field1, \\', [fields, FUNCTIONS.map(v => v.label)]);
});
it('should suggest fields and functions after comma with prefix', async () => {
await runSuggestionTest('fields field1, @mess\\', [fields, FUNCTIONS.map(v => v.label)]);
});
it('should suggest fields and functions after display command', async () => {
await runSuggestionTest('display \\', [fields, FUNCTIONS.map(v => v.label)]);
});
......
......@@ -165,7 +165,7 @@ export class CloudWatchLanguageProvider extends LanguageProvider {
const currentTokenIsComma = curToken.content === ',' && curToken.types.includes('punctuation');
const currentTokenIsCommaOrAfterComma =
currentTokenIsComma || (curToken.prev?.content === ',' && curToken.prev.types.includes('punctuation'));
currentTokenIsComma || (prevToken?.content === ',' && prevToken?.types.includes('punctuation'));
// We only show suggestions if we are after a command or after a comma which is a field separator
if (!(currentTokenIsAfterCommand || currentTokenIsCommaOrAfterComma)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment