Skip to content

Commit

Permalink
feat(intellij): implemented robot framework debugger
Browse files Browse the repository at this point in the history
  • Loading branch information
d-biehl committed Jan 12, 2025
1 parent 507d773 commit 121b26e
Show file tree
Hide file tree
Showing 44 changed files with 1,780 additions and 134 deletions.
10 changes: 7 additions & 3 deletions intellij-client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

<!-- Plugin description -->

**RobotCode** is a PyCharm/IntelliJ Plugin that enhances your workflow with [Robot Framework](https://robotframework.org/).
It provides a rich set of features to help you write, run, and debug your Robot Framework tests directly within your IDE.


⚠️ **Important Notice** ⚠️
This plugin is currently under active development and is not yet ready for production use. Please note that it may contain bugs or lack certain features.

Expand All @@ -14,9 +18,6 @@ We invite you to join the Robot Framework and RobotCode community by reporting i
Your feedback is greatly appreciated! 🙂


**RobotCode** is a PyCharm/IntelliJ Plugin that enhances your workflow with [Robot Framework](https://robotframework.org/).
It provides a rich set of features to help you write, run, and debug your Robot Framework tests directly within your IDE.

## Why RobotCode?

**Built on Robot Framework Core**
Expand All @@ -28,6 +29,7 @@ RobotCode is built on the Language Server Protocol (LSP), a modern standard for
**Powerful Command Line Tools**
RobotCode extends the Robot Framework CLI with enhanced tools for test execution, analysis, and debugging. It supports [`robot.toml`](https://robotcode.io/03_reference/) configurations, integrates a Debug Adapter Protocol (DAP) compatible debugger, and provides an interactive REPL environment for experimenting with Robot Framework commands. Modular and flexible, these tools streamline your workflow for both development and production.


## Key Features

- **Smart Code Editing**: Auto-completion, syntax highlighting, and seamless navigation.
Expand All @@ -47,6 +49,7 @@ RobotCode extends the Robot Framework CLI with enhanced tools for test execution
- Robot Framework 4.1 or newer
- PyCharm 2024.3.1 or newer


## Getting Started

1. Install the [RobotCode Plugin](https://plugins.jetbrains.com/plugin/26216) from the JETBRAINS Marketplace.
Expand All @@ -58,6 +61,7 @@ For a more detailed guide, check out the [Let's get started](https://robotcode.i

<!-- Plugin description end -->


## Installation

- Using the IDE built-in plugin system:
Expand Down
5 changes: 5 additions & 0 deletions intellij-client/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ repositories {
// Dependencies are managed with Gradle version catalog - read more: https://docs.gradle.org/current/userguide/platforms.html#sub:version-catalog
dependencies {
compileOnly(libs.kotlinxSerialization)

// implementation(libs.lsp4j)
implementation(libs.lsp4jdebug)

testImplementation(kotlin("test"))
testImplementation(libs.junit)

Expand Down Expand Up @@ -119,6 +123,7 @@ intellijPlatform {
ides {
recommended()
}

}
}

Expand Down
23 changes: 18 additions & 5 deletions intellij-client/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
[versions]
# libraries
annotations = "24.1.0"
kotlinxSerialization = "1.7.1"
junit = "4.13.2"
annotations = "26.0.1"
kotlinxSerialization = "1.8.0"
junit = "5.11.4"
lsp4j = "0.21.1"

# plugins
changelog = "2.2.1"
intelliJPlatForm = "2.2.1"
kotlin = "2.0.10"
kover = "0.8.3"
kotlin = "2.1.0"
kover = "0.9.1"

[libraries.lsp4j]
group = "org.eclipse.lsp4j"
name = "org.eclipse.lsp4j"
version.ref = "lsp4j"

[libraries.lsp4jdebug]
group = "org.eclipse.lsp4j"
name = "org.eclipse.lsp4j.debug"
version.ref = "lsp4j"

[libraries.annotations]
group = "org.jetbrains"
Expand Down Expand Up @@ -44,3 +55,5 @@ version.ref = "kover"
[plugins.kotlinSerialization]
id = "org.jetbrains.kotlin.plugin.serialization"
version.ref = "kotlin"


Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,23 @@ import dev.robotcode.robotcode4ij.RobotResourceFileType
import dev.robotcode.robotcode4ij.RobotSuiteFileType

class RobotCreateFileAction : CreateFileFromTemplateAction(
"Robot Framework File", "Robot Framework file",
RobotIcons
.Suite
),
DumbAware {
"Robot Framework File", "Robot Framework file", RobotIcons.Suite
), DumbAware {
override fun buildDialog(project: Project, directory: PsiDirectory, builder: CreateFileFromTemplateDialog.Builder) {
builder.setTitle("New Robot Framework File")
FileTemplateManager.getInstance(project)
.allTemplates
.forEach {
if (it.extension == RobotSuiteFileType.defaultExtension) {
builder.addKind(it.name, RobotIcons.Suite, it.name)
} else if (it.extension == RobotResourceFileType.defaultExtension) {
builder.addKind(it.name, RobotIcons.Resource, it.name)
}
FileTemplateManager.getInstance(project).allTemplates.forEach {
if (it.extension == RobotSuiteFileType.defaultExtension) {
builder.addKind(it.name, RobotIcons.Suite, it.name)
} else if (it.extension == RobotResourceFileType.defaultExtension) {
builder.addKind(it.name, RobotIcons.Resource, it.name)
}
builder
.addKind("Suite file", RobotIcons.Suite, "Robot Suite File")
}
builder.addKind("Suite file", RobotIcons.Suite, "Robot Suite File")
.addKind("Resource file", RobotIcons.Resource, "Robot Resource File")

}

override fun getActionName(directory: PsiDirectory?, newName: String, templateName: String?): String {
return "Create Robot Framework File"
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package dev.robotcode.robotcode4ij.debugging

import com.intellij.xdebugger.breakpoints.XBreakpointHandler
import com.intellij.xdebugger.breakpoints.XLineBreakpoint

class RobotCodeBreakpointHandler(val process: RobotCodeDebugProcess) :
XBreakpointHandler<XLineBreakpoint<RobotCodeBreakpointProperties>>(RobotCodeBreakpointType::class.java) {
override fun registerBreakpoint(breakpoint: XLineBreakpoint<RobotCodeBreakpointProperties>) {
process.registerBreakpoint(breakpoint)
}

override fun unregisterBreakpoint(
breakpoint: XLineBreakpoint<RobotCodeBreakpointProperties>,
temporary: Boolean
) {
process.unregisterBreakpoint(breakpoint)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package dev.robotcode.robotcode4ij.debugging

import com.intellij.xdebugger.breakpoints.XBreakpointProperties

class RobotCodeBreakpointProperties : XBreakpointProperties<RobotCodeBreakpointProperties>() {

override fun getState(): RobotCodeBreakpointProperties {
return this
}

override fun loadState(state: RobotCodeBreakpointProperties) {
TODO("Not yet implemented")
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package dev.robotcode.robotcode4ij.debugging

import com.intellij.openapi.project.Project
import com.intellij.openapi.vfs.VirtualFile
import com.intellij.xdebugger.breakpoints.XLineBreakpointType

class RobotCodeBreakpointType : XLineBreakpointType<RobotCodeBreakpointProperties>(ID, NAME) {
companion object {
private const val ID = "robotcode-line"
private const val NAME = "robotcode-line-breakpoint"
}

override fun createBreakpointProperties(file: VirtualFile, line: Int): RobotCodeBreakpointProperties? {
return RobotCodeBreakpointProperties()
}

override fun canPutAt(file: VirtualFile, line: Int, project: Project): Boolean {
return true
}
}
Loading

0 comments on commit 121b26e

Please sign in to comment.