Merge branch 'cideploy' of https://github.com/ethereum/remix-project into cideploy

pull/5370/head
filip mertens 2 years ago
commit 93d2736713
  1. 98
      .circleci/config.yml
  2. 3
      apps/etherscan/project.json
  3. 23
      apps/remix-ide-e2e/package.json
  4. 16
      apps/remix-ide-e2e/src/commands/journalLastChildIncludes.ts
  5. 13
      apps/remix-ide-e2e/src/local-plugin/project.json
  6. 2
      apps/remix-ide-e2e/src/tests/etherscan_api.ts
  7. 2
      apps/remix-ide-e2e/src/tests/plugin_api.ts
  8. 2
      apps/remix-ide-e2e/src/tests/remixd.test.ts
  9. 1
      apps/remix-ide-e2e/src/tests/runAndDeploy.test.ts
  10. 8
      apps/remix-ide-e2e/src/tests/specialFunctions.test.ts
  11. 1
      apps/remix-ide-e2e/src/tests/terminal.test.ts
  12. 2
      apps/remix-ide-e2e/src/tests/transactionExecution.test.ts
  13. 2
      apps/remix-ide-e2e/src/tests/vyper_api.ts
  14. 3936
      apps/remix-ide-e2e/yarn.lock
  15. 3
      apps/remix-ide/ci/browser_test.sh
  16. 6
      apps/remix-ide/ci/browser_test_plugin.sh
  17. 26
      apps/remix-ide/ci/browser_tests_etherscan_plugin.sh
  18. 26
      apps/remix-ide/ci/browser_tests_vyper_plugin.sh
  19. 5
      apps/remix-ide/ci/flaky.sh
  20. 25
      apps/remix-ide/src/app/plugins/code-format.ts
  21. 11
      apps/remix-ide/src/app/plugins/parser/services/code-parser-compiler.ts
  22. 3
      apps/remix-ide/webpack.config.js
  23. 3
      apps/vyper/project.json
  24. 1
      libs/remix-ui/editor/src/index.ts
  25. 4
      libs/remix-ui/editor/src/lib/actions/editor.ts
  26. 45
      libs/remix-ui/editor/src/lib/providers/completion/completionGlobals.ts
  27. 12
      libs/remix-ui/editor/src/lib/providers/completionProvider.ts
  28. 6
      libs/remix-ui/editor/src/lib/providers/hoverProvider.ts
  29. 30
      libs/remix-ui/editor/src/lib/remix-ui-editor.tsx
  30. 8
      package.json
  31. 2566
      yarn.lock

@ -24,21 +24,55 @@ jobs:
key: v1-deps-{{ checksum "yarn.lock" }}
paths:
- node_modules
- run: NX_BIN_URL=http://127.0.0.1:8080/assets/js NX_WASM_URL=http://127.0.0.1:8080/assets/js NPM_URL=http://localhost:9090/ yarn build:production
- run: yarn nx build remix-ide-e2e-src-local-plugin & yarn run build:libs
- run: yarn nx run remixd:build
- run:
name: Build
command: |
if [ "${CIRCLE_BRANCH}" == "master" ]; then
NX_BIN_URL=http://127.0.0.1:8080/assets/js NX_WASM_URL=http://127.0.0.1:8080/assets/js NPM_URL=http://localhost:9090/ yarn build:production
else
NX_BIN_URL=http://127.0.0.1:8080/assets/js NX_WASM_URL=http://127.0.0.1:8080/assets/js NPM_URL=http://localhost:9090/ yarn build
fi
- run: yarn run build:e2e
- run: mkdir persist && zip -0 -r persist/dist.zip dist
- persist_to_workspace:
root: .
paths:
- "persist"
build-plugin:
docker:
- image: cimg/node:14.17.6-browsers
resource_class:
xlarge
working_directory: ~/remix-project
parameters:
plugin:
type: string
steps:
- checkout
- restore_cache:
keys:
- v1-deps-{{ checksum "yarn.lock" }}
- run: yarn
- save_cache:
key: v1-deps-{{ checksum "yarn.lock" }}
paths:
- node_modules
- run: yarn build << parameters.plugin >>
- run: mkdir persist && zip -0 -r persist/plugin-<< parameters.plugin >>.zip dist
- persist_to_workspace:
root: .
paths:
- "persist"
lint:
docker:
- image: cimg/node:14.17.6-browsers
resource_class:
xlarge
working_directory: ~/remix-project
parallelism: 1
steps:
- checkout
- restore_cache:
@ -60,11 +94,11 @@ jobs:
- checkout
- attach_workspace:
at: .
- run: unzip ./persist/dist.zip
- restore_cache:
keys:
- v1-deps-{{ checksum "yarn.lock" }}
- run: yarn
- run: yarn build:libs
- run: cd dist/libs/remix-tests && yarn
- run: cd dist/libs/remix-tests && yarn add @remix-project/remix-url-resolver ../../libs/remix-url-resolver
- run: cd dist/libs/remix-tests && yarn add @remix-project/remix-lib ../../libs/remix-lib
@ -117,12 +151,8 @@ jobs:
- checkout
- attach_workspace:
at: .
- run: unzip ./persist/dist.zip
- restore_cache:
keys:
- v1-deps-{{ checksum "yarn.lock" }}
- run: yarn
- run: unzip ./persist/dist.zip
- run: yarn install --cwd ./apps/remix-ide-e2e --modules-folder ../../node_modules
- run: yarn run downloadsolc_assets_e2e && yarn run downloadsolc_assets_dist
- run: ls -la ./dist/apps/remix-ide/assets/js
- run: yarn run selenium-install || yarn run selenium-install
@ -149,9 +179,12 @@ jobs:
xlarge
working_directory: ~/remix-project
parameters:
script:
plugin:
type: string
parallelism: 4
parallelism:
type: integer
default: 1
parallelism: << parameters.parallelism >>
steps:
- browser-tools/install-browser-tools:
install-firefox: false
@ -164,19 +197,16 @@ jobs:
- checkout
- attach_workspace:
at: .
- restore_cache:
keys:
- v1-deps-{{ checksum "yarn.lock" }}
- run: yarn
- run: unzip ./persist/dist.zip
- run: unzip ./persist/plugin-<< parameters.plugin >>.zip
- run: yarn install --cwd ./apps/remix-ide-e2e --modules-folder ../../node_modules
- run: yarn run downloadsolc_assets_e2e && yarn run downloadsolc_assets_dist
- run: yarn run selenium-install || yarn run selenium-install
- run:
name: Start Selenium
command: yarn run selenium
background: true
- run: ./apps/remix-ide/ci/<< parameters.script >>
- run: ./apps/remix-ide/ci/browser_test_plugin.sh << parameters.plugin >>
- store_test_results:
path: ./reports/tests
- store_artifacts:
@ -293,18 +323,32 @@ workflows:
unless: << pipeline.parameters.run_flaky_tests >>
jobs:
- build
- build-plugin:
matrix:
parameters:
plugin: ["etherscan", "vyper", "plugin_api"]
- lint:
requires:
- build
- remix-libs:
requires:
- build
- remix-libs
- remix-test-plugins:
name: test-plugin-<< matrix.plugin >>
requires:
- build
- build-plugin
matrix:
alias: plugins
parameters:
script: ["browser_tests_plugin_api.sh", "browser_tests_etherscan_plugin.sh", "browser_tests_vyper_plugin.sh"]
plugin: ["etherscan", "vyper", "plugin_api"]
parallelism: [1, 9]
exclude:
- plugin: plugin_api
parallelism: 1
- plugin: etherscan
parallelism: 9
- plugin: vyper
parallelism: 9
- remix-ide-browser:
requires:
- build
@ -319,13 +363,13 @@ workflows:
- lint
- remix-libs
- remix-ide-browser
- remix-test-plugins
- plugins
- deploy-remix-live:
requires:
- lint
- remix-libs
- remix-ide-browser
- remix-test-plugins
- plugins
filters:
branches:
only: remix_live
@ -334,7 +378,7 @@ workflows:
- lint
- remix-libs
- remix-ide-browser
- remix-test-plugins
- plugins
filters:
branches:
only: master
@ -343,7 +387,7 @@ workflows:
- lint
- remix-libs
- remix-ide-browser
- remix-test-plugins
- plugins
filters:
branches:
only: remix_beta

