Git Product home page Git Product logo

fuzzycompletions.jl's Introduction

FuzzyCompletions.jl

FuzzyCompletions provides fuzzy completions for a Julia runtime session.

Its API is totally compatible with the standard library module REPL.REPLCompletions; so this package can be used as a drop-in replacement for your completion provider.

example

You can make your REPL complete fuzzily with the following code:

using REPL
using REPL.LineEdit
using FuzzyCompletions

struct FuzzyCompletionProvider <: REPL.CompletionProvider
    mod::Module
end

function LineEdit.complete_line(c::FuzzyCompletionProvider, s)
  partial = REPL.beforecursor(s.input_buffer)
  full = LineEdit.input_string(s)

  # module-aware repl backend completions
  comps, range, should_complete = completions(full, lastindex(partial), c.mod)
  filter!(c->score(c)0, comps)
  return unique!(FuzzyCompletions.completion_text.(comps)), partial[range], should_complete
end

Base.active_repl.interface.modes[1].complete = FuzzyCompletionProvider(Main) # or whatever module where you want to get completes from

Then, your REPL will work like

julia> sthing
isnothing something # fuzzy completions

julia> regex<tab>
Regex      RegexMatch # cases doesn't need to match

But I'm sure you will dislike this behavior; we usually want CLI to complete eagerly, not to be an indecisive boy.

consumers

Fuzzy completions can be useful within IDE or somewhere some richer UI for showing/selecting completion suggestions is available:

acknowledgment

The original idea of the implementation came from this patch by @pfitzseb.

license

This package is under MIT License.

fuzzycompletions.jl's People

Contributors

aviatesk avatar pangoraw avatar artemsolod avatar

Stargazers

Elias Carvalho avatar

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.