diff --git a/app/client/src/components/editorComponents/CodeEditor/index.tsx b/app/client/src/components/editorComponents/CodeEditor/index.tsx index 6f2a233b8b0e..f6425916bb96 100644 --- a/app/client/src/components/editorComponents/CodeEditor/index.tsx +++ b/app/client/src/components/editorComponents/CodeEditor/index.tsx @@ -326,7 +326,11 @@ class CodeEditor extends Component { handleEditorFocus = () => { this.setState({ isFocused: true }); - if (this.editor.getValue().length === 0) + const entityInformation = this.getEntityInformation(); + if ( + entityInformation.entityType === ENTITY_TYPE.WIDGET && + this.editor.getValue().length === 0 + ) this.handleAutocompleteVisibility(this.editor); }; @@ -372,8 +376,7 @@ class CodeEditor extends Component { CodeEditor.updateMarkings(this.editor, this.props.marking); }; - handleAutocompleteVisibility = (cm: CodeMirror.Editor) => { - if (!this.state.isFocused) return; + getEntityInformation = (): FieldEntityInformation => { const { dataTreePath, dynamicData, expected } = this.props; const entityInformation: FieldEntityInformation = { expectedType: expected?.autocompleteDataType, @@ -397,6 +400,12 @@ class CodeEditor extends Component { if (isWidgetEntity(entity)) entityInformation.entityId = entity.widgetId; entityInformation.propertyPath = propertyPath; } + return entityInformation; + }; + + handleAutocompleteVisibility = (cm: CodeMirror.Editor) => { + if (!this.state.isFocused) return; + const entityInformation: FieldEntityInformation = this.getEntityInformation(); let hinterOpen = false; for (let i = 0; i < this.hinters.length; i++) { hinterOpen = this.hinters[i].showHint(cm, entityInformation, { diff --git a/app/client/src/components/editorComponents/form/fields/EmbeddedDatasourcePathField.tsx b/app/client/src/components/editorComponents/form/fields/EmbeddedDatasourcePathField.tsx index 08a78cc4dd75..e95beb0ab3c3 100644 --- a/app/client/src/components/editorComponents/form/fields/EmbeddedDatasourcePathField.tsx +++ b/app/client/src/components/editorComponents/form/fields/EmbeddedDatasourcePathField.tsx @@ -306,7 +306,7 @@ class EmbeddedDatasourcePathComponent extends React.Component { return ( - + {displayValue && datasource && !("id" in datasource) ? ( ) : datasource && "id" in datasource ? (