From db4b967e9abbab91371cc643e6ce7ce7b600554c Mon Sep 17 00:00:00 2001 From: David Huffman Date: Sat, 28 Nov 2015 15:48:31 -0500 Subject: [PATCH 1/2] Add support for selecting the Rust release channel * Added a `rustReleaseChannel` enum to the config options. * Modified the `assertPageAvailability` function to use the enum when constructing the documentation's URL. --- lib/docs-resolver.coffee | 3 ++- lib/rust-api-docs-helper.coffee | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/docs-resolver.coffee b/lib/docs-resolver.coffee index 11ddf38..7100b4f 100644 --- a/lib/docs-resolver.coffee +++ b/lib/docs-resolver.coffee @@ -15,10 +15,11 @@ module.exports = DocsResolver = assertModulePageAvailability: (path, callback) -> @assertPageAvailability(path, "$1/index.html", callback) assertPageAvailability: (path, resourceEndFormat, callback) -> + c = atom.config.get('rust-api-docs-helper.rustReleaseChannel') p = path.replace(/(\w*?)$/, resourceEndFormat) req = new XMLHttpRequest() req.onloadend = @onLoadEnd(path, @cache, callback) - req.open("HEAD","http://doc.rust-lang.org/#{p}") + req.open("HEAD","http://doc.rust-lang.org/#{c}/#{p}") req.send() onLoadEnd: (path, cache, callback) -> (e) -> diff --git a/lib/rust-api-docs-helper.coffee b/lib/rust-api-docs-helper.coffee index 3f03770..94a2b41 100644 --- a/lib/rust-api-docs-helper.coffee +++ b/lib/rust-api-docs-helper.coffee @@ -29,6 +29,13 @@ module.exports = RustApiDocsHelper = There is a bug at the moment that causes errors with this function. """ default: true + rustReleaseChannel: + type:'string' + description: """ + Identifies which release channel to when providing documentation. + """ + default: 'stable' + enum: ['stable', 'beta', 'nightly'] subscriptions: null From 3ec44ed6a8eaadca54a6c1babfc3252e669a4294 Mon Sep 17 00:00:00 2001 From: David Huffman Date: Sat, 28 Nov 2015 16:13:20 -0500 Subject: [PATCH 2/2] Fix typo in rustReleaseChannel setting description --- lib/rust-api-docs-helper.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rust-api-docs-helper.coffee b/lib/rust-api-docs-helper.coffee index 94a2b41..2dcd99d 100644 --- a/lib/rust-api-docs-helper.coffee +++ b/lib/rust-api-docs-helper.coffee @@ -32,7 +32,7 @@ module.exports = RustApiDocsHelper = rustReleaseChannel: type:'string' description: """ - Identifies which release channel to when providing documentation. + Identifies which release channel to use when providing documentation. """ default: 'stable' enum: ['stable', 'beta', 'nightly']