Giter Site home page Giter Site logo

sublimerl's Introduction

SublimErl (Erlang Tests & Code Completion)

Overview

SublimErl is a plugin for the text editor Sublime Text 2. It allows you to:

  • Benefit from Code Completion ( all Erlang libs + your current project )
  • Allows you to Auto-Indent your Erlang code
  • Run Eunit tests ( all tests for module / single test )
  • Run Common Tests ( all tests for module )
  • Run Dialyzer tests ( single module )
  • Goto any exported function of your project easily
  • Access man pages from the text editor

All within your test editor.

A brief feature introduction video can be seen here:

SublimErl screenshot

Screenshots

Here's a screenshot of SublimErl's Code Completion feature:

SublimErl screenshot

Here's a screenshot of SublimErl's Auto-Indenting feature:

SublimErl screenshot

Here's a screenshot of SublimErl running an Eunit specific test in file.

SublimErl screenshot

Usage

  • Code Completion: Just type and select available options
  • Auto-Indenting: hit Command-Option-L to auto-intent an entire file
  • Run single Eunit: position your cursor anywhere within your test function and hit Command-Shift-F8
  • Run all Eunit tests in file: position your cursor outside any test function and hit Command-Shift-F8
  • Run all CT tests in file: view the file and hit Command-Shift-F8
  • Run Dialyzer on file: view the file and hit Command-Shift-F9
  • Re-Run the previous test: hit Command-F8 ( you do not need to be viewing the test to launch it )
  • View Common Tests results in browser: hit Command-Option-F8 (OSX) | Command-Alt-F8 (Linux/Win)
  • Goto any exported function of your project easily: hit Command-Option-p (OSX) | Command-Alt-p (Linux/Win) and select a function
  • To access man pages: hit Command-Option-i (OSX) | Command-Alt-i (Linux/Win) and select a module

Installation

SublimErl currently supports only on OSX and Linux. There are 3 ways to install it.

1. Sublime Package Control

Download and install the Sublime Package Control. This package controller allows you to easily manage your Sublime Text 2 plugins (installs / removals / upgrades).

SublimErl's latest stable versions are pushed automatically to the package control. However, if you want the latest and greatest, you'll have to use one of the other following options.

2. Git Clone

Go to your Sublime Text 2 Packages directory:

  • OS X: ~/Library/Application Support/Sublime Text 2/Packages
  • Linux: ~/.Sublime Text 2/Packages/

and clone the repository using the command below:

git clone https://github.com/ostinelli/SublimErl.git
3. File Download

Head to the downloads section and unzipping the downloaded file into the Sublime Text 2 Packages directory.

Configuration

SublimErl needs and will try to detect the paths of the following executables: rebar, erl, escript and dialyzer. If it doesn't succeed to find those, or if you prefer to manually configure these path, you can set them in the SublimErl.sublime-settings file, located in the SublimErl plugin directory.

Dependencies

To use SublimErl, you need to have:

  • The editor Sublime Text 2.
  • Erlang ( ..obviously ^^_ ).
  • Basho's Rebar built after September 13th, 2012 (which has support for the tests= option).
  • (optional) Erlang man pages if you use this functionality.

To unleash the full power of the plugin, you will also need to comply to:

TL;DR: it basically means to organize your project structure using:

-- myproject
   |-- ebin
   |-- src
       |-- myproject.app.src
   |-- test
   |-- ...

or, for example, a more complex project structure defined in rebar.conf:

-- myproject
   rebar.config
   |-- apps
       |-- app1
       |-- app2
   |-- deps
       |-- dep1
       |-- dep2
   |-- ...

Known issues

We have had reports that some plugin functionalities experience unwanted behaviour (freezing) with the Erlang precompiled package provided by Erlang Solutions, see issue #56. We're looking into this.

sublimerl's People

Contributors

bjnortier avatar jwheare avatar nox avatar ostinelli 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sublimerl's Issues

Disam notification

On big projects analysis of projects beams occupies a significant amount of time and it would be good to show in a status line the message 'Parsing...." | "Analysing..."

When saving/compiling a file, have output of compiler in console

