Giter Club home page Giter Club logo

jewel.jl's Introduction

Jewel.jl

Jewel.jl is a collection of IDE related code. It also handles communication with Light Table, although this is entirely seperate (in the LightTable folder) and may be removed eventually.

It handles things such as:

  • Extensible autocompletion
  • Pulling code blocks out of files (given a cursor position)
  • Finding relevant documentation or method definitions at the cursor
  • Detecting the module a file belongs to
  • Evaluation of code blocks with correct file, line and module data

If you want any info on using this package as support for another IDE feel free to drop me a line.

jewel.jl's People

Contributors

alyst avatar dlfivefifty avatar drewrobson avatar josephnunn avatar michaelhatherly avatar mikeinnes avatar nilshg avatar pfitzseb avatar ruliana avatar varanas 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

Watchers

 avatar  avatar  avatar

jewel.jl's Issues

"error compiling anonymous" on evaluating whole document

Hey there,

I'm encountering a strange problem which is related to the following (simplified) code:

using PyPlot
for i = 0:9
    println("test")
end

This throws the following error only when executed by C+Shift+Enter, but not when evaluating every single line via C+Enter. If I eval the code from the Julia REPL, it works fine.

error compiling anonymous: unsupported or misplaced expression using in function anonymous
 in eval at no file
 in anonymous at C:\Users\Basti\.julia\v0.3\Jewel\src\eval.jl:21
 in get at dict.jl:590
 in anonymous at C:\Users\Basti\.julia\v0.3\Jewel\src\eval.jl:9

If either the loop or the using is commented out, the evaluation of the whole file works fine.

Edit: What I forgot to add: It doesn't matter which package is included, any using Package will do the trick.

Comment block syntax highlighting bug

Not sure where the syntax highlighting logic is with light table, but I noticed that an inline comment block wasn't working; it seemed to be space sensitive.

The offending line was

fractionals,integrals#=::Integer=# = modf(a) # returns same type as a

It seemed to have a hard time recognizing the inline comment block.

Split @require out into its own package?

I discovered the @require macro by way of JuliaLang/julia#2025, and think it's extremely useful. I'd love to use it in some of my own packages. But since you can only override Base.require once, it'd make sense to have everyone share the same codebase. So would you be willing to split it out into a very simple package? Perhaps named Require.jl? Thanks!

Display incorrect rounding

I seem to get some inconsistent rounding behaviour of the display output. See below
lt-prscr

or try yourself:

T1 = [100, 101]
tt = T1[end] + (T1[end] - T1[1])/2
@show tt

T1 = [1000, 1001]
tt = T1[end] + (T1[end] - T1[1])/2
@show tt

I would expect to see 1001.5 in the second block, not 1002.0

A question related to this issue, where can I set the number of significant numbers of the output?

Use REPLCompletions.jl for completions

The Julia REPL and IJulia share code for completions, maybe you want to make use of it too! It used to be in the REPLCompletions.jl package but it's now in master after the new REPL was merged.

How to lazy-export

So I have something like this

module Foo
  @require Compose include("draw.jl")
end

draw.jl defines a draw_it() function. I want to export draw_it from Foo, but I can't do

module Foo
  export draw_it
  @require Compose include("draw.jl")
end

because draw_it doesn't isn't defined apparently. How is this supposed to look?

Pkg.add fails

In the Julia 0.3.1 REPL I get a weird error:

julia>  Pkg.add("Jewel")
ERROR: IJulia can't be installed because it has no versions that support 0.3.1 of julia
 in wait at task.jl:284
 in wait at task.jl:194
 in wait at task.jl:48
 in sync_end at task.jl:311
 in add at pkg/entry.jl:319
 in add at pkg/entry.jl:71
 in anonymous at pkg/dir.jl:28
 in cd at file.jl:30
 in cd at pkg/dir.jl:28
 in add at pkg.jl:20

IJulia is installed (with Anaconda), and works perfectly. Because of this error Juno (LightTable) cannot connect to Julia. What can I do?

[PkgEval] Jewel may have a testing issue on Julia 0.4 (2014-08-29)

PackageEvaluator.jl is a script that runs nightly. It attempts to load all Julia packages and run their tests (if available) on both the stable version of Julia (0.3) and the nightly build of the unstable version (0.4). The results of this script are used to generate a package listing enhanced with testing results.

