Skip to content
This repository has been archived by the owner on Jun 28, 2024. It is now read-only.

Commit

Permalink
Change log version updatesample cargo toml changed.
Browse files Browse the repository at this point in the history
version resolution improved #6
yanked versions removed #7
  • Loading branch information
serayuzgur committed Jul 2, 2018
1 parent 406de0e commit eb78200
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 15 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Change Log
All notable changes to the "crates" extension will be documented in this file.

### 0.2.0
* Version resolution support improved [#6](https://github.com/serayuzgur/crates/issues/6).
* Yanked versions removed from the version list [#7](https://github.com/serayuzgur/crates/issues/7).

### 0.1.1
* build-dependencies support.
* dev-dependencies support.
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "crates",
"displayName": "crates",
"description": "Aims to help developers to manage dependencies while using Cargo.toml. It is only helpful if you are using dependencies from crates.io.",
"version": "0.1.1",
"description": "Aims to help rust developers to manage dependencies while using Cargo.toml. It is only helpful if you are using dependencies from crates.io.",
"version": "0.2.0",
"publisher": "serayuzgur",
"engines": {
"vscode": "^1.23.0"
Expand Down
16 changes: 9 additions & 7 deletions sample/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,17 @@ features = ["icon_loading"]
icon_loading = ["image"]

[dependencies]
lazy_static = "1.0.0"
libc = "0.2.37"
lazy_static = "1.0.1"
libc = "0.2.42"
image = {version = "0.19.0",optional = true}
futures = "0.1.21"


[dev-dependencies]
tempdir = "0.3.7"

[build-dependencies]
gcc = "0.3.54"
gcc = "0.3"

[target.'cfg(target_os = "android")'.dependencies.android_glue]
version = "0.2"
Expand All @@ -33,7 +35,7 @@ core-foundation = "0.6.0"
core-graphics = "0.14.0"

[target.'cfg(unix)'.dev-dependencies]
mio = "0.6.14"
mio = "0.6"


[target.'cfg(target_os = "windows")'.dependencies.winapi]
Expand All @@ -55,7 +57,7 @@ features = [

[target.'cfg(any(target_os = "linux", target_os = "dragonfly", target_os = "freebsd", target_os = "openbsd"))'.dependencies]
wayland-client = {version = "0.10.3",features = ["dlopen","egl","cursor"]}
smithay-client-toolkit = "0.2.1"
x11-dl = "2.17.5"
parking_lot = "0.5.5"
smithay-client-toolkit = "0.2.4"
x11-dl = "2"
parking_lot = "0.6.2"
percent-encoding = "1.0.1"
19 changes: 13 additions & 6 deletions src/toml/decorations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@ function decoration(
const end = regex.lastIndex;
const start = regex.lastIndex - match.length;
const isVersionString = typeof version === "string";
const currentVersion = isVersionString ? version : version.version;
const hasLatest =
versions[0] === (isVersionString ? version : version.version);

versions[0] === currentVersion ||
versions[0].indexOf(`${currentVersion}.`) === 0;

const hoverMessage = new MarkdownString(`**Available Versions** \t \n `);
hoverMessage.isTrusted = true;
versions.map(item => {
Expand All @@ -50,13 +52,13 @@ function decoration(
start,
end,
});
const command = `[${item}](command:crates.replaceVersion?${encodeURI(replaceData)})`;
const command = `[${item}](command:crates.replaceVersion?${encodeURI(
replaceData,
)})`;
hoverMessage.appendMarkdown("\n * ");
hoverMessage.appendMarkdown(command);
});



return {
range: new Range(
editor.document.positionAt(start),
Expand Down Expand Up @@ -87,7 +89,12 @@ export function dependencies(
console.log("Fetching dependency: ", key);
return versions(key)
.then((json: any) => {
const versions = json.versions.map((item: any) => item["num"]);
const versions = json.versions.reduce((result: any[], item: any) => {
if (!item.yanked) {
result.push(item.num);
}
return result;
}, []);
const decor = decoration(editor, key, dependencies[key], versions);
if (decor) {
options.push(decor);
Expand Down

0 comments on commit eb78200

Please sign in to comment.