From 687a0afa3ac155e97e399758db3f2c54a6383e19 Mon Sep 17 00:00:00 2001 From: Rob Steward Date: Wed, 2 Oct 2024 15:50:56 +0100 Subject: [PATCH 01/11] IntelliJ plugin misc fixes - Add language description - Add file template description - Make supported future versions open ended --- editor-plugin/intellij/build.gradle.kts | 14 +++++++++----- .../intellij/lsp/language/CypherLanguage.java | 8 +++++++- .../src/main/resources/META-INF/plugin.xml | 9 +++++++-- .../fileTemplates/Cypher File.cypher.html | 1 + 4 files changed, 24 insertions(+), 8 deletions(-) create mode 100644 editor-plugin/intellij/src/main/resources/fileTemplates/Cypher File.cypher.html diff --git a/editor-plugin/intellij/build.gradle.kts b/editor-plugin/intellij/build.gradle.kts index f7c1034a1..d5c3bcfc9 100644 --- a/editor-plugin/intellij/build.gradle.kts +++ b/editor-plugin/intellij/build.gradle.kts @@ -35,6 +35,15 @@ tasks { } } + runIde { + debugOptions { + enabled = false + port = 8000 + server = true + suspend = true + } + } + prepareSandbox { doFirst { exec { @@ -47,11 +56,6 @@ tasks { } } - patchPluginXml { - sinceBuild.set("242") - untilBuild.set("242.*") - } - signPlugin { certificateChain.set(System.getenv("CERTIFICATE_CHAIN")) privateKey.set(System.getenv("PRIVATE_KEY")) diff --git a/editor-plugin/intellij/src/main/java/org/neo4j/intellij/lsp/language/CypherLanguage.java b/editor-plugin/intellij/src/main/java/org/neo4j/intellij/lsp/language/CypherLanguage.java index 9e6f1b986..011e92305 100644 --- a/editor-plugin/intellij/src/main/java/org/neo4j/intellij/lsp/language/CypherLanguage.java +++ b/editor-plugin/intellij/src/main/java/org/neo4j/intellij/lsp/language/CypherLanguage.java @@ -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"; + } } diff --git a/editor-plugin/intellij/src/main/resources/META-INF/plugin.xml b/editor-plugin/intellij/src/main/resources/META-INF/plugin.xml index b4108751a..dd33c266b 100644 --- a/editor-plugin/intellij/src/main/resources/META-INF/plugin.xml +++ b/editor-plugin/intellij/src/main/resources/META-INF/plugin.xml @@ -1,6 +1,9 @@ org.neo4j.intellij.lsp.cypher-lsp-support + + + Cypher Lsp Support Neo4j Inc. @@ -17,11 +20,13 @@ + + /> \ No newline at end of file diff --git a/editor-plugin/intellij/src/main/resources/fileTemplates/Cypher File.cypher.html b/editor-plugin/intellij/src/main/resources/fileTemplates/Cypher File.cypher.html new file mode 100644 index 000000000..a899e0257 --- /dev/null +++ b/editor-plugin/intellij/src/main/resources/fileTemplates/Cypher File.cypher.html @@ -0,0 +1 @@ +This file template is used whenever you create a new Cypher file. \ No newline at end of file From 3fdd1687545d092b8bc113dd8e5c8ec0f46b6a43 Mon Sep 17 00:00:00 2001 From: Rob Steward Date: Fri, 21 Mar 2025 15:28:32 +0000 Subject: [PATCH 02/11] Use turbo for intellij plugin build --- .../intellij/.run/Run IDE with Plugin.run.xml | 24 ------------------ package-lock.json | 9 +++++++ package.json | 1 + .../intellij-extension}/.gitignore | 1 + .../intellij-extension}/LICENSE.md | 0 .../intellij-extension}/README.md | 0 .../intellij-extension}/build.gradle.kts | 4 +-- .../gradle/wrapper/gradle-wrapper.jar | Bin .../gradle/wrapper/gradle-wrapper.properties | 0 .../intellij-extension}/gradlew | 0 .../intellij-extension}/gradlew.bat | 0 packages/intellij-extension/package.json | 14 ++++++++++ .../intellij-extension}/settings.gradle.kts | 2 +- .../CypherLspServerSupportProvider.java | 0 .../intellij/lsp/language/CypherFileType.java | 0 .../intellij/lsp/language/CypherIcons.java | 0 .../intellij/lsp/language/CypherLanguage.java | 0 .../src/main/resources/META-INF/fileIcon.svg | 0 .../src/main/resources/META-INF/plugin.xml | 4 +-- .../main/resources/META-INF/pluginIcon.svg | 0 .../fileTemplates/Cypher File.cypher.ft | 0 .../fileTemplates/Cypher File.cypher.html | 0 turbo.json | 9 +++++++ 23 files changed, 39 insertions(+), 29 deletions(-) delete mode 100644 editor-plugin/intellij/.run/Run IDE with Plugin.run.xml rename {editor-plugin/intellij => packages/intellij-extension}/.gitignore (99%) rename {editor-plugin/intellij => packages/intellij-extension}/LICENSE.md (100%) rename {editor-plugin/intellij => packages/intellij-extension}/README.md (100%) rename {editor-plugin/intellij => packages/intellij-extension}/build.gradle.kts (86%) rename {editor-plugin/intellij => packages/intellij-extension}/gradle/wrapper/gradle-wrapper.jar (100%) rename {editor-plugin/intellij => packages/intellij-extension}/gradle/wrapper/gradle-wrapper.properties (100%) rename {editor-plugin/intellij => packages/intellij-extension}/gradlew (100%) rename {editor-plugin/intellij => packages/intellij-extension}/gradlew.bat (100%) create mode 100644 packages/intellij-extension/package.json rename {editor-plugin/intellij => packages/intellij-extension}/settings.gradle.kts (71%) rename {editor-plugin/intellij => packages/intellij-extension}/src/main/java/org/neo4j/intellij/lsp/cypherlspsupport/CypherLspServerSupportProvider.java (100%) rename {editor-plugin/intellij => packages/intellij-extension}/src/main/java/org/neo4j/intellij/lsp/language/CypherFileType.java (100%) rename {editor-plugin/intellij => packages/intellij-extension}/src/main/java/org/neo4j/intellij/lsp/language/CypherIcons.java (100%) rename {editor-plugin/intellij => packages/intellij-extension}/src/main/java/org/neo4j/intellij/lsp/language/CypherLanguage.java (100%) rename {editor-plugin/intellij => packages/intellij-extension}/src/main/resources/META-INF/fileIcon.svg (100%) rename {editor-plugin/intellij => packages/intellij-extension}/src/main/resources/META-INF/plugin.xml (92%) rename {editor-plugin/intellij => packages/intellij-extension}/src/main/resources/META-INF/pluginIcon.svg (100%) rename {editor-plugin/intellij => packages/intellij-extension}/src/main/resources/fileTemplates/Cypher File.cypher.ft (100%) rename {editor-plugin/intellij => packages/intellij-extension}/src/main/resources/fileTemplates/Cypher File.cypher.html (100%) diff --git a/editor-plugin/intellij/.run/Run IDE with Plugin.run.xml b/editor-plugin/intellij/.run/Run IDE with Plugin.run.xml deleted file mode 100644 index 7747a2940..000000000 --- a/editor-plugin/intellij/.run/Run IDE with Plugin.run.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - true - true - false - - - \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 27f343b87..422cafb6c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14024,6 +14024,10 @@ "resolved": "https://registry.npmjs.org/neo4j-driver-core/-/neo4j-driver-core-5.24.1.tgz", "integrity": "sha512-nPPAXnEypaE4HloM2x8GggF5YT7e+LpcEuyYt7ELuax25/SH7ZtdkemnH0voAVfqBwQXSWP9CFpPFznDOU6T5A==" }, + "node_modules/neo4j-for-intellij": { + "resolved": "packages/intellij-extension", + "link": true + }, "node_modules/neo4j-for-vscode": { "resolved": "packages/vscode-extension", "link": true @@ -20483,6 +20487,11 @@ "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, + "packages/intellij-extension": { + "name": "neo4j-for-intellij", + "version": "1.0.0", + "license": "Apache-2.0" + }, "packages/language-server": { "name": "@neo4j-cypher/language-server", "version": "2.0.0-next.17", diff --git a/package.json b/package.json index 520464d6f..b2e0844ed 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "prepare": "husky install", "build": "turbo run build", "build-vscode": "turbo run neo4j-for-vscode#build:dev", + "build-intellij": "turbo run build:intellij", "release": "turbo run build && npx changeset publish", "clean": "turbo run clean", "watch": "turbowatch ./turbowatch.ts", diff --git a/editor-plugin/intellij/.gitignore b/packages/intellij-extension/.gitignore similarity index 99% rename from editor-plugin/intellij/.gitignore rename to packages/intellij-extension/.gitignore index 0dc4237b2..1415216c5 100644 --- a/editor-plugin/intellij/.gitignore +++ b/packages/intellij-extension/.gitignore @@ -1,4 +1,5 @@ .gradle +.run build/ !gradle/wrapper/gradle-wrapper.jar !**/src/main/**/build/ diff --git a/editor-plugin/intellij/LICENSE.md b/packages/intellij-extension/LICENSE.md similarity index 100% rename from editor-plugin/intellij/LICENSE.md rename to packages/intellij-extension/LICENSE.md diff --git a/editor-plugin/intellij/README.md b/packages/intellij-extension/README.md similarity index 100% rename from editor-plugin/intellij/README.md rename to packages/intellij-extension/README.md diff --git a/editor-plugin/intellij/build.gradle.kts b/packages/intellij-extension/build.gradle.kts similarity index 86% rename from editor-plugin/intellij/build.gradle.kts rename to packages/intellij-extension/build.gradle.kts index d5c3bcfc9..2ee22e30b 100644 --- a/editor-plugin/intellij/build.gradle.kts +++ b/packages/intellij-extension/build.gradle.kts @@ -47,12 +47,12 @@ tasks { prepareSandbox { doFirst { exec { - commandLine("bash", "-c", "cd ../.. && npm run build && cp packages/language-server/dist/cypher-language-server.js ./editor-plugin/intellij") + commandLine("bash", "-c", "cd ../.. && npx turbo build && cp packages/language-server/dist/cypher-language-server.js ./packages/intellij-extension") } } from(".") { include("*.js") - into("cypher-lsp-support") + into("neo4j-for-intellij") } } diff --git a/editor-plugin/intellij/gradle/wrapper/gradle-wrapper.jar b/packages/intellij-extension/gradle/wrapper/gradle-wrapper.jar similarity index 100% rename from editor-plugin/intellij/gradle/wrapper/gradle-wrapper.jar rename to packages/intellij-extension/gradle/wrapper/gradle-wrapper.jar diff --git a/editor-plugin/intellij/gradle/wrapper/gradle-wrapper.properties b/packages/intellij-extension/gradle/wrapper/gradle-wrapper.properties similarity index 100% rename from editor-plugin/intellij/gradle/wrapper/gradle-wrapper.properties rename to packages/intellij-extension/gradle/wrapper/gradle-wrapper.properties diff --git a/editor-plugin/intellij/gradlew b/packages/intellij-extension/gradlew similarity index 100% rename from editor-plugin/intellij/gradlew rename to packages/intellij-extension/gradlew diff --git a/editor-plugin/intellij/gradlew.bat b/packages/intellij-extension/gradlew.bat similarity index 100% rename from editor-plugin/intellij/gradlew.bat rename to packages/intellij-extension/gradlew.bat diff --git a/packages/intellij-extension/package.json b/packages/intellij-extension/package.json new file mode 100644 index 000000000..839fad59a --- /dev/null +++ b/packages/intellij-extension/package.json @@ -0,0 +1,14 @@ +{ + "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:intellij": "./gradlew buildPlugin", + "clean": "./gradlew clean", + "run:intellij": "./gradlew runIde" + } +} diff --git a/editor-plugin/intellij/settings.gradle.kts b/packages/intellij-extension/settings.gradle.kts similarity index 71% rename from editor-plugin/intellij/settings.gradle.kts rename to packages/intellij-extension/settings.gradle.kts index 7e31865d6..83cb12b1c 100644 --- a/editor-plugin/intellij/settings.gradle.kts +++ b/packages/intellij-extension/settings.gradle.kts @@ -5,4 +5,4 @@ pluginManagement { } } -rootProject.name = "cypher-lsp-support" \ No newline at end of file +rootProject.name = "neo4j-for-intellij" \ No newline at end of file diff --git a/editor-plugin/intellij/src/main/java/org/neo4j/intellij/lsp/cypherlspsupport/CypherLspServerSupportProvider.java b/packages/intellij-extension/src/main/java/org/neo4j/intellij/lsp/cypherlspsupport/CypherLspServerSupportProvider.java similarity index 100% rename from editor-plugin/intellij/src/main/java/org/neo4j/intellij/lsp/cypherlspsupport/CypherLspServerSupportProvider.java rename to packages/intellij-extension/src/main/java/org/neo4j/intellij/lsp/cypherlspsupport/CypherLspServerSupportProvider.java diff --git a/editor-plugin/intellij/src/main/java/org/neo4j/intellij/lsp/language/CypherFileType.java b/packages/intellij-extension/src/main/java/org/neo4j/intellij/lsp/language/CypherFileType.java similarity index 100% rename from editor-plugin/intellij/src/main/java/org/neo4j/intellij/lsp/language/CypherFileType.java rename to packages/intellij-extension/src/main/java/org/neo4j/intellij/lsp/language/CypherFileType.java diff --git a/editor-plugin/intellij/src/main/java/org/neo4j/intellij/lsp/language/CypherIcons.java b/packages/intellij-extension/src/main/java/org/neo4j/intellij/lsp/language/CypherIcons.java similarity index 100% rename from editor-plugin/intellij/src/main/java/org/neo4j/intellij/lsp/language/CypherIcons.java rename to packages/intellij-extension/src/main/java/org/neo4j/intellij/lsp/language/CypherIcons.java diff --git a/editor-plugin/intellij/src/main/java/org/neo4j/intellij/lsp/language/CypherLanguage.java b/packages/intellij-extension/src/main/java/org/neo4j/intellij/lsp/language/CypherLanguage.java similarity index 100% rename from editor-plugin/intellij/src/main/java/org/neo4j/intellij/lsp/language/CypherLanguage.java rename to packages/intellij-extension/src/main/java/org/neo4j/intellij/lsp/language/CypherLanguage.java diff --git a/editor-plugin/intellij/src/main/resources/META-INF/fileIcon.svg b/packages/intellij-extension/src/main/resources/META-INF/fileIcon.svg similarity index 100% rename from editor-plugin/intellij/src/main/resources/META-INF/fileIcon.svg rename to packages/intellij-extension/src/main/resources/META-INF/fileIcon.svg diff --git a/editor-plugin/intellij/src/main/resources/META-INF/plugin.xml b/packages/intellij-extension/src/main/resources/META-INF/plugin.xml similarity index 92% rename from editor-plugin/intellij/src/main/resources/META-INF/plugin.xml rename to packages/intellij-extension/src/main/resources/META-INF/plugin.xml index dd33c266b..e8888374e 100644 --- a/editor-plugin/intellij/src/main/resources/META-INF/plugin.xml +++ b/packages/intellij-extension/src/main/resources/META-INF/plugin.xml @@ -1,10 +1,10 @@ - org.neo4j.intellij.lsp.cypher-lsp-support + org.neo4j.intellij.lsp.neo4j-for-intellij - Cypher Lsp Support + Neo4j for IntelliJ Neo4j Inc. diff --git a/editor-plugin/intellij/src/main/resources/META-INF/pluginIcon.svg b/packages/intellij-extension/src/main/resources/META-INF/pluginIcon.svg similarity index 100% rename from editor-plugin/intellij/src/main/resources/META-INF/pluginIcon.svg rename to packages/intellij-extension/src/main/resources/META-INF/pluginIcon.svg diff --git a/editor-plugin/intellij/src/main/resources/fileTemplates/Cypher File.cypher.ft b/packages/intellij-extension/src/main/resources/fileTemplates/Cypher File.cypher.ft similarity index 100% rename from editor-plugin/intellij/src/main/resources/fileTemplates/Cypher File.cypher.ft rename to packages/intellij-extension/src/main/resources/fileTemplates/Cypher File.cypher.ft diff --git a/editor-plugin/intellij/src/main/resources/fileTemplates/Cypher File.cypher.html b/packages/intellij-extension/src/main/resources/fileTemplates/Cypher File.cypher.html similarity index 100% rename from editor-plugin/intellij/src/main/resources/fileTemplates/Cypher File.cypher.html rename to packages/intellij-extension/src/main/resources/fileTemplates/Cypher File.cypher.html diff --git a/turbo.json b/turbo.json index 155d21df4..4778b73a6 100644 --- a/turbo.json +++ b/turbo.json @@ -6,6 +6,10 @@ "dependsOn": ["^build"], "outputMode": "new-only" }, + "build:intellij": { + "dependsOn": [], + "outputs": ["editor-plugin/intellij/build/**"] + }, "@neo4j-cypher/language-support#build": { "outputs": ["src/generated-parser/**", "dist/**"], "dependsOn": ["antlr4-c3#build"] @@ -30,6 +34,11 @@ "persistent": false, "dependsOn": ["build"] }, + "run:intellij": { + "cache": false, + "persistent": false, + "dependsOn": [] + }, "@neo4j-cypher/react-codemirror-playground#dev": { "outputs": [], "dependsOn": ["^build"], From f5390329632c936f05f93956f87e350906e89151 Mon Sep 17 00:00:00 2001 From: Rob Steward Date: Fri, 21 Mar 2025 16:03:10 +0000 Subject: [PATCH 03/11] update READMEs --- README.md | 1 + packages/intellij-extension/README.md | 35 ++++++++++++++++++++++++--- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b3781c540..54c4f047e 100644 --- a/README.md +++ b/README.md @@ -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. - [schema-poller](./packages/schema-poller/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. diff --git a/packages/intellij-extension/README.md b/packages/intellij-extension/README.md index fee563fc7..d025598ad 100644 --- a/packages/intellij-extension/README.md +++ b/packages/intellij-extension/README.md @@ -2,7 +2,36 @@ ## Build and run -Prerequisite: Java 21 +Run through the [prerequisites](../../CONTRIBUTING.md#building-the-project). -- Build the plugin via `./gradlew buildPlugin`. -- Choose the plugin's zip archive from `build/distributions/cypher-lsp-support-.zip` when installing it manually in IntelliJ +You can choose to build the plugin via `gradle`: + +``` +intellij-extension$ ./gradlew buildPlugin +``` + +Or you can use [`turbo`](https://turbo.build) from the project root: + +``` +cypher-language-support$ npx turbo build:intellij +``` + +## Manual testing + +If you want to test the plugin during a development workflow, you can spin up a temporary copy +of IntelliJ right from within the project. Simply run either the gradle target directly: + +``` +intellij-extension$ ./gradlew runIde +``` + +Or, from the project root: + +``` +cypher-language-support$ npx turbo run:intellij +``` + +## Installing the plugin + +From IntelliJ, open Settings > Plugins > (cog icon) > Install Plugin from disk, and browse to the jar file +located in `packages/intellij-extension/build/distributions`. \ No newline at end of file From 93c9d1ff7a3b247c608e2a3b3c3e640e1fe3af43 Mon Sep 17 00:00:00 2001 From: Rob Steward Date: Fri, 21 Mar 2025 16:36:46 +0000 Subject: [PATCH 04/11] Still haven't quite figured this out --- packages/intellij-extension/build.gradle.kts | 2 ++ turbo.json | 14 +++++++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/packages/intellij-extension/build.gradle.kts b/packages/intellij-extension/build.gradle.kts index 2ee22e30b..9dc53d02e 100644 --- a/packages/intellij-extension/build.gradle.kts +++ b/packages/intellij-extension/build.gradle.kts @@ -36,6 +36,8 @@ tasks { } runIde { + dependsOn(prepareSandbox) + debugOptions { enabled = false port = 8000 diff --git a/turbo.json b/turbo.json index 4778b73a6..7f39ed6f5 100644 --- a/turbo.json +++ b/turbo.json @@ -7,8 +7,13 @@ "outputMode": "new-only" }, "build:intellij": { - "dependsOn": [], - "outputs": ["editor-plugin/intellij/build/**"] + "dependsOn": ["build"], + "outputs": ["packages/intellij-extension/build/**"] + }, + "run:intellij": { + "cache": false, + "persistent": true, + "dependsOn": ["build:intellij"] }, "@neo4j-cypher/language-support#build": { "outputs": ["src/generated-parser/**", "dist/**"], @@ -34,11 +39,6 @@ "persistent": false, "dependsOn": ["build"] }, - "run:intellij": { - "cache": false, - "persistent": false, - "dependsOn": [] - }, "@neo4j-cypher/react-codemirror-playground#dev": { "outputs": [], "dependsOn": ["^build"], From b1c5bb5930965208652940b79b6ab0bbef3d3fed Mon Sep 17 00:00:00 2001 From: Rob Steward Date: Tue, 1 Apr 2025 10:01:54 +0100 Subject: [PATCH 05/11] Enforce gradle build ordering --- .gitignore | 47 ++++++++++++++++++- package.json | 2 +- packages/intellij-extension/build.gradle.kts | 45 +++++++++++++----- packages/intellij-extension/package.json | 6 +-- .../src/main/resources/META-INF/plugin.xml | 2 +- turbo.json | 18 +++---- 6 files changed, 92 insertions(+), 28 deletions(-) diff --git a/.gitignore b/.gitignore index 4aac7381c..28e75c5e6 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,49 @@ generated *.tsbuildinfo *.npmrc benchmarks.txt -.idea/ vite.config.ts.timestamp* -.wdio-vscode-service \ No newline at end of file +.wdio-vscode-service.gradle +.run + +## Gradle ## +!gradle/wrapper/gradle-wrapper.jar +!**/src/main/**/build/ +!**/src/test/**/build/ + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr +out/ +!**/src/main/**/out/ +!**/src/test/**/out/ +.intellijPlatform + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache +bin/ +!**/src/main/**/bin/ +!**/src/test/**/bin/ + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store + +### Javascript files +*.js diff --git a/package.json b/package.json index b2e0844ed..703947fe4 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "prepare": "husky install", "build": "turbo run build", "build-vscode": "turbo run neo4j-for-vscode#build:dev", - "build-intellij": "turbo run build:intellij", + "build-intellij": "turbo run neo4j-for-intellij#build", "release": "turbo run build && npx changeset publish", "clean": "turbo run clean", "watch": "turbowatch ./turbowatch.ts", diff --git a/packages/intellij-extension/build.gradle.kts b/packages/intellij-extension/build.gradle.kts index 9dc53d02e..46605db2c 100644 --- a/packages/intellij-extension/build.gradle.kts +++ b/packages/intellij-extension/build.gradle.kts @@ -35,29 +35,50 @@ tasks { } } - runIde { - dependsOn(prepareSandbox) + task("bundleServer") { + val outputFile = file("../language-server/dist/cypher-language-server.js") + val targetDir = file(".") - debugOptions { - enabled = false - port = 8000 - server = true - suspend = true - } - } + inputs.file(outputFile) + outputs.file(targetDir.resolve("cypher-language-server.js")) - prepareSandbox { - doFirst { + doLast { exec { - commandLine("bash", "-c", "cd ../.. && npx turbo build && cp packages/language-server/dist/cypher-language-server.js ./packages/intellij-extension") + workingDir = file("../language-server") + commandLine = listOf("bash", "-c", "npm run bundle") + } + + copy { + from(outputFile) + into(targetDir) } } + } + + prepareSandbox { + dependsOn("bundleServer") + from(".") { include("*.js") into("neo4j-for-intellij") } } + buildPlugin { + dependsOn(prepareSandbox) + } + + runIde { + dependsOn(buildPlugin, prepareSandbox) + + debugOptions { + enabled = false + port = 8000 + server = true + suspend = true + } + } + signPlugin { certificateChain.set(System.getenv("CERTIFICATE_CHAIN")) privateKey.set(System.getenv("PRIVATE_KEY")) diff --git a/packages/intellij-extension/package.json b/packages/intellij-extension/package.json index 839fad59a..f634689be 100644 --- a/packages/intellij-extension/package.json +++ b/packages/intellij-extension/package.json @@ -7,8 +7,8 @@ "license": "Apache-2.0", "preview": true, "scripts": { - "build:intellij": "./gradlew buildPlugin", - "clean": "./gradlew clean", - "run:intellij": "./gradlew runIde" + "build": "./gradlew -q buildPlugin", + "clean": "./gradlew -q clean", + "runIde": "./gradlew -q runIde" } } diff --git a/packages/intellij-extension/src/main/resources/META-INF/plugin.xml b/packages/intellij-extension/src/main/resources/META-INF/plugin.xml index e8888374e..85c19369d 100644 --- a/packages/intellij-extension/src/main/resources/META-INF/plugin.xml +++ b/packages/intellij-extension/src/main/resources/META-INF/plugin.xml @@ -2,7 +2,7 @@ org.neo4j.intellij.lsp.neo4j-for-intellij - + Neo4j for IntelliJ diff --git a/turbo.json b/turbo.json index 7f39ed6f5..8dc376780 100644 --- a/turbo.json +++ b/turbo.json @@ -6,15 +6,6 @@ "dependsOn": ["^build"], "outputMode": "new-only" }, - "build:intellij": { - "dependsOn": ["build"], - "outputs": ["packages/intellij-extension/build/**"] - }, - "run:intellij": { - "cache": false, - "persistent": true, - "dependsOn": ["build:intellij"] - }, "@neo4j-cypher/language-support#build": { "outputs": ["src/generated-parser/**", "dist/**"], "dependsOn": ["antlr4-c3#build"] @@ -50,6 +41,15 @@ "cache": false, "persistent": true }, + "neo4j-for-intellij#build": { + "outputs": ["packages/intellij-extension/build/**"], + "dependsOn": ["@neo4j-cypher/language-server#build"] + }, + "neo4j-for-intellij#runIde": { + "cache": false, + "outputs": [], + "dependsOn": ["neo4j-for-intellij#build"] + }, "benchmark": { "cache": false } From c737d5d8ee918f4e9beb45cadc2d76d8ebe533b5 Mon Sep 17 00:00:00 2001 From: Rob Steward Date: Tue, 1 Apr 2025 14:06:47 +0100 Subject: [PATCH 06/11] Add Java 21 setup to github actions --- .github/workflows/archive-vscode-artifacts.yaml | 5 +++++ .github/workflows/benchmark.yaml | 5 +++++ .github/workflows/ci.yaml | 15 +++++++++++++++ .github/workflows/deploy-demo.yml | 5 +++++ .github/workflows/publish-vscode-extension.yaml | 5 +++++ 5 files changed, 35 insertions(+) diff --git a/.github/workflows/archive-vscode-artifacts.yaml b/.github/workflows/archive-vscode-artifacts.yaml index a4f634fc0..b22ab1f2d 100644 --- a/.github/workflows/archive-vscode-artifacts.yaml +++ b/.github/workflows/archive-vscode-artifacts.yaml @@ -19,6 +19,11 @@ jobs: - name: Setup antlr4 uses: ./.github/actions/setup-antlr4 + - uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '21' + - name: Install dependencies with frozen lock file and generate parser run: npm ci diff --git a/.github/workflows/benchmark.yaml b/.github/workflows/benchmark.yaml index 4e8fe61a9..a68aae7b0 100644 --- a/.github/workflows/benchmark.yaml +++ b/.github/workflows/benchmark.yaml @@ -16,6 +16,11 @@ jobs: - name: Setup antlr4 uses: ./.github/actions/setup-antlr4 + - uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '21' + - name: Install dependencies with frozen lock file and generate parser run: npm ci diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index ac9fd45ec..c9c37e187 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -20,6 +20,11 @@ jobs: - name: Setup antlr4 uses: ./.github/actions/setup-antlr4 + - uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '21' + - name: Install dependencies with frozen lock file and generate parser run: npm ci @@ -45,6 +50,11 @@ jobs: - name: Setup antlr4 uses: ./.github/actions/setup-antlr4 + - uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '21' + - name: Install dependencies with frozen lock file and generate parser run: npm ci @@ -63,6 +73,11 @@ jobs: - name: Setup antlr4 uses: ./.github/actions/setup-antlr4 + - uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '21' + - name: Install dependencies run: npm ci diff --git a/.github/workflows/deploy-demo.yml b/.github/workflows/deploy-demo.yml index 80fc17c0e..61b5e7c9f 100644 --- a/.github/workflows/deploy-demo.yml +++ b/.github/workflows/deploy-demo.yml @@ -39,6 +39,11 @@ jobs: - name: Setup antlr4 uses: ./.github/actions/setup-antlr4 + - uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '21' + - name: Install dependencies with frozen lock file and generate parser run: npm ci diff --git a/.github/workflows/publish-vscode-extension.yaml b/.github/workflows/publish-vscode-extension.yaml index 85649beb8..14e97909f 100644 --- a/.github/workflows/publish-vscode-extension.yaml +++ b/.github/workflows/publish-vscode-extension.yaml @@ -27,6 +27,11 @@ jobs: - name: Setup antlr4 uses: ./.github/actions/setup-antlr4 + - uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '21' + - name: Install dependencies with frozen lock file run: npm ci From 115d7cbfef544434df7f4dd760163a4031c1a659 Mon Sep 17 00:00:00 2001 From: Rob Steward Date: Wed, 2 Apr 2025 09:34:19 +0100 Subject: [PATCH 07/11] update README --- packages/intellij-extension/README.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/intellij-extension/README.md b/packages/intellij-extension/README.md index d025598ad..74b9f2b1e 100644 --- a/packages/intellij-extension/README.md +++ b/packages/intellij-extension/README.md @@ -4,34 +4,34 @@ Run through the [prerequisites](../../CONTRIBUTING.md#building-the-project). -You can choose to build the plugin via `gradle`: +You can build the plugin from the project root using [`turbo`](https://turbo.build): ``` -intellij-extension$ ./gradlew buildPlugin +$ npx turbo neo4j-for-intellij#build ``` -Or you can use [`turbo`](https://turbo.build) from the project root: +`gradle` is also an option (and can be used from within IntelliJ): ``` -cypher-language-support$ npx turbo build:intellij +$ cd packages/intellij-extension && ./gradlew buildPlugin ``` -## Manual testing +## Develop and test If you want to test the plugin during a development workflow, you can spin up a temporary copy -of IntelliJ right from within the project. Simply run either the gradle target directly: +of IntelliJ that runs with a freshly built version enabled by default: ``` -intellij-extension$ ./gradlew runIde +$ npx turbo neo4j-for-intellij#runIde ``` -Or, from the project root: +...this target also exists in `gradle`: ``` -cypher-language-support$ npx turbo run:intellij +$ cd packages/intellij-extension && ./gradlew runIde ``` -## Installing the plugin +## 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`. \ No newline at end of file From 3588430f83d80c86bbbbe75a1e1d91759e369f3e Mon Sep 17 00:00:00 2001 From: Rob Steward Date: Tue, 15 Apr 2025 13:34:10 +0100 Subject: [PATCH 08/11] scale back .gitignore changes --- .gitignore | 40 +--------------------------------------- 1 file changed, 1 insertion(+), 39 deletions(-) diff --git a/.gitignore b/.gitignore index 28e75c5e6..56e9d7c07 100644 --- a/.gitignore +++ b/.gitignore @@ -18,48 +18,10 @@ generated *.npmrc benchmarks.txt vite.config.ts.timestamp* -.wdio-vscode-service.gradle -.run - -## Gradle ## -!gradle/wrapper/gradle-wrapper.jar -!**/src/main/**/build/ -!**/src/test/**/build/ ### IntelliJ IDEA ### .idea *.iws *.iml *.ipr -out/ -!**/src/main/**/out/ -!**/src/test/**/out/ -.intellijPlatform - -### Eclipse ### -.apt_generated -.classpath -.factorypath -.project -.settings -.springBeans -.sts4-cache -bin/ -!**/src/main/**/bin/ -!**/src/test/**/bin/ - -### NetBeans ### -/nbproject/private/ -/nbbuild/ -/dist/ -/nbdist/ -/.nb-gradle/ - -### VS Code ### -.vscode/ - -### Mac OS ### -.DS_Store - -### Javascript files -*.js +.intellijPlatform \ No newline at end of file From 0c547df9891ca8c6a45adebcdc371bbe2458dec0 Mon Sep 17 00:00:00 2001 From: Nacho Cordon Date: Wed, 21 May 2025 13:47:02 +0100 Subject: [PATCH 09/11] Removes turbo wiring from the intellij plugin, uses pnpm --- packages/intellij-extension/build.gradle.kts | 20 -------------------- packages/intellij-extension/package.json | 8 +++++++- packages/language-server/package.json | 2 +- packages/react-codemirror/package.json | 2 +- pnpm-lock.yaml | 17 +++++++++++++++-- pnpm-workspace.yaml | 1 + 6 files changed, 25 insertions(+), 25 deletions(-) diff --git a/packages/intellij-extension/build.gradle.kts b/packages/intellij-extension/build.gradle.kts index e6d07771a..ee40a3803 100644 --- a/packages/intellij-extension/build.gradle.kts +++ b/packages/intellij-extension/build.gradle.kts @@ -35,27 +35,7 @@ tasks { } } - task("bundleServer") { - val outputFile = file("../language-server/dist/cypher-language-server.js") - val targetDir = file(".") - - inputs.file(outputFile) - outputs.file(targetDir.resolve("cypher-language-server.js")) - - doLast { - exec { - commandLine("bash", "-c", "cd ../.. && pnpm build && cp packages/language-server/dist/cypher-language-server.js ./editor-plugin/intellij") - } - - copy { - from(outputFile) - into(targetDir) - } - } - } - prepareSandbox { - dependsOn("bundleServer") from(".") { include("*.js") diff --git a/packages/intellij-extension/package.json b/packages/intellij-extension/package.json index f634689be..f1bdddaa9 100644 --- a/packages/intellij-extension/package.json +++ b/packages/intellij-extension/package.json @@ -7,8 +7,14 @@ "license": "Apache-2.0", "preview": true, "scripts": { - "build": "./gradlew -q buildPlugin", + "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:" } } diff --git a/packages/language-server/package.json b/packages/language-server/package.json index c11622541..ecce0328c 100644 --- a/packages/language-server/package.json +++ b/packages/language-server/package.json @@ -53,6 +53,6 @@ }, "devDependencies": { "@types/lodash.debounce": "^4.0.9", - "copyfiles": "^2.4.1" + "copyfiles": "catalog:" } } diff --git a/packages/react-codemirror/package.json b/packages/react-codemirror/package.json index b2d695f13..6aaf39cc2 100644 --- a/packages/react-codemirror/package.json +++ b/packages/react-codemirror/package.json @@ -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", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index dbe05c7fa..b5b082507 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -6,6 +6,9 @@ settings: catalogs: default: + copyfiles: + specifier: ^2.4.1 + version: 2.4.1 neo4j-driver: specifier: 5.12.0 version: 5.12.0 @@ -69,6 +72,16 @@ importers: specifier: ^2.1.9 version: 2.1.9(@types/node@22.15.3)(jsdom@24.1.3) + packages/intellij-extension: + dependencies: + '@neo4j-cypher/language-server': + specifier: workspace:* + version: link:../language-server + devDependencies: + copyfiles: + specifier: 'catalog:' + version: 2.4.1 + packages/language-server: dependencies: '@neo4j-cypher/language-support': @@ -100,7 +113,7 @@ importers: specifier: ^4.0.9 version: 4.0.9 copyfiles: - specifier: ^2.4.1 + specifier: 'catalog:' version: 2.4.1 packages/language-support: @@ -226,7 +239,7 @@ importers: specifier: ^4.3.1 version: 4.3.1(vite@4.5.11(@types/node@22.15.3)) copyfiles: - specifier: ^2.4.1 + specifier: 'catalog:' version: 2.4.1 jsdom: specifier: ^24.1.1 diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index afb0a7c63..0ec9115b1 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -4,3 +4,4 @@ packages: catalog: 'neo4j-driver': '5.12.0' + 'copyfiles': '^2.4.1' From 9f545f14d2bb2c9e027f588b1a40ddc631e059d3 Mon Sep 17 00:00:00 2001 From: Nacho Cordon Date: Wed, 21 May 2025 13:56:01 +0100 Subject: [PATCH 10/11] Adds java to the setup action --- .github/actions/setup-and-build/action.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/actions/setup-and-build/action.yaml b/.github/actions/setup-and-build/action.yaml index 7decfdb71..c88db58d1 100644 --- a/.github/actions/setup-and-build/action.yaml +++ b/.github/actions/setup-and-build/action.yaml @@ -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 From ee97dc2ca2d3bb0c91a1f41724f8ca535bda87ce Mon Sep 17 00:00:00 2001 From: Nacho Cordon Date: Wed, 21 May 2025 14:05:36 +0100 Subject: [PATCH 11/11] Removes intellij artifacts from the ci cache --- .github/actions/setup-and-build/action.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/actions/setup-and-build/action.yaml b/.github/actions/setup-and-build/action.yaml index c88db58d1..2a988908d 100644 --- a/.github/actions/setup-and-build/action.yaml +++ b/.github/actions/setup-and-build/action.yaml @@ -57,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