@neo4j-cypher/react-codemirror 2.0.0-next.23 → 2.0.0-next.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/{CypherEditor.js → src/CypherEditor.js} +2 -2
  3. package/dist/src/CypherEditor.js.map +1 -0
  4. package/dist/src/CypherEditor.test.js.map +1 -0
  5. package/dist/src/constants.js.map +1 -0
  6. package/dist/src/e2e_tests/autoCompletion.spec.js.map +1 -0
  7. package/dist/src/e2e_tests/configuration.spec.js.map +1 -0
  8. package/dist/src/e2e_tests/debounce.spec.js.map +1 -0
  9. package/dist/{e2e_tests → src/e2e_tests}/e2eUtils.d.ts +1 -0
  10. package/dist/{e2e_tests → src/e2e_tests}/e2eUtils.js +9 -1
  11. package/dist/src/e2e_tests/e2eUtils.js.map +1 -0
  12. package/dist/src/e2e_tests/extraKeybindings.spec.js.map +1 -0
  13. package/dist/src/e2e_tests/historyNavigation.spec.js.map +1 -0
  14. package/dist/{e2e_tests → src/e2e_tests}/performanceTest.spec.js +1 -1
  15. package/dist/src/e2e_tests/performanceTest.spec.js.map +1 -0
  16. package/dist/src/e2e_tests/sanityChecks.spec.js.map +1 -0
  17. package/dist/src/e2e_tests/signatureHelp.spec.js.map +1 -0
  18. package/dist/src/e2e_tests/snippets.spec.js.map +1 -0
  19. package/dist/src/e2e_tests/syntaxHighlighting.spec.js.map +1 -0
  20. package/dist/{e2e_tests → src/e2e_tests}/syntaxValidation.spec.js +20 -9
  21. package/dist/src/e2e_tests/syntaxValidation.spec.js.map +1 -0
  22. package/dist/src/historyNavigation.js.map +1 -0
  23. package/dist/src/icons.js.map +1 -0
  24. package/dist/src/index.js.map +1 -0
  25. package/dist/src/lang-cypher/autocomplete.js.map +1 -0
  26. package/dist/src/lang-cypher/constants.js.map +1 -0
  27. package/dist/src/lang-cypher/contants.test.js.map +1 -0
  28. package/dist/{lang-cypher → src/lang-cypher}/createCypherTheme.js +1 -0
  29. package/dist/src/lang-cypher/createCypherTheme.js.map +1 -0
  30. package/dist/src/lang-cypher/langCypher.js.map +1 -0
  31. package/dist/src/lang-cypher/lintWorker.mjs +2004 -0
  32. package/dist/src/lang-cypher/parser-adapter.js.map +1 -0
  33. package/dist/src/lang-cypher/signatureHelp.js.map +1 -0
  34. package/dist/{lang-cypher → src/lang-cypher}/syntaxValidation.js +1 -1
  35. package/dist/src/lang-cypher/syntaxValidation.js.map +1 -0
  36. package/dist/src/lang-cypher/themeIcons.js.map +1 -0
  37. package/dist/src/lang-cypher/utils.js.map +1 -0
  38. package/dist/src/ndlTokensCopy.js.map +1 -0
  39. package/dist/src/ndlTokensCopy.test.js.map +1 -0
  40. package/dist/src/neo4jSetup.js.map +1 -0
  41. package/dist/src/themes.js.map +1 -0
  42. package/dist/tsconfig.tsbuildinfo +1 -0
  43. package/package.json +10 -6
  44. package/src/CypherEditor.tsx +2 -2
  45. package/src/e2e_tests/e2eUtils.ts +17 -1
  46. package/src/e2e_tests/performanceTest.spec.tsx +1 -1
  47. package/src/e2e_tests/syntaxValidation.spec.tsx +28 -9
  48. package/src/lang-cypher/createCypherTheme.ts +1 -0
  49. package/src/lang-cypher/lintWorker.mjs +2004 -0
  50. package/src/lang-cypher/syntaxValidation.ts +3 -2
  51. package/dist/CypherEditor.js.map +0 -1
  52. package/dist/CypherEditor.test.js.map +0 -1
  53. package/dist/constants.js.map +0 -1
  54. package/dist/e2e_tests/autoCompletion.spec.js.map +0 -1
  55. package/dist/e2e_tests/configuration.spec.js.map +0 -1
  56. package/dist/e2e_tests/debounce.spec.js.map +0 -1
  57. package/dist/e2e_tests/e2eUtils.js.map +0 -1
  58. package/dist/e2e_tests/extraKeybindings.spec.js.map +0 -1
  59. package/dist/e2e_tests/historyNavigation.spec.js.map +0 -1
  60. package/dist/e2e_tests/performanceTest.spec.js.map +0 -1
  61. package/dist/e2e_tests/sanityChecks.spec.js.map +0 -1
  62. package/dist/e2e_tests/signatureHelp.spec.js.map +0 -1
  63. package/dist/e2e_tests/snippets.spec.js.map +0 -1
  64. package/dist/e2e_tests/syntaxHighlighting.spec.js.map +0 -1
  65. package/dist/e2e_tests/syntaxValidation.spec.js.map +0 -1
  66. package/dist/historyNavigation.js.map +0 -1
  67. package/dist/icons.js.map +0 -1
  68. package/dist/index.js.map +0 -1
  69. package/dist/lang-cypher/autocomplete.js.map +0 -1
  70. package/dist/lang-cypher/constants.js.map +0 -1
  71. package/dist/lang-cypher/contants.test.js.map +0 -1
  72. package/dist/lang-cypher/createCypherTheme.js.map +0 -1
  73. package/dist/lang-cypher/langCypher.js.map +0 -1
  74. package/dist/lang-cypher/lintWorker.d.ts +0 -12
  75. package/dist/lang-cypher/lintWorker.js +0 -14
  76. package/dist/lang-cypher/lintWorker.js.map +0 -1
  77. package/dist/lang-cypher/parser-adapter.js.map +0 -1
  78. package/dist/lang-cypher/signatureHelp.js.map +0 -1
  79. package/dist/lang-cypher/syntaxValidation.js.map +0 -1
  80. package/dist/lang-cypher/themeIcons.js.map +0 -1
  81. package/dist/lang-cypher/utils.js.map +0 -1
  82. package/dist/ndlTokensCopy.js.map +0 -1
  83. package/dist/ndlTokensCopy.test.js.map +0 -1
  84. package/dist/neo4jSetup.js.map +0 -1
  85. package/dist/themes.js.map +0 -1
  86. package/src/lang-cypher/lintWorker.ts +0 -31
  87. /package/dist/{CypherEditor.d.ts → src/CypherEditor.d.ts} +0 -0
  88. /package/dist/{CypherEditor.test.d.ts → src/CypherEditor.test.d.ts} +0 -0
  89. /package/dist/{CypherEditor.test.js → src/CypherEditor.test.js} +0 -0
  90. /package/dist/{constants.d.ts → src/constants.d.ts} +0 -0
  91. /package/dist/{constants.js → src/constants.js} +0 -0
  92. /package/dist/{e2e_tests → src/e2e_tests}/autoCompletion.spec.d.ts +0 -0
  93. /package/dist/{e2e_tests → src/e2e_tests}/autoCompletion.spec.js +0 -0
  94. /package/dist/{e2e_tests → src/e2e_tests}/configuration.spec.d.ts +0 -0
  95. /package/dist/{e2e_tests → src/e2e_tests}/configuration.spec.js +0 -0
  96. /package/dist/{e2e_tests → src/e2e_tests}/debounce.spec.d.ts +0 -0
  97. /package/dist/{e2e_tests → src/e2e_tests}/debounce.spec.js +0 -0
  98. /package/dist/{e2e_tests → src/e2e_tests}/extraKeybindings.spec.d.ts +0 -0
  99. /package/dist/{e2e_tests → src/e2e_tests}/extraKeybindings.spec.js +0 -0
  100. /package/dist/{e2e_tests → src/e2e_tests}/historyNavigation.spec.d.ts +0 -0
  101. /package/dist/{e2e_tests → src/e2e_tests}/historyNavigation.spec.js +0 -0
  102. /package/dist/{e2e_tests → src/e2e_tests}/performanceTest.spec.d.ts +0 -0
  103. /package/dist/{e2e_tests → src/e2e_tests}/sanityChecks.spec.d.ts +0 -0
  104. /package/dist/{e2e_tests → src/e2e_tests}/sanityChecks.spec.js +0 -0
  105. /package/dist/{e2e_tests → src/e2e_tests}/signatureHelp.spec.d.ts +0 -0
  106. /package/dist/{e2e_tests → src/e2e_tests}/signatureHelp.spec.js +0 -0
  107. /package/dist/{e2e_tests → src/e2e_tests}/snippets.spec.d.ts +0 -0
  108. /package/dist/{e2e_tests → src/e2e_tests}/snippets.spec.js +0 -0
  109. /package/dist/{e2e_tests → src/e2e_tests}/syntaxHighlighting.spec.d.ts +0 -0
  110. /package/dist/{e2e_tests → src/e2e_tests}/syntaxHighlighting.spec.js +0 -0
  111. /package/dist/{e2e_tests → src/e2e_tests}/syntaxValidation.spec.d.ts +0 -0
  112. /package/dist/{historyNavigation.d.ts → src/historyNavigation.d.ts} +0 -0
  113. /package/dist/{historyNavigation.js → src/historyNavigation.js} +0 -0
  114. /package/dist/{icons.d.ts → src/icons.d.ts} +0 -0
  115. /package/dist/{icons.js → src/icons.js} +0 -0
  116. /package/dist/{index.d.ts → src/index.d.ts} +0 -0
  117. /package/dist/{index.js → src/index.js} +0 -0
  118. /package/dist/{lang-cypher → src/lang-cypher}/autocomplete.d.ts +0 -0
  119. /package/dist/{lang-cypher → src/lang-cypher}/autocomplete.js +0 -0
  120. /package/dist/{lang-cypher → src/lang-cypher}/constants.d.ts +0 -0
  121. /package/dist/{lang-cypher → src/lang-cypher}/constants.js +0 -0
  122. /package/dist/{lang-cypher → src/lang-cypher}/contants.test.d.ts +0 -0
  123. /package/dist/{lang-cypher → src/lang-cypher}/contants.test.js +0 -0
  124. /package/dist/{lang-cypher → src/lang-cypher}/createCypherTheme.d.ts +0 -0
  125. /package/dist/{lang-cypher → src/lang-cypher}/langCypher.d.ts +0 -0
  126. /package/dist/{lang-cypher → src/lang-cypher}/langCypher.js +0 -0
  127. /package/dist/{lang-cypher → src/lang-cypher}/parser-adapter.d.ts +0 -0
  128. /package/dist/{lang-cypher → src/lang-cypher}/parser-adapter.js +0 -0
  129. /package/dist/{lang-cypher → src/lang-cypher}/signatureHelp.d.ts +0 -0
  130. /package/dist/{lang-cypher → src/lang-cypher}/signatureHelp.js +0 -0
  131. /package/dist/{lang-cypher → src/lang-cypher}/syntaxValidation.d.ts +0 -0
  132. /package/dist/{lang-cypher → src/lang-cypher}/themeIcons.d.ts +0 -0
  133. /package/dist/{lang-cypher → src/lang-cypher}/themeIcons.js +0 -0
  134. /package/dist/{lang-cypher → src/lang-cypher}/utils.d.ts +0 -0
  135. /package/dist/{lang-cypher → src/lang-cypher}/utils.js +0 -0
  136. /package/dist/{ndlTokensCopy.d.ts → src/ndlTokensCopy.d.ts} +0 -0
  137. /package/dist/{ndlTokensCopy.js → src/ndlTokensCopy.js} +0 -0
  138. /package/dist/{ndlTokensCopy.test.d.ts → src/ndlTokensCopy.test.d.ts} +0 -0
  139. /package/dist/{ndlTokensCopy.test.js → src/ndlTokensCopy.test.js} +0 -0
  140. /package/dist/{neo4jSetup.d.ts → src/neo4jSetup.d.ts} +0 -0
  141. /package/dist/{neo4jSetup.js → src/neo4jSetup.js} +0 -0
  142. /package/dist/{themes.d.ts → src/themes.d.ts} +0 -0
  143. /package/dist/{themes.js → src/themes.js} +0 -0