@ -3,9 +3,6 @@
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "apps/etherscan/src",
"projectType": "application",
"implicitDependencies": [
"remix-debug"
],
"targets": {
"build": {
"executor": "@nrwl/webpack:webpack",

@ -0,0 +1,23 @@
{
"name": "remix-ide-e2e",
"license": "MIT",
"engines": {
"node": "^14.17.6",
"npm": "^6.14.15"
},
"dependencies": {
"@openzeppelin/contracts": "^4.7.3",
"@openzeppelin/contracts-upgradeable": "^4.8.1",
"@openzeppelin/upgrades-core": "^1.22.0",
"@openzeppelin/wizard": "^0.1.1",
"@remix-project/remixd": "../../dist/libs/remixd",
"deep-equal": "^1.0.1",
"ganache-cli": "^6.8.1",
"selenium-standalone": "^8.2.3",
"tree-kill": "^1.2.2"
},
"devDependencies": {
"http-server": "^14.1.1",
"nightwatch": "2.3"
}
}

@ -5,14 +5,14 @@ import EventEmitter from 'events'
Check if the last log in the console contains a specific text
*/
class JournalLastChildIncludes extends EventEmitter {
command (this: NightwatchBrowser, val: string): NightwatchBrowser {
this.api
.waitForElementVisible('*[data-id="terminalJournal"]', 10000)
.pause(1000)
.getText('*[data-id="terminalJournal"]', (result) => {
console.log('JournalLastChildIncludes', result.value)
if (typeof result.value === 'string' && result.value.indexOf(val) === -1) return this.api.assert.fail(`wait for ${val} in ${result.value}`)
else this.api.assert.ok(true, `<*[data-id="terminalJournal"]> contains ${val}.`)
command(this: NightwatchBrowser, val: string): NightwatchBrowser {
this.api
.waitForElementPresent({
selector: `//*[@data-id='terminalJournal' and contains(.,'${val}')]`,
timeout: 10000,
locateStrategy: 'xpath'
}).perform((done) => {
done()
this.emit('complete')
})
return this

@ -1,11 +1,8 @@
{
"name": "remix-ide-e2e-src-local-plugin",
"name": "plugin_api",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "apps/remix-ide-e2e/src/local-plugin/src/",
"projectType": "application",
"implicitDependencies": [
"remix-debug"
],
"targets": {
"build": {
"executor": "@nrwl/webpack:webpack",
@ -13,7 +10,7 @@
"defaultConfiguration": "development",
"options": {
"compiler": "babel",
"outputPath": "dist/apps/remix-ide-e2e-src-local-plugin",
"outputPath": "dist/apps/plugin_api",
"index": "apps/remix-ide-e2e/src/local-plugin/src/index.html",
"baseHref": "/",
"main": "apps/remix-ide-e2e/src/local-plugin/src/main.tsx",
@ -44,16 +41,16 @@
"executor": "@nrwl/webpack:dev-server",
"defaultConfiguration": "development",
"options": {
"buildTarget": "remix-ide-e2e-src-local-plugin:build",
"buildTarget": "plugin_api:build",
"hmr": true
},
"configurations": {
"development": {
"buildTarget": "remix-ide-e2e-src-local-plugin:build:development",
"buildTarget": "plugin_api:build:development",
"port": 2020
},
"production": {
"buildTarget": "remix-ide-e2e-src-local-plugin:build:production"
"buildTarget": "plugin_api:build:production"
}
}
}

@ -9,7 +9,7 @@ declare global {
module.exports = {
'@disabled': true,
before: function (browser: NightwatchBrowser, done: VoidFunction) {
init(browser, done, null, true, { name: 'etherscan', url: 'http://127.0.0.1:5003'})
init(browser, done, null, true, { name: 'etherscan', url: 'http://127.0.0.1:9999'})
},
'Should load etherscan plugin #group1': function (browser: NightwatchBrowser) {

@ -11,7 +11,7 @@ const localPluginData: Profile & LocationProfile & ExternalProfile = {
name: 'localPlugin',
displayName: 'Local Plugin',
canActivate: ['dGitProvider', 'flattener', 'solidityUnitTesting', 'udapp', 'hardhat-provider'],
url: 'http://localhost:2020',
url: 'http://localhost:9999',
location: 'sidePanel'
}

@ -312,7 +312,7 @@ function testImportFromRemixd(browser: NightwatchBrowser, callback: VoidFunction
}
async function spawnRemixd(path: string): Promise<ChildProcess> {
const remixd = spawn('yarn run remixd', [`-s ${path}`], { cwd: process.cwd(), shell: true, detached: true })
const remixd = spawn('chmod +x dist/libs/remixd/src/bin/remixd.js && dist/libs/remixd/src/bin/remixd.js --remix-ide http://127.0.0.1:8080', [`-s ${path}`], { cwd: process.cwd(), shell: true, detached: true })
return new Promise((resolve, reject) => {
remixd.stdout.on('data', function (data) {
if(

@ -224,7 +224,6 @@ module.exports = {
'Call web3.eth.getAccounts() using Injected Provider (Metamask)': !function (browser: NightwatchBrowser) {
browser
.executeScriptInTerminal('web3.eth.getAccounts()')
.pause(2000)
.journalLastChildIncludes('[ "0x76a3ABb5a12dcd603B52Ed22195dED17ee82708f" ]')
.end()
}

@ -29,7 +29,6 @@ module.exports = {
.perform((done) => {
browser.getAddressAtPosition(0, (address) => {
browser.sendLowLevelTx(address, '0', '0xaa')
.pause(1000)
.journalLastChildIncludes('to: CheckSpecials.(fallback)')
.journalLastChildIncludes('value: 0 wei')
.journalLastChildIncludes('data: 0xaa')
@ -67,7 +66,6 @@ module.exports = {
browser.perform((done) => {
browser.getAddressAtPosition(0, (address) => {
browser.sendLowLevelTx(address, '1', '')
.pause(1000)
.journalLastChildIncludes('to: CheckSpecials.(receive)')
.journalLastChildIncludes('value: 1 wei')
.journalLastChildIncludes('data: 0x')
@ -80,7 +78,6 @@ module.exports = {
browser.perform((done) => {
browser.getAddressAtPosition(0, (address) => {
browser.sendLowLevelTx(address, '10', '0xaa')
.pause(1000)
.journalLastChildIncludes('to CheckSpecials.(fallback) errored:')
.journalLastChildIncludes('The called function should be payable if you send value')
.perform(done())
@ -97,7 +94,6 @@ module.exports = {
.perform((done) => {
browser.getAddressAtPosition(0, (address) => {
browser.sendLowLevelTx(address, '1', '')
.pause(1000)
.journalLastChildIncludes('to: CheckSpecials.(receive)')
.journalLastChildIncludes('value: 1 wei')
.journalLastChildIncludes('data: 0x')
@ -110,7 +106,6 @@ module.exports = {
browser.perform((done) => {
browser.getAddressAtPosition(0, (address) => {
browser.sendLowLevelTx(address, '0', '0xaa')
.pause(1000)
.waitForElementVisible(`#instance${address} label[id="deployAndRunLLTxError"]`)
.assert.containsText(`#instance${address} label[id="deployAndRunLLTxError"]`, '\'Fallback\' function is not defined')
.perform(done())
@ -127,7 +122,6 @@ module.exports = {
.perform((done) => {
browser.getAddressAtPosition(0, (address) => {
browser.sendLowLevelTx(address, '1', '')
.pause(1000)
.journalLastChildIncludes('to: CheckSpecials.(fallback)')
.journalLastChildIncludes('value: 1 wei')
.journalLastChildIncludes('data: 0x')
@ -140,7 +134,6 @@ module.exports = {
browser.perform((done) => {
browser.getAddressAtPosition(0, (address) => {
browser.sendLowLevelTx(address, '1', '0xaa')
.pause(1000)
.journalLastChildIncludes('to: CheckSpecials.(fallback)')
.journalLastChildIncludes('value: 1 wei')
.journalLastChildIncludes('data: 0xaa')
@ -180,7 +173,6 @@ module.exports = {
.perform((done) => {
browser.getAddressAtPosition(0, (address) => {
browser.sendLowLevelTx(address, '999999998765257135', '0xaa')
.pause(1000)
.journalLastChildIncludes('to: CheckSpecials.(fallback)')
.journalLastChildIncludes('value: 999999998765257135 wei')
.journalLastChildIncludes('data: 0xaa')

@ -202,7 +202,6 @@ module.exports = {
.addFile('scripts/deploy_storage.js', { content: scriptAutoExec.script })
.openFile('contracts/storage.sol')
.sendKeys('body', [browser.Keys.CONTROL, browser.Keys.SHIFT, 's'])
.pause(15000)
.journalLastChildIncludes('147')
},

@ -141,7 +141,6 @@ module.exports = {
.click('.udapp_contractActionsContainerSingle > button')
.clickInstance(0)
.clickFunction('g - transact (not payable)')
.pause(5000)
.journalLastChildIncludes('Error provided by the contract:')
.journalLastChildIncludes('CustomError : error description')
.journalLastChildIncludes('Parameters:')
@ -182,7 +181,6 @@ module.exports = {
.click('.udapp_contractActionsContainerSingle > button')
.clickInstance(1)
.clickFunction('h - transact (not payable)')
.pause(5000)
.journalLastChildIncludes('Error provided by the contract:')
.journalLastChildIncludes('CustomError : error description from library')
.journalLastChildIncludes('Parameters:')

@ -9,7 +9,7 @@ declare global {
module.exports = {
'@disabled': true,
before: function (browser: NightwatchBrowser, done: VoidFunction) {
init(browser, done, null, true, { name: 'vyper', url: 'http://127.0.0.1:5002'})
init(browser, done, null, true, { name: 'vyper', url: 'http://127.0.0.1:9999'})
},
'Should connect to vyper plugin #group1': function (browser: NightwatchBrowser) {

File diff suppressed because it is too large Load Diff

@ -10,11 +10,8 @@ TEST_EXITCODE=0
yarn run ganache-cli &
npx http-server -p 9090 --cors='*' ./node_modules &
yarn run serve:production &
echo 'sharing folder: ' $PWD '/apps/remix-ide/contracts' &
sleep 5
yarn run build:e2e
# grep -IRiL "@disabled" "dist/apps/remix-ide-e2e/src/tests" | grep "\.spec\|\.test" | xargs -I {} basename {} .test.js | grep -E "\b[${2}]"
# TESTFILES=$(grep -IRiL "@disabled" "dist/apps/remix-ide-e2e/src/tests" | grep "\.spec\|\.test" | xargs -I {} basename {} .test.js | grep -E "\b[$2]" | circleci tests split --split-by=timings )
node apps/remix-ide/ci/splice_tests.js $2 $3

@ -6,16 +6,14 @@ BUILD_ID=${CIRCLE_BUILD_NUM:-${TRAVIS_JOB_NUMBER}}
echo "$BUILD_ID"
TEST_EXITCODE=0
npx http-server -p 9999 ./dist/apps/$1 &
yarn run ganache-cli &
npx http-server -p 9090 --cors='*' ./node_modules &
yarn run serve:production &
npx nx serve remix-ide-e2e-src-local-plugin &
sleep 5
yarn run build:e2e
TESTFILES=$(grep -IRiL "\'@disabled\': \?true" "dist/apps/remix-ide-e2e/src/tests" | grep "plugin_api" | sort | circleci tests split )
TESTFILES=$(grep -IRiL "\'@disabled\': \?true" "dist/apps/remix-ide-e2e/src/tests" | grep $1 | sort | circleci tests split )
for TESTFILE in $TESTFILES; do
npx nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js $TESTFILE --env=chrome || TEST_EXITCODE=1
done

@ -1,26 +0,0 @@
#!/usr/bin/env bash
set -e
BUILD_ID=${CIRCLE_BUILD_NUM:-${TRAVIS_JOB_NUMBER}}
echo "$BUILD_ID"
TEST_EXITCODE=0
yarn build etherscan
yarn run serve:production &
npx nx serve etherscan &
sleep 5
yarn run build:e2e
TESTFILES=$(grep -IRiL "\'@disabled\': \?true" "dist/apps/remix-ide-e2e/src/tests" | grep "etherscan_api" | sort | circleci tests split )
for TESTFILE in $TESTFILES; do
npx nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js $TESTFILE --env=chrome || TEST_EXITCODE=1
done
echo "$TEST_EXITCODE"
if [ "$TEST_EXITCODE" -eq 1 ]
then
exit 1
fi

@ -1,26 +0,0 @@
#!/usr/bin/env bash
set -e
BUILD_ID=${CIRCLE_BUILD_NUM:-${TRAVIS_JOB_NUMBER}}
echo "$BUILD_ID"
TEST_EXITCODE=0
yarn build vyper
yarn run serve:production &
npx nx serve vyper &
sleep 5
yarn run build:e2e
TESTFILES=$(grep -IRiL "\'@disabled\': \?true" "dist/apps/remix-ide-e2e/src/tests" | grep "vyper_api" | sort | circleci tests split )
for TESTFILE in $TESTFILES; do
npx nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js $TESTFILE --env=chrome || TEST_EXITCODE=1
done
echo "$TEST_EXITCODE"
if [ "$TEST_EXITCODE" -eq 1 ]
then
exit 1
fi

@ -2,7 +2,6 @@
set -e
yarn run build:e2e
TESTFILES=$(grep -IRiL "\'@disabled\': \?true" "dist/apps/remix-ide-e2e/src/tests" | grep "\.flaky" | sort )
# count test files
@ -19,10 +18,8 @@ echo "$BUILD_ID"
TEST_EXITCODE=0
yarn run ganache-cli &
npx http-server -p 9090 --cors='*' ./node_modules &
yarn run serve:production &
echo 'sharing folder: ' $PWD '/apps/remix-ide/contracts' &
npx nx serve remix-ide-e2e-src-local-plugin &
sleep 5
for TESTFILE in $TESTFILES; do

@ -1,12 +1,7 @@
'use strict'
import { Plugin } from '@remixproject/engine'
import prettier from 'prettier/standalone'
import { Options } from 'prettier';
import sol from './code-format/index'
import * as ts from 'prettier/parser-typescript'
import * as babel from 'prettier/parser-babel'
import * as espree from 'prettier/parser-espree'
import * as yml from 'prettier/parser-yaml'
import path from 'path'
import yaml from 'js-yaml'
import toml from 'toml'
@ -67,12 +62,28 @@ const defaultOptions = {
export class CodeFormat extends Plugin {
prettier: any
ts: any
babel: any
espree: any
yml: any
sol: any
constructor() {
super(profile)
}
async format(file: string) {
// lazy load
if (!this.prettier) {
this.prettier = await import('prettier/standalone')
this.ts = await import('prettier/parser-typescript')
this.babel = await import('prettier/parser-babel')
this.espree = await import('prettier/parser-espree')
this.yml = await import('prettier/parser-yaml')
}
try {
const content = await this.call('fileManager', 'readFile', file)
if (!content) return
@ -241,8 +252,8 @@ export class CodeFormat extends Plugin {
}
const result = prettier.format(content, {
plugins: [sol as any, ts, babel, espree, yml],
const result = this.prettier.format(content, {
plugins: [sol as any, this.ts, this.babel, this.espree, this.yml],
parser: parserName,
...options
})

@ -7,13 +7,20 @@ import { CodeParser } from "../code-parser";
import { fileDecoration, fileDecorationType } from '@remix-ui/file-decorators'
import { sourceMappingDecoder } from '@remix-project/remix-debug'
import { CompilerRetriggerMode, CompilationSourceCode } from '@remix-project/remix-solidity';
import { MarkerSeverity } from 'monaco-editor';
import { findLinesInStringWithMatch, SearchResultLine } from '@remix-ui/search'
import { lastCompilationResult } from '@remixproject/plugin-api';
import { monacoTypes } from '@remix-ui/editor';
enum MarkerSeverity {
Hint = 1,
Info = 2,
Warning = 4,
Error = 8
}
type errorMarker = {
message: string
severity: MarkerSeverity
severity: monacoTypes.MarkerSeverity
position: {
start: {
line: number

@ -60,7 +60,7 @@ module.exports = composePlugins(withNx(), withReact(), (config) => {
config.plugins.push(
new CopyPlugin({
patterns: [
{ from: '../../node_modules/monaco-editor/dev/vs', to: 'assets/js/monaco-editor/dev/vs' }
{ from: '../../node_modules/monaco-editor/min/vs', to: 'assets/js/monaco-editor/min/vs' }
].filter(Boolean)
}),
new webpack.ProvidePlugin({
@ -79,7 +79,6 @@ module.exports = composePlugins(withNx(), withReact(), (config) => {
config.ignoreWarnings = [/Failed to parse source map/] // ignore source-map-loader warnings
// set minimizer
config.optimization.minimizer = [
new TerserPlugin({

@ -3,9 +3,6 @@
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "apps/vyper/src",
"projectType": "application",
"implicitDependencies": [
"remix-debug"
],
"targets": {
"build": {
"executor": "@nrwl/webpack:webpack",

@ -1 +1,2 @@
export * from './lib/remix-ui-editor'
export { default as monacoTypes } from './types/monaco'

@ -1,5 +1,5 @@
import { IRange } from "monaco-editor";
import { monacoTypes } from '@remix-ui/editor';
export interface Action {
type: string;
payload: Record<string, any>
@ -58,7 +58,7 @@ export const reducerActions = (models = initialState, action: Action) => {
}
case 'REVEAL_RANGE': {
if (!editor) return models
const range: IRange = {
const range: monacoTypes.IRange = {
startLineNumber: action.payload.startLineNumber + 1,
startColumn: action.payload.startColumn,
endLineNumber: action.payload.endLineNumber + 1,

@ -1,6 +1,5 @@
import { IRange } from "monaco-editor";
import monaco from "../../../types/monaco";
import path from "path";
import { monacoTypes } from '@remix-ui/editor';
type CodeParserImportsData = {
files?: string[],
@ -8,7 +7,7 @@ type CodeParserImportsData = {
packages?: string[],
}
export function getStringCompletionItems(range: IRange, monaco): monaco.languages.CompletionItem[] {
export function getStringCompletionItems(range: monacoTypes.IRange, monaco): monacoTypes.languages.CompletionItem[] {
return [
{
detail: 'concatenate an arbitrary number of string values',
@ -21,7 +20,7 @@ export function getStringCompletionItems(range: IRange, monaco): monaco.language
]
}
export function getBytesCompletionItems(range: IRange, monaco): monaco.languages.CompletionItem[] {
export function getBytesCompletionItems(range: monacoTypes.IRange, monaco): monacoTypes.languages.CompletionItem[] {
return [
{
detail: 'concatenate an arbitrary number of values',
@ -35,7 +34,7 @@ export function getBytesCompletionItems(range: IRange, monaco): monaco.languages
}
export function getBlockCompletionItems(range: IRange, monaco): monaco.languages.CompletionItem[] {
export function getBlockCompletionItems(range: monacoTypes.IRange, monaco): monacoTypes.languages.CompletionItem[] {
return [
{
detail: '(address): Current block miner’s address',
@ -97,7 +96,7 @@ export function getBlockCompletionItems(range: IRange, monaco): monaco.languages
];
}
export function getCompletionSnippets(range: IRange, monaco): monaco.languages.CompletionItem[] {
export function getCompletionSnippets(range: monacoTypes.IRange, monaco): monacoTypes.languages.CompletionItem[] {
return [
{
label: 'contract',
@ -193,7 +192,7 @@ export function getCompletionSnippets(range: IRange, monaco): monaco.languages.C
]
}
export function getTxCompletionItems(range: IRange, monaco): monaco.languages.CompletionItem[] {
export function getTxCompletionItems(range: monacoTypes.IRange, monaco): monacoTypes.languages.CompletionItem[] {
return [
{
detail: '(uint): gas price of the transaction',
@ -212,7 +211,7 @@ export function getTxCompletionItems(range: IRange, monaco): monaco.languages.Co
];
}
export function getMsgCompletionItems(range: IRange, monaco): monaco.languages.CompletionItem[] {
export function getMsgCompletionItems(range: monacoTypes.IRange, monaco): monacoTypes.languages.CompletionItem[] {
return [
{
detail: '(bytes): complete calldata',
@ -252,7 +251,7 @@ export function getMsgCompletionItems(range: IRange, monaco): monaco.languages.C
];
}
export function getAbiCompletionItems(range: IRange, monaco): monaco.languages.CompletionItem[] {
export function getAbiCompletionItems(range: monacoTypes.IRange, monaco): monacoTypes.languages.CompletionItem[] {
return [
{
detail: 'encode(..) returs (bytes): ABI-encodes the given arguments',
@ -298,7 +297,7 @@ export function getAbiCompletionItems(range: IRange, monaco): monaco.languages.C
}
export function GetCompletionTypes(range: IRange, monaco): monaco.languages.CompletionItem[] {
export function GetCompletionTypes(range: monacoTypes.IRange, monaco): monacoTypes.languages.CompletionItem[] {
const completionItems = [];
const types = ['address', 'string', 'bytes', 'byte', 'int', 'uint', 'bool', 'hash'];
for (let index = 8; index <= 256; index += 8) {
@ -314,8 +313,8 @@ export function GetCompletionTypes(range: IRange, monaco): monaco.languages.Comp
return completionItems;
}
function CreateCompletionItem(label: string, kind: monaco.languages.CompletionItemKind, detail: string, range: IRange) {
const completionItem: monaco.languages.CompletionItem = {
function CreateCompletionItem(label: string, kind: monacoTypes.languages.CompletionItemKind, detail: string, range: monacoTypes.IRange) {
const completionItem: monacoTypes.languages.CompletionItem = {
label,
kind,
detail,
@ -327,7 +326,7 @@ function CreateCompletionItem(label: string, kind: monaco.languages.CompletionIt
return completionItem;
}
export function GetCompletionKeywords(range: IRange, monaco): monaco.languages.CompletionItem[] {
export function GetCompletionKeywords(range: monacoTypes.IRange, monaco): monacoTypes.languages.CompletionItem[] {
const completionItems = [];
const keywords = ['modifier', 'mapping', 'break', 'continue', 'delete', 'else', 'for',
'after', 'promise', 'alias', 'apply', 'auto', 'copyof', 'default', 'define', 'final', 'implements',
@ -337,7 +336,7 @@ export function GetCompletionKeywords(range: IRange, monaco): monaco.languages.C
'private', 'public', 'external', 'internal', 'payable', 'nonpayable', 'view', 'pure', 'case', 'do', 'else', 'finally',
'in', 'instanceof', 'return', 'throw', 'try', 'catch', 'typeof', 'yield', 'void', 'virtual', 'override'];
keywords.forEach(unit => {
const completionItem: monaco.languages.CompletionItem = {
const completionItem: monacoTypes.languages.CompletionItem = {
label: unit,
kind: monaco.languages.CompletionItemKind.Keyword,
detail: unit + ' keyword',
@ -366,7 +365,7 @@ export function GetCompletionKeywords(range: IRange, monaco): monaco.languages.C
}
export function GeCompletionUnits(range: IRange, monaco): monaco.languages.CompletionItem[] {
export function GeCompletionUnits(range: monacoTypes.IRange, monaco): monacoTypes.languages.CompletionItem[] {
const completionItems = [];
const etherUnits = ['wei', 'gwei', 'finney', 'szabo', 'ether'];
etherUnits.forEach(unit => {
@ -390,10 +389,10 @@ export function GeCompletionUnits(range: IRange, monaco): monaco.languages.Compl
return completionItems;
}
export function GetImports(range: IRange
export function GetImports(range: monacoTypes.IRange
, monaco, data: CodeParserImportsData
, word: string
): monaco.languages.CompletionItem[] {
): monacoTypes.languages.CompletionItem[] {
let list = []
if (!word.startsWith('@')) {
word = word.replace('"', '');
@ -473,7 +472,7 @@ export function GetImports(range: IRange
return list;
};
export function GetGlobalVariable(range: IRange, monaco): monaco.languages.CompletionItem[] {
export function GetGlobalVariable(range: monacoTypes.IRange, monaco): monacoTypes.languages.CompletionItem[] {
return [
{
detail: 'Current block',
@ -520,7 +519,7 @@ export function GetGlobalVariable(range: IRange, monaco): monaco.languages.Compl
];
}
export function GetGlobalFunctions(range: IRange, monaco): monaco.languages.CompletionItem[] {
export function GetGlobalFunctions(range: monacoTypes.IRange, monaco): monacoTypes.languages.CompletionItem[] {
return [
{
detail: 'assert(bool condition): throws if the condition is not met - to be used for internal errors.',
@ -644,7 +643,7 @@ export function GetGlobalFunctions(range: IRange, monaco): monaco.languages.Comp
];
}
export function getContextualAutoCompleteByGlobalVariable(word: string, range: IRange, monaco): monaco.languages.CompletionItem[] {
export function getContextualAutoCompleteByGlobalVariable(word: string, range: monacoTypes.IRange, monaco): monacoTypes.languages.CompletionItem[] {
if (word === 'block') {
return getBlockCompletionItems(range, monaco);
}
@ -669,7 +668,7 @@ export function getContextualAutoCompleteByGlobalVariable(word: string, range: I
return null;
}
export function getArrayCompletionItems(range: IRange, monaco): monaco.languages.CompletionItem[] {
export function getArrayCompletionItems(range: monacoTypes.IRange, monaco): monacoTypes.languages.CompletionItem[] {
return [
{
detail: '',
@ -706,7 +705,7 @@ export function getArrayCompletionItems(range: IRange, monaco): monaco.languages
]
}
export function getAddressCompletionItems(range: IRange, monaco): monaco.languages.CompletionItem[] {
export function getAddressCompletionItems(range: monacoTypes.IRange, monaco): monacoTypes.languages.CompletionItem[] {
return [
{
detail: '(uint256): balance of the Address in Wei',
@ -752,7 +751,7 @@ export function getAddressCompletionItems(range: IRange, monaco): monaco.languag
}
export function getContextualAutoCompleteBTypeName(word: string, range: IRange, monaco): monaco.languages.CompletionItem[] {
export function getContextualAutoCompleteBTypeName(word: string, range: monacoTypes.IRange, monaco): monacoTypes.languages.CompletionItem[] {
if (word === 'ArrayTypeName') {
return getArrayCompletionItems(range, monaco);
}

@ -1,11 +1,9 @@
import { AstNode } from "@remix-project/remix-solidity"
import { isArray } from "lodash"
import { editor, languages, Position } from "monaco-editor"
import monaco from "../../types/monaco"
import { EditorUIProps } from "../remix-ui-editor"
import { GeCompletionUnits, GetCompletionKeywords, getCompletionSnippets, GetCompletionTypes, getContextualAutoCompleteBTypeName, getContextualAutoCompleteByGlobalVariable, GetGlobalFunctions, GetGlobalVariable, GetImports } from "./completion/completionGlobals"
export class RemixCompletionProvider implements languages.CompletionItemProvider {
import { monacoTypes } from '@remix-ui/editor';
export class RemixCompletionProvider implements monacoTypes.languages.CompletionItemProvider {
props: EditorUIProps
monaco: any
@ -17,7 +15,7 @@ export class RemixCompletionProvider implements languages.CompletionItemProvider
}
triggerCharacters = ['.', '', '"', '@', '/']
async provideCompletionItems(model: editor.ITextModel, position: Position, context: monaco.languages.CompletionContext): Promise<monaco.languages.CompletionList | undefined> {
async provideCompletionItems(model: monacoTypes.editor.ITextModel, position: monacoTypes.Position, context: monacoTypes.languages.CompletionContext): Promise<monacoTypes.languages.CompletionList | undefined> {
const completionSettings = await this.props.plugin.call('config', 'getAppParameter', 'settings/auto-completion')
if (!completionSettings) return
@ -32,7 +30,7 @@ export class RemixCompletionProvider implements languages.CompletionItemProvider
const line = model.getLineContent(position.lineNumber)
let nodes: AstNode[] = []
let suggestions: monaco.languages.CompletionItem[] = []
let suggestions: monacoTypes.languages.CompletionItem[] = []
if (context.triggerCharacter === '"' || context.triggerCharacter === '@' || context.triggerCharacter === '/') {
const lastpart = line.substring(0, position.column - 1).split(';').pop()
@ -342,7 +340,7 @@ export class RemixCompletionProvider implements languages.CompletionItemProvider
private getDotCompletions = async (nameOfLastTypedExpression: string, range) => {
const contractCompletions = await this.getContractCompletions()
let nodes: any[] = []
let suggestions: monaco.languages.CompletionItem[] = []
let suggestions: monacoTypes.languages.CompletionItem[] = []
const filterNodes = (nodes: any[], parentNode: any, declarationOf: any = null) => {
return nodes && nodes.filter(node => {

@ -1,8 +1,8 @@
import { Monaco } from '@monaco-editor/react'
import { editor, languages, Position } from 'monaco-editor'
import { EditorUIProps } from '../remix-ui-editor'
export class RemixHoverProvider implements languages.HoverProvider {
import { monacoTypes } from '@remix-ui/editor';
export class RemixHoverProvider implements monacoTypes.languages.HoverProvider {
props: EditorUIProps
monaco: Monaco
@ -11,7 +11,7 @@ export class RemixHoverProvider implements languages.HoverProvider {
this.monaco = monaco
}
provideHover = async function (model: editor.ITextModel, position: Position): Promise<languages.Hover> {
provideHover = async function (model: monacoTypes.editor.ITextModel, position: monacoTypes.Position): Promise<monacoTypes.languages.Hover> {
const cursorPosition = this.props.editorAPI.getHoverPosition(position)
const nodeAtPosition = await this.props.plugin.call('codeParser', 'definitionAtPosition', cursorPosition)
const contents = []

@ -7,11 +7,12 @@ import { solidityTokensProvider, solidityLanguageConfig } from './syntaxes/solid
import { cairoTokensProvider, cairoLanguageConfig } from './syntaxes/cairo'
import { zokratesTokensProvider, zokratesLanguageConfig } from './syntaxes/zokrates'
import { moveTokenProvider, moveLanguageConfig } from './syntaxes/move'
import { monacoTypes } from '@remix-ui/editor';
import './remix-ui-editor.css'
import { loadTypes } from './web-types'
import monaco from '../types/monaco'
import { IMarkdownString, IPosition, MarkerSeverity } from 'monaco-editor'
import { RemixHoverProvider } from './providers/hoverProvider'
import { RemixReferenceProvider } from './providers/referenceProvider'
@ -19,6 +20,14 @@ import { RemixCompletionProvider } from './providers/completionProvider'
import { RemixHighLightProvider } from './providers/highlightProvider'
import { RemixDefinitionProvider } from './providers/definitionProvider'
enum MarkerSeverity {
Hint = 1,
Info = 2,
Warning = 4,
Error = 8
}
type sourceAnnotation = {
row: number,
column: number,
@ -59,12 +68,12 @@ export type lineText = {
className: string
afterContentClassName: string
hide: boolean,
hoverMessage: IMarkdownString | IMarkdownString[]
hoverMessage: monacoTypes.IMarkdownString | monacoTypes.IMarkdownString[]
}
type errorMarker = {
message: string
severity: MarkerSeverity | 'warning' | 'info' | 'error' | 'hint'
severity: monacoTypes.MarkerSeverity | 'warning' | 'info' | 'error' | 'hint'
position: {
start: {
line: number
@ -78,7 +87,8 @@ type errorMarker = {
file: string
}
loader.config({ paths: { vs: 'assets/js/monaco-editor/dev/vs' } })
loader.config({ paths: { vs: 'assets/js/monaco-editor/min/vs' } })
export type DecorationsReturn = {
currentDecorations: Array<string>
@ -105,8 +115,8 @@ export interface EditorUIProps {
findMatches: (uri: string, value: string) => any
getFontSize: () => number,
getValue: (uri: string) => string
getCursorPosition: (offset?: boolean) => number | IPosition
getHoverPosition: (position: IPosition) => number
getCursorPosition: (offset?: boolean) => number | monacoTypes.IPosition
getHoverPosition: (position: monacoTypes.IPosition) => number
addDecoration: (marker: sourceMarker, filePath: string, typeOfDecoration: string) => DecorationsReturn
clearDecorationsByPlugin: (filePath: string, plugin: string, typeOfDecoration: string, registeredDecorations: any, currentDecorations: any) => DecorationsReturn
keepDecorationsFor: (filePath: string, plugin: string, typeOfDecoration: string, registeredDecorations: any, currentDecorations: any) => DecorationsReturn
@ -425,7 +435,7 @@ export const EditorUI = (props: EditorUIProps) => {
props.editorAPI.addErrorMarker = async (errors: errorMarker[], from: string) => {
const allMarkersPerfile: Record<string, Array<monaco.editor.IMarkerData>> = {}
const allMarkersPerfile: Record<string, Array<monacoTypes.editor.IMarkerData>> = {}
for (const error of errors) {
let filePath = error.file
@ -440,7 +450,7 @@ export const EditorUI = (props: EditorUIProps) => {
'info': MarkerSeverity.Info
}
if (model) {
const markerData: monaco.editor.IMarkerData = {
const markerData: monacoTypes.editor.IMarkerData = {
severity: (typeof error.severity === 'string') ? errorServerityMap[error.severity] : error.severity,
startLineNumber: ((error.position.start && error.position.start.line) || 0),
startColumn: ((error.position.start && error.position.start.column) || 0),
@ -496,7 +506,7 @@ export const EditorUI = (props: EditorUIProps) => {
}
}
props.editorAPI.getHoverPosition = (position: monaco.Position) => {
props.editorAPI.getHoverPosition = (position: monacoTypes.Position) => {
if (!monacoRef.current) return
const model = editorModelsState[currentFileRef.current]?.model
if (model) {

@ -129,7 +129,6 @@
"@ethereumjs/vm": "^6.3.0",
"@ethersphere/bee-js": "^3.2.0",
"@isomorphic-git/lightning-fs": "^4.4.1",
"@monaco-editor/react": "4.4.5",
"@openzeppelin/contracts": "^4.7.3",
"@openzeppelin/upgrades-core": "^1.22.0",
"@openzeppelin/wizard": "^0.1.1",
@ -175,10 +174,9 @@
"jszip": "^3.6.0",
"latest-version": "^5.1.0",
"merge": "^2.1.1",
"monaco-editor": "^0.30.1",
"npm-install-version": "^6.0.2",
"path-browserify": "^1.0.1",
"prettier": "^2.7.1",
"prettier": "^2.8.4",
"prettier-plugin-solidity": "^1.0.0-beta.24",
"raw-loader": "^4.0.2",
"react": "^17.0.2",
@ -224,6 +222,7 @@
"@babel/preset-typescript": "^7.18.6",
"@babel/register": "^7.4.4",
"@fortawesome/fontawesome-free": "^5.8.1",
"@monaco-editor/react": "4.4.5",
"@nrwl/cli": "^15.7.1",
"@nrwl/eslint-plugin-nx": "^15.7.1",
"@nrwl/jest": "15.7.1",
@ -235,8 +234,8 @@
"@nrwl/web": "15.7.1",
"@nrwl/webpack": "15.7.1",
"@nrwl/workspace": "^15.7.1",
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.10",
"@openzeppelin/contracts-upgradeable": "^4.8.1",
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.10",
"@svgr/webpack": "^6.5.1",
"@testing-library/react": "13.4.0",
"@types/axios": "^0.14.0",
@ -324,6 +323,7 @@
"minixhr": "^4.0.0",
"mkdirp": "^0.5.1",
"mocha": "^8.0.1",
"monaco-editor": "^0.30.1",
"nanohtml": "^1.6.3",
"nightwatch": "^2.3",
"nodemon": "^2.0.4",

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save