Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(editors/intellij): IntelliJ Platform LSP #185

Merged
merged 19 commits into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
129 changes: 122 additions & 7 deletions .github/workflows/release_lsp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
- main
paths:
- editors/vscode/package.json
- editors/intellij/gradle.properties

jobs:
check:
Expand All @@ -16,12 +17,14 @@ jobs:
outputs:
# LSP Extension Version
version: ${{ env.version }}
intellij_version: ${{ env.intellij_version }}

# Version of the Biome binary
biome_version: ${{ env.biome_version }}
prerelease: ${{ env.prerelease }}
nightly: ${{ env.nightly }}
version_changed: ${{ steps.version.outputs.changed }}
intellij_version_changed: ${{ steps.intellij_version.outputs.changed }}
steps:
- uses: actions/checkout@v3

Expand All @@ -30,14 +33,22 @@ jobs:
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
run: echo "nightly=true" >> $GITHUB_ENV

- name: Check version changes
- name: Check VSCode version changes
uses: EndBug/version-check@v2
if: env.nightly != 'true'
id: version
with:
diff-search: true
file-name: editors/vscode/package.json

- name: Check intellij plugin version changes
uses: victor-teles/gradle-properties-diff-checker@v1
if: env.nightly != 'true'
id: intellij_version
with:
file-name: editors/intellij/gradle.properties
property: pluginVersion

- name: Check Biome version changes
uses: EndBug/version-check@v2
if: env.nightly != 'true'
Expand All @@ -50,6 +61,7 @@ jobs:
run: |
echo "version=${{ steps.version.outputs.version }}" >> $GITHUB_ENV
echo "biome_version=${{ steps.biome_version.outputs.version }}" >> $GITHUB_ENV
echo "intellij_version=${{ steps.intellij_version.outputs.version }}" >> $GITHUB_ENV

- name: Check prerelease status
id: prerelease
Expand All @@ -58,10 +70,15 @@ jobs:
echo "prerelease=true" >> $GITHUB_ENV
node ./editors/vscode/scripts/update-nightly-version.mjs >> $GITHUB_ENV
echo "biome_version=$(node packages/@biomejs/biome/scripts/update-nightly-version.mjs)" >> $GITHUB_ENV
echo "intellij_version=$(node ./editors/intellij/scripts/update-nightly-version.mjs)" >> $GITHUB_ENV

- name: Check version status
- name: Check VSCode version status
if: steps.version.outputs.changed == 'true'
run: 'echo "Version change found! New version: ${{ steps.version.outputs.version }} (${{ steps.version.outputs.version_type }})"'
run: 'echo "VSCode Version change found! New version: ${{ steps.version.outputs.version }} (${{ steps.version.outputs.version_type }})"'

- name: Check intellij version status
if: steps.intellij_version.outputs.changed == 'true'
run: 'echo "Intellij Version change found! New version: ${{ steps.intellij_version.outputs.version }}'

- name: Biome Check version status
if: steps.biome_version.outputs.changed == 'true'
Expand Down Expand Up @@ -90,7 +107,7 @@ jobs:
target: aarch64-apple-darwin
code-target: darwin-arm64

name: Package ${{ matrix.code-target }}
name: Package VSCode ${{ matrix.code-target }}
runs-on: ${{ matrix.os }}

needs: check
Expand Down Expand Up @@ -148,7 +165,7 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: 18

- name: Setup pnpm
uses: pnpm/[email protected]
with:
Expand Down Expand Up @@ -187,7 +204,7 @@ jobs:
if-no-files-found: error

publish:
name: Publish
name: Publish VSCode
runs-on: ubuntu-latest
needs: build
environment: marketplace
Expand All @@ -212,7 +229,7 @@ jobs:
with:
version: latest
run_install: true

- name: Install VCSE
run: pnpm add -g @vscode/vsce

Expand Down Expand Up @@ -255,3 +272,101 @@ jobs:
biome_lsp-*.vsix
fail_on_unmatched_files: true
generate_release_notes: true

build-intellij:
name: Build Intellij LSP
runs-on: ubuntu-latest
needs: check
env:
version: ${{ needs.check.outputs.intellij_version }}

if: needs.check.outputs.intellij_version_changed == 'true' || needs.check.outputs.nightly == 'true'
outputs:
version: ${{ env.version }}
prerelease: ${{ env.prerelease }}

steps:
- name: Checkout repository
uses: actions/checkout@v3

- 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: Update plugin version
if: needs.check.outputs.prerelease == 'true'
working-directory: editors/intellij
run: |
node ./scripts/update-nightly-version.mjs >> $GITHUB_ENV