On Julia 0.4

  • On 2014-08-27 the testing status was Tests pass.
  • On 2014-08-29 the testing status changed to Tests fail, but package loads.

Tests pass. means that PackageEvaluator found the tests for your package, executed them, and they all passed.

Tests fail, but package loads. means that PackageEvaluator found the tests for your package, executed them, and they didn't pass. However, trying to load your package with using worked.

This issue was filed because your testing status became worse. No additional issues will be filed if your package remains in this state, and no issue will be filed if it improves. If you'd like to opt-out of these status-change messages, reply to this message saying you'd like to and @IainNZ will add an exception. If you'd like to discuss PackageEvaluator.jl please file an issue at the repository. For example, your package may be untestable on the test machine due to a dependency - an exception can be added.

Test log:

>>> 'Pkg.add("Jewel")' log
INFO: Installing Color v0.3.4
INFO: Installing Compose v0.3.7
INFO: Installing DataStructures v0.3.1
INFO: Installing FactCheck v0.1.2
INFO: Installing FixedPointNumbers v0.0.2
INFO: Installing Iterators v0.1.6
INFO: Installing JSON v0.3.7
INFO: Installing Jewel v0.7.0
INFO: Installing JuliaParser v0.5.2
INFO: Installing Lazy v0.4.3
INFO: Package database updated

>>> 'using Jewel' log

signal (11): Segmentation fault
unknown function (ip: -61814508)
unknown function (ip: -61931230)
unknown function (ip: -71085076)
unknown function (ip: -71022738)
unknown function (ip: -70991836)
unknown function (ip: -70975231)
unknown function (ip: -71043265)
unknown function (ip: -71026838)
unknown function (ip: -70996086)
unknown function (ip: -70975231)
unknown function (ip: -71043265)
unknown function (ip: -71026838)
unknown function (ip: -71011433)
unknown function (ip: -70996360)
unknown function (ip: -70975231)
unknown function (ip: -71043265)
unknown function (ip: -71039505)
unknown function (ip: -70967250)
... truncated ...
jl_apply_generic at /home/idunning/julia04/usr/bin/../lib/libjulia.so (unknown line)
unknown function (ip: -70901592)
unknown function (ip: -70905383)
unknown function (ip: -70837426)
jl_f_top_eval at /home/idunning/julia04/usr/bin/../lib/libjulia.so (unknown line)
reload_path at loading.jl:152
_require at loading.jl:67
jl_apply_generic at /home/idunning/julia04/usr/bin/../lib/libjulia.so (unknown line)
require at loading.jl:51
jlcall_require;38575 at  (unknown line)
jl_apply_generic at /home/idunning/julia04/usr/bin/../lib/libjulia.so (unknown line)
unknown function (ip: -70841491)
unknown function (ip: -70836821)
unknown function (ip: -70834752)
jl_load at /home/idunning/julia04/usr/bin/../lib/libjulia.so (unknown line)
include at ./boot.jl:245
jl_apply_generic at /home/idunning/julia04/usr/bin/../lib/libjulia.so (unknown line)
include_from_node1 at loading.jl:128
jl_apply_generic at /home/idunning/julia04/usr/bin/../lib/libjulia.so (unknown line)
process_options at ./client.jl:285
_start at ./client.jl:354
_start_3B_3599 at /home/idunning/julia04/usr/bin/../lib/julia/sys.so (unknown line)
jl_apply_generic at /home/idunning/julia04/usr/bin/../lib/libjulia.so (unknown line)
unknown function (ip: 4200466)
julia_trampoline at /home/idunning/julia04/usr/bin/../lib/libjulia.so (unknown line)
unknown function (ip: 4199453)
__libc_start_main at /usr/lib/libc.so.6 (unknown line)
unknown function (ip: 4199507)
unknown function (ip: 0)
timeout: the monitored command dumped core

>>> test log

