From 1fbcf878b4ead0741fde3335d05282cddcc07433 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marius=20H=C3=B6fler?= <29115214+marius-h@users.noreply.github.com> Date: Mon, 23 Aug 2021 01:28:16 +0200 Subject: [PATCH] Prepare release v1.6.0 (#149) * Cleanup * Update readme * Enable force push for release --- .github/workflows/release.yml | 1 + README.md | 28 +++++++++---------- build.gradle.kts | 2 +- .../codeInsight/PubChangelogProvider.kt | 18 ++++++------ .../codeInsight/PubDocumentationProvider.kt | 3 +- .../editor/linter/LinterViewPanel.kt | 2 +- .../utils/GithubApi.kt | 18 +++++------- .../flutterenhancementsuite/utils/PsiUtils.kt | 8 ------ .../flutterenhancementsuite/utils/Utils.kt | 23 --------------- 9 files changed, 33 insertions(+), 70 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5763a630..e2a54b0a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -68,4 +68,5 @@ jobs: uses: ad-m/github-push-action@master with: branch: main + force: true github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/README.md b/README.md index efcb9713..03824f0b 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ The essential plugin for making working with Flutter easier than ever!

Easy-to-use tools for managing your pubspec.yaml, snippets & more +

## Features @@ -22,7 +23,7 @@ Easy-to-use tools for managing your pubspec.yaml, snippets & more

Update Pub Packages

-

Whenever there's a new version available for a package, it will tell you. Just press alt + ⮐ or ⌥ + ⮐ and choose "Update package".

+

Whenever there's a new version available for a package, it will tell you. Just press alt+⮐ or ⌥+⮐ and choose "Update package".

Update pub packages screenshot

@@ -40,13 +41,17 @@ Easy-to-use tools for managing your pubspec.yaml, snippets & more View package's changelog screenshot

-

View Test Coverage Report

-

Ever wondered why you can't view the test coverage in your IDE?

-

Well, with this plugin you can! Just press the "Run with coverage" button when launching your tests.

-View package's changelog screenshot +

Open a package's page on pub.dev

+

No more need to copy a package's name and pasting it into the searchbar on pub.dev!

+

No you can just get there by pressing ctrl+B or ⌘+B while the cursor is on the package's name.

+Open a package's page on pub.dev

->Please note: This requires you to run the tests in a directory. Single files DO NOT work yet. +

Quickly make classes, functions and variables private or public

+

For all of you who got tired pressing ⇧+F6 and adding or removing the underscore: You're finally redeemed!

+

Just use alt+⮐ or ⌥+⮐ to make it private or public.

+Quickly make classes, functions and variables private or public +

Generate Widgets

When creating a new file, choose the "New Flutter Widget" option. @@ -67,7 +72,7 @@ A bunch of snippets/LiveTemplates for quicker coding. Use ctrl+Q or

Icon Previews

Preview icons from different icon packs in the sidebar.
->Please note: This requires you to add the package flutter_vector_icons to your pub dependencies. The only compatible iconpacks for now are FontAwesome, Ionicons and MaterialCommunityIcons.

+> Please note: This requires you to add the package flutter_vector_icons to your pub dependencies. The only compatible iconpacks for now are FontAwesome, Ionicons and MaterialCommunityIcons.

Icon previews screenshot

@@ -80,19 +85,12 @@ select the "Linter Rules Editor" tab at the bottom to see all linting options av Edit linting rules screenshot

-

(Deprecated) Generate Blocs

-

When creating a new file, choose the "New Flutter Bloc" option. -Enter a name for your bloc and it will automatically generate all required classes for you.
- ->Please note: This requires you to add the package bloc to your pub dependencies. -

- - ## :arrow_down: 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 diff --git a/build.gradle.kts b/build.gradle.kts index 013bdc3f..489d435c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,4 +1,3 @@ - import org.jetbrains.changelog.markdownToHTML import org.jetbrains.kotlin.gradle.tasks.KotlinCompile @@ -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. diff --git a/src/main/kotlin/de/mariushoefler/flutterenhancementsuite/codeInsight/PubChangelogProvider.kt b/src/main/kotlin/de/mariushoefler/flutterenhancementsuite/codeInsight/PubChangelogProvider.kt index f63da494..84470328 100644 --- a/src/main/kotlin/de/mariushoefler/flutterenhancementsuite/codeInsight/PubChangelogProvider.kt +++ b/src/main/kotlin/de/mariushoefler/flutterenhancementsuite/codeInsight/PubChangelogProvider.kt @@ -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) } @@ -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" } } diff --git a/src/main/kotlin/de/mariushoefler/flutterenhancementsuite/codeInsight/PubDocumentationProvider.kt b/src/main/kotlin/de/mariushoefler/flutterenhancementsuite/codeInsight/PubDocumentationProvider.kt index 53ebc5d9..46aae683 100644 --- a/src/main/kotlin/de/mariushoefler/flutterenhancementsuite/codeInsight/PubDocumentationProvider.kt +++ b/src/main/kotlin/de/mariushoefler/flutterenhancementsuite/codeInsight/PubDocumentationProvider.kt @@ -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 } } diff --git a/src/main/kotlin/de/mariushoefler/flutterenhancementsuite/editor/linter/LinterViewPanel.kt b/src/main/kotlin/de/mariushoefler/flutterenhancementsuite/editor/linter/LinterViewPanel.kt index 7c8ce772..0740568f 100644 --- a/src/main/kotlin/de/mariushoefler/flutterenhancementsuite/editor/linter/LinterViewPanel.kt +++ b/src/main/kotlin/de/mariushoefler/flutterenhancementsuite/editor/linter/LinterViewPanel.kt @@ -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() + private val data = ArrayList() override fun getRowCount(): Int = data.size diff --git a/src/main/kotlin/de/mariushoefler/flutterenhancementsuite/utils/GithubApi.kt b/src/main/kotlin/de/mariushoefler/flutterenhancementsuite/utils/GithubApi.kt index 67bcfc50..37f97d39 100644 --- a/src/main/kotlin/de/mariushoefler/flutterenhancementsuite/utils/GithubApi.kt +++ b/src/main/kotlin/de/mariushoefler/flutterenhancementsuite/utils/GithubApi.kt @@ -4,12 +4,12 @@ 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 { @@ -17,12 +17,7 @@ object GithubApi { } 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) @@ -66,13 +61,14 @@ private interface GithubApiService { @POST("markdown") fun postMarkdown(@Body text: String): Call - @GET("{filepath}") - fun getTextFromFile(@Path("filepath") filePath: String): Call + @GET + fun getTextFromFile(@Url filePath: String): Call 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) diff --git a/src/main/kotlin/de/mariushoefler/flutterenhancementsuite/utils/PsiUtils.kt b/src/main/kotlin/de/mariushoefler/flutterenhancementsuite/utils/PsiUtils.kt index 489e99a0..e0d77c5c 100644 --- a/src/main/kotlin/de/mariushoefler/flutterenhancementsuite/utils/PsiUtils.kt +++ b/src/main/kotlin/de/mariushoefler/flutterenhancementsuite/utils/PsiUtils.kt @@ -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 { @@ -28,8 +25,3 @@ fun PsiFile.extractDartImportStatements(): List { return importStatements } - -fun PubRoot.isDartFileInLib(virtualFile: VirtualFile): Boolean { - return getRelativePath(virtualFile) - ?.startsWith("lib") == true && FlutterUtils.isDartFile(virtualFile) -} diff --git a/src/main/kotlin/de/mariushoefler/flutterenhancementsuite/utils/Utils.kt b/src/main/kotlin/de/mariushoefler/flutterenhancementsuite/utils/Utils.kt index 64425860..f2fd6162 100644 --- a/src/main/kotlin/de/mariushoefler/flutterenhancementsuite/utils/Utils.kt +++ b/src/main/kotlin/de/mariushoefler/flutterenhancementsuite/utils/Utils.kt @@ -3,25 +3,6 @@ package de.mariushoefler.flutterenhancementsuite.utils import com.intellij.openapi.application.ex.ApplicationUtil import com.intellij.openapi.progress.ProgressManager -inline fun buildList(builder: (CollectionBuilder).() -> Unit): List = - buildCollection(mutableListOf(), builder).toList() - -inline fun buildCollection( - result: MutableCollection, - builder: (CollectionBuilder).() -> Unit -): MutableCollection { - object : CollectionBuilder { - override fun add(item: T) { - result.add(item) - } - - override fun addAll(items: Collection) { - result.addAll(items) - } - }.builder() - return result -} - inline fun ifLet(vararg elements: T?, closure: (List) -> Unit) { if (elements.all { it != null }) { closure(elements.filterNotNull()) @@ -31,7 +12,3 @@ inline fun ifLet(vararg elements: T?, closure: (List) -> Unit) { fun runWithCheckCanceled(callable: () -> T): T = ApplicationUtil.runWithCheckCanceled(callable, ProgressManager.getInstance().progressIndicator) -interface CollectionBuilder { - fun add(item: T) - fun addAll(items: Collection) -}