ostinelli / SublimErl

An Erlang Plugin for Sublime Text 2, which enables code completion and allows you to run tests within the editor itself.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Saving erl file with Sublimerl enabled causes error

sononix opened this issue · comments

Using a Stock install of ST2 - disable Sublimerl files save - enabling Sublimerl file save and generates error

Writing file /Users/studio/CODE/Erlang/hello.erl with encoding UTF-8
Traceback (most recent call last):
File "./sublime_plugin.py", line 190, in on_post_save
File "./sublime_plugin.py", line 154, in run_timed_function
File "./sublime_plugin.py", line 189, in
File "./sublimerl_autocompiler.py", line 86, in on_post_save
File "./sublimerl_autocompiler.py", line 40, in init
File "./sublimerl_core.py", line 224, in init
File "./sublimerl_core.py", line 259, in set_app_name
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'

Also getting this issue:

plugin init time: 0.647114
loading bindings
loading pointer bindings
found 1 files for base name Spacegray.sublime-theme
Errors parsing theme:
Unknown attribute value
theme loaded
app ready
pre session restore time: 0.824381
using gpu buffer for window
using gamma: 2 (err: 6.9282)
wrote startup cache, added files: 2 orphaned files: 0 total files: 63 cache hits: 61
startup time: 0.934793 (package setup was not run)
Traceback (most recent call last):
  File "./sublime_plugin.py", line 175, in on_load
  File "./sublime_plugin.py", line 154, in run_timed_function
  File "./sublime_plugin.py", line 174, in <lambda>
  File "./sublimerl_completion.py", line 232, in on_load
  File "./sublimerl_core.py", line 224, in __init__
  File "./sublimerl_core.py", line 259, in set_app_name
  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'
Traceback (most recent call last):
  File "./sublime_plugin.py", line 175, in on_load
  File "./sublime_plugin.py", line 154, in run_timed_function
  File "./sublime_plugin.py", line 174, in <lambda>
  File "./sublimerl_completion.py", line 232, in on_load
  File "./sublimerl_core.py", line 224, in __init__
  File "./sublimerl_core.py", line 259, in set_app_name
  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'
loaded 844 snippets
no command for selector: noop:
Package Control: Skipping automatic upgrade, last run at 2014-10-23 11:31:23, next run at 2014-10-23 12:31:23 or after

@ruanpienaar can you provide me with the file you're trying to save? Are you using ST2 or ST3?

version: Sublime Text 2 Build 2221.
the above is from the ST2 console when ST 2 starts.

I'll still need some kind of file to reproduce this. :)

-module(m).

i think i can reproduce how i get this issue. give me a min

-package remove SublimErl
-package install SublimErl.
-configure SublimErl settings *( Edit SublimErl.sublime-settings, in ST2 )

pre session restore time: 0.814455
using gpu buffer for window
using gamma: 2 (err: 6.9282)
startup cache, total files: 62 cache hits: 62
startup time: 0.895213 (package setup was not run)
Traceback (most recent call last):
  File "./sublime_plugin.py", line 175, in on_load
  File "./sublime_plugin.py", line 154, in run_timed_function
  File "./sublime_plugin.py", line 174, in <lambda>
  File "./sublimerl_completion.py", line 232, in on_load
  File "./sublimerl_core.py", line 224, in __init__
  File "./sublimerl_core.py", line 259, in set_app_name
  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'
loaded 844 snippets
Package Control: Skipping automatic upgrade, last run at 2014-10-23 13:46:00, next run at 2014-10-23 14:46:00 or after

When i remove the configuration it produce the error.

SublimErl.sublime-settings:

{
    /*
     * SublimErl tries to detect automatically the paths for erl, escript, rebar and dialyzer.
     * If it doesn't succeed or you prefer to manually configure these, you can do so by inputting the paths here.
     *
     * "erl_path": "/usr/local/bin/erl",
     * "escript_path": "/usr/local/bin/escript",
     * "rebar_path": "/usr/local/bin/rebar",
     * "dialyzer_path": "/usr/local/bin/dialyzer"
     */



     // Skip Erlang libs that match the regex
    "completion_skip_erlang_libs": [
        "^[cC]os[A-Z].+",
        ".*orber.*",
        "^oe_.+",
        "^megaco_.+",
        ".*wx.*"
    ]
}

Setting file produces error:

{
    /*
     * SublimErl tries to detect automatically the paths for erl, escript, rebar and dialyzer.
     * If it doesn't succeed or you prefer to manually configure these, you can do so by inputting the paths here.
     *
     * "erl_path": "/usr/local/bin/erl",
     * "escript_path": "/usr/local/bin/escript",
     * "rebar_path": "/usr/local/bin/rebar",
     * "dialyzer_path": "/usr/local/bin/dialyzer"
     */

     "erl_path": "/erlang/bin/erl",
     "escript_path": "/erlang/bin/escript",
     "rebar_path": "/usr/local/bin/rebar",
     "dialyzer_path": "/erlang/bin/dialyzer",

     // Skip Erlang libs that match the regex
    "completion_skip_erlang_libs": [
        "^[cC]os[A-Z].+",
        ".*orber.*",
        "^oe_.+",
        "^megaco_.+",
        ".*wx.*"
    ]
}

No Folders added to project. Just 1 file m.erl.

No error when i add a Folder to Project, that has a rebar-compatible dir structure.

i guess set_app_name in sublimerl_core.py has a issue with no 'src'

Having trouble in following you. Does all of this just boil down to the necessity of having a src directory?

@ostinelli Yes. it seems sublimerl_core.py set_app_name , can't deal with no src