Skip to content

Commit 66e23e2

Browse files
authored
Merge pull request #1248 from HerrEmil/monaco-integration
Use Monaco as the main cypher editor
2 parents f170c5d + a3f12ce commit 66e23e2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+788
-1324
lines changed

.eslintrc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@
7171
"@typescript-eslint/explicit-module-boundary-types": "off",
7272
"@typescript-eslint/explicit-function-return-type": "off",
7373
"@typescript-eslint/no-explicit-any": "off", // remove this when migrated fully to ts. right now it makes warnings unreadable
74-
"@typescript-eslint/ban-ts-comment": "off" // remove this when typings for react-spring allow multiple animation stages
74+
"@typescript-eslint/ban-ts-comment": "off", // remove this when typings for react-spring allow multiple animation stages,
75+
"@typescript-eslint/no-non-null-assertion": "off"
7576
}
7677
}
7778
]

LICENSES.txt

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2072,32 +2072,6 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20722072

20732073
-----
20742074

2075-
The following software may be included in this product: codemirror. A copy of the source code may be downloaded from https://github.com/codemirror/CodeMirror.git. This software contains the following license and notice below:
2076-
2077-
MIT License
2078-
2079-
Copyright (C) 2017 by Marijn Haverbeke <[email protected]> and others
2080-
2081-
Permission is hereby granted, free of charge, to any person obtaining a copy
2082-
of this software and associated documentation files (the "Software"), to deal
2083-
in the Software without restriction, including without limitation the rights
2084-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
2085-
copies of the Software, and to permit persons to whom the Software is
2086-
furnished to do so, subject to the following conditions:
2087-
2088-
The above copyright notice and this permission notice shall be included in
2089-
all copies or substantial portions of the Software.
2090-
2091-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2092-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2093-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2094-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2095-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2096-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2097-
THE SOFTWARE.
2098-
2099-
-----
2100-
21012075
The following software may be included in this product: color-convert. A copy of the source code may be downloaded from https://github.com/Qix-/color-convert.git. This software contains the following license and notice below:
21022076

21032077
Copyright (c) 2011-2016 Heather Arthur <[email protected]>
@@ -2459,7 +2433,7 @@ SOFTWARE.
24592433

24602434
-----
24612435

2462-
The following software may be included in this product: cypher-codemirror, cypher-editor-support. A copy of the source code may be downloaded from git://github.com/neo4j-contrib/cypher-editor.git (cypher-codemirror), git://github.com/neo4j-contrib/cypher-editor.git (cypher-editor-support). This software contains the following license and notice below:
2436+
The following software may be included in this product: cypher-editor-support. A copy of the source code may be downloaded from git://github.com/neo4j-contrib/cypher-editor.git. This software contains the following license and notice below:
24632437

24642438
GNU GENERAL PUBLIC LICENSE
24652439
Version 3, 29 June 2007

NOTICE.txt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -423,9 +423,6 @@ Third-party licenses
423423
│ ├─ VendorName: Tab Atkins Jr.
424424
│ └─ VendorUrl: https://github.com/tabatkins/railroad-diagrams
425425
├─ GPL-3.0
426-
427-
│ │ ├─ URL: git://github.com/neo4j-contrib/cypher-editor.git
428-
│ │ └─ VendorName: Neo Technology Inc.
429426
430427
│ ├─ URL: git://github.com/neo4j-contrib/cypher-editor.git
431428
│ └─ VendorName: Neo Technology Inc.
@@ -863,10 +860,6 @@ Third-party licenses
863860
864861
│ │ ├─ URL: https://github.com/JedWatson/classnames.git
865862
│ │ └─ VendorName: Jed Watson
866-
867-
│ │ ├─ URL: https://github.com/codemirror/CodeMirror.git
868-
│ │ ├─ VendorName: Marijn Haverbeke
869-
│ │ └─ VendorUrl: https://codemirror.net/
870863
871864
│ │ ├─ URL: https://github.com/wooorm/collapse-white-space.git
872865
│ │ ├─ VendorName: Titus Wormer

