Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@neo4j-cypher/react-codemirror

Package Overview
Dependencies
Maintainers
2
Versions
138
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@neo4j-cypher/react-codemirror - npm Package Compare versions

Comparing version 2.0.0-next.6 to 2.0.0-next.7

7

CHANGELOG.md
# @neo4j-cypher/react-codemirror
## 2.0.0-next.7
### Patch Changes
- Updated dependencies [1f790d0]
- @neo4j-cypher/language-support@2.0.0-next.5
## 2.0.0-next.6

@@ -4,0 +11,0 @@

@@ -133,2 +133,23 @@ import { jsx as _jsx } from "react/jsx-runtime";

});
test('can complete pattern snippet', async ({ page, mount }) => {
await mount(_jsx(CypherEditor, {}));
const textField = page.getByRole('textbox');
await textField.fill('MATCH ()-[]->()');
await page.locator('.cm-tooltip-autocomplete').getByText('-[]->()').click();
await expect(page.locator('.cm-tooltip-autocomplete')).not.toBeVisible();
await textField.press('Tab');
await textField.press('Tab');
await textField.press('Tab');
await expect(textField).toHaveText('MATCH ()-[]->()-[ ]->( )');
});
test('does not automatically open completion panel for expressions after snippet trigger char', async ({ page, mount, }) => {
await mount(_jsx(CypherEditor, {}));
const textField = page.getByRole('textbox');
await textField.fill('RETURN (1)');
// expect the panel to not show up
await expect(page.locator('.cm-tooltip-autocomplete')).not.toBeVisible();
// unless manually triggered
await textField.press('Control+ ');
await expect(page.locator('.cm-tooltip-autocomplete')).toBeVisible();
});
//# sourceMappingURL=autoCompletion.spec.js.map

12

dist/lang-cypher/autocomplete.js

@@ -0,1 +1,2 @@

import { snippet } from '@codemirror/autocomplete';
import { autocomplete } from '@neo4j-cypher/language-support';

@@ -27,3 +28,3 @@ import { CompletionItemKind } from 'vscode-languageserver-types';

[CompletionItemKind.Struct]: 'Struct',
// we're missuing the enum here as there is no `Console` kind in the predefined list
// we're miss-using the enum here as there is no `Console` kind in the predefined list
[CompletionItemKind.Event]: 'Console',

@@ -37,3 +38,3 @@ [CompletionItemKind.Operator]: 'Operator',

const textUntilCursor = context.state.doc.toString().slice(0, context.pos);
const triggerCharacters = ['.', ':', '{', '$'];
const triggerCharacters = ['.', ':', '{', '$', ')'];
const lastCharacter = textUntilCursor.slice(-1);

@@ -49,3 +50,3 @@ const lastWord = context.matchBefore(/\w*/);

}
const options = autocomplete(textUntilCursor, config.schema ?? {});
const options = autocomplete(textUntilCursor, config.schema ?? {}, undefined, context.explicit);
return {

@@ -56,2 +57,7 @@ from: context.matchBefore(/(\w|\$)*$/).from,

type: completionKindToCodemirrorIcon(o.kind),
apply: o.kind === CompletionItemKind.Snippet
? // codemirror requires an empty snippet space to be able to tab out of the completion
snippet((o.insertText ?? o.label) + '${}')
: undefined,
detail: o.detail,
})),

@@ -58,0 +64,0 @@ };

@@ -12,2 +12,5 @@ import { HighlightStyle, syntaxHighlighting, } from '@codemirror/language';

},
'& .cm-snippetField': {
backgroundColor: settings.autoCompletionPanel.selectedColor,
},
'&.cm-focused': {

@@ -14,0 +17,0 @@ outline: 'none',

@@ -20,3 +20,3 @@ {

],
"version": "2.0.0-next.6",
"version": "2.0.0-next.7",
"main": "./dist/index.js",

@@ -55,3 +55,3 @@ "types": "./dist/index.d.ts",

"@lezer/highlight": "^1.1.3",
"@neo4j-cypher/language-support": "2.0.0-next.4",
"@neo4j-cypher/language-support": "2.0.0-next.5",
"@types/prismjs": "^1.26.3",

@@ -58,0 +58,0 @@ "@types/workerpool": "^6.4.7",

@@ -1,2 +0,2 @@

import { CompletionSource } from '@codemirror/autocomplete';
import { CompletionSource, snippet } from '@codemirror/autocomplete';
import { autocomplete } from '@neo4j-cypher/language-support';

@@ -31,3 +31,3 @@ import { CompletionItemKind } from 'vscode-languageserver-types';

[CompletionItemKind.Struct]: 'Struct',
// we're missuing the enum here as there is no `Console` kind in the predefined list
// we're miss-using the enum here as there is no `Console` kind in the predefined list
[CompletionItemKind.Event]: 'Console',

@@ -45,3 +45,3 @@ [CompletionItemKind.Operator]: 'Operator',

const triggerCharacters = ['.', ':', '{', '$'];
const triggerCharacters = ['.', ':', '{', '$', ')'];
const lastCharacter = textUntilCursor.slice(-1);

@@ -63,3 +63,8 @@

const options = autocomplete(textUntilCursor, config.schema ?? {});
const options = autocomplete(
textUntilCursor,
config.schema ?? {},
undefined,
context.explicit,
);

@@ -71,4 +76,10 @@ return {

type: completionKindToCodemirrorIcon(o.kind),
apply:
o.kind === CompletionItemKind.Snippet
? // codemirror requires an empty snippet space to be able to tab out of the completion
snippet((o.insertText ?? o.label) + '${}')
: undefined,
detail: o.detail,
})),
};
};

@@ -56,2 +56,5 @@ import {

},
'& .cm-snippetField': {
backgroundColor: settings.autoCompletionPanel.selectedColor,
},
'&.cm-focused': {

@@ -58,0 +61,0 @@ outline: 'none',

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc