Skip to content

Commit

Permalink
feat: v2.1.0 - auto sorting & crash fixes (#58)
Browse files Browse the repository at this point in the history
- auto sort dependencies after import (implements #19)
- add option for auto sorting
- add command for auto sorting
- fix crash when pubspec or dependencies are empty (fixes #56, #54, #49, #47)
  • Loading branch information
jeroen-meijer authored Oct 5, 2020
1 parent f20919f commit 3f9059e
Show file tree
Hide file tree
Showing 21 changed files with 332 additions and 234 deletions.
54 changes: 24 additions & 30 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,28 @@
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
{
"version": "0.2.0",
"configurations": [
{
"name": "Extension",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
],
"outFiles": [
"${workspaceFolder}/out/**/*.js"
],
"preLaunchTask": "npm: watch"
},
{
"name": "Extension Tests",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/test"
],
"outFiles": [
"${workspaceFolder}/out/test/**/*.js"
],
"preLaunchTask": "npm: watch"
}
]
"version": "0.2.0",
"configurations": [
{
"name": "Debug extension",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": ["--extensionDevelopmentPath=${workspaceFolder}"],
"outFiles": ["${workspaceFolder}/out/**/*.js"],
"preLaunchTask": "npm: watch"
},
{
"name": "Extension Tests",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/test"
],
"outFiles": ["${workspaceFolder}/out/test/**/*.js"],
"preLaunchTask": "npm: watch"
}
]
}
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,15 @@ First official release! 🎉
- Filtered `dart:...` packages from search results.
- Improved and updated README.md
- Upgrade dependency versions for security reasons (again again).

## 2.1.0 - 2020-10-05

### Changed

- Added command that sorts all `dependencies` and `dev_dependencies`.
- Added option to sorts all `dependencies` and `dev_dependencies` automatically when running an import (turned on by default). (Thanks [@JCKodel](https://github.com/JCKodel) for feature request [#19](https://github.com/jeroen-meijer/pubspec-assist/issues/19)!)
- Removed old text parser.

### Fixed

- Fixed several bugs where the extension would crash when adding dependencies to an empty pubspec or empty `(dev_)dependencies`. (Thank you to [@cverdes](https://github.com/cverdes) for [#56](https://github.com/jeroen-meijer/pubspec-assist/issues/56), [@JCKodel](https://github.com/JCKodel) for [#54](https://github.com/jeroen-meijer/pubspec-assist/issues/54), [@simphotonics](https://github.com/simphotonics) for [#49](https://github.com/jeroen-meijer/pubspec-assist/issues/49) and [@ernestsheldon](https://github.com/ernestsheldon) for [#47](https://github.com/jeroen-meijer/pubspec-assist/issues/47)!)
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ You can look for and import packages directly from VS Code without ever switchin
**Pubspec Assist is smart about finding what you're trying to search for.**<br/>
It gets you the most likely package you want and will give you a selection to choose from otherwise and **sorts them by relevance**.

### Automatically sort dependencies.

**Pubspec Assist automatically sorts your dependencies after adding a new package.**<br/>
This makes it easy to manage packages from multiple sources, such as local packages, ones hosted on Git, somewhere else or regular packages from [pub.dev](https://pub.dev/).

Already have your dependencies set up? **Just use the sort command to instantly sort your existing dependencies.**

### Compatible with multiple projects.

**Pubspec Assist will add your new dependencies to the `pubspec.yaml` that's open in your editor.**<br/>
Expand All @@ -51,8 +58,10 @@ Don't have your `pubspec.yaml` file opened? No problem - the package will be add

Some features that are planned for the future, in order of expected implementation.

- Search/batch add/update multiple packages.
- Command for updating all packages.
- Auto-complete while searching.

## Bugs and feature requests

If you have any bugs or feature requests to report, please check out the issues on the GitHub repository page or create a new one.
If you have any bugs or feature requests to report, please check out the issues on the GitHub repository or create a new one.
51 changes: 22 additions & 29 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 18 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "pubspec-assist",
"displayName": "Pubspec Assist",
"description": "Easily add and update dependencies to your Dart and Flutter project.",
"version": "2.0.0",
"version": "2.1.0",
"publisher": "jeroen-meijer",
"author": {
"name": "Jeroen Meijer",
Expand Down Expand Up @@ -52,6 +52,11 @@
"command": "pubspec-assist.addDevDependency",
"title": "Add/update dev dependency",
"category": "Pubspec Assist"
},
{
"command": "pubspec-assist.sortAllDependencies",
"title": "Sort all dependencies",
"category": "Pubspec Assist"
}
],
"configuration": [
Expand All @@ -64,6 +69,11 @@
"default": true,
"description": "If a package with a very close match to your search is found, add it to the pubspec file automatically."
},
"pubspec-assist.sortDependencies": {
"type": "boolean",
"default": true,
"description": "Sort all dependencies and dev_dependencies after adding/updating a dependency using the new YAML parser."
},
"pubspec-assist.useCaretSyntax": {
"type": "boolean",
"default": true,
Expand All @@ -87,18 +97,18 @@
"test": "node ./out/test/index.js"
},
"devDependencies": {
"@types/glob": "^7.1.1",
"@types/js-yaml": "^3.12.3",
"@types/glob": "^7.1.3",
"@types/js-yaml": "^3.12.5",
"@types/mocha": "^5.2.6",
"@types/node": "^12.12.0",
"@types/node": "^12.12.62",
"@types/openurl": "^1.0.0",
"@types/vscode": "^1.32.0",
"@types/vscode": "^1.49.0",
"glob": "^7.1.4",
"mocha": "^6.1.4",
"source-map-support": "^0.5.12",
"source-map-support": "^0.5.19",
"tslint": "^5.19.0",
"typescript": "^3.8.3",
"vscode-test": "^1.3.0"
"typescript": "^3.9.7",
"vscode-test": "^1.4.0"
},
"dependencies": {
"fuse-js-latest": "^3.1.0",
Expand Down
8 changes: 6 additions & 2 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as vscode from "vscode";
import * as functions from "./functions";

export function activate(context: vscode.ExtensionContext) {
let commands = {
const commands = {
addDependencyCommand: vscode.commands.registerCommand(
"pubspec-assist.addDependency",
(_: vscode.ExtensionContext) => functions.addDependency("dependencies")
Expand All @@ -14,7 +14,11 @@ export function activate(context: vscode.ExtensionContext) {
(_: vscode.ExtensionContext) =>
functions.addDependency("dev_dependencies")
),
};
sortAllDependenciesCommand: vscode.commands.registerCommand(
"pubspec-assist.sortAllDependencies",
(_: vscode.ExtensionContext) => functions.sortAllDependencies()
),
} as const;

Object.values(commands).forEach((command) =>
context.subscriptions.push(command)
Expand Down
Loading

0 comments on commit 3f9059e

Please sign in to comment.