Skip to content
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

Dev #174

Merged
merged 54 commits into from
Oct 28, 2024
Merged

Dev #174

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
ec4dc21
wip: opens diff with correct indent, todo: show the diff as changes i…
MarcMcIntosh Sep 6, 2024
b17aeb2
wip: add in file diff viewer.
MarcMcIntosh Sep 6, 2024
1851a99
checkout diff code from v1.2.17
MarcMcIntosh Sep 9, 2024
69721d8
wip: render diff
MarcMcIntosh Sep 9, 2024
db1d306
fix: adjusted description text of vector database
alashchev17 Sep 11, 2024
2da8bc9
fix: apply diff on tab press.
MarcMcIntosh Sep 11, 2024
af203dd
ci: use the main branch for the lsp.
MarcMcIntosh Sep 11, 2024
7eddf1c
refactor: remove unused code.
MarcMcIntosh Sep 11, 2024
626b2ce
diffs: indent the code
MarcMcIntosh Sep 11, 2024
fcf90c9
fix: refact-lsp branch for CI change
alashchev17 Sep 11, 2024
8ffcabd
fix: set osr to true so that pressing tab to accept diff works.
MarcMcIntosh Sep 11, 2024
7a2f633
ci: update version
MarcMcIntosh Sep 11, 2024
fb1c62f
Revert "ci: update version"
MarcMcIntosh Sep 11, 2024
bf2b60d
ci: allow branch names to have a slash
MarcMcIntosh Sep 11, 2024
4816e73
ci: use the main lsp branch
MarcMcIntosh Sep 11, 2024
5faef61
Merge pull request #172 from smallcloudai/vecdb-description-fix
alashchev17 Sep 11, 2024
7877727
Merge pull request #173 from smallcloudai/ci/branch-slash
MarcMcIntosh Sep 11, 2024
97f74be
Merge pull request #171 from smallcloudai/diff-paste
MarcMcIntosh Sep 11, 2024
c57a304
fix: don't open browser when clicking a file link
MarcMcIntosh Sep 12, 2024
d4c964a
fix: error when open a new chat without a snippet / file open.
MarcMcIntosh Sep 12, 2024
bf91157
notes: add notes about osr
MarcMcIntosh Sep 13, 2024
f39e92e
update version 1.4.2
MarcMcIntosh Sep 13, 2024
6b591fd
fix: resolved CSS cursor and webview's cursor states conflict
alashchev17 Sep 13, 2024
19439cc
Merge pull request #176 from smallcloudai/cursor-flickering-fix
MarcMcIntosh Sep 13, 2024
fc3b2b5
feat: documentation for refact-chat-js & refact-intellij integration
alashchev17 Sep 17, 2024
0ab2d42
Merge branch 'dev' of https://github.com/smallcloudai/refact-intellij…
alashchev17 Sep 17, 2024
5041954
fix byok generation file
reymondzzzz Oct 3, 2024
90c2ae2
feat: active doc support
alashchev17 Oct 2, 2024
db016f5
notify to discord
oxyplay Oct 3, 2024
8624d3d
fix byok opening config
reymondzzzz Oct 4, 2024
575add9
Merge branch 'main' into dev
reymondzzzz Oct 4, 2024
998b933
new gradle
reymondzzzz Oct 7, 2024
2f16cfb
ci fixes
reymondzzzz Oct 18, 2024
63e2443
remove rudiment code
reymondzzzz Oct 18, 2024
e2b28c8
fix incorrect plugin version
reymondzzzz Oct 22, 2024
31a428e
wip: 📍 start adding json parsers for new events.
MarcMcIntosh Oct 11, 2024
367ad9a
feat(📍events): add json parsers.
MarcMcIntosh Oct 14, 2024
d828e5b
refactor(📍events): naming things better.
MarcMcIntosh Oct 14, 2024
6fd632b
wip(📍): add handler for applying patches.
MarcMcIntosh Oct 15, 2024
e326f44
wip(📍 show): add event handler for show, todo: diff.
MarcMcIntosh Oct 15, 2024
375c417
wip(📍): open file, to fix: adding the diff
MarcMcIntosh Oct 16, 2024
cb2b297
feat(📍): add diff to file
MarcMcIntosh Oct 16, 2024
3dcd6bb
feat(📍): animate diffs 🌈
MarcMcIntosh Oct 16, 2024
95e94ab
refactor(📍): move duplicated code to dedicated methods.
MarcMcIntosh Oct 16, 2024
395976c
wip(📍): add handler for applying patches.
MarcMcIntosh Oct 15, 2024
2c7be22
feat(📍): animate diffs 🌈
MarcMcIntosh Oct 16, 2024
e412c7a
fix(chat href): omit opening `http://refactai/index.html` in a browser.
MarcMcIntosh Oct 21, 2024
b49cee8
ci: EAP 1.4.3, pin messages support.
MarcMcIntosh Oct 22, 2024
6406f6a
fix(rainbow): stop rainbow animation when showing a diff
MarcMcIntosh Oct 23, 2024
5779594
chore: remove println
MarcMcIntosh Oct 23, 2024
adfc86d
return login popup message
reymondzzzz Oct 25, 2024
abffa89
fix: windows paths sanitization
alashchev17 Oct 25, 2024
06b492f
fix: '\\?\\' prefix handling
alashchev17 Oct 25, 2024
11cf255
add notification if jcef didn't start
reymondzzzz Oct 27, 2024
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
17 changes: 9 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
name: refact-chat-js-latest
path: ./src/main/resources/webview/dist

