diff --git a/CHANGELOG.md b/CHANGELOG.md index e195174..9e9d2ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/package.json b/package.json index 9a7142c..3efdabe 100644 --- a/package.json +++ b/package.json @@ -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" diff --git a/sample/Cargo.toml b/sample/Cargo.toml index e4350f1..1c6bc2f 100644 --- a/sample/Cargo.toml +++ b/sample/Cargo.toml @@ -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" @@ -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] @@ -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" \ No newline at end of file diff --git a/src/toml/decorations.ts b/src/toml/decorations.ts index b17cd18..aca84d0 100644 --- a/src/toml/decorations.ts +++ b/src/toml/decorations.ts @@ -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 => { @@ -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), @@ -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);