signal (11): Segmentation fault
unknown function (ip: 551479572)
unknown function (ip: 551362850)
unknown function (ip: 542209004)
unknown function (ip: 542271342)
unknown function (ip: 542302244)
unknown function (ip: 542318849)
unknown function (ip: 542250815)
unknown function (ip: 542267242)
unknown function (ip: 542297994)
unknown function (ip: 542318849)
unknown function (ip: 542250815)
unknown function (ip: 542267242)
unknown function (ip: 542282647)
unknown function (ip: 542297720)
unknown function (ip: 542318849)
unknown function (ip: 542250815)
unknown function (ip: 542254575)
unknown function (ip: 542326830)
... truncated ...
include_from_node1 at loading.jl:128
jl_apply_generic at /home/idunning/julia04/usr/bin/../lib/libjulia.so (unknown line)
process_options at ./client.jl:285
_start at ./client.jl:354
_start_3B_3599 at /home/idunning/julia04/usr/bin/../lib/julia/sys.so (unknown line)
jl_apply_generic at /home/idunning/julia04/usr/bin/../lib/libjulia.so (unknown line)
unknown function (ip: 4200466)
julia_trampoline at /home/idunning/julia04/usr/bin/../lib/libjulia.so (unknown line)
unknown function (ip: 4199453)
__libc_start_main at /usr/lib/libc.so.6 (unknown line)
unknown function (ip: 4199507)
unknown function (ip: 0)

INFO: Testing Jewel
================================[ ERROR: Jewel ]================================

failed process: Process(`/home/idunning/julia04/usr/bin/julia /home/idunning/pkgtest/.julia/v0.4/Jewel/test/runtests.jl`, ProcessSignaled(11)) [0]

================================================================================
INFO: No packages to install, update or remove
ERROR: Jewel had test errors
 in error at error.jl:21
 in test at pkg/entry.jl:715
 in anonymous at pkg/dir.jl:28
 in cd at ./file.jl:20
 in cd at pkg/dir.jl:28
 in test at pkg.jl:68
 in process_options at ./client.jl:213
 in _start at ./client.jl:354
 in _start_3B_3599 at /home/idunning/julia04/usr/bin/../lib/julia/sys.so

>>> end of log

Info about upcoming removal of packages in the General registry

As described in https://discourse.julialang.org/t/ann-plans-for-removing-packages-that-do-not-yet-support-1-0-from-the-general-registry/ we are planning on removing packages that do not support 1.0 from the General registry. This package has been detected to not support 1.0 and is thus slated to be removed. The removal of packages from the registry will happen approximately a month after this issue is open.

To transition to the new Pkg system using Project.toml, see https://github.com/JuliaRegistries/Registrator.jl#transitioning-from-require-to-projecttoml.
To then tag a new version of the package, see https://github.com/JuliaRegistries/Registrator.jl#via-the-github-app.

If you believe this package has erroneously been detected as not supporting 1.0 or have any other questions, don't hesitate to discuss it here or in the thread linked at the top of this post.

Saving deletes trailing whitespace

Not sure if this is a Jewel, Jupiter/Juno, or base LightTable behavior, but saving a file deletes trailing whitespace characters at the end of every line. This is nice because it keeps things tidy, but it also adds a bunch of whitespace-only changes to version controlled files. It's bitten me a lot recently when I try to submit a pull request and see dozens of extra changes I didn't mean to make.

Can this behavior be disabled? Even if it's base LightTable behavior, maybe it would be a good idea to disable this by default in Juno.


For anyone sumbling upon this issue, (and so I can find it again,) if you want to commit only non-whitespace changes you can use:

git diff -w --no-color | git apply --cached --ignore-whitespace

From stack overflow.

InexactError on Julia HEAD

I have a mac homebrew installation of Julia HEAD, and get this error when loading Jewel (originally noticed error from Juno in lighttable). Not sure if it's a problem with my installation or Jewel (the tests pass after installing).

~  julia
               _
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type "help()" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.4.0-dev+864 (2014-09-30 14:09 UTC)
 _/ |\__'_|_|_|\__'_|  |  Commit a34b9f0* (0 days old master)
|__/                   |  x86_64-apple-darwin13.3.0

julia> Pkg.add("Jewel")
INFO: Nothing to be done

