Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/docs-resolver.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,18 @@ module.exports = DocsResolver =
@searchMathingDocs(path, callback)

searchMathingDocs: (path, callback) ->
for objectType in ['struct','trait','fn']
for objectType in ['type','enum','struct','trait','fn']
@assertPageAvailability(path, "#{objectType}.$1.html", callback)
@assertModulePageAvailability(path, callback)

assertModulePageAvailability: (path, callback) -> @assertPageAvailability(path, "$1/index.html", callback)

assertPageAvailability: (path, resourceEndFormat, callback) ->
channel = atom.config.get('rust-api-docs-helper.rustChannel')
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/#{channel}/#{p}")
req.send()

onLoadEnd: (path, cache, callback) -> (e) ->
Expand Down
7 changes: 7 additions & 0 deletions lib/rust-api-docs-helper.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ Shell = require 'shell'

module.exports = RustApiDocsHelper =
config:
rustChannel:
type: 'string'
description: """
The distribution channel from which the document will be searched
"""
enum: ['stable','beta','nightly']
default: 'stable'
useInternalBrowser:
type:'boolean'
description: """If set, a URL open request will be sent, that will attempt to open the docs URL within atom,
Expand Down