diff --git a/packages/bruno-app/src/components/MultiLineEditor/index.js b/packages/bruno-app/src/components/MultiLineEditor/index.js index efcd89f45..d548898fe 100644 --- a/packages/bruno-app/src/components/MultiLineEditor/index.js +++ b/packages/bruno-app/src/components/MultiLineEditor/index.js @@ -24,13 +24,15 @@ class MultiLineEditor extends Component { componentDidMount() { // Initialize CodeMirror as a single line editor /** @type {import("codemirror").Editor} */ + const variables = getAllVariables(this.props.collection, this.props.item); + this.editor = CodeMirror(this.editorRef.current, { lineWrapping: false, lineNumbers: false, theme: this.props.theme === 'dark' ? 'monokai' : 'default', mode: 'brunovariables', brunoVarInfo: { - variables: getAllVariables(this.props.collection) + variables }, scrollbarStyle: null, tabindex: 0, @@ -85,7 +87,7 @@ class MultiLineEditor extends Component { } this.editor.setValue(String(this.props.value) || ''); this.editor.on('change', this._onEdit); - this.addOverlay(); + this.addOverlay(variables); } _onEdit = () => { @@ -103,10 +105,10 @@ class MultiLineEditor extends Component { // event loop. this.ignoreChangeEvent = true; - let variables = getAllVariables(this.props.collection); + let variables = getAllVariables(this.props.collection, this.props.item); if (!isEqual(variables, this.variables)) { this.editor.options.brunoVarInfo.variables = variables; - this.addOverlay(); + this.addOverlay(variables); } if (this.props.theme !== prevProps.theme && this.editor) { this.editor.setOption('theme', this.props.theme === 'dark' ? 'monokai' : 'default'); @@ -125,10 +127,8 @@ class MultiLineEditor extends Component { this.editor.getWrapperElement().remove(); } - addOverlay = () => { - let variables = getAllVariables(this.props.collection); + addOverlay = (variables) => { this.variables = variables; - defineCodeMirrorBrunoVariablesMode(variables, 'text/plain'); this.editor.setOption('mode', 'brunovariables'); }; diff --git a/packages/bruno-app/src/components/RequestPane/Auth/AwsV4Auth/index.js b/packages/bruno-app/src/components/RequestPane/Auth/AwsV4Auth/index.js index 7c144fbf8..41820a0c8 100644 --- a/packages/bruno-app/src/components/RequestPane/Auth/AwsV4Auth/index.js +++ b/packages/bruno-app/src/components/RequestPane/Auth/AwsV4Auth/index.js @@ -136,6 +136,7 @@ const AwsV4Auth = ({ onTokenChange, item, collection }) => { onChange={(val) => handleAccessKeyIdChange(val)} onRun={handleRun} collection={collection} + item={item} /> @@ -148,6 +149,7 @@ const AwsV4Auth = ({ onTokenChange, item, collection }) => { onChange={(val) => handleSecretAccessKeyChange(val)} onRun={handleRun} collection={collection} + item={item} /> @@ -160,6 +162,7 @@ const AwsV4Auth = ({ onTokenChange, item, collection }) => { onChange={(val) => handleSessionTokenChange(val)} onRun={handleRun} collection={collection} + item={item} /> @@ -172,6 +175,7 @@ const AwsV4Auth = ({ onTokenChange, item, collection }) => { onChange={(val) => handleServiceChange(val)} onRun={handleRun} collection={collection} + item={item} /> @@ -184,6 +188,7 @@ const AwsV4Auth = ({ onTokenChange, item, collection }) => { onChange={(val) => handleRegionChange(val)} onRun={handleRun} collection={collection} + item={item} /> @@ -196,6 +201,7 @@ const AwsV4Auth = ({ onTokenChange, item, collection }) => { onChange={(val) => handleProfileNameChange(val)} onRun={handleRun} collection={collection} + item={item} /> diff --git a/packages/bruno-app/src/components/RequestPane/Auth/BasicAuth/index.js b/packages/bruno-app/src/components/RequestPane/Auth/BasicAuth/index.js index 845dae273..bbe16ec70 100644 --- a/packages/bruno-app/src/components/RequestPane/Auth/BasicAuth/index.js +++ b/packages/bruno-app/src/components/RequestPane/Auth/BasicAuth/index.js @@ -55,6 +55,7 @@ const BasicAuth = ({ item, collection }) => { onChange={(val) => handleUsernameChange(val)} onRun={handleRun} collection={collection} + item={item} /> @@ -67,6 +68,7 @@ const BasicAuth = ({ item, collection }) => { onChange={(val) => handlePasswordChange(val)} onRun={handleRun} collection={collection} + item={item} /> diff --git a/packages/bruno-app/src/components/RequestPane/Auth/BearerAuth/index.js b/packages/bruno-app/src/components/RequestPane/Auth/BearerAuth/index.js index 77198d311..1dfa42b15 100644 --- a/packages/bruno-app/src/components/RequestPane/Auth/BearerAuth/index.js +++ b/packages/bruno-app/src/components/RequestPane/Auth/BearerAuth/index.js @@ -42,6 +42,7 @@ const BearerAuth = ({ item, collection }) => { onChange={(val) => handleTokenChange(val)} onRun={handleRun} collection={collection} + item={item} /> diff --git a/packages/bruno-app/src/components/RequestPane/Auth/DigestAuth/index.js b/packages/bruno-app/src/components/RequestPane/Auth/DigestAuth/index.js index e43f18c46..24f4610f0 100644 --- a/packages/bruno-app/src/components/RequestPane/Auth/DigestAuth/index.js +++ b/packages/bruno-app/src/components/RequestPane/Auth/DigestAuth/index.js @@ -55,6 +55,7 @@ const DigestAuth = ({ item, collection }) => { onChange={(val) => handleUsernameChange(val)} onRun={handleRun} collection={collection} + item={item} /> @@ -67,6 +68,7 @@ const DigestAuth = ({ item, collection }) => { onChange={(val) => handlePasswordChange(val)} onRun={handleRun} collection={collection} + item={item} /> diff --git a/packages/bruno-app/src/components/RequestPane/Auth/OAuth2/AuthorizationCode/index.js b/packages/bruno-app/src/components/RequestPane/Auth/OAuth2/AuthorizationCode/index.js index 3c813b14b..793be57f0 100644 --- a/packages/bruno-app/src/components/RequestPane/Auth/OAuth2/AuthorizationCode/index.js +++ b/packages/bruno-app/src/components/RequestPane/Auth/OAuth2/AuthorizationCode/index.js @@ -92,6 +92,7 @@ const OAuth2AuthorizationCode = ({ item, collection }) => { onChange={(val) => handleChange(key, val)} onRun={handleRun} collection={collection} + item={item} /> diff --git a/packages/bruno-app/src/components/RequestPane/Auth/OAuth2/ClientCredentials/index.js b/packages/bruno-app/src/components/RequestPane/Auth/OAuth2/ClientCredentials/index.js index 7edb8bb25..df08475e8 100644 --- a/packages/bruno-app/src/components/RequestPane/Auth/OAuth2/ClientCredentials/index.js +++ b/packages/bruno-app/src/components/RequestPane/Auth/OAuth2/ClientCredentials/index.js @@ -55,6 +55,7 @@ const OAuth2ClientCredentials = ({ item, collection }) => { onChange={(val) => handleChange(key, val)} onRun={handleRun} collection={collection} + item={item} /> diff --git a/packages/bruno-app/src/components/RequestPane/Auth/OAuth2/PasswordCredentials/index.js b/packages/bruno-app/src/components/RequestPane/Auth/OAuth2/PasswordCredentials/index.js index 1e64d4faa..cfcff9784 100644 --- a/packages/bruno-app/src/components/RequestPane/Auth/OAuth2/PasswordCredentials/index.js +++ b/packages/bruno-app/src/components/RequestPane/Auth/OAuth2/PasswordCredentials/index.js @@ -57,6 +57,7 @@ const OAuth2AuthorizationCode = ({ item, collection }) => { onChange={(val) => handleChange(key, val)} onRun={handleRun} collection={collection} + item={item} /> diff --git a/packages/bruno-app/src/components/RequestPane/FormUrlEncodedParams/index.js b/packages/bruno-app/src/components/RequestPane/FormUrlEncodedParams/index.js index a358e2ed3..22de4735b 100644 --- a/packages/bruno-app/src/components/RequestPane/FormUrlEncodedParams/index.js +++ b/packages/bruno-app/src/components/RequestPane/FormUrlEncodedParams/index.js @@ -110,6 +110,7 @@ const FormUrlEncodedParams = ({ item, collection }) => { allowNewlines={true} onRun={handleRun} collection={collection} + item={item} />