Currently, when there is a compile error, on compile on save, there is no way to know what triggered the error. And the failure is silent, except for the fact that the .beam file disappear on the file listing.

Having the output of the compiler in the console — like when tests are being run — would be great.

some problems about v0.5

thanks author wrote this plugin.
when I use sublimerl, I found some problems:

  1. not support windows
  2. autocompletion support for the project is incomplete.
    the OTP and BIF support is no problem, the problem is that the support of the current project.
    analysis files exported function is dependent on the export keyword.
  3. sublimerl dependent python 2.x, need install additional python 2.x
  4. If my project without rebar ?
  5. for jump inside the module does not support.
  6. function search dependent autocompletion result(only search export function).
    Actually, can use the existing ways to handle for OTP and BIF, but for the current project file,
    can use the 80 lines of code to get. Instead of using the previous method.

some ideas about the current project function searches:

  1. get select region of view
  2. use self.view.substr(region) get the selected funciton
  3. get line string to analysis mod
  4. use sublime.active_window().folders()[0] can get current project folder
  5. use mod name and current project folder name can find the file.
  6. get line in the file
  7. sublime.active_window.open_file with ENCODE_POSITION

Hangs on code reformat on Mac OS

I've created simple project rooted at ~/Documents/Erlang with only one file:
~/Documents/Erlang/test/src/test.app.src/test.erl

-module(test).

-export([start/0]).

start() ->
  "1".

When I try to reformat it, Sublime hangs, quits only on Forced Quit.

Not sure how to provide more useful information.

Date/Time:       2013-02-20 20:42:40 -0800
OS Version:      10.8.2 (Build 12C3012)
Architecture:    x86_64
Report Version:  11

Command:         Sublime Text 2
Path:            /Applications/Sublime Text 2.app/Contents/MacOS/Sublime Text 2
Version:         Version 2.0.1, Build 2217 (2217)
Parent:          launchd [465]

PID:             94188
Event:           hang
Duration:        1.17s
Steps:           12 (100ms sampling interval)

Hardware model:  MacBookAir5,2
Active cpus:     4
Free pages:      819957 pages (+1304)
Pageins:         0 pages
Pageouts:        0 pages


