Git Product home page Git Product logo

module-linker's Introduction

Notice

Module Linker only works on Firefox now because Google Chrome invented something called "manifest v3" and kicked Module Linker because it kept using v2 and didn't submit to their everchanging will fast enough.

Module Linker

module linker logo

Module Linker adds direct links in the GitHub source code viewer, to any imported modules or files. If you're browsing source code on GitHub, this extension will improve your life.

python-screencast

Works with all flavours of Javascript, Python, Go, Rust, Nim, Ruby, Elm, Haskell, Julia, Crystal, Purescript and more!

See this page for a full list of supported files, and screenshots.

Install it: https://addons.mozilla.org/firefox/addon/module-linker/

firefox icon

module-linker's People

Contributors

fiatjaf avatar filips123 avatar haltcase avatar sarehag avatar sidneynemzer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

module-linker's Issues

Freezes tab in chrome

When I open this page in chrome, it loads forever/freezes, but only when ModuleLinker is enabled.
Otherwise it works as expected.

Add support for Haxe.

Haxe seems to have an easy enough module and import system to be supported by Module Linker.

Opera support

This looks like a great plugin! Can I get it for Opera somewhere?

Some bugs with `Back` and `Forward` browser buttons

Hello!

I have some troubles with this extension, when pressing Back and Forward browser buttons 😰

Steps to reproduce:

  1. Load some file, application for example — there are highlights.
  2. Click to some require (require_relative 'router', for example) — works good, now you in router file with highlights.
  3. Press browser Back button — works good, now you in application file again with highlights.
  4. Press browser Forward button — BAM, you in router file without highlights (and some dynamic GitHub loading seen).

Thanks.

Lack of SASS partials support

Better support for PHP

Can you add better support for PHP?


This should include better composer.json handling.

The current version only links normal dependencies. But it should also link extension dependencies (ext-*) to correct documentation page on PHP documentation website. Suggested dependencies in suggest section should also be linked correctly.