build_scripts/webpack.config.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ module.exports = {
6767
enforce: true
6868
},
6969
'cypher-editor': {
70-
test: /[\\/]node_modules[\\/](antlr4|codemirror|cypher-codemirror|cypher-editor-support)[\\/]/,
70+
test: /[\\/]node_modules[\\/](antlr4|cypher-editor-support|monaco-editor)[\\/]/,
7171
name: 'cypher-editor',
7272
chunks: 'all',
7373
enforce: true
@@ -78,12 +78,6 @@ module.exports = {
7878
chunks: 'all',
7979
enforce: true
8080
},
81-
monaco: {
82-
test: /[\\/]node_modules[\\/](monaco-editor)[\\/]/,
83-
name: 'monaco',
84-
chunks: 'all',
85-
enforce: true
86-
},
8781
'relate-by-ui': {
8882
test: /[\\/]node_modules[\\/](@relate-by-ui|semantic-ui-react)[\\/]/,
8983
name: 'relate-by-ui',

e2e_tests/integration/commands.spec.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,10 @@ describe('Commands', () => {
5656
// lose focus
5757
cy.get('[data-testid=drawerFavorites]').click()
5858
cy.get('[data-testid=drawerFavorites]').click()
59-
cy.get('.ReactCodeMirror textarea').should('not.be', 'focused')
59+
cy.get('#monaco-main-editor > .monaco-editor').should(
60+
'not.have.class',
61+
'focused'
62+
)
6063

6164
// we now have 2 cards, and some hidden padding
6265
cy.get('[data-testid="stream"]')
@@ -65,12 +68,12 @@ describe('Commands', () => {
6568

6669
// focus editor
6770
cy.get('body').type('/')
68-
cy.get('.ReactCodeMirror textarea')
69-
.should('be', 'focused')
71+
cy.get('#monaco-main-editor > .monaco-editor')
72+
.should('have.class', 'focused')
7073
.type(':clear{shift}{enter}')
7174

7275
// we see line number in multiline view
73-
cy.get('.CodeMirror-linenumber').should('contain', '1')
76+
cy.get('.line-numbers').should('contain', '1')
7477
// we can run command with ctrl enter
7578
cy.get('[data-testid="activeEditor"] textarea').type('{ctrl}{enter}')
7679
// editor is now cleared

e2e_tests/integration/connect-form.spec.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,9 @@ describe('Connect form', () => {
182182
cy.get('[data-testid=password]')
183183
.type(Cypress.config('password'))
184184
.type('{enter}')
185-
cy.get('[data-testid="editor-wrapper"]').contains('system')
185+
186+
cy.get('[data-testid="drawerDBMS"]').click()
187+
cy.get('[data-testid="database-selection-list"]').contains('system')
186188
})
187189
}
188190
}

e2e_tests/integration/multi-db.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ describe('Multi database', () => {
7676
}
7777
it(':use command works + shows current db in editor gutter', () => {
7878
cy.executeCommand(':clear')
79-
const editor = () => cy.get('[data-testid="editor-wrapper"]')
79+
const editor = () => cy.get('#monaco-main-editor')
8080

8181
cy.executeCommand(':use system')
8282
editor().contains('system$')

e2e_tests/integration/params.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ function runTests() {
6464
// it(':param x => {prop: 1} multi line', () => {
6565
// Set param
6666
cy.executeCommand(':clear')
67-
setParamQ = `:param [x] => {{}{shift}{enter}RETURN {{}prop: 1} AS x{enter}}`
67+
setParamQ = `:param [x] => {{}{shift}{enter}RETURN {{}prop: 1} AS x`
6868
cy.executeCommand(setParamQ)
6969
cy.resultContains('"prop": 1')
7070
// return param

e2e_tests/integration/plan.spec.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,9 @@ describe('Plan output', () => {
2828
.title()
2929
.should('include', 'Neo4j Browser')
3030
cy.wait(3000)
31-
cy.disableEditorAutocomplete()
3231
const password = Cypress.config('password')
3332
cy.connect('neo4j', password)
3433
})
35-
after(function() {
36-
cy.enableEditorAutocomplete()
37-
})
3834
it('displays the expanded details by default and displays/hides details when clicking the plan expand/collapse buttons respectively', () => {
3935
cy.executeCommand(':clear')
4036
cy.executeCommand(

e2e_tests/integration/saved-scripts.spec.ts

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,11 @@ describe('Saved Scripts', () => {
4141
cy.get('[data-testid="scriptTitle-script name"]').click()
4242
cy.get('[data-testid="currentlyEditing"]').contains('script name')
4343
// Editing script updates name and content
44-
cy.get('[data-testid="activeEditor"] textarea').type(
45-
`// Guide
46-
:play movies${
47-
'{del}'.repeat(
48-
22
49-
) /* normal clear doesn't seem to work with code-mirror text field*/
50-
}
51-
`,
52-
{ force: true }
53-
)
44+
const clearInput =
45+
Cypress.platform == 'darwin' ? '{cmd}a{del}' : '{ctrl}a{del}'
46+
cy.get('[data-testid="activeEditor"] textarea')
47+
.type(clearInput)
48+
.type('// Guide{shift}{enter}:play movies', { force: true })
5449
cy.get('[title="Update favorite"]').click()
5550

5651
cy.get('[data-testid="scriptTitle-Guide"]').should('exist')

0 commit comments

Comments
 (0)