Coder Social home page Coder Social logo

mbuscemi / elm-lens Goto Github PK

View Code? Open in Web Editor NEW
51.0 5.0 2.0 5.84 MB

Elm code visualizations for maximum productivity in Atom

Home Page: https://atom.io/packages/elm-lens

License: MIT License

JavaScript 70.95% Elm 19.41% CSS 9.64%
elm atom-package productivity tools elm-lang elm-language

elm-lens's People

Contributors

mbuscemi avatar stil4m 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

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

stil4m

elm-lens's Issues

Uncaught TypeError: Cannot read property 'substr' of undefined

[Enter steps to reproduce:]

  1. ...
  2. ...

Atom: 1.23.1 x64
Electron: 1.6.15
OS: Mac OS X 10.13.1
Thrown From: elm-lens package 0.1.1

Stack Trace

Uncaught TypeError: Cannot read property 'substr' of undefined

At /Users/dan/.atom/packages/elm-lens/lib/text-editor-facade.js:27

TypeError: Cannot read property 'substr' of undefined
    at TextEditorFacade.isElmFile (/packages/elm-lens/lib/text-editor-facade.js:27:49)
    at Project.processAllElmFiles (/packages/elm-lens/lib/project.js:41:48)
    at /packages/elm-lens/lib/project.js:31:35

Commands

Non-Core Packages

atom-slime 2.8.0 
autocomplete-haskell 1.0.1 
elm-format 3.0.0 
elm-lens 0.1.1 
elmjutsu 7.2.1 
ide-haskell 2.2.0 
indent-detective 0.1.1 
ink 0.7.11 
julia-client 0.6.6 
language-elm 1.5.0 
language-julia 0.14.0 
language-lisp 0.2.0 
latex-completions 0.3.3 
lisp-paredit 0.6.0 
teletype 0.4.0 
tool-bar 1.1.0 
uber-juno 0.1.2 

Shortcut if only one reference exists

A nice enhancement would be to add an arrow or something at the end of the references text, if only one reference exist. Clicking this would jump straight to the given line. Would be really nice if it's a bit easier to jump to a reference. A popup on hover with the references or something could also work.

Love elm-lens btw! โค๏ธ

elm-lens has long startup time

There's a noticeable lag when I start up atom. Atom's timecop package shows this

screenshot from 2018-01-23 03-54-29

Here the plugin took over 40s to startup. It seems the startup time depends on which directory I start atom in.

When I run it inside small project (atom ~/path/to/my/project), it takes 0.5s to start
When I run it inside my home directory (atom .) it takes 40s to start

Type usages are ignored in let-expression

For example in the following file:

module Test exposing (foo)


type alias Thing =
    { x : Int
    }


foo : Int -> Int
foo x =
    let
        f : Thing
        f =
            { x = x }
    in
    f.x

Thing is annotated with 0 internal references, while it is being used within a let expression in foo.

I'm using version 0.1.2 of elm-lens.

Reference counting is wrong when multiple modules are imported with the same alias

I have a module that import Tangram with:

import Tangram.Model as Tangram
import Tangram.Types as Tangram
import Tangram.Update as Tangram
import Tangram.View as Tangram

and use

Tangram.subscriptions

that is coming from Tangram.Model

but in Tangram.Model it says that external references are 0 while it should say 1.

Maybe the plug-in is not taking in consideration the multiple import with the same name?

Changing the import to

import Tangram.Model
import Tangram.Types
import Tangram.Update
import Tangram.View

the counting is correct

Lens shows up on wrong line. Abandonware?

The lens lines are showing up randomly, rather than above function headers they are in the middle of functions, and they are far from the functions they describe.

Since this project was last worked on 2 years ago and makes no mention of Elm 0.19, am I to assume it's abandonware?

Roadmap

  • 0.1.0
    • Exposed/Local Display
    • Internal Ref Count
    • External Ref Count
  • 0.2.0
    • Pop-up visualization when clicking on reference counts that shows an excerpt from each line with a reference
    • Editor navigates to file and line when user clicks on an excerpt
  • 0.3.0
    • Separate display for test/project external references
  • 0.4.0
    • Elm Lens should regard each Elm project as distinct within a workspace. Base this on the presence of elm-package.json.

Metadata is not respecting zoom level

When I change the zoom level, the metadata from elm-lens is not scaled with my font. It would be nice to have the same zoom level on the metadata as on my code. For example, when you give a presentation and increase your font size.

Not fully working...

Very cool concept!

I have a large Elm project (>15,000 LOC). It semi-works, but some functions are not showing up as having any external references when they do.

Not sure if this is a time-out thing or what.

(I have an 1800 line Update file, for example, and many functions that are used in that file are showing up as having 0 external references.)

Seems to work for the smaller files.

Let me know if there is something I can do to help debug...

VSCode Integration?

Awesome project!

I just wanted to see if you had any opinions around the feasibility of a VSCode version of this tool?

Thanks ๐Ÿ‘

Wrong reference count (Task)

This happens consistently in at least two projects.

I'm not an expert in Elm, but I believe that is probably because is doing some confusion with Platform.Task

screen shot 2017-12-29 at 12 55 54

You can see the source code in action in this ellie: https://ellie-app.com/cvmGqQdtda1/0

If I rename Task to TaskItem per example, the reference count becomes correct:

screen shot 2017-12-29 at 13 05 44

Import using 'as' format not picked up