- name: Build plugin
working-directory: editors/intellij
run: ./gradlew buildPlugin

- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: intellij_package
path: ./editors/intellij/build/distributions/intellij-biome-*.zip
if-no-files-found: error

publish-intellij:
name: Publish Intellij LSP
runs-on: ubuntu-latest
needs: build-intellij
environment: intellij-plugin
permissions:
contents: write
steps:
- uses: actions/checkout@v3

- name: Download extension artifacts
uses: actions/download-artifact@v3
with:
name: intellij_package
path: ./editors/intellij/build/distributions

- 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: Publish Plugin
env:
PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
CERTIFICATE_CHAIN: ${{ secrets.CERTIFICATE_CHAIN }}
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}
PRIVATE_KEY_PASSWORD: ${{ secrets.PRIVATE_KEY_PASSWORD }}
run: ./gradlew publishPlugin
working-directory: editors/intellij

- name: Extract changelog
run: |
bash scripts/print-changelog.sh ${{ needs.build.outputs.version }} >| ${{ github.workspace }}/RELEASE_NOTES
- name: Create GitHub release and tag
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
name: Intellij Plugin v${{ needs.build.outputs.version }}
tag_name: lsp-intellij/v${{ needs.build.outputs.version }}
draft: false
prerelease: ${{ needs.build.outputs.prerelease == 'true' }}
body_path: ${{ github.workspace }}/RELEASE_NOTES
files: |
./editors/intellij/build/distributions/intellij-biome-*.zip
fail_on_unmatched_files: true
generate_release_notes: true
19 changes: 19 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,25 @@ If files specific to your local development environment should be ignored, pleas

You can find more information on this process [here](https://help.github.com/en/github/using-git/ignoring-files#configuring-ignored-files-for-all-repositories-on-your-computer).

## Intellij plugin

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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does that mean that CLion, WebStorm, etc. wouldn't work for local development?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can remove this requirement,

The Intellij IDEA for testing purpose is automatically downloaded when you run ./gradlew runIde (i don't know if it's possible to use other IDE's)

For more details about IDE Development Instance


### Running the plugin on IDEA
```bash
./gradlew runIde
```

### Build the plugin
```bash
./gradlew buildPlugin
```

## Node.js development

The npm module `npm/biome` contains Biome's Node JS API that supports different backends:
Expand Down
4 changes: 4 additions & 0 deletions editors/intellij/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.gradle
.idea
.qodana
build
25 changes: 25 additions & 0 deletions editors/intellij/.run/Run IDE for UI Tests.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Run IDE for UI Tests" type="GradleRunConfiguration" factoryName="Gradle">
<log_file alias="idea.log" path="$PROJECT_DIR$/build/idea-sandbox/system/log/idea.log" />
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="runIdeForUiTests" />
</list>
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<RunAsTest>false</RunAsTest>
<method v="2" />
</configuration>
</component>
24 changes: 24 additions & 0 deletions editors/intellij/.run/Run Plugin.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Run Plugin" type="GradleRunConfiguration" factoryName="Gradle">
<log_file alias="idea.log" path="$PROJECT_DIR$/build/idea-sandbox/system/log/idea.log" />
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="runIde" />
</list>
</option>
<option name="vmOptions" value="" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<method v="2" />
</configuration>
</component>
30 changes: 30 additions & 0 deletions editors/intellij/.run/Run Qodana.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Run Qodana" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="env">
<map>
<entry key="QODANA_SHOW_REPORT" value="true" />
</map>
</option>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="cleanInspections" />
<option value="runInspections" />
</list>
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<RunAsTest>false</RunAsTest>
<method v="2" />
</configuration>
</component>
24 changes: 24 additions & 0 deletions editors/intellij/.run/Run Tests.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Run Tests" type="GradleRunConfiguration" factoryName="Gradle">
<log_file alias="idea.log" path="$PROJECT_DIR$/build/idea-sandbox/system/log/idea.log" />
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="check" />
</list>
</option>
<option name="vmOptions" value="" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<method v="2" />
</configuration>
</component>
26 changes: 26 additions & 0 deletions editors/intellij/.run/Run Verifications.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Run Verifications" type="GradleRunConfiguration" factoryName="Gradle">
<log_file alias="idea.log" path="$PROJECT_DIR$/build/idea-sandbox/system/log/idea.log" />
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="runPluginVerifier" />
</list>
</option>
<option name="vmOptions" value="" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<method v="2">
<option name="Gradle.BeforeRunTask" enabled="true" tasks="clean" externalProjectPath="$PROJECT_DIR$" vmOptions="" scriptParameters="" />
</method>
</configuration>
</component>
Loading