-
-
Notifications
You must be signed in to change notification settings - Fork 504
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(intellij): add server restart action
- Loading branch information
Victor Teles
committed
Sep 10, 2023
1 parent
001840b
commit 9234688
Showing
8 changed files
with
84 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<!-- Keep a Changelog guide -> https://keepachangelog.com --> | ||
|
||
# intellij-rome Changelog | ||
|
||
## [Unreleased] | ||
### Added | ||
- Initial scaffold created from [IntelliJ Platform Plugin Template](https://github.com/JetBrains/intellij-platform-plugin-template) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,16 @@ | ||
# intellij-biome | ||
|
||
<!-- Plugin description --> | ||
https://biomejs.dev plugin for JetBrains IDEs. | ||
|
||
## features | ||
- Linting | ||
- Quickfix | ||
- Formatting | ||
<!-- Plugin description end --> | ||
|
||
--- | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
...ntellij/src/main/kotlin/com/github/biomejs/intellijbiome/listeners/BiomeConfigListener.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.github.biomejs.intellijbiome.listeners | ||
|
||
import com.intellij.openapi.project.Project | ||
import com.intellij.openapi.vfs.newvfs.BulkFileListener | ||
import com.intellij.openapi.vfs.newvfs.events.VFileEvent | ||
import com.intellij.openapi.components.service | ||
import com.github.biomejs.intellijbiome.services.BiomeServerService | ||
|
||
class BiomeConfigListener(val project: Project) : BulkFileListener { | ||
override fun after(events: MutableList<out VFileEvent>) { | ||
super.after(events) | ||
events.forEach { | ||
if(it.file?.name?.contains("biome.json") == true) { | ||
val biomeServerService = project.service<BiomeServerService>() | ||
|
||
biomeServerService.restartBiomeServer() | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
.../intellij/src/main/kotlin/com/github/biomejs/intellijbiome/services/BiomeServerService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.github.biomejs.intellijbiome.services | ||
|
||
import com.intellij.openapi.components.Service | ||
import com.intellij.openapi.project.Project | ||
import com.github.biomejs.intellijbiome.BiomeBundle | ||
import com.github.biomejs.intellijbiome.lsp.BiomeLspServerSupportProvider | ||
import com.intellij.notification.NotificationGroupManager | ||
import com.intellij.notification.NotificationType | ||
import com.intellij.platform.lsp.api.LspServerManager | ||
|
||
@Service(Service.Level.PROJECT) | ||
class BiomeServerService(private val project: Project) { | ||
|
||
fun restartBiomeServer() { | ||
LspServerManager.getInstance(project).stopAndRestartIfNeeded(BiomeLspServerSupportProvider::class.java) | ||
} | ||
|
||
fun notifyRestart(){ | ||
NotificationGroupManager.getInstance() | ||
.getNotificationGroup("Biome") | ||
.createNotification(BiomeBundle.message("biome.language.server.restarted"), "", NotificationType.INFORMATION) | ||
.notify(project) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters