@neo4j-cypher/react-codemirror 2.0.0-next.30 → 2.0.0-next.32

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.
package/package.json CHANGED
@@ -17,7 +17,7 @@
17
17
  "codemirror",
18
18
  "codemirror 6"
19
19
  ],
20
- "version": "2.0.0-next.30",
20
+ "version": "2.0.0-next.32",
21
21
  "main": "./dist/src/index.js",
22
22
  "types": "./dist/src/index.d.ts",
23
23
  "type": "module",
@@ -51,8 +51,8 @@
51
51
  "style-mod": "^4.1.2",
52
52
  "vscode-languageserver-types": "^3.17.3",
53
53
  "workerpool": "^9.3.3",
54
- "@neo4j-cypher/language-support": "2.0.0-next.27",
55
- "@neo4j-cypher/lint-worker": "1.10.1-next.4"
54
+ "@neo4j-cypher/language-support": "2.0.0-next.29",
55
+ "@neo4j-cypher/lint-worker": "1.10.1-next.6"
56
56
  },
57
57
  "devDependencies": {
58
58
  "@neo4j-ndl/base": "^3.2.10",
@@ -1,78 +1,6 @@
1
1
  import { expect, test } from '@playwright/experimental-ct-react';
2
2
  import { CypherEditor } from '../CypherEditor';
3
3
 
4
- test('can complete pattern snippet', async ({ page, mount }) => {
5
- await mount(<CypherEditor />);
6
- const textField = page.getByRole('textbox');
7
-
8
- await textField.fill('MATCH ()-[]->()');
9
-
10
- await page.locator('.cm-tooltip-autocomplete').getByText('-[]->()').click();
11
- await expect(page.locator('.cm-tooltip-autocomplete')).not.toBeVisible();
12
-
13
- await textField.press('Tab');
14
- await textField.press('Tab');
15
-
16
- await expect(textField).toHaveText('MATCH ()-[]->()-[ ]->( )');
17
- });
18
-
19
- test('can navigate snippet', async ({ page, mount }) => {
20
- await mount(<CypherEditor />);
21
- const textField = page.getByRole('textbox');
22
-
23
- await textField.fill('CREATE INDEX abc FOR ()');
24
-
25
- await page
26
- .locator('.cm-tooltip-autocomplete')
27
- .getByText('-[]-()', { exact: true })
28
- .click();
29
- await expect(page.locator('.cm-tooltip-autocomplete')).not.toBeVisible();
30
- await expect(page.locator('.cm-snippetField')).toHaveCount(2);
31
-
32
- await textField.press('Tab');
33
- await textField.press('Shift+Tab');
34
-
35
- await expect(textField).toHaveText('CREATE INDEX abc FOR ()-[ ]-( )');
36
-
37
- await textField.press('a');
38
- await expect(textField).toHaveText('CREATE INDEX abc FOR ()-[a]-( )');
39
-
40
- await textField.press('Escape');
41
- await textField.press('Escape');
42
- await expect(page.locator('.cm-snippetField')).toHaveCount(0);
43
- await textField.press('Tab');
44
- await expect(textField).toHaveText('CREATE INDEX abc FOR ()-[a ]-( )');
45
- });
46
-
47
- test('can accept completion inside pattern snippet', async ({
48
- page,
49
- mount,
50
- }) => {
51
- await mount(<CypherEditor schema={{ labels: ['City'] }} />);
52
- const textField = page.getByRole('textbox');
53
-
54
- await textField.fill('MATCH ()-[]->()');
55
-
56
- await page.locator('.cm-tooltip-autocomplete').getByText('-[]->()').click();
57
- await expect(page.locator('.cm-tooltip-autocomplete')).not.toBeVisible();
58
-
59
- // move to node
60
- await textField.press('Tab');
61
-
62
- // get & accept completion
63
- await textField.press(':');
64
- await expect(
65
- page.locator('.cm-tooltip-autocomplete').getByText('City'),
66
- ).toBeVisible();
67
-
68
- await textField.press('Tab', { delay: 300 });
69
- await expect(page.locator('.cm-tooltip-autocomplete')).not.toBeVisible();
70
-
71
- // tab out of the snippet
72
- await textField.press('Tab', { delay: 300 });
73
-
74
- await expect(textField).toHaveText('MATCH ()-[]->()-[ ]->(:City)');
75
- });
76
4
 
77
5
  test('does not automatically open completion panel for expressions after snippet trigger char', async ({
78
6
  page,
@@ -62,7 +62,7 @@ export const cypherAutocomplete: (config: CypherConfig) => CompletionSource =
62
62
  (config) => (context) => {
63
63
  const documentText = context.state.doc.toString();
64
64
  const offset = context.pos;
65
- const triggerCharacters = ['.', ':', '{', '$', ')'];
65
+ const triggerCharacters = ['.', ':', '{', '$', ')', ']'];
66
66
  const lastCharacter = documentText.at(offset - 1);
67
67
  const yieldTriggered = shouldAutoCompleteYield(documentText, offset);
68
68
  const lastWord = context.matchBefore(/\w*/);