Process:         Sublime Text 2 [94188]
Path:            /Applications/Sublime Text 2.app/Contents/MacOS/Sublime Text 2
Architecture:    x86_64
Parent:          launchd [465]
UID:             54686
Task size:       11267 pages

  Thread 0x42040f   DispatchQueue 1          priority 46        
  12 start + 52 (Sublime Text 2) [0x10d8cd064]
    12 main + 2251 (Sublime Text 2) [0x10d9be3cb]
      12 -[NSApplication run] + 636 (AppKit) [0x7fff8db362fa]
        12 -[NSApplication sendEvent:] + 4480 (AppKit) [0x7fff8dc20243]
          12 -[NSApplication _handleKeyEquivalent:] + 462 (AppKit) [0x7fff8dd63114]
            12 -[NSWindow performKeyEquivalent:] + 64 (AppKit) [0x7fff8dd63329]
              12 -[NSView _performKeyEquivalent:conditionally:] + 41 (AppKit) [0x7fff8dd633c9]
                12 -[NSView performKeyEquivalent:] + 166 (AppKit) [0x7fff8dd63512]
                  12 -[NSView _performKeyEquivalent:conditionally:] + 41 (AppKit) [0x7fff8dd633c9]
                    12 ??? (Sublime Text 2 + 2489896) [0x10db2ae28]
                      12 window_impl::handle_event(px_event_t*) + 6795 (Sublime Text 2) [0x10d94118f]
                        12 route_message_using_input_focus(ui_message_type, void*, control*) + 151 (Sublime Text 2) [0x10d8ef547]
                          12 message_handler::handle_message(ui_message_type, void*) + 652 (Sublime Text 2) [0x10d90e6f4]
                            12 python_command::run(value const&) + 131 (Sublime Text 2) [0x10da0cb2d]
                              12 PyEval_CallFunction + 183 (Python) [0x10e2bb80a]
                                12 PyEval_CallObjectWithKeywords + 177 (Python) [0x10e292dfc]
                                  12 PyObject_Call + 97 (Python) [0x10e28baba]
                                    12 ??? (Python + 188826) [0x10e2a619a]
                                      12 PyObject_Call + 97 (Python) [0x10e28baba]
                                        12 ??? (Python + 348024) [0x10e2ccf78]
                                          12 PyEval_EvalCodeEx + 1956 (Python) [0x10e28d281]
                                            12 PyEval_EvalFrameEx + 7693 (Python) [0x10e28f0d2]
                                              12 ??? (Python + 112107) [0x10e2935eb]
                                                12 PyEval_EvalFrameEx + 7693 (Python) [0x10e28f0d2]
                                                  12 ??? (Python + 112107) [0x10e2935eb]
                                                    12 PyEval_EvalFrameEx + 7693 (Python) [0x10e28f0d2]
                                                      12 ??? (Python + 112107) [0x10e2935eb]
                                                        12 PyEval_EvalFrameEx + 7693 (Python) [0x10e28f0d2]
                                                          12 ??? (Python + 112107) [0x10e2935eb]
                                                            12 PyEval_EvalFrameEx + 7693 (Python) [0x10e28f0d2]
                                                              12 ??? (Python + 112225) [0x10e293661]
                                                                12 PyEval_EvalCodeEx + 1956 (Python) [0x10e28d281]
                                                                  12 PyEval_EvalFrameEx + 7693 (Python) [0x10e28f0d2]
                                                                    12 ??? (Python + 112107) [0x10e2935eb]
                                                                      12 PyEval_EvalFrameEx + 7548 (Python) [0x10e28f041]
                                                                        12 __select + 10 (libsystem_kernel.dylib) [0x7fff8c4c4322]
                                                                         *12 ??? (mach_kernel + 3576576) [0xffffff8000569300]

  Thread 0x42041c   DispatchQueue 2          priority 48        
  12 _dispatch_mgr_thread + 54 (libdispatch.dylib) [0x7fff8c4a09ee]
    12 kevent + 10 (libsystem_kernel.dylib) [0x7fff8c4c4d16]
     *12 ??? (mach_kernel + 3467616) [0xffffff800054e960]

  Thread 0x42041e   priority 46        
  12 thread_start + 13 (libsystem_c.dylib) [0x7fff8bd96181]
    12 _pthread_start + 327 (libsystem_c.dylib) [0x7fff8bda9742]
      12 ??? (Sublime Text 2 + 56745) [0x10d8d8da9]
        12 thread_queue_runner::run() + 97 (Sublime Text 2) [0x10d8d8f7b]
          12 __psynch_cvwait + 10 (libsystem_kernel.dylib) [0x7fff8c4c40fa]
           *12 psynch_cvcontinue + 0 (mach_kernel) [0xffffff80005b4b10]

  Thread 0x42041f   priority 46        
  12 thread_start + 13 (libsystem_c.dylib) [0x7fff8bd96181]
    12 _pthread_start + 327 (libsystem_c.dylib) [0x7fff8bda9742]
      12 ??? (Sublime Text 2 + 90745) [0x10d8e1279]
        12 io_worker::thread_proc() + 155 (Sublime Text 2) [0x10d8e1253]
          12 io_scheduler::extract_next_request() + 148 (Sublime Text 2) [0x10d8e1184]
            12 __psynch_cvwait + 10 (libsystem_kernel.dylib) [0x7fff8c4c40fa]
             *12 psynch_cvcontinue + 0 (mach_kernel) [0xffffff80005b4b10]

  Thread 0x420420   priority 46        
  12 thread_start + 13 (libsystem_c.dylib) [0x7fff8bd96181]
    12 _pthread_start + 327 (libsystem_c.dylib) [0x7fff8bda9742]
      12 ??? (Sublime Text 2 + 90745) [0x10d8e1279]
        12 io_worker::thread_proc() + 155 (Sublime Text 2) [0x10d8e1253]
          12 io_scheduler::extract_next_request() + 148 (Sublime Text 2) [0x10d8e1184]
            12 __psynch_cvwait + 10 (libsystem_kernel.dylib) [0x7fff8c4c40fa]
             *12 psynch_cvcontinue + 0 (mach_kernel) [0xffffff80005b4b10]

  Thread 0x420465   priority 46        
  12 thread_start + 13 (libsystem_c.dylib) [0x7fff8bd96181]
    12 _pthread_start + 327 (libsystem_c.dylib) [0x7fff8bda9742]
      12 ??? (Python + 446480) [0x10e2e5010]
        12 PyEval_CallObjectWithKeywords + 177 (Python) [0x10e292dfc]
          12 PyObject_Call + 97 (Python) [0x10e28baba]
            12 ??? (Python + 188826) [0x10e2a619a]
              12 PyObject_Call + 97 (Python) [0x10e28baba]
                12 ??? (Python + 348024) [0x10e2ccf78]
                  12 PyEval_EvalCodeEx + 1956 (Python) [0x10e28d281]
                    12 PyEval_EvalFrameEx + 7693 (Python) [0x10e28f0d2]
                      12 ??? (Python + 112107) [0x10e2935eb]
                        12 PyEval_EvalFrameEx + 7693 (Python) [0x10e28f0d2]
                          12 ??? (Python + 112107) [0x10e2935eb]
                            12 PyEval_EvalFrameEx + 2452 (Python) [0x10e28dc59]
                              12 PyObject_Call + 97 (Python) [0x10e28baba]
                                12 ??? (Python + 348024) [0x10e2ccf78]
                                  12 PyEval_EvalCodeEx + 1956 (Python) [0x10e28d281]
                                    12 PyEval_EvalFrameEx + 7693 (Python) [0x10e28f0d2]
                                      12 ??? (Python + 112225) [0x10e293661]
                                        12 PyEval_EvalCodeEx + 1956 (Python) [0x10e28d281]
                                          12 PyEval_EvalFrameEx + 7693 (Python) [0x10e28f0d2]
                                            12 ??? (Python + 112225) [0x10e293661]
                                              12 PyEval_EvalCodeEx + 1956 (Python) [0x10e28d281]
                                                12 PyEval_EvalFrameEx + 7548 (Python) [0x10e28f041]
                                                  12 ??? (Python + 445416) [0x10e2e4be8]
                                                    12 PyThread_acquire_lock + 96 (Python) [0x10e2de54e]
                                                      12 __psynch_cvwait + 10 (libsystem_kernel.dylib) [0x7fff8c4c40fa]
                                                       *12 psynch_cvcontinue + 0 (mach_kernel) [0xffffff80005b4b10]