julia> require("Jewel")
ERROR: InexactError()
 in char at char.jl:1
 in include at /usr/local/Cellar/julia/HEAD/lib/julia/sys.dylib
 in include_from_node1 at /usr/local/Cellar/julia/HEAD/lib/julia/sys.dylib
 in include at /usr/local/Cellar/julia/HEAD/lib/julia/sys.dylib
 in include_from_node1 at /usr/local/Cellar/julia/HEAD/lib/julia/sys.dylib
 in reload_path at loading.jl:152
 in _require at loading.jl:67
 in require at loading.jl:54
 in require at /Users/me/.julia/v0.4/Jewel/src/lazymod.jl:2
 in include at /usr/local/Cellar/julia/HEAD/lib/julia/sys.dylib
 in include_from_node1 at /usr/local/Cellar/julia/HEAD/lib/julia/sys.dylib
 in include at /usr/local/Cellar/julia/HEAD/lib/julia/sys.dylib
 in include_from_node1 at /usr/local/Cellar/julia/HEAD/lib/julia/sys.dylib
 in include at /usr/local/Cellar/julia/HEAD/lib/julia/sys.dylib
 in include_from_node1 at /usr/local/Cellar/julia/HEAD/lib/julia/sys.dylib
 in reload_path at loading.jl:152
 in _require at loading.jl:67
 in require at loading.jl:51
while loading /Users/me/.julia/v0.4/JuliaParser/src/lexer.jl, in expression starting on line 12
while loading /Users/me/.julia/v0.4/JuliaParser/src/JuliaParser.jl, in expression starting on line 5
while loading /Users/me/.julia/v0.4/Jewel/src/parse/scope.jl, in expression starting on line 4
while loading /Users/me/.julia/v0.4/Jewel/src/parse/parse.jl, in expression starting on line 1
while loading /Users/me/.julia/v0.4/Jewel/src/Jewel.jl, in expression starting on line 7

`@require` and `workspace`

I really like this macro, but find it doesn't work with workspace:

using Jewel
workspace()
using Jewel

ends up with: ERROR: invalid redefinition of constant HTML

WARNING: LightTable.jl: cannot resize array with shared data

WARNING: LightTable.jl: cannot resize array with shared data
 in push! at ./array.jl:430
 in read_operator at /Users/Mikael/.julia/v0.4/JuliaParser/src/lexer.jl:368
 in next_token at /Users/Mikael/.julia/v0.4/JuliaParser/src/lexer.jl:752
 in qualifiedname at /Users/Mikael/.julia/v0.4/Jewel/src/parse/scope.jl:59
 in nexttoken at /Users/Mikael/.julia/v0.4/Jewel/src/parse/scope.jl:78
 in tokens at /Users/Mikael/.julia/v0.4/Jewel/src/parse/scope.jl:178
 in allcompletions at /Users/Mikael/.julia/v0.4/Jewel/src/completions.jl:72
 in anonymous at /Users/Mikael/.julia/v0.4/Jewel/src/LightTable/completions.jl:5
 in handlecmd at /Users/Mikael/.julia/v0.4/Jewel/src/LightTable/LightTable.jl:65
 in handlenext at /Users/Mikael/.julia/v0.4/Jewel/src/LightTable/LightTable.jl:81
 in server at /Users/Mikael/.julia/v0.4/Jewel/src/LightTable/LightTable.jl:22
 in server at /Users/Mikael/.julia/v0.4/Jewel/src/Jewel.jl:18
 in include at ./boot.jl:260
 in include_from_node1 at ./loading.jl:271
 in process_options at ./client.jl:308
 in _start at ./client.jl:411

MWE with this version of Julia:

julia> versioninfo()
Julia Version 0.4.0-rc1+33
Commit a0fa6af* (2015-09-13 16:27 UTC)
Platform Info:
  System: Darwin (x86_64-apple-darwin14.5.0)
  CPU: Intel(R) Core(TM) i7-4980HQ CPU @ 2.80GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell)
  LAPACK: libopenblas
  LIBM: libopenlibm
  LLVM: libLLVM-3.3

and on the master branches of Julia-LT, Juno-LT, Jewel.jl, JuliaParser.jl, LNR.jl, and Lazy.jl, I open LightTable, and in the default Tutorial.jl file, I type a, then delete it.

WARNING: Jewel: BoundsError()

I'm getting this a lot when trying to run my code:

