clemos / haxe-sublime-bundle

Sublime Text bundle for Haxe programming language
Apache License 2.0
235 stars 86 forks source link

cannot create new type using sidebar context menu #171

Closed kevinfiol closed 9 years ago

kevinfiol commented 9 years ago

Attempting to create a new class, for example, using the context menu in ST2 creates nothing. Console results in this:

Traceback (most recent call last):
File ".\sublime_plugin.py", line 337, in run_
File ".\features\haxe_create_type.py", line 19, in run
File ".\HaxeHelper.py", line 16, in HaxeComplete_inst
ValueError: Attempted relative import in non-package

ST3 seems to work for the most part, although sometimes, when right-clicking on a folder and attempting to create a new file, a similar error will occur except without console output.

lensisle commented 9 years ago

same problem here

blakfeld commented 9 years ago

I made a fork and started playing around with trying to fix this, but it looks like if you use the 'refactoring' branch it works! (Also, after looking at the refactoring branch, I'd use it anyway. The master is a mess)

clemos commented 9 years ago

Sorry, your issue got somehow lost in the flow ;) I'll look into it asap.

blakfeld commented 9 years ago

If it helps the problem seems to be because instead of having everything be a package, it just tries to pull it in from the relative path. I tried appending '.' to the path, but didn't have any luck with that. I added an init.py and had it start finding the correct files, but still choking. If we just make it a python package/module instead of a 'collection of files' like it is now, it should be nicely resolved!

genesisbryant commented 9 years ago

I'm still seeing this issue in the latest version of the master branch :( I'm running ST3 Build 3081. This is the error I'm seeing in the console:

Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 533, in run_
    return self.run(**args)
  File "/Users/Bryant/Library/Application Support/Sublime Text 3/Packages/Haxe/features/haxe_create_type.py", line 19, in run
    builds = HaxeComplete_inst().builds
  File "/Users/Bryant/Library/Application Support/Sublime Text 3/Packages/Haxe/HaxeHelper.py", line 16, in HaxeComplete_inst
    from .HaxeComplete import HaxeComplete
TypeError: Can't convert 'NoneType' object to str implicitly
ghost commented 9 years ago

Try to restart sublime, and wait 5-10 sec. I'll try to fix this.

genesisbryant commented 9 years ago

No luck after restarting Sublime :( I still get the same error message in the console :(

ghost commented 9 years ago

Do you use git or/and gitgutter plugins? I saw the same error message, when i had a lot of modified files.

Please share all messages from the console.

genesisbryant commented 9 years ago

I do use Git, but I don't use any Git plugins for Sublime. The only packages I have installed are Haxe, Kulture, OmniSharp, and Package Control.

Here's the full console output after restarting Sublime and attempting to create a new Haxe type:

startup, version: 3081 osx x64 channel: dev
executable: /Applications/Sublime Text.app/Contents/MacOS/Sublime Text
working dir: /
packages path: /Users/Bryant/Library/Application Support/Sublime Text 3/Packages
state path: /Users/Bryant/Library/Application Support/Sublime Text 3/Local
zip path: /Applications/Sublime Text.app/Contents/MacOS/Packages
zip path: /Users/Bryant/Library/Application Support/Sublime Text 3/Installed Packages
ignored_packages: ["Vintage"]
pre session restore time: 1.02691
first paint time: 1.14306
startup time: 1.26411
reloading plugin Default.block
reloading plugin Default.comment
reloading plugin Default.copy_path
reloading plugin Default.delete_word
reloading plugin Default.detect_indentation
reloading plugin Default.duplicate_line
reloading plugin Default.echo
reloading plugin Default.exec
reloading plugin Default.fold
reloading plugin Default.font
reloading plugin Default.goto_line
reloading plugin Default.history_list
reloading plugin Default.indentation
reloading plugin Default.kill_ring
reloading plugin Default.mark
reloading plugin Default.new_templates
reloading plugin Default.open_context_url
reloading plugin Default.open_file_settings
reloading plugin Default.open_in_browser
reloading plugin Default.pane
reloading plugin Default.paragraph
reloading plugin Default.paste_from_history
reloading plugin Default.quick_panel
reloading plugin Default.save_on_focus_lost
reloading plugin Default.scroll
reloading plugin Default.set_unsaved_view_name
reloading plugin Default.side_bar
reloading plugin Default.sort
reloading plugin Default.swap_line
reloading plugin Default.switch_file
reloading plugin Default.symbol
reloading plugin Default.transform
reloading plugin Default.transpose
reloading plugin Default.trim_trailing_white_space
reloading plugin CSS.css_completions
reloading plugin Diff.diff
reloading plugin HTML.encode_html_entities
reloading plugin HTML.html_completions
reloading plugin 0_package_control_loader.00-package_control
reloading plugin 0_package_control_loader.02-bz2
reloading plugin Package Control.bootstrap
reloading plugin Package Control.Package Control
reloading plugin Haxe.HaxeComplete
hello
Haxe : Reloading haxe module
Haxe : Reloading haxelib module
HAXE : haxelib list 
HAXE : haxelib install 
HAXE : haxelib search 
HAXE : haxelib upgrade 
reloading plugin Haxe.HaxeHelper
reloading plugin Kulture.Completions
reloading plugin Kulture.Kulture
reloading plugin OmniSharp.OmniSharpSublime
plugins loaded
omnisharp plugin_loaded
Starting Haxe server on port 6001
Package Control: Installing 1 upgrades
ignored packages updated to: ["Vintage", "Haxe"]
unloading plugin Haxe.HaxeComplete
unloading plugin Haxe.HaxeHelper
reloading Packages/Haxe/Support/Haxe.sublime-settings
generating syntax summary
generating meta info summary
reloading Packages/User/Package Control.sublime-settings
reloading Packages/User/Preferences.sublime-settings
Package Control: Upgraded Haxe to latest git commit
ignored packages updated to: ["Vintage"]
reloading plugin Haxe.HaxeComplete
reloading plugin Haxe.HaxeHelper
generating syntax summary
generating meta info summary
reloading Packages/Haxe/Support/Haxe.sublime-settings
generating meta info summary
reloading Packages/User/Package Control.sublime-settings
reloading Packages/User/Preferences.sublime-settings
reloading Packages/User/Preferences.sublime-settings
Starting Haxe server on port 6001
Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 533, in run_
    return self.run(**args)
  File "/Users/Bryant/Library/Application Support/Sublime Text 3/Packages/Haxe/features/haxe_create_type.py", line 19, in run
    builds = HaxeComplete_inst().builds
  File "/Users/Bryant/Library/Application Support/Sublime Text 3/Packages/Haxe/HaxeHelper.py", line 16, in HaxeComplete_inst
    from .HaxeComplete import HaxeComplete
TypeError: Can't convert 'NoneType' object to str implicitly
ghost commented 9 years ago

Thanks. Meanwhile you can try this patch: fix_171

genesisbryant commented 9 years ago

Well, I'm a little embarrassed :) In a previous comment I said I was using the latest from the master branch, but apparently I lied! I was 70 commits behind. Package Control thought I was fully up to date.

Pulling from master fixed the issue for me. I also tried applying the patch, and everything still worked.

Sorry for the trouble! :(

ghost commented 9 years ago

np)