Skip to content

Commit

Permalink
fix(intellij): Use node interpreter to run commands (#416)
Browse files Browse the repository at this point in the history
  • Loading branch information
victor-teles authored Sep 30, 2023
1 parent 240aa9a commit a75a9b7
Show file tree
Hide file tree
Showing 31 changed files with 785 additions and 154 deletions.
97 changes: 97 additions & 0 deletions .github/workflows/pull_request_intellij.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# Jobs run on pull request for intellij
name: Pull request Intellij
on:
workflow_dispatch: ~

jobs:
test-ui:
name: Test UI
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
runIde: |
export DISPLAY=:99.0
Xvfb -ac :99 -screen 0 1920x1080x24 &
sleep 10
mkdir -p editors/intellij/build/reports
./gradlew :runIdeForUiTests > editors/intellij/build/reports/idea.log &
runTests: |
export DISPLAY=:99.0
./gradlew :test
reportName: ui-test-fails-report-linux
- os: windows-latest
runIde: start gradlew.bat :runIdeForUiTests
runTests: ./gradlew :test
reportName: ui-test-fails-report-windows
- os: macos-latest
runIde: ./gradlew :runIdeForUiTests &
runTests: ./gradlew :test
reportName: ui-test-fails-report-mac

steps:

- name: Fetch Sources
uses: actions/checkout@v3

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 18

- name: Cache pnpm modules
uses: actions/cache@v3
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-
- uses: pnpm/action-setup@v2.2.4
with:
version: 8

- name: Install basic project fixture dependencies
working-directory: editors/intellij/src/test/testData/basic-project
run: pnpm i

- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: zulu
java-version: 17

- name: Setup Gradle
uses: gradle/gradle-build-action@v2
with:
gradle-home-cache-cleanup: true

- name: Run IDE
working-directory: editors/intellij
run: ${{ matrix.runIde }}

# Wait for IDEA to be started
- name: Health Check
uses: jtalk/url-health-check-action@v3
with:
url: http://127.0.0.1:8082
max-attempts: 15
retry-delay: 30s

- name: Run
working-directory: editors/intellij
run: ${{ matrix.runTests }}

- name: Copy logs
if: ${{ failure() }}
run: mv editors/intellij/build/idea-sandbox/system/log/ editors/intellij/build/reports

- name: Save fails report
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.reportName }}
path: |
editors/intellij/build/reports
2 changes: 1 addition & 1 deletion .github/workflows/release_lsp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ jobs:
build-intellij:
name: Build Intellij LSP
runs-on: ubuntu-latest
needs: check
needs: [check, test-ui-intellij]
env:
version: ${{ needs.check.outputs.intellij_version }}
prerelease: ${{ needs.check.outputs.prerelease }}
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ Read our [guidelines for writing a good changelog entry](https://github.com/biom


### Editors

#### Bug fixes

- Fix [#404](https://github.com/biomejs/biome/issues/404). Biome intellij plugin now works on Windows. Contributed by @victor-teles

- Fix [#402](https://github.com/biomejs/biome/issues/402). Biome `format` on intellij plugin now recognize biome.json. Contributed by @victor-teles

### Formatter

#### Enhancements
Expand Down
12 changes: 11 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ To start development from source, navigate to the `editors/intellij` directory.
Build and run the plugin requires:

- Java development kit 17+
- IntelliJ IDEA (Ultimate edition or community edition)
- IntelliJ IDEA Ultimate edition

### Running the plugin on IDEA
```bash
Expand All @@ -190,6 +190,16 @@ Build and run the plugin requires:
./gradlew buildPlugin
```

### UI Testing intellij plugin

Before start testing the plugin you will need to start IDE by invoking the `./gradlew runIdeForUiTests &` and wait IDE startup

You can now run the test task:

```bash
./gradlew test
```

## Node.js development

The npm module `npm/biome` contains Biome's Node JS API that supports different backends:
Expand Down
2 changes: 1 addition & 1 deletion biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"useIgnoreFile": true
},
"files": {
"ignore": ["types.d.ts"]
"ignore": ["types.d.ts", "./editors/intellij"]
},
"formatter": {
"ignore": [
Expand Down
30 changes: 0 additions & 30 deletions editors/intellij/.run/Run Qodana.run.xml

This file was deleted.

61 changes: 36 additions & 25 deletions editors/intellij/README.md
Original file line number Diff line number Diff line change
@@ -1,44 +1,55 @@
# Biome JetBrains IDEs Plugin

https://biomejs.dev plugin for JetBrains IDEs.
[Biome](https://biomejs.dev/) is a powerful tool designed to enhance your development experience. This plugin integrates seamlessly with many [JetBrains IDE's](#Supported IDEs) to provide some capabilities:

## features
- See lints while you type
- Apply code fixes (from mouse-over, <kbd title="Option">⌥</kbd>+<kbd title="Enter">⏎</kbd> or <kbd title="Alt">Alt</kbd>+<kbd title="Enter">Enter</kbd>)
- Reformat your code with <kbd>⌥⇧</kbd>+<kbd title="Cmd">⌘</kbd>+<kbd title="L">L</kbd> or <kbd title="Ctrl">Ctrl</kbd>+<kbd title="Alt">Alt</kbd>+<kbd title="L">L</kbd> (You can also format your [code on save](https://www.jetbrains.com/help/webstorm/reformat-and-rearrange-code.html#reformat-on-save))

- Linting
- Quickfix
- Formatting
However, please note the following limitations:

---
- Automatically applying code fixes on save

## Installation

To install the Biome IntelliJ Plugin, Head over to [official plugin page](https://plugins.jetbrains.com/plugin/22761-biome) or follow these steps:

### From JetBrains IDEs

- Press `⌘Сmd,` to open the IDE settings and then select Plugins.
![Plugins](https://resources.jetbrains.com/help/img/idea/2023.2/ws_plugins_settings.png)
- Search for Biome and click `install`
1. Open IntelliJ IDEA.
2. Go to **Settings/Preferences**.
3. Select **Plugins** from the left-hand menu.
4. Click on the **Marketplace** tab.
5. Search for "Biome" and click **Install**.
6. Restart the IDE to activate the plugin.

### From disk

- Download the plugin .zip from releases tab.
- Press `⌘Сmd,` to open the IDE settings and then select Plugins.
- On the Plugins page, click The Settings button and then click Install Plugin from Disk….
1. Download the plugin .zip from releases tab.
2. Press `⌘Сmd,` to open the IDE settings and then select Plugins.
3. On the Plugins page, click The Settings button and then click Install Plugin from Disk….

## Biome Resolution

The Plugin tries to use Biome from your project’s local dependencies (`node_modules/.bin/biome`). We recommend adding Biome as a project dependency to ensure that NPM scripts and the extension use the same Biome version.

You can also explicitly specify the `Biome` binary the extension should use by configuring the `Biome CLI Path` in `Settings`->`Language & Frameworks`->`Biome Settings`.

## Plugin settings

## Building and running the plugin
### `Biome CLI Path`

Build and run the plugin requires:
This setting overrides the Biome binary used by the plugin.

- Java development kit 17+
- IntelliJ IDEA (Ultimate edition or community edition)
## Supported IDEs

### Running the plugin on IDEA
This plugin is currently supported in the following IDEs:

```shell
./gradlew runIde
```
- IntelliJ IDEA Ultimate >2023.2.2
- WebStorm >2023.2.2
- AppCode >2023.2.2
- PhpStorm >2023.2.2
- RubyMine >2023.2.2

### Build the plugin
## Contributing

```shell
./gradlew buildPlugin
```
We welcome contributions to the Biome IntelliJ Plugin. If you encounter any issues or have suggestions for improvements, please open an issue on our [GitHub repository](https://github.com/biomejs/biome/issues/new/choose). We also have a [Discord community](https://discord.gg/BypW39g6Yc) where you can discuss the plugin, ask questions, and connect with other Biome's developers.
36 changes: 34 additions & 2 deletions editors/intellij/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import java.net.URI

fun properties(key: String) = providers.gradleProperty(key)
fun environment(key: String) = providers.environmentVariable(key)
val remoteRobotVersion = "0.11.20"

plugins {
id("java") // Java support
Expand All @@ -13,11 +16,22 @@ version = properties("pluginVersion").get()
// Configure project's dependencies
repositories {
mavenCentral()
maven { url = URI("https://packages.jetbrains.team/maven/p/ij/intellij-dependencies") }
}

// Dependencies are managed with Gradle version catalog - read more: https://docs.gradle.org/current/userguide/platforms.html#sub:version-catalog
dependencies {
// implementation(libs.annotations)
testImplementation("com.intellij.remoterobot:remote-robot:$remoteRobotVersion")
testImplementation("com.intellij.remoterobot:remote-fixtures:$remoteRobotVersion")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.9.3")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.9.2")
testRuntimeOnly("org.junit.platform:junit-platform-launcher:1.9.3")

// Logging Network Calls
testImplementation("com.squareup.okhttp3:logging-interceptor:4.11.0")

// Video Recording
implementation("com.automation-remarks:video-recorder-junit5:2.0")
}

// Set the JVM language level used to build the project. Use Java 11 for 2020.3+, and Java 17 for 2022.2+.
Expand Down Expand Up @@ -46,15 +60,30 @@ tasks {
untilBuild = properties("pluginUntilBuild")
}

// Configure UI tests plugin
downloadRobotServerPlugin {
version.set(remoteRobotVersion)
}

// Configure UI tests plugin
// Read more: https://github.com/JetBrains/intellij-ui-test-robot
runIdeForUiTests {
systemProperty("robot-server.port", "8082")
systemProperty("ide.mac.message.dialogs.as.sheets", "false")
systemProperty("jb.privacy.policy.text", "<!--999.999-->")
systemProperty("jb.consents.confirmation.enabled", "false")
systemProperty("ide.mac.file.chooser.native", "false")
systemProperty("jbScreenMenuBar.enabled", "false")
systemProperty("apple.laf.useScreenMenuBar", "false")
systemProperty("idea.trust.all.projects", "true")
systemProperty("ide.show.tips.on.startup.default.value", "false")
systemProperty("eap.require.license", "false")

}

test {
useJUnitPlatform()
}

signPlugin {
certificateChain = environment("CERTIFICATE_CHAIN")
privateKey = environment("PRIVATE_KEY")
Expand All @@ -69,3 +98,6 @@ tasks {
channels = properties("pluginVersion").map { listOf(it.split('-').getOrElse(1) { "default" }.split('.').first()) }
}
}



12 changes: 0 additions & 12 deletions editors/intellij/qodana.yml

This file was deleted.

Loading

0 comments on commit a75a9b7

Please sign in to comment.