@@ -33,7 +33,7 @@ test('Can turn linting back on', async ({ page, mount }) => {
33
33
 
34
34
  await editorPage.checkErrorMessage(
35
35
  'METCH',
36
- `Invalid input 'METCH': expected 'FOREACH', 'ALTER', 'ORDER BY', 'CALL', 'USING PERIODIC COMMIT', 'CREATE', 'LOAD CSV', 'START DATABASE', 'STOP DATABASE', 'DEALLOCATE', 'DELETE', 'DENY', 'DETACH', 'DROP', 'DRYRUN', 'FINISH', 'GRANT', 'INSERT', 'LIMIT', 'MATCH', 'MERGE', 'NODETACH', 'OFFSET', 'OPTIONAL', 'REALLOCATE', 'REMOVE', 'RENAME', 'RETURN', 'REVOKE', 'ENABLE SERVER', 'SET', 'SHOW', 'SKIP', 'TERMINATE', 'UNWIND', 'USE' or 'WITH'`,
36
+ `Invalid input 'METCH': expected 'ALTER', 'ORDER BY', 'CALL', 'USING PERIODIC COMMIT', 'CREATE', 'LOAD CSV', 'START DATABASE', 'STOP DATABASE', 'DEALLOCATE', 'DELETE', 'DENY', 'DETACH', 'DROP', 'DRYRUN', 'FINISH', 'FOREACH', 'GRANT', 'INSERT', 'LIMIT', 'MATCH', 'MERGE', 'NODETACH', 'OFFSET', 'OPTIONAL', 'REALLOCATE', 'REMOVE', 'RENAME', 'RETURN', 'REVOKE', 'ENABLE SERVER', 'SET', 'SHOW', 'SKIP', 'TERMINATE', 'UNWIND', 'USE' or 'WITH'`,
37
37
  );
38
38
  });