It should also link name field to package on Packagist (but don't then forget to fix #45), autoload and autoload-dev sections to correct directories and bin section to correct file.

Composer's composer.json file is similar to Node's package.json so you could take some code from there. You should also look to composer.json schema for reference.


There should also be parsing of PHP files.

First, it should link require, require_once, include and include_once to correct files. This is similar to Node, except that it can be used with or without brackets.

It should also link use statements. This is a bit different because it includes namespace instead of the file. But with autoloading, program then includes correct file. In this case, this extension should somehow "extract" correct file from namespace and link it.

Rust invalid link to types

On the following page (https://github.com/alexcrichton/futures-rs/blob/80611a740db789c1aa62942d9b3d1ee3296bb333/src/future/empty.rs), Future link leads to https://github.com/scareangel/future-rs module (which doesn't seem to exist at all) but should link to https://github.com/alexcrichton/futures-rs/blob/80611a740db789c1aa62942d9b3d1ee3296bb333/src/future/mod.rs#L168.

Also, Poll and Async are not resolved at all.

I think the issue is that the module linker only supports linking modules and does not resolve types.

Manipulate element objects instead of innerHTML

I think it would be more elegant to manipulate the element objects instead of rewriting innerHTML.

For example, this could be substituted with something like this:

var newElem = link.get(0);
var oldTextElem = Array.from(elem.querySelector(".pl-s").childNodes)
    .filter(function (node) { return node.nodeType === 3 })[0];
elem.querySelector(".pl-s").replaceChild(newElem, oldTextElem);

Errors at PRs

Error in event handler for runtime.onMessage: TypeError: Cannot read property '1' of null
    at main (chrome-extension://dglofghjinifeolcpjfjmfdnnbaanggn/dist/full.js:22:64)
    at chrome-extension://dglofghjinifeolcpjfjmfdnnbaanggn/dist/full.js:118:3

Error occurs at this page: https://github.com/getsentry/sentry/pull/7521/files

Sometimes Back and Forward in browser are broken (I don't know if it cause of this).

Linker might run multiple times

It looks like the 'don't run more than once' protection is broken because Github changed their markup?

This line injects an element to stop the content script from running multiple times but I think it doesn't work because the element it injects into does not exist (or maybe it doesn't always exist).

In this screenshot, notice that there are multiple dots next to the imports, and the <span id="module-linker-done"> doesn't exist in the page.

image

"import" at the beginning of module name in multiline import breaks code representation [python]

import_plugins turns into import_plugins_plugins●ort_plugins.
It might be multiline-only bug, but I haven't checked.

Example: https://github.com/ansible/ansible/blob/b9b8081/test/runner/lib/cloud/__init__.py#L19

source:

from lib.util import (
    ApplicationError,
    display,
    is_shippable,
    import_plugins,
    load_plugins,
    ABC,
)

result:

from lib●.util import (
    ApplicationError,
    display,
    is_shippable,
    import_plugins_pluginsort_plugins,
    load_plugins,
    ABC,
)

local modules with webpack `resolve`

When local module is written like below, module linker links remote module having same namesake.

const hello = require('hello');  // it's a local module. not remote.

I suggest that module-linker should find the package.json first. So it can resolve whether the module is local or remote.

Lots of memory usage (1.6 gb)

Hey there, great extension!

I can't really say why but just wanted to point out that there might a memory leak. Been running my mac book for 5 days, 46 mins and the memory has reached 1.6 gb.
Cheers

Screenshot 2019-03-12 at 10 56 27

Add support for CSS/SASS/Less/etc.

Just the @import statements, to relative or absolute URLs. Should be very simple to do with some basic regex/string parsing and require('../helpers').createLink.

Rust links outside of module from definition.

When a rust module is defined in a file, e.g.

mod test {
    ....
}

a link is added for "test" which leads somewhere other than the definition, because the definition follows.

Example.

After the mod keyword I believe there are only four cases:

  • A brace (and therefore definition) follows, so there should be no link.
  • It links to a {modname}.rs file elsewhere in the repo (this is what it does now).
  • It links to a {modname}/mod.rs elsewhere in the repo.
  • The code is broken.

Btw I've head a great experience navigating Go repos with this; thank you for your work!

Scala/SBT support?

I don't know how this works, but I see a variety of different languages, so I guess you have some flexible solution. Would it be possible to add Scala support?

Actually, if there were some contribution docs, I could try to add it myself..

Error while installing the plugin on chrome

This plugin looks awesome but when I try to add it to chrome, I get the following error:

Package is invalid. Details: 'Could not load background script 'background.js'.'.

Which OAuth scopes does it need?

During the option to enter a GitHub API token, it links to the page to create a new API token, but does not explain what scopes it needs in order to work correctly. Which scopes are necessary?

Relative upper-level imports are improperly linked [python]

Consider this code:

from ..models.alphaname import Alphaname
from ..forms.alphaname import AlphanameForm

from ..tasks import submitAlphanameInstantly

Module Linker creates references to:

instead of referring upper-level packages/modules.

However it successfully recognises same-package imports, like:

from .models.campaign import Campaign
from .models.task import Task
from .models.alphaname import Alphaname
from .models.message import Message

Detect files with no extension

I just came across a file that uses #!/usr/bin/env node instead of a .js extension. It threw me off for a second because GitHub still syntax highlighted it, but no Module Linker links showed up.

I noticed the switch statement to detect the language. If there's no match, could main() also see if the first line begins with #!, and if it does, check that for common program names?

What are your thoughts of this approach?

Color legend

First off, thanks for this incredible tool 😄

I may have missed this, but it'd be nice to know what the different colors mean.

At first I thought green meant "resolved" and yellow meant "not enough info" or something. It was only after finding this that I could see a full list (and even then, you can only get an idea of what the color is since it's code).

A legend in the docs, README, or better yet, in options.html would be awesome.

Messes with back/forward history navigation

When I'm on GitHub in a source file (history index n) and go back in chrome (n-1), sometimes only the URL bar changes to the previous (n-1) URL but the content stays the same (n), when this extension is installed.
Then I have to reload or go back (n-2) and forward (to n-1) to get to that page (n-1).
This shouldn't happen, please fix it :)

Incorrectly links authors as packages

Extension incorrectly links authors as packages. This happens because both the package name and author name use name key. I tested this in Node.js project but it probably happens in every project which uses similar keys.

Example of this problem is in web3.js:

{
    "name": "web3", <---- Corrctly links to package
    ...
    "authors": [
        {
            "name": "Samuel Furter", <---- Incorrectly links to package
            "email": "[email protected]",
            "homepage": "https://github.com/nivida"
        },
        ...
    ],
    ...
}

In this example, "name": "web3" is correctly linked to correct package, but "name": "Samuel Furter" (and all other authors' names) is incorrectly linked to unexisting package with that name.

screenshot

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.