- uses: convictional/[email protected].1
- uses: convictional/[email protected].5
name: "Build refact-lsp"
with:
owner: smallcloudai
Expand All @@ -63,20 +63,22 @@ jobs:
github_token: ${{secrets.GITHUB_TOKEN}}
workflow: build.yml
repo: smallcloudai/refact-lsp
name_is_regexp: true
name: dist-*
branch: ${{ steps.setupvars.outputs.lsp_version }}
path: ./src/main/resources/bin


# Validate wrapper
- name: Gradle Wrapper Validation
uses: gradle/wrapper-validation-action@v3
uses: gradle/actions/wrapper-validation@v3

# Setup Java 11 environment for the next steps
# Setup Java 17 environment for the next steps
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 11
java-version: 17

# Set environment variables
- name: Export Properties
Expand All @@ -85,7 +87,7 @@ jobs:
run: |
echo "pluginVerifierHomeDir=~/.pluginVerifier" >> $GITHUB_OUTPUT
./gradlew properties --console=plain -q
./gradlew listProductsReleases # prepare list of IDEs for Plugin Verifier
./gradlew printProductsReleases # prepare list of IDEs for Plugin Verifier

# Run tests
- name: Run Tests
Expand All @@ -108,11 +110,10 @@ jobs:

# Run Verify Plugin task and IntelliJ Plugin Verifier tool
- name: Run Plugin Verification tasks
run: ./gradlew runPluginVerifier -Dplugin.verifier.home.dir=${{ steps.properties.outputs.pluginVerifierHomeDir }}
run: ./gradlew verifyPlugin -Dplugin.verifier.home.dir=${{ steps.properties.outputs.pluginVerifierHomeDir }}

# Collect Plugin Verifier Result
- name: Collect Plugin Verifier Result
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: pluginVerifier-result
Expand All @@ -131,7 +132,7 @@ jobs:

# Store already-built plugin as an artifact for downloading
- name: Upload artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ${{ steps.artifact.outputs.filename }}
path: ./build/distributions/content/*/*
26 changes: 14 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ jobs:
with:
fetch-depth: 0

# Setup Java 17 environment for the next steps
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 17

- name: Set env CHANNEL
shell: bash
id: setupvars
Expand Down Expand Up @@ -68,7 +75,7 @@ jobs:
name: refact-chat-js-latest
path: ./src/main/resources/webview/dist

- uses: convictional/[email protected].1
- uses: convictional/[email protected].5
name: "Build refact-lsp"
with:
owner: smallcloudai
Expand All @@ -84,19 +91,14 @@ jobs:
github_token: ${{secrets.GITHUB_TOKEN}}
workflow: build.yml
repo: smallcloudai/refact-lsp
name_is_regexp: true
name: dist-*
branch: ${{ steps.setupvars.outputs.lsp_version }}
path: ./src/main/resources/bin

# Validate wrapper
- name: Gradle Wrapper Validation
uses: gradle/wrapper-validation-action@v3

# Setup Java 11 environment for the next steps
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 11
uses: gradle/actions/wrapper-validation@v3

# Set environment variables
- name: Export Properties
Expand All @@ -105,7 +107,7 @@ jobs:
run: |
echo "pluginVerifierHomeDir=~/.pluginVerifier" >> $GITHUB_OUTPUT
./gradlew properties --console=plain -q
./gradlew listProductsReleases # prepare list of IDEs for Plugin Verifier
./gradlew printProductsReleases # prepare list of IDEs for Plugin Verifier

# Run tests
- name: Run Tests
Expand All @@ -128,7 +130,7 @@ jobs:

# Run Verify Plugin task and IntelliJ Plugin Verifier tool
- name: Run Plugin Verification tasks
run: ./gradlew runPluginVerifier -Dplugin.verifier.home.dir=${{ steps.properties.outputs.pluginVerifierHomeDir }}
run: ./gradlew verifyPlugin -Dplugin.verifier.home.dir=${{ steps.properties.outputs.pluginVerifierHomeDir }}

# Collect Plugin Verifier Result
- name: Collect Plugin Verifier Result
Expand All @@ -151,7 +153,7 @@ jobs:

# Store already-built plugin as an artifact for downloading
- name: Upload artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ${{ steps.artifact.outputs.filename }}
path: ./build/distributions/content/*/*
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ bin/
/nbproject/private/
/nbbuild/
/dist/
.intellijPlatform/
/nbdist/
/.nb-gradle/