Process:         bash [94209]
Path:            /bin/bash
Architecture:    x86_64
Parent:          login [94208]
UID:             54686
Task size:       305 pages

Process:         beam.smp [94212]
Path:            /usr/local/lib/erlang/erts-5.10/bin/beam.smp
Architecture:    x86_64
Parent:          bash [94209]
UID:             54686
Task size:       4637 pages


Process:         beam.smp [94222]
Path:            /usr/local/lib/erlang/erts-5.10/bin/beam.smp
Architecture:    x86_64
Parent:          Sublime Text 2 [94188]
UID:             54686
Task size:       6079 pages (-32)
CPU Time:        1.078s

Building completion files is extremely slow

I'm on Mac OS X 10.7, 4 GB RAM, 2.16 GHz Core2Duo and a project with 8 dependencies and about 15 erlang src files takes at least 30 minutes. That renders the plug-in pretty unusable as I cannot switch between projects and have the completions available to me. Things worked better when Erlang was used to read the BEAM files instead of Python parsing the src files.

Code completion search too fuzzy

  1. Open an erlang file
  2. Type is_

Actual result: Results show that are not in the exact sequence as that typed. For example, inets_app, inets_regexp show up because they have an i, s, and _, but they also have characters between those.

Expected: only results with the exact sequence should be shown, e.g. is_list, is_binary, etc.

I'm fine if you'd prefer to close this and keep as is, but just wanted to get it out there that it makes more sense to me for this not to be a fuzzy search but rather a search based on the exact sequence typed. This is how most other code completions work that I've used.

BIF functions not showing in completion

  1. Open an Erlang file
  2. Go into a function and type erlang:is_

