CloudWatch/Logs: Fix suggestions of fields after comma (#24520)
This commit is contained in:
@@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user