Skip to content

Commit 121b26e

Browse files
committed
feat(intellij): implemented robot framework debugger
1 parent 507d773 commit 121b26e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1780
-134
lines changed

intellij-client/README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66

77
<!-- Plugin description -->
88

9+
**RobotCode** is a PyCharm/IntelliJ Plugin that enhances your workflow with [Robot Framework](https://robotframework.org/).
10+
It provides a rich set of features to help you write, run, and debug your Robot Framework tests directly within your IDE.
11+
12+
913
⚠️ **Important Notice** ⚠️
1014
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.
1115

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

1620

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

2223
**Built on Robot Framework Core**
@@ -28,6 +29,7 @@ RobotCode is built on the Language Server Protocol (LSP), a modern standard for
2829
**Powerful Command Line Tools**
2930
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.
3031

32+
3133
## Key Features
3234

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

52+
5053
## Getting Started
5154

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

5962
<!-- Plugin description end -->
6063

64+
6165
## Installation
6266

6367
- Using the IDE built-in plugin system:

intellij-client/build.gradle.kts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ repositories {
4141
// Dependencies are managed with Gradle version catalog - read more: https://docs.gradle.org/current/userguide/platforms.html#sub:version-catalog
4242
dependencies {
4343
compileOnly(libs.kotlinxSerialization)
44+
45+
// implementation(libs.lsp4j)
46+
implementation(libs.lsp4jdebug)
47+
4448
testImplementation(kotlin("test"))
4549
testImplementation(libs.junit)
4650

@@ -119,6 +123,7 @@ intellijPlatform {
119123
ides {
120124
recommended()
121125
}
126+
122127
}
123128
}
124129

intellij-client/gradle/libs.versions.toml

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,25 @@
11
[versions]
22
# libraries
3-
annotations = "24.1.0"
4-
kotlinxSerialization = "1.7.1"
5-
junit = "4.13.2"
3+
annotations = "26.0.1"
4+
kotlinxSerialization = "1.8.0"
5+
junit = "5.11.4"
6+
lsp4j = "0.21.1"
67

78
# plugins
89
changelog = "2.2.1"
910
intelliJPlatForm = "2.2.1"
10-
kotlin = "2.0.10"
11-
kover = "0.8.3"
11+
kotlin = "2.1.0"
12+
kover = "0.9.1"
13+
14+
[libraries.lsp4j]
15+
group = "org.eclipse.lsp4j"
16+
name = "org.eclipse.lsp4j"
17+
version.ref = "lsp4j"
18+
19+
[libraries.lsp4jdebug]
20+
group = "org.eclipse.lsp4j"
21+
name = "org.eclipse.lsp4j.debug"
22+
version.ref = "lsp4j"
1223

1324
[libraries.annotations]
1425
group = "org.jetbrains"
@@ -44,3 +55,5 @@ version.ref = "kover"
4455
[plugins.kotlinSerialization]
4556
id = "org.jetbrains.kotlin.plugin.serialization"
4657
version.ref = "kotlin"
58+
59+

intellij-client/src/main/kotlin/dev/robotcode/robotcode4ij/actions/RobotCreateFileAction.kt

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,30 +11,23 @@ import dev.robotcode.robotcode4ij.RobotResourceFileType
1111
import dev.robotcode.robotcode4ij.RobotSuiteFileType
1212

1313
class RobotCreateFileAction : CreateFileFromTemplateAction(
14-
"Robot Framework File", "Robot Framework file",
15-
RobotIcons
16-
.Suite
17-
),
18-
DumbAware {
14+
"Robot Framework File", "Robot Framework file", RobotIcons.Suite
15+
), DumbAware {
1916
override fun buildDialog(project: Project, directory: PsiDirectory, builder: CreateFileFromTemplateDialog.Builder) {
2017
builder.setTitle("New Robot Framework File")
21-
FileTemplateManager.getInstance(project)
22-
.allTemplates
23-
.forEach {
24-
if (it.extension == RobotSuiteFileType.defaultExtension) {
25-
builder.addKind(it.name, RobotIcons.Suite, it.name)
26-
} else if (it.extension == RobotResourceFileType.defaultExtension) {
27-
builder.addKind(it.name, RobotIcons.Resource, it.name)
28-
}
18+
FileTemplateManager.getInstance(project).allTemplates.forEach {
19+
if (it.extension == RobotSuiteFileType.defaultExtension) {
20+
builder.addKind(it.name, RobotIcons.Suite, it.name)
21+
} else if (it.extension == RobotResourceFileType.defaultExtension) {
22+
builder.addKind(it.name, RobotIcons.Resource, it.name)
2923
}
30-
builder
31-
.addKind("Suite file", RobotIcons.Suite, "Robot Suite File")
24+
}
25+
builder.addKind("Suite file", RobotIcons.Suite, "Robot Suite File")
3226
.addKind("Resource file", RobotIcons.Resource, "Robot Resource File")
3327

3428
}
3529

3630
override fun getActionName(directory: PsiDirectory?, newName: String, templateName: String?): String {
3731
return "Create Robot Framework File"
3832
}
39-
4033
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package dev.robotcode.robotcode4ij.debugging
2+
3+
import com.intellij.xdebugger.breakpoints.XBreakpointHandler
4+
import com.intellij.xdebugger.breakpoints.XLineBreakpoint
5+
6+
class RobotCodeBreakpointHandler(val process: RobotCodeDebugProcess) :
7+
XBreakpointHandler<XLineBreakpoint<RobotCodeBreakpointProperties>>(RobotCodeBreakpointType::class.java) {
8+
override fun registerBreakpoint(breakpoint: XLineBreakpoint<RobotCodeBreakpointProperties>) {
9+
process.registerBreakpoint(breakpoint)
10+
}
11+
12+
override fun unregisterBreakpoint(
13+
breakpoint: XLineBreakpoint<RobotCodeBreakpointProperties>,
14+
temporary: Boolean
15+
) {
16+
process.unregisterBreakpoint(breakpoint)
17+
}
18+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package dev.robotcode.robotcode4ij.debugging
2+
3+
import com.intellij.xdebugger.breakpoints.XBreakpointProperties
4+
5+
class RobotCodeBreakpointProperties : XBreakpointProperties<RobotCodeBreakpointProperties>() {
6+
7+
override fun getState(): RobotCodeBreakpointProperties {
8+
return this
9+
}
10+
11+
override fun loadState(state: RobotCodeBreakpointProperties) {
12+
TODO("Not yet implemented")
13+
}
14+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package dev.robotcode.robotcode4ij.debugging
2+
3+
import com.intellij.openapi.project.Project
4+
import com.intellij.openapi.vfs.VirtualFile
5+
import com.intellij.xdebugger.breakpoints.XLineBreakpointType
6+
7+
class RobotCodeBreakpointType : XLineBreakpointType<RobotCodeBreakpointProperties>(ID, NAME) {
8+
companion object {
9+
private const val ID = "robotcode-line"
10+
private const val NAME = "robotcode-line-breakpoint"
11+
}
12+
13+
override fun createBreakpointProperties(file: VirtualFile, line: Int): RobotCodeBreakpointProperties? {
14+
return RobotCodeBreakpointProperties()
15+
}
16+
17+
override fun canPutAt(file: VirtualFile, line: Int, project: Project): Boolean {
18+
return true
19+
}
20+
}

0 commit comments

Comments
 (0)