Actual: None of the is_ functions are showing (e.g. is_record, is_binary, etc.)

Expected: All of the functions exported in erlang should show in the completion list.

lists:member is missing

  1. Open an erlang file
  2. Type 'lists:mem' or just type 'lists' and search for member

Actual result: lists:member does not exist in the completion drop down
Expected: lists:member should be included in the completion drop down

Add missing Erlang keywords to code completion

When writing Ertlang code with SublimErl it always offers an atom, variable name or function name in the code completion listbox, but never an Erlang keyword. This forces you to press the escape key to remove the listbox when trying to write a keyword like of. I think the keywords should be added to the code completion string list to avoid this problem.

Build command

I have a rebarized project "cmp" with a standard layout:

cmp
+-- rebar.config
+-- cmp.sublime-project
+-- src
+-- cmp_app.erl

When saving cmp_app.erl from sublime, the compilation window correctly shows compilation errors:

==> cmp (compile)
src/cmp_app.erl:168: variable 'CowboyRoutes' is unbound

However, when I click on the error, it doesn't jump to the corresponding line in the source file. Is it a limitation of sublime or sublimerl?

Typing erlang: defaults selection to apply/2

Very minor issue....

  1. Open an erl file
  2. Type erlang:

Result: The highlighted function is not the first function in the list, but rather the 6th, apply/2.

Expected: The highlighted function should be the first function in the list, abs/1

UnicodeDecodeError in sublimerl_man.py

Operation: for example Ctrl-Alt-i → lists

Result: in console:

Traceback (most recent call last):
  File "./sublimerl_man.py", line 59, in update_panel
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 8125: ordinal not in range(128)

Platform: Ubuntu 12.04 x86-64

Alphabetize the completion results

  1. Open an erl file
  2. Type 'lists:'

Actual result: All the functions within list exist but they are in no order

Expected result: The functions should be alphabetized

Add Windows support

Need to check rebar support on windows. Also, where should be used instead of which.

Not a priority issue right now.

optimize completion regeneration

Currently:

  • erlang libs completion is regen only on a new sublime text session
  • project libs regen is done on every tab switch.

High cpu uses of SublimErl

Hi, I have tried the SublimErl, then I close the Sublime Text 2. About half an hour, I suddenly found cpu is very high, near 100%. Then top, I found erlang vm process created by SublimErl almost exhaust cpu resource.

ps: I open Sublime Text 2 many times and close it many times, I found there are 2 erlang vm processes.

Thanks.

Add completion support for dependencies

Right now, the dependencies in the directory specified by the lib_dirs are not factored into the code completion. It would be great to add support for dependencies.

commands not working on ubuntu

SublimErl looks fantastic and I was really excited to install it. Happily, the install went perfectly. Unfortunately, none of the commands appear to work. Here's an example from ST's console when I try to run ctrl + alt + p to navigate to a function definition:

Traceback (most recent call last):
File "./sublime_plugin.py", line 362, in run_
File "./sublimerl_core.py", line 308, in run
File "./sublimerl_function_search.py", line 103, in run_command
File "./sublimerl_function_search.py", line 48, in show
File "./sublimerl_function_search.py", line 58, in set_search_completions
File ".\posixpath.py", line 67, in join
AttributeError: 'NoneType' object has no attribute 'endswith'

I'm running on ubuntu 12.04

Thanks

Code completion: Newly compiled files doesn't work with code completion

  1. Start Sublime
  2. Create a new Erlang module
  3. Compile
  4. In another Erlang module, use the previous module in 2.

Result: Code completion does not work and I don't get a list of exported functions from the new module.
Expected result: Code completion should be refreshed anytime a new beam file is written and I should see the exports from the new module.

emacs style indenting

Current auto indent works great, but is based on tab levels.

Most erlang projects require emacs style indent however, so adding this to sublimerl would be great.

Auto completion not working for core erlang

Hello,
Great tool.
I have two projects created from rebar, A, and B. B includes A using libs_dir in rebar.config and I can see function auto complete for A, but only when I open one file from project A. However, when I type gen_server:foo, I don't see gen_server in the auto completion list, not any of its function when I manually type.
I am running on CentOS 6.2 and using Erlang R14 B04.

