diff --git a/.vscodeignore b/.vscodeignore index 66900af8..43943cab 100644 --- a/.vscodeignore +++ b/.vscodeignore @@ -13,6 +13,7 @@ webpack.config.js .eslintrc.json tsconfig.json vscode-client +intellij-client .eslintignore .prettier* eslint.config.mjs diff --git a/intellij-client/.editorconfig b/intellij-client/.editorconfig new file mode 100644 index 00000000..631b4755 --- /dev/null +++ b/intellij-client/.editorconfig @@ -0,0 +1,153 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +max_line_length = 120 +tab_width = 4 +ij_visual_guides = 80, 120 + +[.editorconfig] +ij_editorconfig_align_group_field_declarations = false +ij_editorconfig_space_after_colon = true +ij_editorconfig_space_after_comma = true +ij_editorconfig_space_before_colon = false +ij_editorconfig_space_before_comma = false +ij_editorconfig_spaces_around_assignment_operators = true + +[*.properties] +ij_visual_guides = 120 +ij_properties_align_group_field_declarations = false +ij_properties_keep_blank_lines = true +ij_properties_key_value_delimiter = equals +ij_properties_spaces_around_key_value_delimiter = true + +[{*.kt,*.kts}] +indent_size = 4 +indent_style = space +ij_visual_guides = 120 +ij_continuation_indent_size = 4 +ij_wrap_on_typing = true +ij_kotlin_align_in_columns_case_branch = false +ij_kotlin_align_multiline_binary_operation = true +ij_kotlin_align_multiline_extends_list = true +ij_kotlin_align_multiline_method_parentheses = false +ij_kotlin_align_multiline_parameters = true +ij_kotlin_align_multiline_parameters_in_calls = true +ij_kotlin_allow_trailing_comma = false +ij_kotlin_allow_trailing_comma_on_call_site = false +ij_kotlin_assignment_wrap = normal +ij_kotlin_blank_lines_after_class_header = 0 +ij_kotlin_blank_lines_around_block_when_branches = 0 +ij_kotlin_blank_lines_before_declaration_with_comment_or_annotation_on_separate_line = 1 +ij_kotlin_block_comment_add_space = false +ij_kotlin_block_comment_at_first_column = false +ij_kotlin_call_parameters_new_line_after_left_paren = true +ij_kotlin_call_parameters_right_paren_on_new_line = true +ij_kotlin_call_parameters_wrap = on_every_item +ij_kotlin_catch_on_new_line = false +ij_kotlin_class_annotation_wrap = normal +ij_kotlin_code_style_defaults = KOTLIN_OFFICIAL +ij_kotlin_continuation_indent_for_chained_calls = false +ij_kotlin_continuation_indent_for_expression_bodies = false +ij_kotlin_continuation_indent_in_argument_lists = false +ij_kotlin_continuation_indent_in_elvis = false +ij_kotlin_continuation_indent_in_if_conditions = false +ij_kotlin_continuation_indent_in_parameter_lists = false +ij_kotlin_continuation_indent_in_supertype_lists = false +ij_kotlin_else_on_new_line = false +ij_kotlin_enum_constants_wrap = split_into_lines +ij_kotlin_extends_list_wrap = normal +ij_kotlin_field_annotation_wrap = normal +ij_kotlin_finally_on_new_line = false +ij_kotlin_if_rparen_on_new_line = true +ij_kotlin_import_nested_classes = false +ij_kotlin_imports_layout = *, java.**, javax.**, kotlin.**, ^ +ij_kotlin_insert_whitespaces_in_simple_one_line_method = true +ij_kotlin_keep_blank_lines_before_right_brace = 1 +ij_kotlin_keep_blank_lines_in_code = 2 +ij_kotlin_keep_blank_lines_in_declarations = 2 +ij_kotlin_keep_first_column_comment = false +ij_kotlin_keep_indents_on_empty_lines = true +ij_kotlin_keep_line_breaks = true +ij_kotlin_lbrace_on_next_line = false +ij_kotlin_line_break_after_multiline_when_entry = true +ij_kotlin_line_comment_add_space = true +ij_kotlin_line_comment_add_space_on_reformat = true +ij_kotlin_line_comment_at_first_column = false +ij_kotlin_method_annotation_wrap = normal +ij_kotlin_method_call_chain_wrap = normal +ij_kotlin_method_parameters_new_line_after_left_paren = true +ij_kotlin_method_parameters_right_paren_on_new_line = true +ij_kotlin_method_parameters_wrap = on_every_item +ij_kotlin_name_count_to_use_star_import = 100 +ij_kotlin_name_count_to_use_star_import_for_members = 100 +ij_kotlin_packages_to_use_import_on_demand = java.util.*, kotlinx.android.synthetic.**, io.ktor.** +ij_kotlin_parameter_annotation_wrap = normal +ij_kotlin_space_after_comma = true +ij_kotlin_space_after_extend_colon = true +ij_kotlin_space_after_type_colon = true +ij_kotlin_space_before_catch_parentheses = true +ij_kotlin_space_before_comma = false +ij_kotlin_space_before_extend_colon = true +ij_kotlin_space_before_for_parentheses = true +ij_kotlin_space_before_if_parentheses = true +ij_kotlin_space_before_lambda_arrow = true +ij_kotlin_space_before_type_colon = false +ij_kotlin_space_before_when_parentheses = true +ij_kotlin_space_before_while_parentheses = true +ij_kotlin_spaces_around_additive_operators = true +ij_kotlin_spaces_around_assignment_operators = true +ij_kotlin_spaces_around_equality_operators = true +ij_kotlin_spaces_around_function_type_arrow = true +ij_kotlin_spaces_around_logical_operators = true +ij_kotlin_spaces_around_multiplicative_operators = true +ij_kotlin_spaces_around_range = false +ij_kotlin_spaces_around_relational_operators = true +ij_kotlin_spaces_around_unary_operator = false +ij_kotlin_spaces_around_when_arrow = true +ij_kotlin_variable_annotation_wrap = normal +ij_kotlin_while_on_new_line = false +ij_kotlin_wrap_elvis_expressions = 1 +ij_kotlin_wrap_expression_body_functions = 1 +ij_kotlin_wrap_first_method_in_call_chain = false + +[*.md] +indent_size = 2 +indent_style = space + +[docs/**.md] +indent_size = 4 + +[*.py] +indent_size = 4 +indent_style = tab + +[*.toml] +ij_continuation_indent_size = 4 +ij_toml_keep_indents_on_empty_lines = true + +[*.xml] +indent_style = tab +ij_continuation_indent_size = 4 +ij_xml_keep_whitespaces_around_cdata = preserve +ij_xml_keep_whitespaces_inside_cdata = false + +[*.html] +indent_style = tab +ij_continuation_indent_size = 4 + +[*.yaml] +indent_size = 2 +indent_style = space +ij_yaml_align_values_properties = do_not_align +ij_yaml_autoinsert_sequence_marker = true +ij_yaml_block_mapping_on_new_line = true +ij_yaml_indent_sequence_value = true +ij_yaml_keep_indents_on_empty_lines = true +ij_yaml_keep_line_breaks = true +ij_yaml_sequence_on_new_line = true +ij_yaml_space_before_colon = false +ij_yaml_spaces_within_braces = true +ij_yaml_spaces_within_brackets = true diff --git a/intellij-client/.gitignore b/intellij-client/.gitignore new file mode 100644 index 00000000..8b875a59 --- /dev/null +++ b/intellij-client/.gitignore @@ -0,0 +1,61 @@ +.scripts/* +!.scripts/changelog.py +!.scripts/edit_releases.py + +TODO.md +.credentials/ + +.sources/ +site/ +venv/ + +### Generated ### +.gradle/ +.kotlin/ +.intellijPlatform/ +build/ +!gradle/wrapper/gradle-wrapper.jar +!**/src/main/**/build/ +!**/src/test/**/build/ + +### IntelliJ IDEA ### +.idea/** +!.idea/gradle.xml +!.idea/icon.svg +*.iws +*.iml +*.ipr +out/ +!**/src/main/**/out/ +!**/src/test/**/out/ + +### 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 + + +### + +src/main/bundled/libs + diff --git a/intellij-client/README.md b/intellij-client/README.md new file mode 100644 index 00000000..ac039692 --- /dev/null +++ b/intellij-client/README.md @@ -0,0 +1,47 @@ +# robotcode4ij + +![Build](https://github.com/robotcodedev/robotcode4ij/workflows/Build/badge.svg) +[![Version](https://img.shields.io/jetbrains/plugin/v/MARKETPLACE_ID.svg)](https://plugins.jetbrains.com/plugin/MARKETPLACE_ID) +[![Downloads](https://img.shields.io/jetbrains/plugin/d/MARKETPLACE_ID.svg)](https://plugins.jetbrains.com/plugin/MARKETPLACE_ID) + +## Template ToDo list +- [x] Create a new [IntelliJ Platform Plugin Template][template] project. +- [ ] Get familiar with the [template documentation][template]. +- [ ] Adjust the [pluginGroup](./gradle.properties) and [pluginName](./gradle.properties), as well as the [id](./src/main/resources/META-INF/plugin.xml) and [sources package](./src/main/kotlin). +- [ ] Adjust the plugin description in `README` (see [Tips][docs:plugin-description]) +- [ ] Review the [Legal Agreements](https://plugins.jetbrains.com/docs/marketplace/legal-agreements.html?from=IJPluginTemplate). +- [ ] [Publish a plugin manually](https://plugins.jetbrains.com/docs/intellij/publishing-plugin.html?from=IJPluginTemplate) for the first time. +- [ ] Set the `MARKETPLACE_ID` in the above README badges. You can obtain it once the plugin is published to JetBrains Marketplace. +- [ ] Set the [Plugin Signing](https://plugins.jetbrains.com/docs/intellij/plugin-signing.html?from=IJPluginTemplate) related [secrets](https://github.com/JetBrains/intellij-platform-plugin-template#environment-variables). +- [ ] Set the [Deployment Token](https://plugins.jetbrains.com/docs/marketplace/plugin-upload.html?from=IJPluginTemplate). +- [ ] Click the Watch button on the top of the [IntelliJ Platform Plugin Template][template] to be notified about releases containing new features and fixes. + + +Robot Framework IntelliSense, linting, test execution and debugging, code formatting, refactoring, and many more. + + +## Installation + +- Using the IDE built-in plugin system: + + Settings/Preferences > Plugins > Marketplace > Search for "robotcode4ij" > + Install + +- Using JetBrains Marketplace: + + Go to [JetBrains Marketplace](https://plugins.jetbrains.com/plugin/MARKETPLACE_ID) and install it by clicking the Install to ... button in case your IDE is running. + + You can also download the [latest release](https://plugins.jetbrains.com/plugin/MARKETPLACE_ID/versions) from JetBrains Marketplace and install it manually using + Settings/Preferences > Plugins > ⚙️ > Install plugin from disk... + +- Manually: + + Download the [latest release](https://github.com/robotcodedev/robotcode4ij/releases/latest) and install it manually using + Settings/Preferences > Plugins > ⚙️ > Install plugin from disk... + + +--- +Plugin based on the [IntelliJ Platform Plugin Template][template]. + +[template]: https://github.com/JetBrains/intellij-platform-plugin-template +[docs:plugin-description]: https://plugins.jetbrains.com/docs/intellij/plugin-user-experience.html#plugin-description-and-presentation diff --git a/intellij-client/build.gradle.kts b/intellij-client/build.gradle.kts new file mode 100644 index 00000000..379c4ee6 --- /dev/null +++ b/intellij-client/build.gradle.kts @@ -0,0 +1,229 @@ +import org.jetbrains.changelog.Changelog +import org.jetbrains.changelog.markdownToHTML +import org.jetbrains.intellij.platform.gradle.Constants.Constraints +import org.jetbrains.intellij.platform.gradle.TestFrameworkType +import java.net.URI +import java.net.http.HttpClient +import java.net.http.HttpRequest +import java.net.http.HttpResponse +import java.time.Duration +import java.time.temporal.ChronoUnit +import java.util.regex.Pattern + +plugins { + alias(libs.plugins.kotlin) + alias(libs.plugins.intelliJPlatForm) + alias(libs.plugins.changelog) + alias(libs.plugins.kover) + alias(libs.plugins.kotlinSerialization) +} + +group = providers.gradleProperty("pluginGroup").get() +version = providers.gradleProperty("pluginVersion").get() + +// Set the JVM language level used to build the project. +kotlin { + jvmToolchain(21) +} + +// Configure project's dependencies +repositories { + mavenCentral() + + // IntelliJ Platform Gradle Plugin Repositories Extension - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-repositories-extension.html + intellijPlatform { + defaultRepositories() + } +} + +// Dependencies are managed with Gradle version catalog - read more: https://docs.gradle.org/current/userguide/platforms.html#sub:version-catalog +dependencies { + compileOnly(libs.kotlinxSerialization) + testImplementation(kotlin("test")) + testImplementation(libs.junit) + + // IntelliJ Platform Gradle Plugin Dependencies Extension - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-dependencies-extension.html + intellijPlatform { + create( + providers.gradleProperty("platformType"), + providers.gradleProperty("platformVersion"), + useInstaller = false + ) + + // Plugin Dependencies. Uses `platformBundledPlugins` property from the gradle.properties file for bundled IntelliJ Platform plugins. + bundledPlugins(providers.gradleProperty("platformBundledPlugins").map { it.split(',') }) + + // Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file for plugin from JetBrains Marketplace. + // plugins(providers.gradleProperty("platformPlugins").map { it.split(',') }) + + val platformPlugins = ArrayList() + // val localLsp4ij = file("../lsp4ij.old/build/idea-sandbox/plugins/LSP4IJ").absoluteFile + // if (localLsp4ij.isDirectory) { + // // In case Gradle fails to build because it can't find some missing jar, try deleting + // // ~/.gradle/caches/modules-2/files-2.1/com.jetbrains.intellij.idea/unzipped.com.jetbrains.plugins/com.redhat.devtools.lsp4ij* + // localPlugin(localLsp4ij.toString()) + // } else { + // // When running on CI or when there's no local lsp4ij + // val latestLsp4ijNightlyVersion = fetchLatestLsp4ijNightlyVersion() + // platformPlugins.add("com.redhat.devtools.lsp4ij:$latestLsp4ijNightlyVersion@nightly") + // } + + platformPlugins.add("com.redhat.devtools.lsp4ij:0.9.0") + //Uses `platformPlugins` property from the gradle.properties file. + platformPlugins.addAll(providers.gradleProperty("platformPlugins").map { it.split(',').map(String::trim).filter(String::isNotEmpty) }.get()) + + plugins(platformPlugins) + + pluginVerifier() + zipSigner() + testFramework(TestFrameworkType.Platform) + } +} + +// Configure IntelliJ Platform Gradle Plugin - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-extension.html +intellijPlatform { + pluginConfiguration { + name = providers.gradleProperty("pluginName") + version = providers.gradleProperty("pluginVersion") + + // Extract the section from README.md and provide for the plugin's manifest + description = providers.fileContents(layout.projectDirectory.file("README.md")).asText.map { + val start = "" + val end = "" + + with(it.lines()) { + if (!containsAll(listOf(start, end))) { + throw GradleException("Plugin description section not found in README.md:\n$start ... $end") + } + subList(indexOf(start) + 1, indexOf(end)).joinToString("\n").let(::markdownToHTML) + } + } + + val changelog = project.changelog // local variable for configuration cache compatibility + // Get the latest available change notes from the changelog file + changeNotes = providers.gradleProperty("pluginVersion").map { pluginVersion -> + with(changelog) { + renderItem( + (getOrNull(pluginVersion) ?: getUnreleased()) + .withHeader(false) + .withEmptySections(false), + Changelog.OutputType.HTML, + ) + } + } + + ideaVersion { + sinceBuild = providers.gradleProperty("pluginSinceBuild") + untilBuild = providers.gradleProperty("pluginUntilBuild") + } + } + + signing { + certificateChain = providers.environmentVariable("CERTIFICATE_CHAIN") + privateKey = providers.environmentVariable("PRIVATE_KEY") + password = providers.environmentVariable("PRIVATE_KEY_PASSWORD") + } + + publishing { + token = providers.environmentVariable("PUBLISH_TOKEN") + // The pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3 + // Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more: + // https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel + channels = providers.gradleProperty("pluginVersion") + .map { listOf(it.substringAfter('-', "").substringBefore('.').ifEmpty { "default" }) } + } + + pluginVerification { + ides { + recommended() + } + } +} + +// Configure Gradle Changelog Plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin +changelog { + path.set(file("../CHANGELOG.md").canonicalPath) + groups.empty() + repositoryUrl = providers.gradleProperty("pluginRepositoryUrl") +} + +// Configure Gradle Kover Plugin - read more: https://github.com/Kotlin/kotlinx-kover#configuration +kover { + reports { + total { + xml { + onCheck = true + } + } + } +} + +tasks { + runIde { + // From https://app.slack.com/client/T5P9YATH9/C5U8BM1MK + // systemProperty("ide.experimental.ui", "true") + // systemProperty("projectView.hide.dot.idea", "false") + // systemProperty("terminal.new.ui", "false") + // systemProperty("ide.tree.painter.compact.default", "true") + } + + wrapper { + gradleVersion = providers.gradleProperty("gradleVersion").get() + } + + publishPlugin { + dependsOn(patchChangelog) + } + prepareSandbox { + from("..") { + include("package.json", "language-configuration.json", "syntaxes/**/*", "bundled/**/*" ) + + exclude("**/bin") + exclude("**/__pycache__") + into("robotcode4ij/data") + } + } +} + +// Configure UI tests plugin +// Read more: https://github.com/JetBrains/intellij-ui-test-robot +val runIdeForUiTests by intellijPlatformTesting.runIde.registering { + task { + jvmArgumentProviders += CommandLineArgumentProvider { + listOf( + "-Drobot-server.port=8082", + "-Dide.mac.message.dialogs.as.sheets=false", + "-Djb.privacy.policy.text=", + "-Djb.consents.confirmation.enabled=false", + ) + } + } + + plugins { + robotServerPlugin(Constraints.LATEST_VERSION) + } +} + +fun fetchLatestLsp4ijNightlyVersion(): String { + val client = HttpClient.newBuilder().build(); + var onlineVersion = "" + try { + val request: HttpRequest = HttpRequest.newBuilder() + .uri(URI("https://plugins.jetbrains.com/api/plugins/23257/updates?channel=nightly&size=1")) + .GET() + .timeout(Duration.of(10, ChronoUnit.SECONDS)) + .build() + val response = client.send(request, HttpResponse.BodyHandlers.ofString()); + val pattern = Pattern.compile("\"version\":\"([^\"]+)\"") + val matcher = pattern.matcher(response.body()) + if (matcher.find()) { + onlineVersion = matcher.group(1) + println("Latest approved nightly build: $onlineVersion") + } + } catch (e:Exception) { + println("Failed to fetch LSP4IJ nightly build version: ${e.message}") + } + + val minVersion = "0.0.1-20231213-012910" + return if (minVersion < onlineVersion) onlineVersion else minVersion +} diff --git a/intellij-client/gradle.properties b/intellij-client/gradle.properties new file mode 100644 index 00000000..0dca82ce --- /dev/null +++ b/intellij-client/gradle.properties @@ -0,0 +1,35 @@ +# IntelliJ Platform Artifacts Repositories -> https://plugins.jetbrains.com/docs/intellij/intellij-artifacts.html + +pluginGroup = dev.robotcode +pluginName = RobotCode - Robot Framework Support +pluginRepositoryUrl = https://github.com/robotcodedev/robotcode4ij +# SemVer format -> https://semver.org +pluginVersion = 0.103.0 + +# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html +pluginSinceBuild = 243 +pluginUntilBuild = 243.* + + +# IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension +platformType = PC +platformVersion = 2024.3 + +# 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 = com.redhat.devtools.lsp4ij:0.3.0 +platformPlugins = +# Example: platformBundledPlugins = com.intellij.java +platformBundledPlugins = PythonCore, org.jetbrains.plugins.textmate + +# Gradle Releases -> https://github.com/gradle/gradle/releases +gradleVersion = 8.11.1 + +# 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 = true diff --git a/intellij-client/gradle/libs.versions.toml b/intellij-client/gradle/libs.versions.toml new file mode 100644 index 00000000..4f09b761 --- /dev/null +++ b/intellij-client/gradle/libs.versions.toml @@ -0,0 +1,46 @@ +[versions] +# libraries +annotations = "24.1.0" +kotlinxSerialization = "1.7.1" +junit = "4.13.2" + +# plugins +changelog = "2.2.1" +intelliJPlatForm = "2.2.1" +kotlin = "2.0.10" +kover = "0.8.3" + +[libraries.annotations] +group = "org.jetbrains" +name = "annotations" +version.ref = "annotations" + +[libraries.kotlinxSerialization] +group = "org.jetbrains.kotlinx" +name = "kotlinx-serialization-json" +version.ref = "kotlinxSerialization" + +[libraries.junit] +group = "junit" +name = "junit" +version.ref = "junit" + +[plugins.changelog] +id = "org.jetbrains.changelog" +version.ref = "changelog" + +[plugins.intelliJPlatForm] +id = "org.jetbrains.intellij.platform" +version.ref = "intelliJPlatForm" + +[plugins.kotlin] +id = "org.jetbrains.kotlin.jvm" +version.ref = "kotlin" + +[plugins.kover] +id = "org.jetbrains.kotlinx.kover" +version.ref = "kover" + +[plugins.kotlinSerialization] +id = "org.jetbrains.kotlin.plugin.serialization" +version.ref = "kotlin" diff --git a/intellij-client/gradle/wrapper/gradle-wrapper.jar b/intellij-client/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000..a4b76b95 Binary files /dev/null and b/intellij-client/gradle/wrapper/gradle-wrapper.jar differ diff --git a/intellij-client/gradle/wrapper/gradle-wrapper.properties b/intellij-client/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..e2847c82 --- /dev/null +++ b/intellij-client/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/intellij-client/gradlew b/intellij-client/gradlew new file mode 100644 index 00000000..f5feea6d --- /dev/null +++ b/intellij-client/gradlew @@ -0,0 +1,252 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s +' "$PWD" ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/intellij-client/gradlew.bat b/intellij-client/gradlew.bat new file mode 100644 index 00000000..9d21a218 --- /dev/null +++ b/intellij-client/gradlew.bat @@ -0,0 +1,94 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/intellij-client/settings.gradle.kts b/intellij-client/settings.gradle.kts new file mode 100644 index 00000000..4365906a --- /dev/null +++ b/intellij-client/settings.gradle.kts @@ -0,0 +1,5 @@ +plugins { + id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0" +} + +rootProject.name = "robotcode4ij" diff --git a/intellij-client/src/main/kotlin/dev/robotcode/robotcode4ij/BundledHelpers.kt b/intellij-client/src/main/kotlin/dev/robotcode/robotcode4ij/BundledHelpers.kt new file mode 100644 index 00000000..3bfa3fa3 --- /dev/null +++ b/intellij-client/src/main/kotlin/dev/robotcode/robotcode4ij/BundledHelpers.kt @@ -0,0 +1,14 @@ +package dev.robotcode.robotcode4ij + +import com.intellij.openapi.application.PathManager +import java.nio.file.Path + +class BundledHelpers { + companion object { + val basePath: Path = PathManager.getPluginsDir().resolve("robotcode4ij").resolve("data") + val bundledPath: Path = basePath.resolve("bundled") + val toolPath: Path = bundledPath.resolve("tool") + val robotCodePath: Path = toolPath.resolve("robotcode") + val checkRobotVersion: Path= toolPath.resolve("utils").resolve("check_robot_version.py") + } +} diff --git a/intellij-client/src/main/kotlin/dev/robotcode/robotcode4ij/RobotCodeBundle.kt b/intellij-client/src/main/kotlin/dev/robotcode/robotcode4ij/RobotCodeBundle.kt new file mode 100644 index 00000000..f8dfd561 --- /dev/null +++ b/intellij-client/src/main/kotlin/dev/robotcode/robotcode4ij/RobotCodeBundle.kt @@ -0,0 +1,20 @@ +package dev.robotcode.robotcode4ij + +import com.intellij.DynamicBundle +import org.jetbrains.annotations.NonNls +import org.jetbrains.annotations.PropertyKey + +@NonNls +private const val BUNDLE = "messages.RobotCode" + +object RobotCodeBundle : DynamicBundle(BUNDLE) { + + @JvmStatic + fun message(@PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any) = + getMessage(key, *params) + + @Suppress("unused") + @JvmStatic + fun messagePointer(@PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any) = + getLazyMessage(key, *params) +} diff --git a/intellij-client/src/main/kotlin/dev/robotcode/robotcode4ij/RobotCodePostStartupActivity.kt b/intellij-client/src/main/kotlin/dev/robotcode/robotcode4ij/RobotCodePostStartupActivity.kt new file mode 100644 index 00000000..58f803e7 --- /dev/null +++ b/intellij-client/src/main/kotlin/dev/robotcode/robotcode4ij/RobotCodePostStartupActivity.kt @@ -0,0 +1,29 @@ +package dev.robotcode.robotcode4ij + +import com.intellij.openapi.project.Project +import com.intellij.openapi.startup.ProjectActivity +import com.intellij.openapi.vfs.VirtualFileManager +import com.intellij.platform.backend.workspace.workspaceModel +import com.intellij.platform.workspace.jps.entities.ModuleEntity +import com.intellij.platform.workspace.storage.EntityChange +import dev.robotcode.robotcode4ij.lsp.langServerManager +import kotlinx.coroutines.flow.collect +import kotlinx.coroutines.flow.onEach + +class RobotCodePostStartupActivity : ProjectActivity { + override suspend fun execute(project: Project) { + project.messageBus.connect().subscribe(VirtualFileManager.VFS_CHANGES, RobotCodeVirtualFileListener(project)) + + project.langServerManager.start() + + project.workspaceModel.eventLog.onEach { + val moduleChanges = it.getChanges(ModuleEntity::class.java) + if (moduleChanges.filterIsInstance>().isNotEmpty()) { + project.langServerManager.restart() + } + }.collect() + } + + +} + diff --git a/intellij-client/src/main/kotlin/dev/robotcode/robotcode4ij/RobotCodeRunConfiguration.kt b/intellij-client/src/main/kotlin/dev/robotcode/robotcode4ij/RobotCodeRunConfiguration.kt new file mode 100644 index 00000000..82f9e35a --- /dev/null +++ b/intellij-client/src/main/kotlin/dev/robotcode/robotcode4ij/RobotCodeRunConfiguration.kt @@ -0,0 +1,12 @@ +package dev.robotcode.robotcode4ij + + +import com.intellij.execution.configurations.ConfigurationTypeBase + + +class RobotCodeRunConfiguration : + ConfigurationTypeBase("robotcode", "RobotCode", "Run Robot Framework Tests", RobotIcons.RobotCode) { + init { + addFactory(RobotCodeRunConfigurationFactory(this)); + } +} diff --git a/intellij-client/src/main/kotlin/dev/robotcode/robotcode4ij/RobotCodeRunConfigurationFactory.kt b/intellij-client/src/main/kotlin/dev/robotcode/robotcode4ij/RobotCodeRunConfigurationFactory.kt new file mode 100644 index 00000000..c0196ad2 --- /dev/null +++ b/intellij-client/src/main/kotlin/dev/robotcode/robotcode4ij/RobotCodeRunConfigurationFactory.kt @@ -0,0 +1,21 @@ +package dev.robotcode.robotcode4ij + +import com.intellij.execution.configurations.ConfigurationFactory; +import com.intellij.execution.configurations.ConfigurationType +import com.intellij.execution.configurations.RunConfiguration +import com.intellij.openapi.project.Project +import javax.swing.Icon + +class RobotCodeRunConfigurationFactory(type: ConfigurationType) : ConfigurationFactory(type) { + override fun createTemplateConfiguration(project: Project): RunConfiguration { + TODO("Not yet implemented") + } + + override fun getId(): String { + return "RobotCode[Default]" + } + + override fun getIcon(): Icon? { + return RobotIcons.RobotCode; + } +} diff --git a/intellij-client/src/main/kotlin/dev/robotcode/robotcode4ij/RobotCodeSemanticTokensColorsProvider.kt b/intellij-client/src/main/kotlin/dev/robotcode/robotcode4ij/RobotCodeSemanticTokensColorsProvider.kt new file mode 100644 index 00000000..e72144db --- /dev/null +++ b/intellij-client/src/main/kotlin/dev/robotcode/robotcode4ij/RobotCodeSemanticTokensColorsProvider.kt @@ -0,0 +1,42 @@ +package dev.robotcode.robotcode4ij + +import com.intellij.openapi.editor.colors.TextAttributesKey +import com.intellij.psi.PsiFile +import com.redhat.devtools.lsp4ij.features.semanticTokens.SemanticTokensColorsProvider + + +class RobotCodeSemanticTokensColorsProvider : SemanticTokensColorsProvider { + + + override fun getTextAttributesKey( + tokenType: String, tokenModifiers: MutableList, file: PsiFile + ): TextAttributesKey? { // TODO implement RobotCodeSemanticTokensColorsProvider + return when (tokenType) { + "header", + "headerKeyword", + "headerComment", + "headerSettings", + "headerVariable", + "headerTestcase", + "headerTask", + -> RobotColors.HEADER + + "testcaseName" -> RobotColors.TESTCASE_NAME + "keywordName" -> RobotColors.KEYWORD_NAME + else -> null + } + + // return when (tokenType) { + // "headerTestcase" -> { + // val myAttrs = DefaultLanguageHighlighterColors.KEYWORD.defaultAttributes.clone(); + // + // myAttrs.effectType = EffectType.LINE_UNDERSCORE; + // myAttrs.effectColor = myAttrs.foregroundColor; + // myAttrs.fontType = Font.ITALIC; + // return TextAttributesKey.createTextAttributesKey( + // "tokenType", myAttrs + // ) + // } + } +} + diff --git a/intellij-client/src/main/kotlin/dev/robotcode/robotcode4ij/RobotCodeTextMateBundleProvider.kt b/intellij-client/src/main/kotlin/dev/robotcode/robotcode4ij/RobotCodeTextMateBundleProvider.kt new file mode 100644 index 00000000..87ddbea4 --- /dev/null +++ b/intellij-client/src/main/kotlin/dev/robotcode/robotcode4ij/RobotCodeTextMateBundleProvider.kt @@ -0,0 +1,17 @@ +package dev.robotcode.robotcode4ij + + +import org.jetbrains.plugins.textmate.api.TextMateBundleProvider + +private val robotCodeBundle = getBundles() + +private fun getBundles(): List { + return listOf(TextMateBundleProvider.PluginBundle("robotcode", BundledHelpers.basePath)) +} + +class RobotCodeTextMateBundleProvider : TextMateBundleProvider { + + override fun getBundles(): List { + return robotCodeBundle; + } +} diff --git a/intellij-client/src/main/kotlin/dev/robotcode/robotcode4ij/RobotCodeVirtualFileListener.kt b/intellij-client/src/main/kotlin/dev/robotcode/robotcode4ij/RobotCodeVirtualFileListener.kt new file mode 100644 index 00000000..0ca56bfc --- /dev/null +++ b/intellij-client/src/main/kotlin/dev/robotcode/robotcode4ij/RobotCodeVirtualFileListener.kt @@ -0,0 +1,18 @@ +package dev.robotcode.robotcode4ij + +import com.intellij.openapi.project.Project +import com.intellij.openapi.vfs.newvfs.BulkFileListener +import com.intellij.openapi.vfs.newvfs.events.VFileEvent +import dev.robotcode.robotcode4ij.lsp.langServerManager + +class RobotCodeVirtualFileListener(private val project: Project) : BulkFileListener { + companion object { + val PROJECT_FILES = arrayOf("robot.toml", ".robot.toml", "pyproject.toml") + } + + override fun after(events: MutableList) { + if (events.any { it.file?.name in PROJECT_FILES }) { + project.langServerManager.restart() + } + } +} diff --git a/intellij-client/src/main/kotlin/dev/robotcode/robotcode4ij/RobotColors.kt b/intellij-client/src/main/kotlin/dev/robotcode/robotcode4ij/RobotColors.kt new file mode 100644 index 00000000..9085b568 --- /dev/null +++ b/intellij-client/src/main/kotlin/dev/robotcode/robotcode4ij/RobotColors.kt @@ -0,0 +1,37 @@ +package dev.robotcode.robotcode4ij + +import com.intellij.openapi.editor.DefaultLanguageHighlighterColors +import com.intellij.openapi.editor.colors.TextAttributesKey +import com.intellij.openapi.editor.colors.TextAttributesKey.createTextAttributesKey +import com.intellij.openapi.editor.markup.EffectType +import com.intellij.openapi.editor.markup.TextAttributes + +object RobotColors { + val HEADER: TextAttributesKey = + createTextAttributesKey( + "ROBOTFRAMEWORK_HEADER", TextAttributes( + null, null, + DefaultLanguageHighlighterColors.KEYWORD + .defaultAttributes.foregroundColor, + EffectType + .LINE_UNDERSCORE, 1 + ) + ) + + val TESTCASE_NAME: TextAttributesKey = + createTextAttributesKey( + "ROBOTFRAMEWORK_TESTCASE_NAME", TextAttributes( + null, null, null, + null, 1 + ) + ) + + val KEYWORD_NAME: TextAttributesKey = + createTextAttributesKey( + "ROBOTFRAMEWORK_TESTCASE_NAME", TextAttributes( + null, null, null, + null, 1 + ) + ) +} + diff --git a/intellij-client/src/main/kotlin/dev/robotcode/robotcode4ij/RobotFrameworkLanguage.kt b/intellij-client/src/main/kotlin/dev/robotcode/robotcode4ij/RobotFrameworkLanguage.kt new file mode 100644 index 00000000..5ba35bb1 --- /dev/null +++ b/intellij-client/src/main/kotlin/dev/robotcode/robotcode4ij/RobotFrameworkLanguage.kt @@ -0,0 +1,11 @@ +package dev.robotcode.robotcode4ij + +import com.intellij.lang.Language + +class RobotFrameworkLanguage : Language("robotframework") { + companion object { + val INSTANCE = RobotFrameworkLanguage(); + } + + override fun getDisplayName() = "Robot Framework" +} \ No newline at end of file diff --git a/intellij-client/src/main/kotlin/dev/robotcode/robotcode4ij/RobotIcons.kt b/intellij-client/src/main/kotlin/dev/robotcode/robotcode4ij/RobotIcons.kt new file mode 100644 index 00000000..925f9040 --- /dev/null +++ b/intellij-client/src/main/kotlin/dev/robotcode/robotcode4ij/RobotIcons.kt @@ -0,0 +1,13 @@ +package dev.robotcode.robotcode4ij + +import com.intellij.openapi.util.IconLoader +import javax.swing.Icon + +public class RobotIcons { + companion object { + val Resource: Icon? = IconLoader.findIcon("/images/robot.svg", RobotIcons.Companion::class.java); + val Suite: Icon? = IconLoader.findIcon("/images/robot.svg", RobotIcons.Companion::class.java); + val RobotCode: Icon? = IconLoader.findIcon("/images/robotcode.svg", RobotIcons.Companion::class.java); + } + +} diff --git a/intellij-client/src/main/kotlin/dev/robotcode/robotcode4ij/RobotResourceFileType.kt b/intellij-client/src/main/kotlin/dev/robotcode/robotcode4ij/RobotResourceFileType.kt new file mode 100644 index 00000000..3e7c8487 --- /dev/null +++ b/intellij-client/src/main/kotlin/dev/robotcode/robotcode4ij/RobotResourceFileType.kt @@ -0,0 +1,12 @@ +package dev.robotcode.robotcode4ij + +import com.intellij.openapi.fileTypes.LanguageFileType +import org.jetbrains.plugins.textmate.TextMateBackedFileType + +class RobotResourceFileType() : LanguageFileType(RobotFrameworkLanguage.INSTANCE) { + override fun getName() = "ROBOT_FRAMEWORK_RESOURCE"; + override fun getDisplayName() = "Robot Framework Resource"; + override fun getDescription() = "Robot Framework resource files"; + override fun getDefaultExtension() = "robot" + override fun getIcon() = RobotIcons.Resource +} diff --git a/intellij-client/src/main/kotlin/dev/robotcode/robotcode4ij/RobotSuiteFileType.kt b/intellij-client/src/main/kotlin/dev/robotcode/robotcode4ij/RobotSuiteFileType.kt new file mode 100644 index 00000000..20136f9a --- /dev/null +++ b/intellij-client/src/main/kotlin/dev/robotcode/robotcode4ij/RobotSuiteFileType.kt @@ -0,0 +1,12 @@ +package dev.robotcode.robotcode4ij + +import com.intellij.openapi.fileTypes.LanguageFileType +import org.jetbrains.plugins.textmate.TextMateBackedFileType + +class RobotSuiteFileType() : LanguageFileType(RobotFrameworkLanguage.INSTANCE) { + override fun getName() = "ROBOT_FRAMEWORK_SUITE"; + override fun getDisplayName() = "Robot Framework Suite"; + override fun getDescription() = "Robot Framework suite files"; + override fun getDefaultExtension() = "robot" + override fun getIcon() = RobotIcons.Suite +} diff --git a/intellij-client/src/main/kotlin/dev/robotcode/robotcode4ij/listeners/RobotCodeApplicationActivationListener.kt b/intellij-client/src/main/kotlin/dev/robotcode/robotcode4ij/listeners/RobotCodeApplicationActivationListener.kt new file mode 100644 index 00000000..e482f37e --- /dev/null +++ b/intellij-client/src/main/kotlin/dev/robotcode/robotcode4ij/listeners/RobotCodeApplicationActivationListener.kt @@ -0,0 +1,12 @@ +package dev.robotcode.robotcode4ij.listeners + +import com.intellij.openapi.application.ApplicationActivationListener +import com.intellij.openapi.diagnostic.thisLogger +import com.intellij.openapi.wm.IdeFrame + +internal class RobotCodeApplicationActivationListener : ApplicationActivationListener { + + override fun applicationActivated(ideFrame: IdeFrame) { + + } +} diff --git a/intellij-client/src/main/kotlin/dev/robotcode/robotcode4ij/lsp/RobotCodeLanguageClient.kt b/intellij-client/src/main/kotlin/dev/robotcode/robotcode4ij/lsp/RobotCodeLanguageClient.kt new file mode 100644 index 00000000..1ccc1a0a --- /dev/null +++ b/intellij-client/src/main/kotlin/dev/robotcode/robotcode4ij/lsp/RobotCodeLanguageClient.kt @@ -0,0 +1,19 @@ +package dev.robotcode.robotcode4ij.lsp + +import com.intellij.openapi.project.Project +import com.redhat.devtools.lsp4ij.ServerStatus +import com.redhat.devtools.lsp4ij.client.IndexAwareLanguageClient +import dev.robotcode.robotcode4ij.settings.ProjectSettings + +class RobotCodeLanguageClient(project: Project?) : IndexAwareLanguageClient(project) { + + override fun handleServerStatusChanged(serverStatus: ServerStatus?) { + if (serverStatus == ServerStatus.started) { + triggerChangeConfiguration(); + } + } + + override fun createSettings(): Any { + return ProjectSettings.getInstance(project).asJson() + } +} diff --git a/intellij-client/src/main/kotlin/dev/robotcode/robotcode4ij/lsp/RobotCodeLanguageServer.kt b/intellij-client/src/main/kotlin/dev/robotcode/robotcode4ij/lsp/RobotCodeLanguageServer.kt new file mode 100644 index 00000000..ce125965 --- /dev/null +++ b/intellij-client/src/main/kotlin/dev/robotcode/robotcode4ij/lsp/RobotCodeLanguageServer.kt @@ -0,0 +1,82 @@ +package dev.robotcode.robotcode4ij.lsp + +import com.intellij.execution.configurations.GeneralCommandLine +import com.intellij.openapi.diagnostic.thisLogger +import com.intellij.openapi.project.Project +import com.jetbrains.python.sdk.pythonSdk +import com.redhat.devtools.lsp4ij.server.LanguageServerLogErrorHandler +import com.redhat.devtools.lsp4ij.server.OSProcessStreamConnectionProvider +import dev.robotcode.robotcode4ij.BundledHelpers +import java.io.InputStream +import java.io.OutputStream +import java.net.ServerSocket +import java.net.Socket +import java.nio.charset.StandardCharsets +import kotlin.io.path.pathString + +class RobotCodeLanguageServer(private val project: Project) : OSProcessStreamConnectionProvider(), + LanguageServerLogErrorHandler { + + private var inputStream: InputStream? = null + private var outputStream: OutputStream? = null + private var serverSocket: ServerSocket? = null + private var clientSocket: Socket? = null + + init { + this.addLogErrorHandler(this) + commandLine = buildCommandLine() + } + + private fun buildCommandLine(port: Int = 6610): GeneralCommandLine { + val pythonInterpreter = project.pythonSdk?.homePath; + if (pythonInterpreter != null) { + return GeneralCommandLine( + pythonInterpreter, "-u", "-X", "utf8", + //"-m", "robotcode.cli", + BundledHelpers.robotCodePath.pathString, + //"--log", "--log-level", "DEBUG", + // "--debugpy", + // "--debugpy-wait-for-client", + "language-server", "--socket", "$port" + ).withWorkDirectory(project.basePath).withCharset(StandardCharsets.UTF_8) + } + throw IllegalArgumentException("PythonSDK is not defined for project ${project.name}") + } + + override fun logError(error: String?) { + if (error != null) + thisLogger().error(error) + } + + // override fun getInitializationOptions(rootUri: VirtualFile?): Any { + // return null + // } + + override fun start() { + serverSocket = ServerSocket(0) + commandLine = buildCommandLine(serverSocket!!.localPort) + thisLogger().info("Start robotcode with command $commandLine") + super.start() + clientSocket = serverSocket!!.accept() + inputStream = clientSocket!!.getInputStream() + outputStream = clientSocket!!.getOutputStream() + } + + override fun stop() { + super.stop() + inputStream = null + outputStream = null + clientSocket!!.close() + clientSocket = null + serverSocket!!.close() + serverSocket = null; + + } + override fun getInputStream(): InputStream { + return inputStream!! + } + + override fun getOutputStream(): OutputStream { + return outputStream!! + } +} diff --git a/intellij-client/src/main/kotlin/dev/robotcode/robotcode4ij/lsp/RobotCodeLanguageServerFactory.kt b/intellij-client/src/main/kotlin/dev/robotcode/robotcode4ij/lsp/RobotCodeLanguageServerFactory.kt new file mode 100644 index 00000000..4ca131a4 --- /dev/null +++ b/intellij-client/src/main/kotlin/dev/robotcode/robotcode4ij/lsp/RobotCodeLanguageServerFactory.kt @@ -0,0 +1,36 @@ +package dev.robotcode.robotcode4ij.lsp + +import com.intellij.openapi.project.Project +import com.redhat.devtools.lsp4ij.LanguageServerEnablementSupport +import com.redhat.devtools.lsp4ij.LanguageServerFactory +import com.redhat.devtools.lsp4ij.client.LanguageClientImpl +import com.redhat.devtools.lsp4ij.server.StreamConnectionProvider +import dev.robotcode.robotcode4ij.lsp.RobotCodeLanguageServerManager.Companion.ENABLED_KEY +import org.eclipse.lsp4j.services.LanguageServer + +class RobotCodeLanguageServerFactory : LanguageServerFactory, LanguageServerEnablementSupport { + override fun createConnectionProvider(project: Project): StreamConnectionProvider { + return RobotCodeLanguageServer(project) + } + + override fun createLanguageClient(project: Project): LanguageClientImpl { + return RobotCodeLanguageClient(project) + } + + override fun getServerInterface(): Class { + return super.getServerInterface() + } + + override fun isEnabled(project: Project): Boolean { + if (project.getUserData(ENABLED_KEY) == true) { + return true + } + + return project.langServerManager.tryConfigureProject() + } + + override fun setEnabled(enabled: Boolean, project: Project) { + project.putUserData(ENABLED_KEY, enabled) + } +} + diff --git a/intellij-client/src/main/kotlin/dev/robotcode/robotcode4ij/lsp/RobotCodeLanguageServerManager.kt b/intellij-client/src/main/kotlin/dev/robotcode/robotcode4ij/lsp/RobotCodeLanguageServerManager.kt new file mode 100644 index 00000000..05a1a372 --- /dev/null +++ b/intellij-client/src/main/kotlin/dev/robotcode/robotcode4ij/lsp/RobotCodeLanguageServerManager.kt @@ -0,0 +1,131 @@ +package dev.robotcode.robotcode4ij.lsp + +import com.intellij.execution.configurations.GeneralCommandLine +import com.intellij.execution.util.ExecUtil +import com.intellij.openapi.Disposable +import com.intellij.openapi.application.ApplicationManager +import com.intellij.openapi.components.Service +import com.intellij.openapi.components.service +import com.intellij.openapi.diagnostic.thisLogger +import com.intellij.openapi.project.Project +import com.intellij.openapi.util.Key +import com.intellij.openapi.util.removeUserData +import com.intellij.util.io.isFile +import com.jetbrains.python.sdk.pythonSdk +import com.redhat.devtools.lsp4ij.LanguageServerManager +import com.redhat.devtools.lsp4ij.ServerStatus +import dev.robotcode.robotcode4ij.BundledHelpers +import kotlinx.coroutines.CompletableDeferred +import kotlinx.coroutines.launch +import kotlinx.coroutines.runBlocking +import kotlin.io.path.Path +import kotlin.io.path.exists +import kotlin.io.path.isDirectory +import kotlin.io.path.isRegularFile +import kotlin.io.path.pathString + +@Service(Service.Level.PROJECT) +class RobotCodeLanguageServerManager(private val project: Project) { + companion object { + const val LANGUAGE_SERVER_ID = "RobotCode" + val ENABLED_KEY = Key.create("ROBOTCODE_ENABLED") + } + + fun tryConfigureProject(): Boolean { + val pythonInterpreter = project.pythonSdk?.homePath + + project.removeUserData(ENABLED_KEY) + + val result = ApplicationManager.getApplication().executeOnPooledThread { + checkPythonAndRobot(pythonInterpreter) + }.get() + + project.putUserData(ENABLED_KEY, result) + + return result + } + + private fun checkPythonAndRobot(pythonInterpreter: String?): Boolean { + if (pythonInterpreter == null) { + thisLogger().info("No Python Interpreter defined for project '${project.name}'") + return false + } + + if (!Path(pythonInterpreter).exists()) { + thisLogger().warn("Python Interpreter $pythonInterpreter not exists") + return false + } + + if (!Path(pythonInterpreter).isRegularFile()) { + thisLogger().warn("Python Interpreter $pythonInterpreter is not a regular file") + return false + } + + thisLogger().info("Use Python Interpreter $pythonInterpreter for project '${project.name}'") + + val res = ExecUtil.execAndGetOutput( + GeneralCommandLine( + pythonInterpreter, "-u", "-c", + "import sys; print(sys.version_info[:2]>=(3,8))" + ), timeoutInMilliseconds = 5000 + ) + if (res.exitCode != 0 || res.stdout.trim() != "True") { + thisLogger().warn("Invalid python version") + return false; + } + + val res1 = ExecUtil.execAndGetOutput( + GeneralCommandLine(pythonInterpreter, "-u", BundledHelpers.checkRobotVersion.pathString), + timeoutInMilliseconds = 5000 + ) + if (res1.exitCode != 0 || res1.stdout.trim() != "True") { + thisLogger().warn("Invalid Robot Framework version") + return false + } + + return true + } + + private var lease: Disposable? = null + + fun start() { + if (lease != null) { + lease!!.dispose() + lease = null + } + + if (tryConfigureProject()) { + + val options = LanguageServerManager.StartOptions() + options.setForceStart(true) + + LanguageServerManager.getInstance(project).start(LANGUAGE_SERVER_ID, options) + LanguageServerManager.getInstance(project).getLanguageServer(LANGUAGE_SERVER_ID).thenApply { server -> + this.lease = server?.keepAlive() + } + } + } + + fun stop() { + if (lease != null) { + lease!!.dispose() + lease = null + } + LanguageServerManager.getInstance(project).stop(LANGUAGE_SERVER_ID) + } + + fun restart() { + stop() + start() + } + + val status: ServerStatus? + get() { + return LanguageServerManager.getInstance(project).getServerStatus(LANGUAGE_SERVER_ID) + } +} + +val Project.langServerManager: RobotCodeLanguageServerManager + get() { + return this.service() + } diff --git a/intellij-client/src/main/kotlin/dev/robotcode/robotcode4ij/services/MyProjectService.kt b/intellij-client/src/main/kotlin/dev/robotcode/robotcode4ij/services/MyProjectService.kt new file mode 100644 index 00000000..0f295d67 --- /dev/null +++ b/intellij-client/src/main/kotlin/dev/robotcode/robotcode4ij/services/MyProjectService.kt @@ -0,0 +1,15 @@ +package dev.robotcode.robotcode4ij.services + +import com.intellij.openapi.components.Service +import com.intellij.openapi.diagnostic.thisLogger +import com.intellij.openapi.project.Project +import dev.robotcode.robotcode4ij.RobotCodeBundle + +@Service(Service.Level.PROJECT) +class MyProjectService(project: Project) { + + init { + thisLogger().info(RobotCodeBundle.message("projectService", project.name)) + thisLogger().warn("Don't forget to remove all non-needed sample code files with their corresponding registration entries in `plugin.xml`.") + } +} diff --git a/intellij-client/src/main/kotlin/dev/robotcode/robotcode4ij/settings/ProjectSettingsConfigurableProvider.kt b/intellij-client/src/main/kotlin/dev/robotcode/robotcode4ij/settings/ProjectSettingsConfigurableProvider.kt new file mode 100644 index 00000000..3404e7e1 --- /dev/null +++ b/intellij-client/src/main/kotlin/dev/robotcode/robotcode4ij/settings/ProjectSettingsConfigurableProvider.kt @@ -0,0 +1,143 @@ +package dev.robotcode.robotcode4ij.settings + +import com.google.gson.GsonBuilder +import com.google.gson.JsonElement +import com.intellij.openapi.components.BaseState +import com.intellij.openapi.components.Service +import com.intellij.openapi.components.SimplePersistentStateComponent +import com.intellij.openapi.components.State +import com.intellij.openapi.components.Storage +import com.intellij.openapi.components.service +import com.intellij.openapi.options.BoundSearchableConfigurable +import com.intellij.openapi.options.Configurable +import com.intellij.openapi.options.ConfigurableProvider +import com.intellij.openapi.project.Project +import com.intellij.openapi.ui.DialogPanel +import com.intellij.ui.dsl.builder.AlignX +import com.intellij.ui.dsl.builder.bindSelected +import com.intellij.ui.dsl.builder.bindText +import com.intellij.ui.dsl.builder.panel +import dev.robotcode.robotcode4ij.lsp.langServerManager +import dev.robotcode.robotcode4ij.settings.SimplePersistentStateComponentHelper.delegate +import dev.robotcode.robotcode4ij.settings.SimplePersistentStateComponentHelper.stringDelegate + + +class ProjectSettingsConfigurableProvider(private val project: Project) : ConfigurableProvider() { + override fun createConfigurable(): Configurable { + return ProjectSettingsConfigurable(project) + } + + override fun canCreateConfigurable(): Boolean { + return super.canCreateConfigurable() + } +} + + +class ProjectSettingsConfigurable(private val project: Project) : BoundSearchableConfigurable( + "Robot Framework", "robotcode.robotframework.settings" +) { + + private val settings = ProjectSettings.getInstance(project) + + override fun createPanel(): DialogPanel { + return panel { + row { + text("!!!! ATTENTION !!! this is work in progress") + } + group("Robot") { + row { + expandableTextField().align(AlignX.FILL) .label("Arguments") + }.rowComment("Additional arguments to pass to the robot command.") + row { + comboBox(listOf("default", "rpa", "norpa")).label("Mode") + }.rowComment("Specifies robot execution mode. Corresponds to the `--rpa` or `--norpa` option of __robot__.") + } + group("Editing") { + // TODO: not supported in IntelliJ + // group("Editor") { + // row { + // checkBox("4 Spaces Tab").bindSelected(settings::editor4SpacesTab) + // }.rowComment("If actived insert 4 spaces if TAB is pressed.") + // } + group("Completion") { + row { + checkBox("Filter Default Language").bindSelected(settings::completionFilterDefaultLanguage) + }.rowComment("Filter default language (English) for completion if there is another language defined.") + row { + textField().bindText(settings::completionHeaderStyle).label("Header Style") + }.rowComment("Defines the header style format. If not defined ```*** {name} ***``` is used.") + } + group("Inlay Hints") { + row { + checkBox("Parameter Names").bindSelected(settings::inlayHintsParameterNames) + }.rowComment( + "Enable/disable inlay hints for parameter names." + ) + row { + checkBox("Namespaces").bindSelected(settings::inlayHintsNamespaces) + }.rowComment( + "Enable/disable inlay hints for namespaces." + ) + } + } + } + } + + override fun apply() { + super.apply() + project.langServerManager.restart() + } +} + +@Service(Service.Level.PROJECT) @State(name = "ProjectSettings", storages = [Storage("robotcodeSettings.xml")]) +class ProjectSettings : SimplePersistentStateComponent(ProjectState()) { + companion object { + fun getInstance(project: Project): ProjectSettings = project.service() + } + + fun asJson(): JsonElement { + val builder = GsonBuilder().serializeNulls().setPrettyPrinting().create(); + + val robotSettings = RobotCodeSettings() + robotSettings.robotcode.inlayHints.parameterNames = state.inlayHintsParameterNames + robotSettings.robotcode.inlayHints.namespaces = state.inlayHintsNamespaces + + val json = builder.toJsonTree(robotSettings) + return json; + } + + class ProjectState : BaseState() { + // TODO var editor4SpacesTab by property(defaultValue = true) + var completionFilterDefaultLanguage by property(defaultValue = false) + var completionHeaderStyle by string() + var inlayHintsParameterNames by property(defaultValue = false) + var inlayHintsNamespaces by property(defaultValue = false) + } + + // TODO var editor4SpacesTab by delegate(ProjectState::editor4SpacesTab) + var completionFilterDefaultLanguage by delegate(ProjectState::completionFilterDefaultLanguage) + var completionHeaderStyle by stringDelegate(ProjectState::completionHeaderStyle) + var inlayHintsParameterNames by delegate(ProjectState::inlayHintsParameterNames) + var inlayHintsNamespaces by delegate(ProjectState::inlayHintsNamespaces) +} + +data class InlayHints( + var parameterNames: Boolean = false, var namespaces: Boolean = false +) + +data class Completion( + var filterDefaultLanguage: Boolean = false, + var headerStyle: String? = null +) + +data class All( + var completion: Completion = Completion(), + var inlayHints: InlayHints = InlayHints() +) + +data class RobotCodeSettings( + var robotcode: All = All() +) + + + diff --git a/intellij-client/src/main/kotlin/dev/robotcode/robotcode4ij/settings/RobotCodeColorSettingsPage.kt b/intellij-client/src/main/kotlin/dev/robotcode/robotcode4ij/settings/RobotCodeColorSettingsPage.kt new file mode 100644 index 00000000..94ff21cf --- /dev/null +++ b/intellij-client/src/main/kotlin/dev/robotcode/robotcode4ij/settings/RobotCodeColorSettingsPage.kt @@ -0,0 +1,50 @@ +package dev.robotcode.robotcode4ij.settings + +import com.intellij.openapi.editor.colors.TextAttributesKey +import com.intellij.openapi.fileTypes.SyntaxHighlighter +import com.intellij.openapi.fileTypes.SyntaxHighlighterFactory +import com.intellij.openapi.options.colors.AttributesDescriptor +import com.intellij.openapi.options.colors.ColorDescriptor +import com.intellij.openapi.options.colors.ColorSettingsPage +import dev.robotcode.robotcode4ij.RobotColors +import dev.robotcode.robotcode4ij.RobotFrameworkLanguage +import dev.robotcode.robotcode4ij.RobotIcons +import javax.swing.Icon + +class RobotCodeColorSettingsPage : ColorSettingsPage { + + private val descriptors: Array = arrayOf( + AttributesDescriptor("Settings", RobotColors.HEADER), + AttributesDescriptor("Test case name", RobotColors.TESTCASE_NAME), + AttributesDescriptor("Keyword name", RobotColors.KEYWORD_NAME), + ) + + + override fun getAttributeDescriptors(): Array { + return descriptors + } + + override fun getColorDescriptors(): Array { + return ColorDescriptor.EMPTY_ARRAY + } + + override fun getDisplayName(): String { + return "Robot Framework" + } + + override fun getIcon(): Icon? { + return RobotIcons.RobotCode + } + + override fun getHighlighter(): SyntaxHighlighter { + return SyntaxHighlighterFactory.getSyntaxHighlighter(RobotFrameworkLanguage.INSTANCE, null, null) + } + + override fun getDemoText(): String { + return "*** Test Cases *** " + } + + override fun getAdditionalHighlightingTagToDescriptorMap(): MutableMap? { + return null + } +} diff --git a/intellij-client/src/main/kotlin/dev/robotcode/robotcode4ij/settings/SimplePersistentStateComponentHelper.kt b/intellij-client/src/main/kotlin/dev/robotcode/robotcode4ij/settings/SimplePersistentStateComponentHelper.kt new file mode 100644 index 00000000..3d74d8a7 --- /dev/null +++ b/intellij-client/src/main/kotlin/dev/robotcode/robotcode4ij/settings/SimplePersistentStateComponentHelper.kt @@ -0,0 +1,50 @@ +package dev.robotcode.robotcode4ij.settings + +import com.intellij.openapi.components.BaseState +import com.intellij.openapi.components.SimplePersistentStateComponent +import kotlin.properties.ReadWriteProperty +import kotlin.reflect.KMutableProperty1 +import kotlin.reflect.KProperty + +internal object SimplePersistentStateComponentHelper { + /** + * Creates property which delegates every access to the given property of the state. + * + * ```kotlin + * @State(name = "SomeSettings", storages = [Storage(...)]) + * class SomeSettings : SimplePersistentStateComponent(State()) { + * class State : BaseState() { + * // The internal storage of the configured values + * var enabled by property(true) + * } + * + * // Makes the property publicly accessible + * var enabled: Boolean by delegate(State::enabled) + * } + * ``` + */ + fun delegate(prop: KMutableProperty1): ReadWriteProperty, V> { + return object : ReadWriteProperty, V> { + override fun getValue(thisRef: SimplePersistentStateComponent, property: KProperty<*>): V { + return prop.get(thisRef.state) + } + + override fun setValue(thisRef: SimplePersistentStateComponent, property: KProperty<*>, value: V) { + prop.set(thisRef.state, value) + } + } + } + + fun stringDelegate(prop: KMutableProperty1): + ReadWriteProperty, String> { + return object : ReadWriteProperty, String> { + override fun getValue(thisRef: SimplePersistentStateComponent, property: KProperty<*>): String { + return prop.get(thisRef.state) ?: "" + } + + override fun setValue(thisRef: SimplePersistentStateComponent, property: KProperty<*>, value: String) { + prop.set(thisRef.state, value) + } + } + } +} diff --git a/intellij-client/src/main/resources/META-INF/plugin.xml b/intellij-client/src/main/resources/META-INF/plugin.xml new file mode 100644 index 00000000..67a40ac5 --- /dev/null +++ b/intellij-client/src/main/resources/META-INF/plugin.xml @@ -0,0 +1,88 @@ + + + dev.robotcode.robotcode4ij + RobotCode - Robot Framework Support + robotcode.dev + + com.intellij.modules.platform + com.intellij.modules.python + com.redhat.devtools.lsp4ij + org.jetbrains.plugins.textmate + + + messages.RobotCode + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/intellij-client/src/main/resources/META-INF/pluginIcon.svg b/intellij-client/src/main/resources/META-INF/pluginIcon.svg new file mode 100644 index 00000000..0f423c4a --- /dev/null +++ b/intellij-client/src/main/resources/META-INF/pluginIcon.svg @@ -0,0 +1,110 @@ + + + + diff --git a/intellij-client/src/main/resources/images/robot.svg b/intellij-client/src/main/resources/images/robot.svg new file mode 100644 index 00000000..7ecd8af0 --- /dev/null +++ b/intellij-client/src/main/resources/images/robot.svg @@ -0,0 +1,42 @@ + + + + + + diff --git a/intellij-client/src/main/resources/images/robotcode.svg b/intellij-client/src/main/resources/images/robotcode.svg new file mode 100644 index 00000000..d128a691 --- /dev/null +++ b/intellij-client/src/main/resources/images/robotcode.svg @@ -0,0 +1,110 @@ + + + + diff --git a/intellij-client/src/main/resources/inspectionDescriptions/RobotCodeLocal.html b/intellij-client/src/main/resources/inspectionDescriptions/RobotCodeLocal.html new file mode 100644 index 00000000..b7fa851b --- /dev/null +++ b/intellij-client/src/main/resources/inspectionDescriptions/RobotCodeLocal.html @@ -0,0 +1,27 @@ + + +Write your description here. +Start the description with a verb in 3rd person singular, like reports, detects, highlights. +In the first sentence, briefly explain what exactly the inspection helps you detect. +Make sure the sentence is not very long and complicated. +

+ The first sentence must be in a dedicated paragraph separated from the rest of the text. This will make the + description easier to read. + Make sure the description doesn’t just repeat the inspection title. +

+

+ See https://plugins.jetbrains.com/docs/intellij/inspections.html#descriptions for more information. +

+

+ Embed code snippets: +

+

+// automatically highlighted according to inspection registration 'language' attribute
+
+ +

Text after this comment will only be shown in the settings of the inspection.

+ +

To open related settings directly from the description, add a link with `settings://$` optionally followed by `?$` to + pre-select a UI element.

+ + diff --git a/intellij-client/src/main/resources/messages/RobotCode.properties b/intellij-client/src/main/resources/messages/RobotCode.properties new file mode 100644 index 00000000..2e041d8b --- /dev/null +++ b/intellij-client/src/main/resources/messages/RobotCode.properties @@ -0,0 +1,3 @@ +projectService=Project service: {0} +randomLabel=The random number is: {0} +shuffle=Shuffle diff --git a/intellij-client/src/test/kotlin/dev/robotcode/robotcode4ij/MyPluginTest.kt b/intellij-client/src/test/kotlin/dev/robotcode/robotcode4ij/MyPluginTest.kt new file mode 100644 index 00000000..ea03aabd --- /dev/null +++ b/intellij-client/src/test/kotlin/dev/robotcode/robotcode4ij/MyPluginTest.kt @@ -0,0 +1,10 @@ +package dev.robotcode.robotcode4ij + +import com.intellij.testFramework.fixtures.BasePlatformTestCase + +class MyPluginTest : BasePlatformTestCase() { + + fun testDummy() { + + } +} diff --git a/package.json b/package.json index 30620c93..136847d6 100644 --- a/package.json +++ b/package.json @@ -871,7 +871,7 @@ "items": { "type": "string" }, - "description": "Specifies the arguments to be passed to robot.", + "description": "Additional arguments to pass to the __robot__ command.", "scope": "resource" }, "robotcode.robot.paths": {