Skip to content

Commit

Permalink
Prepare release v1.6.0 (#149)
Browse files Browse the repository at this point in the history
* Cleanup

* Update readme

* Enable force push for release
  • Loading branch information
marius-h authored Aug 22, 2021
1 parent c2d59fc commit 1fbcf87
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 70 deletions.
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,5 @@ jobs:
uses: ad-m/github-push-action@master
with:
branch: main
force: true
github_token: ${{ secrets.GITHUB_TOKEN }}
28 changes: 13 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
The essential plugin for making working with Flutter easier than ever!
<p>
Easy-to-use tools for managing your pubspec.yaml, snippets & more
<p>

## Features

Expand All @@ -22,7 +23,7 @@ Easy-to-use tools for managing your pubspec.yaml, snippets & more
<p>

<h3>Update Pub Packages</h3>
<p>Whenever there's a new version available for a package, it will tell you. Just press <code>alt + ⮐</code> or <code>⌥ + ⮐</code> and choose <em>"Update package"</em>.</p>
<p>Whenever there's a new version available for a package, it will tell you. Just press <code>alt+⮐</code> or <code>⌥+⮐</code> and choose <em>"Update package"</em>.</p>
<p>
<img src="https://i.imgur.com/BEgj52a.png" width="400" alt="Update pub packages screenshot"/>
<p>
Expand All @@ -40,13 +41,17 @@ Easy-to-use tools for managing your pubspec.yaml, snippets & more
<img src="https://i.imgur.com/ks2i0Hx.png" width="400" alt="View package's changelog screenshot"/>
<p>

<h3>View Test Coverage Report</h3>
<p>Ever wondered why you can't view the test coverage in your IDE?</p>
<p>Well, with this plugin you can! Just press the "Run with coverage" button when launching your tests.</p>
<img src="https://i.imgur.com/s22Wo7t.png" width="400" alt="View package's changelog screenshot"/>
<h3>Open a package's page on pub.dev</h3>
<p>No more need to copy a package's name and pasting it into the searchbar on pub.dev!</p>
<p>No you can just get there by pressing <code>ctrl+B</code> or <code>⌘+B</code> while the cursor is on the package's name.</p>
<img src="https://i.imgur.com/K2jd8bN.png" width="400" alt="Open a package's page on pub.dev"/>
<p>

><strong>Please note:</strong> This requires you to run the tests in a directory. Single files DO NOT work yet.
<h3>Quickly make classes, functions and variables private or public</h3>
<p>For all of you who got tired pressing <code>⇧+F6</code> and adding or removing the underscore: You're finally redeemed!</p>
<p>Just use <code>alt+⮐</code> or <code>⌥+⮐</code> to make it private or public.</p>
<img src="https://i.imgur.com/72tAvtf.png" width="400" alt="Quickly make classes, functions and variables private or public"/>
<p>

<h3>Generate Widgets</h3>
<p>When creating a new file, choose the <em>"New Flutter Widget"</em> option.
Expand All @@ -67,7 +72,7 @@ A bunch of snippets/LiveTemplates for quicker coding. Use <code>ctrl+Q</code> or
<h3>Icon Previews</h3>
<p>Preview icons from different icon packs in the sidebar.<br>

><strong>Please note:</strong> This requires you to add the package <a href="https://pub.dev/packages/flutter_vector_icons">flutter_vector_icons</a> to your pub dependencies. The only compatible iconpacks for now are FontAwesome, Ionicons and MaterialCommunityIcons.</p>
> <strong>Please note:</strong> This requires you to add the package <a href="https://pub.dev/packages/flutter_vector_icons">flutter_vector_icons</a> to your pub dependencies. The only compatible iconpacks for now are FontAwesome, Ionicons and MaterialCommunityIcons.</p>
<p>
<img src="https://i.imgur.com/JB9MkjA.png" width="400" alt="Icon previews screenshot"/>
<p>
Expand All @@ -80,19 +85,12 @@ select the "Linter Rules Editor" tab at the bottom to see all linting options av
<img src="https://i.imgur.com/kg9GeiY.png" width="400" alt="Edit linting rules screenshot"/>
<p>

<h3>(Deprecated) Generate Blocs</h3>
<p>When creating a new file, choose the <em>"New Flutter Bloc"</em> option.
Enter a name for your bloc and it will automatically generate all required classes for you.<br>

><strong>Please note:</strong> This requires you to add the package <a href="https://pub.dev/packages/bloc">bloc</a> to your pub dependencies.
<p>
<!-- Plugin description end -->


## :arrow_down:&nbsp;How to install?

You can install plugin directly from IntelliJ IDEA or Android Studio:

1. Open _Preferences_
2. Choose _Plugins_
3. Select the _Marketplace_ tab
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import org.jetbrains.changelog.markdownToHTML
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

Expand Down Expand Up @@ -26,6 +25,7 @@ repositories {
dependencies {
implementation("com.squareup.retrofit2:retrofit:2.9.0")
implementation("com.squareup.retrofit2:converter-gson:2.9.0")
implementation("com.squareup.retrofit2:converter-scalars:2.9.0")
}

// Configure gradle-intellij-plugin plugin.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ import de.mariushoefler.flutterenhancementsuite.utils.isPubspecFile
*/
class PubChangelogProvider : DocumentationProvider {
override fun getQuickNavigateInfo(element: PsiElement, originalElement: PsiElement?): String {
return findPackageNameAndGenerateDoc(element) ?: "Changelog not available"
return findPackageNameAndGenerateDoc(element)
}

override fun generateDoc(element: PsiElement, originalElement: PsiElement?): String? {
override fun generateDoc(element: PsiElement, originalElement: PsiElement?): String {
return findPackageNameAndGenerateDoc(element)
}

Expand All @@ -28,18 +28,16 @@ class PubChangelogProvider : DocumentationProvider {
contextElement: PsiElement?,
targetOffset: Int
): PsiElement? {
contextElement?.let {
if (file.isPubspecFile() && it.parent.parent.text.matches(REGEX_DEPENDENCY.toRegex())
) {
return contextElement
}
return contextElement?.let {
return if (file.isPubspecFile() && it.parent.parent.text.matches(REGEX_DEPENDENCY.toRegex())) {
contextElement
} else null
}
return null
}

private fun findPackageNameAndGenerateDoc(element: PsiElement): String? {
private fun findPackageNameAndGenerateDoc(element: PsiElement): String {
return element.parent.parent.firstChild.text?.let {
PubApi.getPackageChangelog(it)
}
} ?: "Changelog not available"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ class PubDocumentationProvider : DocumentationProvider {
} else {
element.parent?.text?.let {
if (it.isPubPackageName()) {
PubApi.getPackageDoc(element.text)
// TODO: unshorten again when performance was improved
PubApi.getPackageDoc(element.text, true)
} else null
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class LinterViewPanel(val project: Project, parentDisposable: Disposable) : Disp

inner class MyTableModel : AbstractTableModel() {
private val columnNames = arrayListOf("", "Rule", "Description")
val data = ArrayList<LinterRule>()
private val data = ArrayList<LinterRule>()

override fun getRowCount(): Int = data.size

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,20 @@ import de.mariushoefler.flutterenhancementsuite.exceptions.MarkdownParseExceptio
import org.json.JSONObject
import retrofit2.Call
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory
import retrofit2.converter.scalars.ScalarsConverterFactory
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.Headers
import retrofit2.http.POST
import retrofit2.http.Path
import retrofit2.http.Url

object GithubApi {
private val githubApiService by lazy {
GithubApiService.create()
}

fun formatMarkdownAsHtml(text: String, repoUrl: String): String {
var context: String
repoUrl.replace(Regex("https?://github.com/"), "")
.split("/")
.let {
context = "${it[0]}/${it[1]}"
}
val context = repoUrl.replace(Regex("https?://github.com/"), "")

val jsonObj = JSONObject()
jsonObj.put("text", text)
Expand Down Expand Up @@ -66,13 +61,14 @@ private interface GithubApiService {
@POST("markdown")
fun postMarkdown(@Body text: String): Call<String>

@GET("{filepath}")
fun getTextFromFile(@Path("filepath") filePath: String): Call<String>
@GET
fun getTextFromFile(@Url filePath: String): Call<String>

companion object {
fun create(): GithubApiService {
val retrofit =
Retrofit.Builder().addConverterFactory(GsonConverterFactory.create()).baseUrl("https://api.github.com/")
Retrofit.Builder().baseUrl("https://api.github.com/")
.addConverterFactory(ScalarsConverterFactory.create())
.build()

return retrofit.create(GithubApiService::class.java)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
package de.mariushoefler.flutterenhancementsuite.utils

import com.intellij.openapi.project.Project
import com.intellij.openapi.vfs.VirtualFile
import com.intellij.psi.PsiElement
import com.intellij.psi.PsiFile
import com.intellij.psi.PsiWhiteSpace
import com.jetbrains.lang.dart.psi.DartImportStatement
import com.jetbrains.lang.dart.util.DartElementGenerator
import io.flutter.FlutterUtils
import io.flutter.pub.PubRoot

// import 'package:flutter/material.dart';
fun Project.createImportStatement(libraryName: String): PsiElement {
Expand All @@ -28,8 +25,3 @@ fun PsiFile.extractDartImportStatements(): List<PsiElement> {

return importStatements
}

fun PubRoot.isDartFileInLib(virtualFile: VirtualFile): Boolean {
return getRelativePath(virtualFile)
?.startsWith("lib") == true && FlutterUtils.isDartFile(virtualFile)
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,6 @@ package de.mariushoefler.flutterenhancementsuite.utils
import com.intellij.openapi.application.ex.ApplicationUtil
import com.intellij.openapi.progress.ProgressManager

inline fun <reified T> buildList(builder: (CollectionBuilder<T>).() -> Unit): List<T> =
buildCollection(mutableListOf(), builder).toList()

inline fun <T> buildCollection(
result: MutableCollection<T>,
builder: (CollectionBuilder<T>).() -> Unit
): MutableCollection<T> {
object : CollectionBuilder<T> {
override fun add(item: T) {
result.add(item)
}

override fun addAll(items: Collection<T>) {
result.addAll(items)
}
}.builder()
return result
}

inline fun <T : Any> ifLet(vararg elements: T?, closure: (List<T>) -> Unit) {
if (elements.all { it != null }) {
closure(elements.filterNotNull())
Expand All @@ -31,7 +12,3 @@ inline fun <T : Any> ifLet(vararg elements: T?, closure: (List<T>) -> Unit) {
fun <T> runWithCheckCanceled(callable: () -> T): T =
ApplicationUtil.runWithCheckCanceled(callable, ProgressManager.getInstance().progressIndicator)

interface CollectionBuilder<in T> {
fun add(item: T)
fun addAll(items: Collection<T>)
}

0 comments on commit 1fbcf87

Please sign in to comment.