39
39
 
@@ -45,7 +45,7 @@ test('Syntactic errors are surfaced', async ({ page, mount }) => {
45
45
 
46
46
  await editorPage.checkErrorMessage(
47
47
  'METCH',
48
- `Invalid input 'METCH': expected 'FOREACH', 'ALTER', 'ORDER BY', 'CALL', 'USING PERIODIC COMMIT', 'CREATE', 'LOAD CSV', 'START DATABASE', 'STOP DATABASE', 'DEALLOCATE', 'DELETE', 'DENY', 'DETACH', 'DROP', 'DRYRUN', 'FINISH', 'GRANT', 'INSERT', 'LIMIT', 'MATCH', 'MERGE', 'NODETACH', 'OFFSET', 'OPTIONAL', 'REALLOCATE', 'REMOVE', 'RENAME', 'RETURN', 'REVOKE', 'ENABLE SERVER', 'SET', 'SHOW', 'SKIP', 'TERMINATE', 'UNWIND', 'USE' or 'WITH'`,
48
+ `Invalid input 'METCH': expected 'ALTER', 'ORDER BY', 'CALL', 'USING PERIODIC COMMIT', 'CREATE', 'LOAD CSV', 'START DATABASE', 'STOP DATABASE', 'DEALLOCATE', 'DELETE', 'DENY', 'DETACH', 'DROP', 'DRYRUN', 'FINISH', 'FOREACH', 'GRANT', 'INSERT', 'LIMIT', 'MATCH', 'MERGE', 'NODETACH', 'OFFSET', 'OPTIONAL', 'REALLOCATE', 'REMOVE', 'RENAME', 'RETURN', 'REVOKE', 'ENABLE SERVER', 'SET', 'SHOW', 'SKIP', 'TERMINATE', 'UNWIND', 'USE' or 'WITH'`,
49
49
  );
50
50
  });
