
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
@neo4j-cypher/language-server
Advanced tools
A language server wrapper for the @neo4j-cypher/language-support
package.
You can install the language server using npm:
npm i -g @neo4j-cypher/language-server
Once installed, you can run the language server using cypher-language-server --stdio
.
Below you can find a few examples in Typescript on how to send messages to that server.
For integrations with other editors, see Integrating with other editors.
import * as child_process from 'child_process';
let lspProcess = child_process.spawn('cypher-language-server', ['--ipc']);
let messageId = 1;
function send(method: string, params: object) {
let message = {
jsonrpc: '2.0',
id: messageId++,
method: method,
params: params,
};
lspProcess.send(message);
}
function initialize() {
send('initialize', {
rootPath: process.cwd(),
processId: process.pid,
capabilities: {
/* ... */
},
});
}
lspProcess.on('message', function (json) {
console.log(json);
});
initialize();
import * as net from 'net';
import * as child_process from 'child_process';
import * as rpc from 'vscode-jsonrpc/node';
let messageId = 1;
let reader: rpc.SocketMessageReader = null;
let writer: rpc.SocketMessageWriter = null;
function send(method: string, params: object) {
let message = {
jsonrpc: '2.0',
id: messageId++,
method: method,
params: params,
};
writer.write(message);
}
function initialize() {
send('initialize', {
rootPath: process.cwd(),
processId: process.pid,
capabilities: {
textDocument: {
/* ... */
},
workspace: {
/* ... */
},
},
});
}
const server = net.createServer((socket: net.Socket) => {
server.close();
reader = new rpc.SocketMessageReader(socket);
reader.listen((data) => {
console.log(data);
});
writer = new rpc.SocketMessageWriter(socket);
initialize();
});
server.listen(3000, () => {
child_process.spawn('cypher-language-server', ['--socket=3000']);
});
import * as child_process from 'child_process';
import * as rpc from 'vscode-jsonrpc/node';
let lspProcess = child_process.spawn('cypher-language-server', ['--stdio']);
let messageId = 1;
const reader = new rpc.StreamMessageReader(lspProcess.stdout);
const writer = new rpc.StreamMessageWriter(lspProcess.stdin);
function send(method: string, params: object) {
let message = {
jsonrpc: '2.0',
id: messageId++,
method: method,
params: params,
};
writer.write(message);
}
function initialize() {
send('initialize', {
rootPath: process.cwd(),
processId: process.pid,
capabilities: {
/* ... */
},
});
}
reader.listen((data) => {
console.log(data);
});
initialize();
As of version 8.0.1, lsp-mode
provides built in support for the cypher-language-server
. lsp-mode
will connect to a cypher-language-server
for any file ending with .cypher
, or if you're currently in a cypher-mode
.
If the cypher-language-server
is not already installed, you can install the server by running M-x lsp-install-server RET
and then selecting cypher-ls
from the list.
(with-eval-after-load 'lsp-mode
(add-to-list 'lsp-language-id-configuration
;; '(cypher-mode . "cypher")) ;; use this if you have a cypher-mode installed
'(".*cypher" . "cypher")) ;; otherwise, you can simply match on file ending with a regex
(lsp-register-client
(make-lsp-client :new-connection (lsp-stdio-connection '("cypher-language-server" "--stdio"))
:activation-fn (lsp-activate-on "cypher")
:server-id 'cypher)))
If you want semantic highlighting, remember to set
(setq lsp-semantic-tokens-enable t)
As of Emacs 29, eglot
is built in. In eglot
, a language server needs to be associate with a specific major mode. Install any available cypher-mode
in order to get the server running with eglot
. Note also that eglot
does not support semantic highlighting.
(add-to-list 'Eglot-server-programs '((cypher-mode) "cypher-language-server" "--stdio")))
There is built-in support for the cypher-language-server
in the plugin (cypher_ls).
Activate the language server support in your config file.
require('lspconfig').cypher_ls.setup{}
The language server is registered for cypher files. To make neovim aware of this type, add a file to your neovim-configuration-path/ftdetect (if it does not exist, create one) folder, e.g. cypher.vim, defining the file suffix and file type.
au BufRead,BufNewFile *.cypher set filetype=cypher
FAQs
Cypher Language Server
The npm package @neo4j-cypher/language-server receives a total of 147 weekly downloads. As such, @neo4j-cypher/language-server popularity was classified as not popular.
We found that @neo4j-cypher/language-server demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.