feat(editor): Show tip when user can type dot after an expression (#8931)

This commit is contained in:
Elias Meire
2024-03-26 15:23:30 +01:00
committed by GitHub
parent 372d5c7d01
commit 160dfd383d
17 changed files with 510 additions and 272 deletions

View File

@@ -902,7 +902,7 @@ const regexes = {
singleQuoteStringLiteral: /('.+')\.([^'{\s])*/, // 'abc'.
doubleQuoteStringLiteral: /(".+")\.([^"{\s])*/, // "abc".
dateLiteral: /\(?new Date\(\(?.*?\)\)?\.(.*)/, // new Date(). or (new Date()).
arrayLiteral: /(\[.*\])\.(.*)/, // [1, 2, 3].
arrayLiteral: /\(?(\[.*\])\)?\.(.*)/, // [1, 2, 3].
indexedAccess: /([^"{\s]+\[.+\])\.(.*)/, // 'abc'[0]. or 'abc'.split('')[0] or similar ones
objectLiteral: /\(\{.*\}\)\.(.*)/, // ({}).

View File

@@ -237,3 +237,9 @@ export const withSectionHeader = (section: CompletionSection): CompletionSection
section.header = renderSectionHeader;
return section;
};
export const isCompletionSection = (
section: CompletionSection | string | undefined,
): section is CompletionSection => {
return typeof section === 'object';
};