51
51
 
@@ -138,7 +138,7 @@ test('Semantic errors are correctly accumulated', async ({ page, mount }) => {
138
138
 
139
139
  await editorPage.checkErrorMessage(
140
140
  '-1',
141
- "Invalid input. '-1' is not a valid value. Must be a positive integer",
141
+ "Invalid input. '-1' is not a valid value. Must be a positive integer.",
142
142
  );
143
143
  });
144
144
 
@@ -153,12 +153,12 @@ test('Multiline errors are correctly placed', async ({ page, mount }) => {
153
153
 
154
154
  await editorPage.checkErrorMessage(
155
155
  'MATCH (n)',
156
- 'Query cannot conclude with MATCH (must be a RETURN clause, a FINISH clause, an update clause, a unit subquery call, or a procedure call with no YIELD)',
156
+ 'Query cannot conclude with MATCH (must be a RETURN clause, a FINISH clause, an update clause, a unit subquery call, or a procedure call with no YIELD).',
157
157
  );
158
158
 
159
159
  await editorPage.checkErrorMessage(
160
160
  '-1',
161
- "Invalid input. '-1' is not a valid value. Must be a positive integer",
161
+ "Invalid input. '-1' is not a valid value. Must be a positive integer.",
162
162
  );
163
163
  });