module Table imports another module using the 'as' notation

import Shots as S

...the module then uses a function from that module...

processShots yndex m = S.process yndex m

Viewing the Shots module in elm-lens shows the function 'process' to have 0 external calls

Reference counting for union types not working

Hi Matt,

I love this plugin even more than elm-test-runner. I'm running version 0.2.0, and I've just noticed one issue with counting external references for union types whose constructors are exposed.

I have a module called Types.elm, declared as follows:
module Types exposing (Model, Entity, EntityClass(..), Sprite, View(..))

And I import these types into my Main.elm as follows:
import Types exposing (Model, Entity, EntityClass(..), Sprite, View(..))

When I look in the Types.elm file, the reference counts for Model, Entity and Sprite are fine - but for the union types EntityClass and View, it says they have 0 external references.

image

However, they definitely do have external references: here is an example from Main.elm:

image

Elm Lens trying to access address book on Mac

[Enter steps to reproduce:]

  1. Installed the elm-lens package on atom
  2. Open up atom. I received pop-ups asking if Atom had permission to view Documents, Desktop, etc. Most of these were fine to mark yes.
  3. One popup asked if I wanted to give Atom permission to access my address book (which I selected no). After atom finished opening, I received an error message saying that elm-lens could not access my address book.

Is this expected behavior? Does elm-lens really need access to your address book to function properly?

Atom: 1.41.0 x64
Electron: 4.2.7
OS: Mac OS X 10.15.1
Thrown From: elm-lens package 0.3.0

Stack Trace

Uncaught Error: EPERM: operation not permitted, scandir '/Users/cyrus/Library/Application Support/AddressBook'

At fs.js:115

Error: EPERM: operation not permitted, scandir '/Users/cyrus/Library/Application Support/AddressBook'
    at Object.readdirSync (fs.js:764:3)
    at Object.fs.readdirSync (ELECTRON_ASAR.js:641:39)
    at Workspace.elmFileList (/packages/elm-lens/lib/workspace.js:57:19)
    at Workspace.findElmFilesInSubdirectories (/packages/elm-lens/lib/workspace.js:43:29)
    at /packages/elm-lens/lib/workspace.js:47:45
    at Array.forEach (<anonymous>)
    at Workspace.findElmFilesInSubdirectories (/packages/elm-lens/lib/workspace.js:46:24)
    at /packages/elm-lens/lib/workspace.js:47:45
    at Array.forEach (<anonymous>)
    at Workspace.findElmFilesInSubdirectories (/packages/elm-lens/lib/workspace.js:46:24)
    at /packages/elm-lens/lib/workspace.js:47:45
    at Array.forEach (<anonymous>)
    at Workspace.findElmFilesInSubdirectories (/packages/elm-lens/lib/workspace.js:46:24)
    at /packages/elm-lens/lib/workspace.js:23:45
    at Array.forEach (<anonymous>)
    at Workspace.getAllElmFiles (/packages/elm-lens/lib/workspace.js:22:32)
    at Project.processAllElmFiles (/packages/elm-lens/lib/project.js:21:41)
    at /packages/elm-lens/lib/project.js:31:35

Commands

     -0:38.2.0 core:copy (atom-notification.fatal.icon.icon-bug.native-key-bindings.has-detail.has-close.has-stack)

Non-Core Packages

atom-beautify 0.33.4 
atom-elixir 0.2.3 
atom-elixir-formatter 1.0.6 
atom-material-syntax 1.0.8 
atom-material-ui 2.1.3 
atom-ternjs 0.19.1 
atom-typescript 13.2.1 
auto-detect-indentation 1.3.0 
autocomplete-modules 2.3.0 
busy-signal 2.0.1 
elm-format 3.2.0 
elm-lens 0.3.0 
elmjutsu 9.11.0 
file-icons 2.1.31 
firacode 0.3.0 
gloom 0.6.5 
html-to-elm 0.2.0 
hyperclick 0.1.5 
intentions 1.1.5 
language-babel 2.85.0 
language-docker 1.1.8 
language-ejs 0.4.0 
language-elixir 0.22.1 
language-elm 1.5.0 
linter 2.3.0 
linter-ui-default 1.7.1 
markdown-pdf 2.2.0 
pdf-view 0.71.0 
pigments 0.40.2 
single-click-open 0.2.2 
sort-lines 0.19.0 
sync-settings 0.8.6 
todo-show 2.3.2 

Create a cli script so other editors can collect and use results

Just looking briefly at the source, it looks like this is completely coupled to Atom, which is fine, but it means no other editor can use this really neat tool.

What would be interesting is if this were an npm package, that could be used like:

$ npm install -g elm-lens
$ elm-lens ./src/*.elm

And it would send out (maybe json?) information about each function, maybe something like:

[
  {
    "file": "path/to/file.elm",
    "line": 5,
    "name": "nameOfFunction",
    "definition": "nameOfFunction : Int -> Int",
    "externalReferences": [{ "file": "other/file.elm", "line": 72 }],
    "internalReferences": []
  },
  // ...
]

Not sure you'd need all that information, and maybe you could scope things a little better to make the json output much smaller, but that's the general gist. From there, you could pipe it to a file in unix like elm-lens ./src/*.elm > elm-lens.json, or from an editor, consume that json and show the appropriate information in the editor.

Haven't looked into the source code enough to know what sort of effort this would be, but it will satisfy 100% of the other issues that will crop up of "please support editor x."

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.