Merge branch 'master' into better_electron_support

pull/5370/head
bunsenstraat 2 years ago committed by GitHub
commit 6a302ca371
  1. 9
      apps/remix-ide-e2e/src/tests/editorAutoComplete.test.ts
  2. 8
      apps/remix-ide-e2e/src/tests/editorHoverContext.test.ts
  3. 7
      apps/remix-ide-e2e/src/tests/editorReferences.test.ts
  4. 7
      apps/remix-ide-e2e/src/tests/editor_error_marker.test.ts
  5. 7
      apps/remix-ide-e2e/src/tests/editor_line_text.test.ts
  6. 18
      apps/remix-ide/src/app/plugins/parser/code-parser.tsx
  7. 19
      libs/remix-ui/settings/src/lib/remix-ui-settings.tsx

@ -12,6 +12,15 @@ module.exports = {
before: function (browser: NightwatchBrowser, done: VoidFunction) { before: function (browser: NightwatchBrowser, done: VoidFunction) {
init(browser, done, 'http://127.0.0.1:8080', false) init(browser, done, 'http://127.0.0.1:8080', false)
}, },
'Should enable settings': function (browser: NightwatchBrowser) {
browser
.clickLaunchIcon('settings')
.click('[data-id="settingsAutoCompleteLabel"]')
.click('[data-id="settingsShowGasLabel"]')
.click('[data-id="displayErrorsLabel"]')
},
'Should add test and base files #group1': function (browser: NightwatchBrowser) { 'Should add test and base files #group1': function (browser: NightwatchBrowser) {
browser.addFile(examples.testContract.name, examples.testContract) browser.addFile(examples.testContract.name, examples.testContract)
.addFile(examples.baseContract.name, examples.baseContract) .addFile(examples.baseContract.name, examples.baseContract)

@ -18,6 +18,14 @@ module.exports = {
init(browser, done, 'http://127.0.0.1:8080', false) init(browser, done, 'http://127.0.0.1:8080', false)
}, },
'Should enable settings': function (browser: NightwatchBrowser) {
browser
.clickLaunchIcon('settings')
.click('[data-id="settingsAutoCompleteLabel"]')
.click('[data-id="settingsShowGasLabel"]')
.click('[data-id="displayErrorsLabel"]')
},
'Should load the test file': function (browser: NightwatchBrowser) { 'Should load the test file': function (browser: NightwatchBrowser) {
browser.openFile('contracts') browser.openFile('contracts')
.openFile('contracts/3_Ballot.sol') .openFile('contracts/3_Ballot.sol')

@ -20,6 +20,13 @@ module.exports = {
init(browser, done, 'http://127.0.0.1:8080', false) init(browser, done, 'http://127.0.0.1:8080', false)
}, },
'Should enable settings': function (browser: NightwatchBrowser) {
browser
.clickLaunchIcon('settings')
.click('[data-id="settingsAutoCompleteLabel"]')
.click('[data-id="settingsShowGasLabel"]')
.click('[data-id="displayErrorsLabel"]')
},
'Should load the test file': function (browser: NightwatchBrowser) { 'Should load the test file': function (browser: NightwatchBrowser) {
browser.openFile('contracts') browser.openFile('contracts')
.openFile('contracts/3_Ballot.sol') .openFile('contracts/3_Ballot.sol')

@ -8,6 +8,13 @@ module.exports = {
before: function (browser: NightwatchBrowser, done: VoidFunction) { before: function (browser: NightwatchBrowser, done: VoidFunction) {
init(browser, done, 'http://127.0.0.1:8080', true) init(browser, done, 'http://127.0.0.1:8080', true)
}, },
'Should enable settings': function (browser: NightwatchBrowser) {
browser
.clickLaunchIcon('settings')
.click('[data-id="settingsAutoCompleteLabel"]')
.click('[data-id="settingsShowGasLabel"]')
.click('[data-id="displayErrorsLabel"]')
},
'Should add error marker': function (browser: NightwatchBrowser) { 'Should add error marker': function (browser: NightwatchBrowser) {
browser browser
.openFile('contracts') .openFile('contracts')

@ -8,6 +8,13 @@ module.exports = {
before: function (browser: NightwatchBrowser, done: VoidFunction) { before: function (browser: NightwatchBrowser, done: VoidFunction) {
init(browser, done, 'http://127.0.0.1:8080', true) init(browser, done, 'http://127.0.0.1:8080', true)
}, },
'Should enable settings': function (browser: NightwatchBrowser) {
browser
.clickLaunchIcon('settings')
.click('[data-id="settingsAutoCompleteLabel"]')
.click('[data-id="settingsShowGasLabel"]')
.click('[data-id="displayErrorsLabel"]')
},
'Should add line texts': function (browser: NightwatchBrowser) { 'Should add line texts': function (browser: NightwatchBrowser) {
browser browser
.openFile('contracts') .openFile('contracts')

@ -87,6 +87,18 @@ export class CodeParser extends Plugin {
} }
} }
async handleChangeEvents() {
const completionSettings = await this.call('config', 'getAppParameter', 'auto-completion')
if (completionSettings) {
await this.antlrService.getCurrentFileAST()
}
const showGasSettings = await this.call('config', 'getAppParameter', 'show-gas')
const showErrorSettings = await this.call('config', 'getAppParameter', 'display-errors')
if(showGasSettings || showErrorSettings || completionSettings) {
await this.compilerService.compile()
}
}
async onActivation() { async onActivation() {
this.gasService = new CodeParserGasService(this) this.gasService = new CodeParserGasService(this)
@ -102,8 +114,7 @@ export class CodeParser extends Plugin {
this.on('editor', 'didChangeFile', async (file) => { this.on('editor', 'didChangeFile', async (file) => {
await this.call('editor', 'discardLineTexts') await this.call('editor', 'discardLineTexts')
await this.antlrService.getCurrentFileAST() await this.handleChangeEvents()
await this.compilerService.compile()
}) })
this.on('filePanel', 'setWorkspace', async () => { this.on('filePanel', 'setWorkspace', async () => {
@ -113,8 +124,7 @@ export class CodeParser extends Plugin {
this.on('fileManager', 'currentFileChanged', async () => { this.on('fileManager', 'currentFileChanged', async () => {
await this.call('editor', 'discardLineTexts') await this.call('editor', 'discardLineTexts')
await this.antlrService.getCurrentFileAST() await this.handleChangeEvents()
await this.compilerService.compile()
}) })
this.on('solidity', 'loadingCompiler', async (url) => { this.on('solidity', 'loadingCompiler', async (url) => {

@ -41,13 +41,13 @@ export const RemixUiSettings = (props: RemixUiSettingsProps) => {
if (javascriptVM === null || javascriptVM === undefined) ethereumVM(props.config, true, dispatch) if (javascriptVM === null || javascriptVM === undefined) ethereumVM(props.config, true, dispatch)
const useAutoComplete = props.config.get('settings/auto-completion') const useAutoComplete = props.config.get('settings/auto-completion')
if (useAutoComplete === null || useAutoComplete === undefined) useAutoCompletion(props.config, true, dispatch) if (useAutoComplete === null || useAutoComplete === undefined) useAutoCompletion(props.config, false, dispatch)
const displayErrors = props.config.get('settings/display-errors') const displayErrors = props.config.get('settings/display-errors')
if (displayErrors === null || displayErrors === undefined) useDisplayErrors(props.config, true, dispatch) if (displayErrors === null || displayErrors === undefined) useDisplayErrors(props.config, false, dispatch)
const useShowGas = props.config.get('settings/show-gas') const useShowGas = props.config.get('settings/show-gas')
if (useShowGas === null || useShowGas === undefined) useShowGasInEditor(props.config, true, dispatch) if (useShowGas === null || useShowGas === undefined) useShowGasInEditor(props.config, false, dispatch)
} }
useEffect(() => initValue(), [resetState, props.config]) useEffect(() => initValue(), [resetState, props.config])
useEffect(() => initValue(), []) useEffect(() => initValue(), [])
@ -148,9 +148,10 @@ export const RemixUiSettings = (props: RemixUiSettingsProps) => {
const isEditorWrapChecked = props.config.get('settings/text-wrap') || false const isEditorWrapChecked = props.config.get('settings/text-wrap') || false
const isPersonalChecked = props.config.get('settings/personal-mode') || false const isPersonalChecked = props.config.get('settings/personal-mode') || false
const isMatomoChecked = props.config.get('settings/matomo-analytics') || false const isMatomoChecked = props.config.get('settings/matomo-analytics') || false
const isAutoCompleteChecked = props.config.get('settings/auto-completion') === null ? true:props.config.get('settings/auto-completion')
const isShowGasInEditorChecked = props.config.get('settings/show-gas') === null ? true:props.config.get('settings/show-gas') const isAutoCompleteChecked = props.config.get('settings/auto-completion') || false
const displayErrorsChecked = props.config.get('settings/display-errors') === null ? true:props.config.get('settings/display-errors') const isShowGasInEditorChecked = props.config.get('settings/show-gas') || false
const displayErrorsChecked = props.config.get('settings/display-errors') || false
return ( return (
<div className="$border-top"> <div className="$border-top">
<div title="Reset to Default settings." className='d-flex justify-content-end pr-4'> <div title="Reset to Default settings." className='d-flex justify-content-end pr-4'>
@ -188,19 +189,19 @@ export const RemixUiSettings = (props: RemixUiSettingsProps) => {
</div> </div>
<div className='custom-control custom-checkbox mb-1'> <div className='custom-control custom-checkbox mb-1'>
<input onChange={onchangeUseAutoComplete} id="settingsUseAutoComplete" type="checkbox" className="custom-control-input" checked={isAutoCompleteChecked} /> <input onChange={onchangeUseAutoComplete} id="settingsUseAutoComplete" type="checkbox" className="custom-control-input" checked={isAutoCompleteChecked} />
<label className={`form-check-label custom-control-label align-middle ${getTextClass('settings/auto-completion')}`} htmlFor="settingsUseAutoComplete"> <label className={`form-check-label custom-control-label align-middle ${getTextClass('settings/auto-completion')}`} data-id="settingsAutoCompleteLabel" htmlFor="settingsUseAutoComplete">
<span>{useAutoCompleteText}</span> <span>{useAutoCompleteText}</span>
</label> </label>
</div> </div>
<div className='custom-control custom-checkbox mb-1'> <div className='custom-control custom-checkbox mb-1'>
<input onChange={onchangeShowGasInEditor} id="settingsUseShowGas" type="checkbox" className="custom-control-input" checked={isShowGasInEditorChecked} /> <input onChange={onchangeShowGasInEditor} id="settingsUseShowGas" type="checkbox" className="custom-control-input" checked={isShowGasInEditorChecked} />
<label className={`form-check-label custom-control-label align-middle ${getTextClass('settings/show-gas')}`} htmlFor="settingsUseShowGas"> <label className={`form-check-label custom-control-label align-middle ${getTextClass('settings/show-gas')}`} data-id="settingsShowGasLabel" htmlFor="settingsUseShowGas">
<span>{useShowGasInEditorText}</span> <span>{useShowGasInEditorText}</span>
</label> </label>
</div> </div>
<div className='custom-control custom-checkbox mb-1'> <div className='custom-control custom-checkbox mb-1'>
<input onChange={onchangeDisplayErrors} id="settingsDisplayErrors" type="checkbox" className="custom-control-input" checked={displayErrorsChecked} /> <input onChange={onchangeDisplayErrors} id="settingsDisplayErrors" type="checkbox" className="custom-control-input" checked={displayErrorsChecked} />
<label className={`form-check-label custom-control-label align-middle ${getTextClass('settings/display-errors')}`} htmlFor="settingsDisplayErrors"> <label className={`form-check-label custom-control-label align-middle ${getTextClass('settings/display-errors')}`} data-id="displayErrorsLabel" htmlFor="settingsDisplayErrors">
<span>{displayErrorsText}</span> <span>{displayErrorsText}</span>
</label> </label>
</div> </div>

Loading…
Cancel
Save