164
164
 
@@ -178,10 +178,28 @@ test('Validation errors are correctly overlapped', async ({ page, mount }) => {
178
178
 
179
179
  await editorPage.checkErrorMessage(
180
180
  '-1',
181
- "Invalid input. '-1' is not a valid value. Must be a positive integer",
181
+ "Invalid input. '-1' is not a valid value. Must be a positive integer.",
182
182
  );
183
183
  });
184
184
 
185
+ test('Syntax highlighting works as expected with multiple separate linting messages', async ( {
186
+ page,
187
+ mount
188
+ }) => {
189
+ const editorPage = new CypherEditorPage(page);
190
+ const query = `MATCH (n)--(m) CALL (n) {RETURN id(n) AS b} RETURN apoc.create.uuid(), a`;
191
+
192
+ await mount(<CypherEditor value={query} schema={testData.mockSchema} />);
193
+ await expect(
194
+ editorPage.page.locator('.cm-deprecated-element').last(),
195
+ ).toBeVisible({ timeout: 10000 });
196
+ await editorPage.checkWarningMessage('id', 'Function id is deprecated.');
197
+ await editorPage.checkWarningMessage('id', `The query used a deprecated function. ('id' has been replaced by 'elementId or an application-generated id')`);
198
+
199
+ await editorPage.checkWarningMessage('apoc.create.uuid', 'Function apoc.create.uuid is deprecated. Alternative: Neo4j randomUUID() function');
200
+ await editorPage.checkErrorMessage('a', 'Variable `a` not defined');
201
+ })
202
+
185
203
  test('Strikethroughs are shown for deprecated functions', async ({
186
204
  page,
187
205
  mount,
@@ -194,6 +212,7 @@ test('Strikethroughs are shown for deprecated functions', async ({
194
212
  editorPage.page.locator('.cm-deprecated-element').last(),
195
213
  ).toBeVisible({ timeout: 10000 });
196
214
  await editorPage.checkWarningMessage('id', 'Function id is deprecated.');
215
+ await editorPage.checkErrorMessage('id', `Insufficient parameters for function 'id'`);
197
216
  });
198
217
 
199
218
  test('Strikethroughs are shown for deprecated procedures', async ({
@@ -210,7 +229,7 @@ test('Strikethroughs are shown for deprecated procedures', async ({
210
229
 
211
230
  await editorPage.checkWarningMessage(
212
231
  'apoc.create.uuids',
213
- 'Procedure apoc.create.uuids is deprecated.',
232
+ "Procedure apoc.create.uuids is deprecated. Alternative: Neo4j's randomUUID() function can be used as a replacement, for example: `UNWIND range(0,$count) AS row RETURN row, randomUUID() AS uuid`",
214
233
  );
215
234
  });
216
235
 
@@ -231,13 +250,13 @@ test('Syntax validation depends on the Cypher version', async ({
231
250
 
232
251
  await editorPage.checkWarningMessage(
233
252
  'apoc.create.uuids',
234
- 'Procedure apoc.create.uuids is deprecated.',
253
+ "Procedure apoc.create.uuids is deprecated. Alternative: Neo4j's randomUUID() function can be used as a replacement, for example: `UNWIND range(0,$count) AS row RETURN row, randomUUID() AS uuid`",
235
254
  );
236
255
 
237
256
  await textField.fill('CYPHER 25 CALL apoc.create.uuids(5)');
238
257
 
239
258
  await editorPage.checkErrorMessage(
240
259
  'apoc.create.uuids',
241
- 'Procedure apoc.create.uuids is not present in the database.',
260
+ `Procedure apoc.create.uuids is not present in the database. Make sure you didn't misspell it or that it is available when you run this statement in your application`,
242
261
  );
243
262
  });
@@ -91,6 +91,7 @@ export const createCypherTheme = ({
91
91
  '& .cm-panels': {
92
92
  backgroundColor: settings.searchPanel.background,
93
93
  fontFamily: 'Fira Code, Menlo, Monaco, Lucida Console, monospace',
94
+ zIndex: 0,
94
95
  },
95
96
  '& .cm-completionLabel': {
96
97
  fontFamily: 'Fira Code, Menlo, Monaco, Lucida Console, monospace',