Any suggestions?

Completions don't exist for erl files within subdirectories

If you set up a project where all the source files are not directly underneath the src dir, the completion doesn't exist for those source files.

An example set up is:

src
--> subdir1
--> test.erl
--> subdir2
--> test2.erl

Neither test or test2 will show up for completions.

Project dir

How about support for more complicated project dir structure?
Something like in riak project.

proj 
  |- apps
    |- app1
      |- ebin
    |- app2
      |- ebin
  |- deps
    |- app1
      |- ebin
    |- app2
      |- ebin
.... 

Default keyboard shortcut to auto indent in Linux

I believe that in most linux flavored distros the keyboard shortcut to auto-ident will not work because it is a system wide shortcut for locking the session (much like the super + L in windows).

I know it is easy to override the default key bindings for this action, but I believe that a change here would enhance the out of the box experience for linux users.

Regards!

PS: keep up the excellent work!

Add a Linter

It would be great to get some sort of linting working to see the errors on a file. I don't know if you would want this in SublimeLinter or if it should be included in SublimErl.

erlang module showing up multiple times in code completion

  1. Delete all Erlang-Libs in SublimErl dir to ensure a fresh set are created
  2. Open Sublime
  3. Open an erlang file and type erlang

Actual result: 3 results show in the completion drop down, all saying erlang
Expected: Only 1 erlang module should show in the results.

Deps .app file not found

Strangely, when I launch the test, I get an error explaining I cannot start Mochiweb, because the mochiweb.app file is not found.

{error,{"no such file or directory","mochiweb.app"}}}

I am not sure what should be done to fix my environment to allow my app to start one of my dependency.

Python processes not quitting when Sublime closed

  1. Download HEAD
  2. Open Sublime Text 2
  3. Close Sublime Text 2
  4. run ps ax | grep python

Result:

python sublimerl_libparser.py /Users/andrew/Documents/workspace /Users/andrew/Library/Application Support/Sublime Text 2/Packages/SublimErl/completion/Current-Project
python sublimerl_libparser.py /usr/local/Cellar/erlang/R15B01/lib/erlang/lib /Users/andrew/Library/Application Support/Sublime Text 2/Packages/SublimErl/completion/Erlang-Libs

Expected result:

Should have exited when Sublime exited.

I see that the parser is using my entire workspace instead of just the project directory. As a result, it's going through every project I have and is causing extremely high CPU as well on Mac OS X 10.7.3.

on MacOS the default bash profile name is '.profile'

ver: 0.5.1
in source file "sublimerl_core.py"
line 83:

bash_profile_path = os.path.join(os.getenv('HOME'), '.bash_profile')

maybe change to:

bash_profile_path = os.path.join(os.getenv('HOME'), '.profile')

Thank you for your contribution

Can not load on Mountain Lion / 2.0

after installing from both Git and package manager , trying the auto-indent feature returns

Exception in thread Thread-4:
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/threading.py", line 532, in __bootstrap_inner
self.run()
File "./sublimerl_completion.py", line 143, in run
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/posixpath.py", line 67, in join
elif path == '' or path.endswith('/'):
AttributeError: 'NoneType' object has no attribute 'endswith'

Build 2217 on Osx Mountain Lion

Saving a file in a big project locks up Sublime

I have a fairly big project and every time I save a file, Sublime locks up for about 5 seconds. I have traced it to

sublime.set_timeout(completions.compile_source, 0)

in sublimerl_completion.py:

def on_post_save(self, view):
    ...
    class SublimErlThread(threading.Thread):
        def run(self):
            # compile
            sublime.set_timeout(completions.compile_source, 0) # 
            # trigger event to reload completions
            sublime.set_timeout(completions.generate_project_completions, 0)
    SublimErlThread().start()

https://github.com/ostinelli/SublimErl/blob/master/sublimerl_completion.py#L212

I believe it's because it takes about 5 seconds for rebar to compile the whole project. Interestingly, if I remove the sublime.set_timeout and just call

completions.compile_source()