Expand Down
16 changes: 16 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# refact-intellij & refact-chat-js
### Instructions for React Chat build for JetBrains IDEs (to run locally)
1. Clone the branch alpha of the repository `refact-chat-js`.
2. Install dependencies and build the project:
```bash
npm install && npm run build
```
3. Clone the branch `dev` of the repository `refact-intellij`.
4. Move the generated `dist` directory from the `refact-chat-js` repository to the `src/main/resources/webview` directory of the `refact-intellij` repository.
5. Wait for the files to be indexed.
6. Open the IDE and navigate to the Gradle panel, then select Run Configurations with the suffix [runIde].
7. In the Environment variables field, insert `REFACT_DEBUG=1`.
8. Start the project by right-clicking on the command `refact-intellij [runIde]`.
9. Inside the Refact.ai settings in the new IDE (PyCharm will open), select the field `Secret API Key` and press the key combination `Ctrl + Alt + - (minus)`, if using MacOS: `Command + Option + - (minus)`.
10. Scroll down and insert the port value for `xDebug LSP port`, which is the port under which LSP is running locally. By default, LSP's port is `8001`.
11. After that, you can test the chat functionality with latest features.
135 changes: 69 additions & 66 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,10 +1,28 @@
import org.jetbrains.intellij.platform.gradle.TestFrameworkType

plugins {
id("java")
id("org.jetbrains.intellij") version "1.16.0"
id("org.jetbrains.kotlin.jvm") version "1.9.21"
id("org.jetbrains.changelog") version "2.0.0"
id("org.jetbrains.qodana") version "0.1.13"
id("org.jetbrains.kotlinx.kover") version "0.6.1"
id("java") // Java support
alias(libs.plugins.kotlin) // Kotlin support
alias(libs.plugins.intelliJPlatform) // IntelliJ Platform Gradle Plugin
alias(libs.plugins.changelog) // Gradle Changelog Plugin
alias(libs.plugins.qodana) // Gradle Qodana Plugin
alias(libs.plugins.kover) // Gradle Kover Plugin
}

group = providers.gradleProperty("pluginGroup").get()
version = getVersionString(providers.gradleProperty("pluginVersion").get())

val javaCompilerVersion = "17"
kotlin {
jvmToolchain(javaCompilerVersion.toInt())
}

repositories {
mavenCentral()

intellijPlatform {
defaultRepositories()
}
}

