pkulev / jedhy

Autocompletion and code introspection for Hy.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Jedhy

Last Hy version verified working for: Hy 0.16.0

jedhy provides autocompletion, documentation introspection and formatting, and other tools useful to IDEs for Hy, a lisp embedded in Python.

Leveraged in Emacs hy-mode IDE which I maintain.

Install from pypi pip install jedhy.

Features

  1. Completes:
    1. All standard python constructs (builtins, user-defined funcs, modules, etc.)
    2. Hy constructs (macros, shadowed operators, compile table)
    3. All of the above with Hy’s mangling rules handled.
  2. Documentation introspection and formatting (eg. for Emacs Eldoc mode).
  3. Annotations (eg. for Emacs Company mode).

Jedhy is fully tested. The tests folder is the easiest way to see example usage.

See jedhy.api, the simple entry point.

Example Usage

(setv jedhy (jedhy.api.API))

;; Add some stuff to namespace
(import numpy :as np)
(import itertools)
(defclass Foo [object] "A class\nDetails..." (defn __init__ [self x y]))
(defmacro foo-macro [x])

(jedhy.set-namespace :locals- (locals) :macros- _hy_macros)

;; COMPLETION
(jedhy.complete "pr")     ; print
(jedhy.complete "print.") ; print.__call__, print.__str__, ...
(jedhy.complete "np.a")   ; np.add, np.array, ...
(jedhy.complete "foo-")   ; foo-macro

;; DOCS
(jedhy.docs "itertools")  ; "Functional tools for creating and using iterators."
(jedhy.docs "Foo")        ; "Foo: (x y) - A class"
(jedhy.full-docs "Foo")   ; "Foo: (x y) - A class\nDetails..."

;; ANNOTATION
(jedhy.annotate "itertools") ; <module itertools>
(jedhy.annotate "try")       ; <compiler try>

About

Autocompletion and code introspection for Hy.


Languages

Language:Hy 99.1%Language:Python 0.9%