Code Monkey home page Code Monkey logo

purescript-docs-search's People

Contributors

dependabot[bot] avatar f-f avatar klntsky avatar purefunctor 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

purescript-docs-search's Issues

Improvements to module grouping

The latest version (0.0.9) includes the optional grouping for modules in the sidebar and the index proposed in #20, which is very lovely. While using it I noticed that it could do with some small UX improvements to make it more intuitive:

  • module grouping should be on by default, since it's really the better way to look at things
  • the project modules don't seem to be included in a package when grouping. I propose that we include them (we can get the project name from the Spago config), and we always list the project package at the top of the list of packages
  • clicking on the package name opens up a subtree in the list, but the icon on the left of the name is still a -, which doesn't communicate that it's an expandable item. Some kind of arrow, like โ–ธ, would probably be clearer
  • the title (in both the sidebar and the index) is still "Modules", even when grouping by packages

Thoughts?

Improve output for data/newtype constructors on REPL interface

Currently, the REPL interface only shows the names of constructors for data/newtype declarations like so:

Tuple

tuples                                   Data.Tuple
Additive

prelude                                  Data.Monoid.Additive

I think this can be improved by adding data constructor and newtype constructor prefixes. I'm also currently trying to integrate docs-search into Emacs and having prefixes like this would make it easier to write, considering the output format itself is already easy to parse given how the results are spaced.

data constructor Tuple :: a -> b -> Tuple a b

tuples                                   Data.Tuple
newtype constructor Additive :: a -> Additive a

prelude                                  Data.Monoid.Additive

Any thoughts? I can try working on this later this week as well. I have a working implementation at purefunctor/purescript-docs-search@1518f71

Non-interactive query

Is it possible to issue a request to the CLI without starting an interactive session?

Running `spago test` breaks `spago docs`

Steps to replicate:

spago build
spago docs
spago test

So far everything works as expected. But now run

spago docs

again. It does create most of the documentation but fails to create an index and reports an error message that includes "TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension " and warns that it "Failed while trying to make the documentation searchable: 1"

Use pager in CLI

Currently, we are printing the results reversed, so that the most relevant ones appear last. That makes sense, because that way there's no need to scroll. However, using $PAGER when available might be a better option.

Improve parser for CLI arguments

As for now, we do something like fromMaybe defaultCommands <$> getArgs where getArgs :: Effect (Maybe Commands). The default command is Search (i.e. start an interactive CLI session) with some reasonable defaults.

Thus, we are unable to pass arguments to the default command when it's not specified explicitly. E.g. this fails:

purescript-docs-search \
  --bower-jsons ".spago/*/*/bower.json" \
  --bower-jsons "bower_components/purescript-*/bower.json"

Add `install` npm script

When trying out the new side bar feature, I realized that the build script is not triggered on running npm install.

I guess if there was an install script it would build to dist and then register the CLI binary in node_modules/.bin so that the following would work:

npm install purescript-docs-search
npm run purescript-docs-search

Improve discoverability in CLI

Today I tried the functionality via spago search CLI.
Searching for individual names works great!

But what I miss is some kind of "show everything" or "focus on one module" functionality. Use case: you remember the function you're looking for is in module XYZ, but can't remember its name. I'd like to list all functions from given module. Or maybe I'd like to just go through all names that are available in the docs to explore them.

For example in Haskell's ghci you can type these commands:
:browse - show all things loaded in the repl (just functinn/type names without associated docs)
:browse Module.Name - show list of names in given module

It would be great it this package had similar functionality in CLI :-)

Call stack safety

Hi!

Thanks for building and sharing this useful tool!

I'm getting RangeError: Maximum call stack size exceeded for a quite large project. I'm using purs version 0.13.0 at the moment but I'm not sure if this is relevant.
Here is a short stack trace and attached bundle:

[nix-shell:~/programming/purescript/projects/magusai]$ purescript-docs-search build-index                                                                             
Building the search index...
Found 1071 modules.
/home/paluh/programming/purescript/projects/magusai/node_modules/purescript-docs-search/dist/main.js:2317                                                             
      function Cons(value0, value1) {
                   ^

RangeError: Maximum call stack size exceeded
    at new Cons (/home/paluh/programming/purescript/projects/magusai/node_modules/purescript-docs-search/dist/main.js:2317:20)                                        
    at $tco_loop (/home/paluh/programming/purescript/projects/magusai/node_modules/purescript-docs-search/dist/main.js:11934:89)                                      
    at /home/paluh/programming/purescript/projects/magusai/node_modules/purescript-docs-search/dist/main.js:11998:33                                                  
    at Object.shapeOfType (/home/paluh/programming/purescript/projects/magusai/node_modules/purescript-docs-search/dist/main.js:12003:97)                             
    at /home/paluh/programming/purescript/projects/magusai/node_modules/purescript-docs-search/dist/main.js:12047:85                                                  
    at /home/paluh/programming/purescript/projects/magusai/node_modules/purescript-docs-search/dist/main.js:12054:58                                                  
    at /home/paluh/programming/purescript/projects/magusai/node_modules/purescript-docs-search/dist/main.js:2608:59                                                   
    at /home/paluh/programming/purescript/projects/magusai/node_modules/purescript-docs-search/dist/main.js:2608:110                                                  
    at /home/paluh/programming/purescript/projects/magusai/node_modules/purescript-docs-search/dist/main.js:2608:110                                                  
    at /home/paluh/programming/purescript/projects/magusai/node_modules/purescript-docs-search/dist/main.js:2608:110

dist.main.js.zip

Please ping me back if you want me to test or provide additional info.

`s` should select input, just focus

e.g. $('input').select() is the behavior you want when you want the input to be focused with all of the text selected, so you can readily replace the contents

Merging in the Spago repo

I would like to merge this repository into the Spago repo - now that everything is PureScript over there I think we can (or at least I can) offer better maintenance if the code is sitting over there.

Thoughts @klntsky?

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.