then it's fine as it's not in the Sublime GUI thread, but I presume that's not thread-safe and set_timeout is used for a reason.

Using skip_deps=true when compiling would help, but it will still lock up the UI for a second or two.

If it could be kept in the separate thread and 'skip_deps=true' it would be great. I can create a pull request.

What is the reason for using set_timeout?

How can I debug my SublimErl installation?

Hi guys, I just installed SublimErl via Package Manager, but it seems for me that it just doesn't work for me. So I am wondering, where I can see logs or something that might help me debugging my problem?

OS: Mac OS 10.7.5

Normal autocompletion is broken

Hello,

I discovered SublimErl recently and I love the automatic compilation of files at save.

Unfortunately, it breaks the normal autocompletion of Sublime Text 2. If I hade a word "State" in the document and I type "st", I expect to be able to autocomplete it, but it doesn't appear anywhere.

Please, how can I fix it?

Thanks.

Cannot start/install the plugin

I am trying to get an existing project to run. The project directory looks like this:

├── Makefile
├── lib
│ ├── alarms
│ │ ├── ebin
│ │ │ ├── alarms.app
│ │ │ ├── alarms.beam
│ │ │ ├── alarms_app.beam
│ │ │ ├── alarms_h.beam
│ │ │ └── alarms_sup.beam
│ │ ├── priv
│ │ └── src
│ │ ├── alarms.app.src
│ │ ├── alarms.erl
│ │ ├── alarms_app.erl
│ │ ├── alarms_h.erl
│ │ ├── alarms_sup.erl
│ │ └── vsn.mk
...
├── rebar.config
├── releases

At the top level, I can just type "rebar compile" and it does its thing.

I started with a new project, did an "Add Folder to Project" under the project menu and opened a one of the .erl files above. I also saved the project.

I then made a deliberate error in alarms.erl and saved. I don't see anything at all.

Nothing happened.

This is the console log:

startup, version: 2217 osx x64 channel: stable
executable: /Applications/Sublime Text 2.app/Contents/MacOS/Sublime Text 2
working dir: /
packages path: /Users/rvg/Library/Application Support/Sublime Text 2/Packages
settings path: /Users/rvg/Library/Application Support/Sublime Text 2/Settings
PackageSetup not required
catalogue loaded
found 7 files for base name Default.sublime-keymap
found 1 files for base name Default.sublime-mousemap
found 2 files for base name Main.sublime-menu
Reloading plugin /Users/rvg/Library/Application Support/Sublime Text 2/Packages/CSS/css_completions.py
Reloading plugin /Users/rvg/Library/Application Support/Sublime Text 2/Packages/Default/comment.py
Reloading plugin /Users/rvg/Library/Application Support/Sublime Text 2/Packages/Default/copy_path.py
Reloading plugin /Users/rvg/Library/Application Support/Sublime Text 2/Packages/Default/delete_word.py
Reloading plugin /Users/rvg/Library/Application Support/Sublime Text 2/Packages/Default/detect_indentation.py
Reloading plugin /Users/rvg/Library/Application Support/Sublime Text 2/Packages/Default/duplicate_line.py
Reloading plugin /Users/rvg/Library/Application Support/Sublime Text 2/Packages/Default/echo.py
Reloading plugin /Users/rvg/Library/Application Support/Sublime Text 2/Packages/Default/exec.py
Reloading plugin /Users/rvg/Library/Application Support/Sublime Text 2/Packages/Default/fold.py
Reloading plugin /Users/rvg/Library/Application Support/Sublime Text 2/Packages/Default/font.py
Reloading plugin /Users/rvg/Library/Application Support/Sublime Text 2/Packages/Default/goto_line.py
Reloading plugin /Users/rvg/Library/Application Support/Sublime Text 2/Packages/Default/indentation.py
Reloading plugin /Users/rvg/Library/Application Support/Sublime Text 2/Packages/Default/kill_ring.py
Reloading plugin /Users/rvg/Library/Application Support/Sublime Text 2/Packages/Default/mark.py
Reloading plugin /Users/rvg/Library/Application Support/Sublime Text 2/Packages/Default/new_templates.py
Reloading plugin /Users/rvg/Library/Application Support/Sublime Text 2/Packages/Default/open_file_settings.py
Reloading plugin /Users/rvg/Library/Application Support/Sublime Text 2/Packages/Default/open_in_browser.py
Reloading plugin /Users/rvg/Library/Application Support/Sublime Text 2/Packages/Default/paragraph.py
Reloading plugin /Users/rvg/Library/Application Support/Sublime Text 2/Packages/Default/save_on_focus_lost.py
Reloading plugin /Users/rvg/Library/Application Support/Sublime Text 2/Packages/Default/scroll.py
Reloading plugin /Users/rvg/Library/Application Support/Sublime Text 2/Packages/Default/set_unsaved_view_name.py
Reloading plugin /Users/rvg/Library/Application Support/Sublime Text 2/Packages/Default/side_bar.py
Reloading plugin /Users/rvg/Library/Application Support/Sublime Text 2/Packages/Default/sort.py
Reloading plugin /Users/rvg/Library/Application Support/Sublime Text 2/Packages/Default/swap_line.py
Reloading plugin /Users/rvg/Library/Application Support/Sublime Text 2/Packages/Default/switch_file.py
Reloading plugin /Users/rvg/Library/Application Support/Sublime Text 2/Packages/Default/transform.py
Reloading plugin /Users/rvg/Library/Application Support/Sublime Text 2/Packages/Default/transpose.py
Reloading plugin /Users/rvg/Library/Application Support/Sublime Text 2/Packages/Default/trim_trailing_white_space.py
Reloading plugin /Users/rvg/Library/Application Support/Sublime Text 2/Packages/Diff/diff.py
Reloading plugin /Users/rvg/Library/Application Support/Sublime Text 2/Packages/HTML/encode_html_entities.py
Reloading plugin /Users/rvg/Library/Application Support/Sublime Text 2/Packages/HTML/html_completions.py
Reloading plugin /Users/rvg/Library/Application Support/Sublime Text 2/Packages/Package Control/Package Control.py
Reloading plugin /Users/rvg/Library/Application Support/Sublime Text 2/Packages/SublimErl/sublimerl_autocompiler.py
Reloading plugin /Users/rvg/Library/Application Support/Sublime Text 2/Packages/SublimErl/sublimerl_completion.py
Reloading plugin /Users/rvg/Library/Application Support/Sublime Text 2/Packages/SublimErl/sublimerl_core.py
Reloading plugin /Users/rvg/Library/Application Support/Sublime Text 2/Packages/SublimErl/sublimerl_formatter.py
Reloading plugin /Users/rvg/Library/Application Support/Sublime Text 2/Packages/SublimErl/sublimerl_function_search.py
Reloading plugin /Users/rvg/Library/Application Support/Sublime Text 2/Packages/SublimErl/sublimerl_man.py
Reloading plugin /Users/rvg/Library/Application Support/Sublime Text 2/Packages/SublimErl/sublimerl_tests_integration.py
Reloading plugin /Users/rvg/Library/Application Support/Sublime Text 2/Packages/Vintage/vintage.py
Reloading plugin /Users/rvg/Library/Application Support/Sublime Text 2/Packages/Vintage/vintage_commands.py
Reloading plugin /Users/rvg/Library/Application Support/Sublime Text 2/Packages/Vintage/vintage_motions.py
plugin init time: 2.1146
loading bindings
loading pointer bindings
found 1 files for base name Default.sublime-theme
theme loaded
app ready
pre session restore time: 2.8309
using gamma: 2 (err: 6.9282)
wrote startup cache, added files: 1 orphaned files: 0 total files: 103 cache hits: 105
startup time: 3.12516 (package setup was not run)
reloading /Users/rvg/Library/Application Support/Sublime Text 2/Packages/User/Package Control.sublime-settings
loaded 837 snippets
Package Control: No updated packages

cat evasdev-13.1.sublime-project
{
"folders":
[
{
"path": "/Users/rvg/src/evasdev/Projects/PDF/ebdc-13.1"
}
]
}

In the workspace file I noticed this:

"output.sublimerl_autocompiler":
{
    "height": 0.0
},

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.