Skip to content

Integrate IntelliJ plugin into pnpm 🚀 #420

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions .github/actions/setup-and-build/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ runs:
echo -e "#bin/bash\njava -jar $PWD/antlr4.jar \$@" > $HOME/.local/bin/antlr4
chmod a+x $HOME/.local/bin/antlr4

- name: Setup java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'

- name: Setup pnpm
uses: pnpm/action-setup@v4

Expand Down Expand Up @@ -51,8 +57,10 @@ runs:
shell: bash
env:
NODE_OPTIONS: '--max_old_space_size=4096'
run: pnpm build

run: |
pnpm build
rm -rf packages/intellij-extension/build

- name: Cache build output
if: steps.restore-cache.outputs.cache-hit != 'true'
uses: actions/cache@v4
Expand Down
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ generated
*.tsbuildinfo
*.npmrc
benchmarks.txt
.idea/
vite.config.ts.timestamp*

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
.intellijPlatform
.wdio-vscode-service
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ The project comprises several packages:
- [language-support](./packages/language-support/README.md) - The core library implementing the language support features.
- [language-server](./packages/language-server/README.md) - The language server wrapper for the `language-support` package.
- [vscode-extension](./packages/vscode-extension/README.md) - The Neo4j VS Code extension which bundles the `language-server`
- [intellij-extension](./packages/intellij-extension/README.md) - The Neo4j Intellij plugin which bundles the `language-server`
- [react-codemirror](./packages/react-codemirror/README.md) - A set of [codemirror6](https://codemirror.net/) cypher language support plugins and a react wrapper.
- [react-codemirror-playground](./packages/react-codemirror-playground/README.md) - A playground for the codemirror integration.
- [query-tools](./packages/query-tools/README.md) - An internal package we use to manage the Neo4j connection and keep the schema (procedure names, labels, database names, etc.) up to date in the language server.
Expand Down
24 changes: 0 additions & 24 deletions editor-plugin/intellij/.run/Run IDE with Plugin.run.xml

This file was deleted.

8 changes: 0 additions & 8 deletions editor-plugin/intellij/README.md

This file was deleted.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"prepare": "husky install",
"build": "pnpm --recursive build",
"build-vscode": "pnpm --filter='neo4j-for-vscode...' build",
"build-intellij": "pnpm --filter='intellij-extension...' build",
"dev-codemirror": "pnpm --recursive --parallel --filter='@neo4j-cypher/react-codemirror-playground...' dev",
"dev-vscode": "pnpm --recursive --parallel --filter='neo4j-for-vscode...' dev",
"release": "pnpm build && pnpm publish -r --tag next --access=public",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.gradle
.run
build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
Expand Down
37 changes: 37 additions & 0 deletions packages/intellij-extension/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Neo4j Cypher LSP support for IntelliJ

## Build and run

Run through the [prerequisites](../../CONTRIBUTING.md#building-the-project).

You can build the plugin from the project root using [`turbo`](https://turbo.build):

```
$ npx turbo neo4j-for-intellij#build
```

`gradle` is also an option (and can be used from within IntelliJ):

```
$ cd packages/intellij-extension && ./gradlew buildPlugin
```

## Develop and test

If you want to test the plugin during a development workflow, you can spin up a temporary copy
of IntelliJ that runs with a freshly built version enabled by default:

```
$ npx turbo neo4j-for-intellij#runIde
```

...this target also exists in `gradle`:

```
$ cd packages/intellij-extension && ./gradlew runIde
```

## Installing the plugin manually

From IntelliJ, open Settings > Plugins > (cog icon) > Install Plugin from disk, and browse to the jar file
located in `packages/intellij-extension/build/distributions`.
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,26 @@ tasks {
}

prepareSandbox {
doFirst {
exec {
commandLine("bash", "-c", "cd ../.. && pnpm build && cp packages/language-server/dist/cypher-language-server.js ./editor-plugin/intellij")
}
}

from(".") {
include("*.js")
into("cypher-lsp-support")
into("neo4j-for-intellij")
}
}

patchPluginXml {
sinceBuild.set("242")
untilBuild.set("242.*")
buildPlugin {
dependsOn(prepareSandbox)
}

runIde {
dependsOn(buildPlugin, prepareSandbox)

debugOptions {
enabled = false
port = 8000
server = true
suspend = true
}
}

signPlugin {
Expand Down
File renamed without changes.
20 changes: 20 additions & 0 deletions packages/intellij-extension/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "neo4j-for-intellij",
"version": "1.0.0",
"description": "Highlighting, completions and more for Neo4j Cypher in IntelliJ",
"publisher": "neo4j-extensions",
"author": "Neo4j Inc.",
"license": "Apache-2.0",
"preview": true,
"scripts": {
"build": "copyfiles -u 3 ../language-server/dist/cypher-language-server.js . && ./gradlew -q buildPlugin",
"clean": "./gradlew -q clean",
"runIde": "./gradlew -q runIde"
},
"dependencies": {
"@neo4j-cypher/language-server": "workspace:*"
},
"devDependencies": {
"copyfiles": "catalog:"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ pluginManagement {
}
}

rootProject.name = "cypher-lsp-support"
rootProject.name = "neo4j-for-intellij"
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
package org.neo4j.intellij.lsp.language;

import com.intellij.lang.Language;
import org.jetbrains.annotations.NotNull;

public class CypherLanguage extends Language {

public static final CypherLanguage INSTANCE = new CypherLanguage();

private CypherLanguage() {
super("Cypher");
}

@Override
public @NotNull String getDisplayName() {
return "Cypher";
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
<idea-plugin>
<id>org.neo4j.intellij.lsp.cypher-lsp-support</id>
<id>org.neo4j.intellij.lsp.neo4j-for-intellij</id>

<name>Cypher Lsp Support</name>
<!-- see https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html -->
<idea-version since-build="242.23339"/>

<name>Neo4j for IntelliJ</name>

<vendor url="https://www.neo4j.com">Neo4j Inc.</vendor>

Expand All @@ -17,11 +20,13 @@
<extensions defaultExtensionNs="com.intellij">
<platform.lsp.serverSupportProvider
implementation="org.neo4j.intellij.lsp.cypherlspsupport.CypherLspServerSupportProvider"/>

<fileType
name="Cypher File"
language="Cypher"
implementationClass="org.neo4j.intellij.lsp.language.CypherFileType"
extensions="cypher"
fieldName="INSTANCE"
language="Cypher"
extensions="cypher"/>
/>
</extensions>
</idea-plugin>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<font face="verdana" size="-1">This file template is used whenever you create a new Cypher file.</font>
2 changes: 1 addition & 1 deletion packages/language-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,6 @@
},
"devDependencies": {
"@types/lodash.debounce": "^4.0.9",
"copyfiles": "^2.4.1"
"copyfiles": "catalog:"
}
}
2 changes: 1 addition & 1 deletion packages/react-codemirror/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"@types/react": "^18.0.28",
"@types/react-dom": "^18.0.11",
"@vitejs/plugin-react": "^4.3.1",
"copyfiles": "^2.4.1",
"copyfiles": "catalog:",
"jsdom": "^24.1.1",
"lodash": "^4.17.21",
"playwright": "^1.51.1",
Expand Down
17 changes: 15 additions & 2 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ packages:

catalog:
'neo4j-driver': '5.12.0'
'copyfiles': '^2.4.1'