WARNING: Jewel: BoundsError()
 in cur_scope at /Users/sabae/.julia/v0.3/Jewel/src/parse/scope.jl:81
 in leaving_expr at /Users/sabae/.julia/v0.3/Jewel/src/parse/scope.jl:83
 in scope_pass at /Users/sabae/.julia/v0.3/Jewel/src/parse/scope.jl:168
 in scope_pass at /Users/sabae/.julia/v0.3/Jewel/src/parse/scope.jl:69
 in completions at /Users/sabae/.julia/v0.3/Jewel/src/completions.jl:29
 in allcompletions at /Users/sabae/.julia/v0.3/Jewel/src/completions.jl:68
 in anonymous at /Users/sabae/.julia/v0.3/Jewel/src/LightTable/completions.jl:5
 in handle_cmd at /Users/sabae/.julia/v0.3/Jewel/src/LightTable/LightTable.jl:65
 in server at /Users/sabae/.julia/v0.3/Jewel/src/LightTable/LightTable.jl:22
 in server at /Users/sabae/.julia/v0.3/Jewel/src/Jewel.jl:15
 in include at /usr/local/Cellar/julia/HEAD/lib/julia/sys.dylib
 in include_from_node1 at loading.jl:128
 in process_options at /usr/local/Cellar/julia/HEAD/lib/julia/sys.dylib
 in _start at /usr/local/Cellar/julia/HEAD/lib/julia/sys.dylib (repeats 2 times)

The code I'm trying to run is a package I'm developing, which has two files:

# BinaryAnalysis.jl
module BinaryAnalysis

include("mach_o.jl")

end # module
# mach_o.jl
using StrPack

@struct type mach_header
  magic::Uint32
  cputype::Cint
  cpusubtype::Cint
  filetype::Uint32
  ncmds::Uint32
  sizeofcmds::Uint32
  flags::Uint32
end

data = readbytes(open(joinpath(Pkg.dir("BinaryAnalysis"),"test","test.dylib")))

names(StrPack)

Anything I can do to help debug this? I'm running the latest master of Jewel.jl.

completions comments

So I've been playing around with the allcompletions code as we talked about for Sublime-IJulia and I had a few comments/requests:

  • Can the return type of [:hints] be made more consistent? From playing around with it, it seems like the result is sometimes an array of ASCIIString, sometimes UTF8String, and sometimes just an Any array. This is probably because a comprehension or map or something is being used. I can look into it more, but I figured you may know where the return array code is and could pre-allocate a consistent type
  • It seems like sometimes the return list is a little excessive, take the following example:
julia> Jewel.allcompletions("P", LNR.cursor(1,1))[:hints]
1465-element Array{Any,1}:
 "%"
 ">>"
 ".\u2265"
 "\u220c"
 "-"
 ">="
 "|"
 "eval"
 "ndims"
 "~"
 ">:"
 "colon"
 "^"
 "|>"
 ".<<"
 "ENV"
 "transpose"
 "\u2288"
 "include"
 "LightTable"
 "×"
 
 "end"
 "export"
 "finally"
 "for"
 "function"
 "global"
 "if"
 "immutable"
 "import"
 "importall"
 "let"
 "local"
 "macro"
 "module"
 "quote"
 "return"
 "try"
 "type"
 "typealias"
 "using"
 "while"

Any idea why things like try or while are coming up as completions for P? It might also be good to be able to specify a cap limit on the number of completions to return.

  • Are the completions ranked at all? Like, best matches first? Could be a possible solution to the cap limit, because the user could just take the top 20 or whatever

Multi-line selection doesn't work (with proposed fix)

I found and fixed a bug in the way parse.jl handles multi-line selections.

When the cursor is at the beginning of a line and I hold shift and press the down arrow a few times to select multiple lines, then stop[2] - 1 is equal to 0. I believe this leads to the same "WARNING: Jewel: Position 2:0 not found in string" problem described in Jewel issue #27.

Maybe you have already fixed this on master? If not, here's how I fixed it in Jewel.jl v0.6.2:

Original:

:lines  => (start[1], stop[1]),

Fixed:

:lines  => (start[1], stop[2] == 1 ? stop[1] - 1 : stop[1]),

Original:

isvalid(s, i) || continue
lines == line && char == chars+1 && return i

Fixed:

isvalid(s, i) || continue
char == 0 && (lines == line - 1) && s[i] == '\n' && return i-1
lines == line && char == chars+1 && return i

You probably know the code better and can decide if this is the right way to fix this issue. I can at least say that this works for me.

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.