aboutsummaryrefslogtreecommitdiff
path: root/javascript/app
diff options
context:
space:
mode:
authoralexwl <alexey.a.kiryushin@gmail.com>2018-10-06 01:15:16 +0300
committeralexwl <alexey.a.kiryushin@gmail.com>2018-10-06 01:15:16 +0300
commit579a0f16c4f3ad2bcc8a283081d214fbe1ee3a59 (patch)
tree8f24b55358d47c73dd92aae83f4ad1e4b8c93870 /javascript/app
parenta221abf41ca9c28d267f7da272ec12ccd2688b94 (diff)
Generate links to hyperlinked source code on Hackage instead of links to documentation
Diffstat (limited to 'javascript/app')
-rw-r--r--javascript/app/utils/go-to-definition.js17
1 files changed, 5 insertions, 12 deletions
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