From 579a0f16c4f3ad2bcc8a283081d214fbe1ee3a59 Mon Sep 17 00:00:00 2001 From: alexwl Date: Sat, 6 Oct 2018 01:15:16 +0300 Subject: Generate links to hyperlinked source code on Hackage instead of links to documentation --- javascript/app/utils/go-to-definition.js | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'javascript/app') diff --git a/javascript/app/utils/go-to-definition.js b/javascript/app/utils/go-to-definition.js index e05f6bf..7063ec0 100644 --- a/javascript/app/utils/go-to-definition.js +++ b/javascript/app/utils/go-to-definition.js @@ -9,21 +9,14 @@ function exactLocationToUrl(exactLocation) { } function hackageUrl(packageId,locationInfo) { - const dasherizedModuleName = locationInfo.moduleName.replace(/\./g,'-'); - let key; - if(locationInfo.entity === "Val") { - key = "v"; - } else { - key = "t"; - } let hash = ""; - if(locationInfo.entity === "Val" || locationInfo.entity === "Typ") { - hash = "#"+key+":"+locationInfo.haddockAnchorId; - } - return "https://hackage.haskell.org/package/"+packageId+"/docs/"+dasherizedModuleName+".html"+hash; + if (locationInfo.entity !== "Mod") { + hash = "#" + encodeURIComponent(locationInfo.name); + } + return "https://hackage.haskell.org/package/"+packageId+"/docs/src/"+locationInfo.moduleName+".html"+hash; } -function openUrl(buttonId,url) { +function openUrl(buttonId,url) { if(buttonId === 2) {//middle mouse button window.open(url, '_blank'); } else if(buttonId == 1) {//left mouse button -- cgit v1.2.3