dependencies {
Expand All @@ -18,31 +36,47 @@ dependencies {

// test libraries
testImplementation(kotlin("test"))
}

intellijPlatform {
create(providers.gradleProperty("platformType"), providers.gradleProperty("platformVersion"))

// Plugin Dependencies. Uses `platformBundledPlugins` property from the gradle.properties file for bundled IntelliJ Platform plugins.
bundledPlugins(providers.gradleProperty("platformBundledPlugins").map { it.split(',') })

group = "com.smallcloud"
version = getVersionString("1.4.1")
// Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file for plugin from JetBrains Marketplace.
plugins(providers.gradleProperty("platformPlugins").map { it.split(',') })

repositories {
mavenCentral()
instrumentationTools()
pluginVerifier()
zipSigner()
testFramework(TestFrameworkType.Platform)
}
}

intellijPlatform {
pluginConfiguration {
ideaVersion {
sinceBuild = providers.gradleProperty("pluginSinceBuild")
untilBuild = providers.gradleProperty("pluginUntilBuild")
}
}

// Configure Gradle IntelliJ Plugin
// Read more: https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#intellij-extension-type
intellij {
// version.set("LATEST-EAP-SNAPSHOT")
version.set("2023.1.6")
type.set("PC") // Target IDE Platform
signing {
certificateChain = providers.environmentVariable("CERTIFICATE_CHAIN")
privateKey = providers.environmentVariable("PRIVATE_KEY")
password = providers.environmentVariable("PRIVATE_KEY_PASSWORD")
}

plugins.set(listOf(
"Git4Idea",
))
}
publishing {
token = providers.environmentVariable("PUBLISH_TOKEN")
channels = providers.environmentVariable("PUBLISH_CHANNEL").map { listOf(it) }
}

val javaCompilerVersion = "17"
pluginVerification {
ides {
recommended()
}
}
}

tasks {
// Set the JVM compatibility versions
Expand All @@ -53,59 +87,28 @@ tasks {
withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions.jvmTarget = javaCompilerVersion
}

patchPluginXml {
sinceBuild.set("231")
untilBuild.set("242.*")
}

signPlugin {
certificateChain.set(System.getenv("CERTIFICATE_CHAIN"))
privateKey.set(System.getenv("PRIVATE_KEY"))
password.set(System.getenv("PRIVATE_KEY_PASSWORD"))
}

publishPlugin {
channels.set(listOf(System.getenv("PUBLISH_CHANNEL")))
token.set(System.getenv("PUBLISH_TOKEN"))
}

test {
useJUnitPlatform()
}
}

fun String.runCommand(
workingDir: File = File("."),
timeoutAmount: Long = 10,
timeoutUnit: TimeUnit = TimeUnit.SECONDS
): String = ProcessBuilder(split("\\s(?=(?:[^'\"`]*(['\"`])[^'\"`]*\\1)*[^'\"`]*$)".toRegex()))
.directory(workingDir)
.redirectOutput(ProcessBuilder.Redirect.PIPE)
.redirectError(ProcessBuilder.Redirect.PIPE)
.start()
.apply { waitFor(timeoutAmount, timeoutUnit) }
.run {
val error = errorStream.bufferedReader().readText().trim()
if (error.isNotEmpty()) {
throw Exception(error)
}
inputStream.bufferedReader().readText().trim()
}
fun runCommand(cmd: String): String {
return providers.exec {
commandLine(cmd.split(" "))
}.standardOutput.asText.get().trim()
}

fun getVersionString(baseVersion: String): String {
val tag = "git tag -l --points-at HEAD".runCommand(workingDir = rootDir)
val tag = runCommand("git tag -l --points-at HEAD")

if (System.getenv("PUBLISH_EAP") != "1" &&
tag.isNotEmpty() && tag.contains(baseVersion)) return baseVersion

val branch = "git rev-parse --abbrev-ref HEAD".runCommand(workingDir = rootDir)
val branch = runCommand("git rev-parse --abbrev-ref HEAD").replace("/", "-")
val numberOfCommits = if (branch == "main") {
val lastTag = "git describe --tags --abbrev=0 @^".runCommand(workingDir = rootDir)
"git rev-list ${lastTag}..HEAD --count".runCommand(workingDir = rootDir)
val lastTag = runCommand("git describe --tags --abbrev=0 @^")
runCommand("git rev-list ${lastTag}..HEAD --count")
} else {
"git rev-list --count HEAD ^origin/main".runCommand(workingDir = rootDir)
runCommand("git rev-list --count HEAD ^origin/main")
}
val commitId = "git rev-parse --short=8 HEAD".runCommand(workingDir = rootDir)
val commitId = runCommand("git rev-parse --short=8 HEAD")
return if (System.getenv("PUBLISH_EAP") == "1") {
"$baseVersion.$numberOfCommits-eap-$commitId"
} else {
Expand Down
33 changes: 33 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1,34 @@
# IntelliJ Platform Artifacts Repositories -> https://plugins.jetbrains.com/docs/intellij/intellij-artifacts.html

pluginGroup = "com.smallcloud"
pluginName = Refact.ai
pluginRepositoryUrl = https://github.com/smallcloudai/refact-intellij
# SemVer format -> https://semver.org
pluginVersion = 1.4.3

# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
pluginSinceBuild = 232
pluginUntilBuild = 243.*

# IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension
platformType = PC
platformVersion = 2023.2.8

# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html
# Example: platformPlugins = com.jetbrains.php:203.4449.22, org.intellij.scala:2023.3.27@EAP
platformPlugins =
# Example: platformBundledPlugins = com.intellij.java
platformBundledPlugins =

# Gradle Releases -> https://github.com/gradle/gradle/releases
gradleVersion = 8.10.2

# Opt-out flag for bundling Kotlin standard library -> https://jb.gg/intellij-platform-kotlin-stdlib
kotlin.stdlib.default.dependency = false

# Enable Gradle Configuration Cache -> https://docs.gradle.org/current/userguide/configuration_cache.html
org.gradle.configuration-cache = true

# Enable Gradle Build Cache -> https://docs.gradle.org/current/userguide/build_cache.html
org.gradle.caching = false
org.gradle.jvmargs=-Xmx2048m
20 changes: 20 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[versions]
# libraries
junit = "4.13.2"

# plugins
changelog = "2.2.1"
intelliJPlatform = "2.1.0"
kotlin = "1.9.25"
kover = "0.8.3"
qodana = "2024.2.3"

[libraries]
junit = { group = "junit", name = "junit", version.ref = "junit" }

[plugins]
changelog = { id = "org.jetbrains.changelog", version.ref = "changelog" }
intelliJPlatform = { id = "org.jetbrains.intellij.platform", version.ref = "intelliJPlatform" }
kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover" }
qodana = { id = "org.jetbrains.qodana", version.ref = "qodana" }
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
Loading