snowkit / atom-haxe Goto Github PK
View Code? Open in Web Editor NEWatom.io haxe plugin, includes completion, error checking and more.
License: MIT License
atom.io haxe plugin, includes completion, error checking and more.
License: MIT License
Also added issue for theRemix/language-haxe
I finally tracked this one down and got a hack in place for now. The main gist of this is that when the autocomplete server tries to compile the project to get completions, go to definition or lint the project it fails with:
Type not found: LuxeApp
This happens with all the test and sample projects included with Luxe. Note also that flow builds them just fine. I can only guess this happens due to the replacement tags in the LuxeApp class but I really dont have enough experience with all this to say for sure.
I was able to hack around it by first doing a web build (which gets a LuxeApp class with the replacement tags removed) and then adding the path to the build directory for all haxe compiler calls.
In the haxe-call.js file, I modified the haxe method to have the extra search path:
args.push( '-cp' );
args.push( 'bin/web.build/haxe' );
Note that this is obviously not a proper fix. I don't know what a proper fix would be for this but I figured I would detail the exact error and what fixes it (finding the LuxeApp class).
It seems that the plugin uses character position for --display
arguments instead of byte position expected by the compiler. This completely breaks completion if a file contains non-ascii letters.
Port from @jeremyfa coffeescript.
Should be implemented in lib/linting/ only, in the same minimal/clean layout as completion.
Commands register in lib/haxe.js, and implemented in the sub folder.
If I want to add the same shortcut for, let's say, building a coffee-script project, the haxe console will show up as well when pressing CTRL+B.
Maybe we should detect that when the selected flow/hxml file is not in the current workspace and if the current edited file is not a haxe/flow/hxml file, the console doesn't show up.
Right now, the messages panel show up at the bottom, even on projects that are not related to haxe at all. This display should be disabled until an hxml file is set.
[Enter steps to reproduce below:]
Atom Version: 0.188.0
System: Mac OS X 10.10.2
Thrown From: haxe package, v0.6.0
Uncaught TypeError: Cannot read property 'getRootScopeDescriptor' of undefined
At /Users/adrienjonquet/.atom/packages/haxe/lib/haxe.js:148
TypeError: Cannot read property 'getRootScopeDescriptor' of undefined
at Object.module.exports.build (/Users/adrienjonquet/.atom/packages/haxe/lib/haxe.js:148:27)
at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/Applications/Atom.app/Contents/Resources/app/src/command-registry.js:242:29)
at /Applications/Atom.app/Contents/Resources/app/src/command-registry.js:3:61
at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (/Applications/Atom.app/Contents/Resources/app/node_modules/atom-keymap/lib/keymap-manager.js:558:16)
at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/Applications/Atom.app/Contents/Resources/app/node_modules/atom-keymap/lib/keymap-manager.js:396:22)
at HTMLDocument.module.exports.WindowEventHandler.onKeydown (/Applications/Atom.app/Contents/Resources/app/src/window-event-handler.js:180:20)
-3:40.5 haxe:build (atom-text-editor.editor.is-focused)
7x -3:35.9 core:close (atom-text-editor.editor.is-focused)
6x -3:27.6 symbols-view:toggle-file-symbols (ol.tree-view.full-menu.list-tree.has-collapsable-children.focusable-panel)
-1:29.7 settings-view:open (atom-pane.pane.active)
6x -1:09.4 core:backspace (atom-text-editor.editor.mini)
-0:00.5 haxe:build (ul.list-inline.tab-bar.inset-panel)
{
"core": {
"themes": [
"atom-dark-ui",
"monokai"
]
},
"haxe": {}
}
# User
autocomplete-haxe, v0.2.0
autocomplete-plus, v2.7.0
haxe, v0.6.0
language-haxe, v0.2.1
language-ocaml, v1.1.0
language-opa-ocaml, v0.2.0
language-scala, v1.1.0
linter, v0.12.0
monokai, v0.13.0
pretty-json, v0.3.2
# Dev
No dev packages
hwdy,
this may be simple. but is there a way this can run openfl code at all from within atom?
not seen anything too much on this, except people saying to just do it in console
thanks
As the title suggests, when the haxe plugin is activated autocomplete-plus doesn't work properly, i.e. it doesn't suggest words while I'm typing, but if I disable haxe, autocomplete-plus works properly.
I have the same problem in linux and mac, even with a fresh installation.
By the way, when I restart the haxe completition server, the debug log shows the following output:
haxe / completition / server / starting `haxe `on `6112`
haxe / completition / server / Error: Couldn't wait on 127.0.0.1:6112
haxe / completition / server / process exit 1
Ported from @jeremyfa coffeescript version, to replace the existing version
This is dependent on how autocomplete-plus
works.
It relates directly to this issue on their repo:
https://github.com/atom-community/autocomplete-plus/issues/268
This is a wildly annoying for us,
So I will leave this open and hopefully updates in autocomplete-plus will save us.
Spaces in paths will be split on for args, will fix
What will be done:
the have package is great, but, it kills off things such as say, switch statments, for loops, if statements etc.
finding say openfl stuff is fine, but the actual language for other things dissapear
haxe supports toplevel completion (i think its 3.2+, but still), you just do --display Main.hx@42@toplevel
and it returns a list of local vars, fields, imports, etc.
this is really important completion feature, and I'd like to see it in atom-haxe.
one thing to note: currently if we autocomplete inside function call parens, it shows call tips, but actually, i think it should show toplevel completion, and show calltips using some other keybinding (or just show both)
The following is true:
This means that there should only be one active completion provider end point active at any time, and activating a second consumer would switch exclusively to that one. i.e two consumers can't easily share the same provider.
This also solves the problem of multiple consumers on the provider, overriding each others state on startup. The provider will remember the last active consumer, and ignore any other's. consumers should remember whether they were active and only try to register once they are re-activated.
To put this in concrete:
There can only be one consumer active, and haxe plugin will remember only that one. consumer will remember whether it thought it was active, for user workflow, but haxe plugin will ignore it otherwise.
Potentially in future it might be worth revisiting but I don't think this will impact workflow in short term.
When setting a hxml file from the right click menu, it's not possible to specify it's cwd directly yet so it uses the same folder as the hxml itself.
Hey guys!
I'm using HaxeFlixel and it would be really awesome to use this package with it. I don't know if this is the cause, but HaxeFlixel uses a Project.xml (instead of an HXML) file to config libraries to be used.
I don't know if it would help, but this sublime plugin can handle it:
https://github.com/clemos/haxe-sublime-bundle
While editing my pure haxe (no OpenFL, Haxeflixel, etc) autocomplete stops working while in files not in the folder that build.hxml is in. Autocomplete works perfectly fine for all files in the same folder as build.hxml.
Screenshot of console:
https://i.gyazo.com/833078222224afbe9137fef03c09233a.png
See the line that says 'Display file was not found in class path'
Any ideas?
If the active hxml defines the classpaths using --each, these will not be accounted for on the completion server.
AtomLinter v0.X.Y API has been deprecated. Please refer to the Linter docs to update and the latest API: https://github.com/atom-community/linter/wiki/Migrating-to-the-new-API
HaxeLinter.Linter (/Users/lepton/.atom/packages/linter/lib/linter.coffee:60:4)
new HaxeLinter (/Users/lepton/.atom/packages/haxe/lib/linting/linter.js:12:38)
Object.lint (/Users/lepton/.atom/packages/linter/lib/legacy.coffee:61:21)
<unknown> (/Users/lepton/.atom/packages/linter/lib/editor-linter.coffee:69:25)
currentLinter (/Users/lepton/.atom/packages/linter/lib/editor-linter.coffee:68:19)
<unknown> (/Users/lepton/.atom/packages/linter/lib/editor-linter.coffee:82:22)
After typing (
autocomplete suggestions should be displayed to provide haxe type hinting or toplevel completion.
Probably related to: https://github.com/atom-community/autocomplete-plus/issues/329
[Enter steps to reproduce below:]
Atom Version: 1.0.7
System: Mac OS X 10.10.5
Thrown From: haxe package, v0.8.7
Uncaught Error: spawn EACCES
At child_process.js:1145
Error: spawn EACCES
at exports._errnoException (util.js:734:11)
at ChildProcess.spawn (child_process.js:1145:11)
at exports.spawn (child_process.js:977:9)
at Object.module.exports.reset (/Users/cpg/.atom/packages/haxe/lib/completion/server.js:41:24)
{
"core": {
"themes": [
"atom-material-ui",
"one-dark-syntax"
]
},
"haxe": {
"haxe_path": "/usr/lib/Haxe",
"haxelib_path": "/usr/lib/Haxe/lib",
"debug_logging": true
}
}
# User
atom-beautify, v0.28.11
atom-material-ui, v0.5.21
flow, v0.4.2
haxe, v0.8.7
language-actionscript3, v0.3.0
language-haxe, v0.3.0
lime, v0.3.1
linter, v1.4.2
# Dev
No dev packages
First of all, I am not sure if this is a functionality issue of this plugin or the requirement one "language-haxe", so please tell me if this is in the wrong place ;)
Most functions of the plugin (except building) are exceptionally slow or won't function at all when the project.hxml does multiple builds using "--next".
Now, I know that the underlying problem here might be the haxe executable itself, which causes problems with this.
However, since this problem is known since forever and not fixed in haxe yet, I'd suggest a workaround in the plugin.
Would it be possible to not send the whole project.hxml to the executable for auto-completion, but instead something else, like the part before the first "--next" or something like it?
I think that for most project that would yield correct results, anyway. And would definitely be preferrable to the current state (= not working at all).
It is really uncomfortable having to comment/uncomment stuff in the project.hxml all the time just to get autocompletion working ;)
Hi,
I've noticed auto-completion happens after typing the semi-colon (;) at the end of a line/statement.
I realise the user could in theory start typing another statement at that point, but in practice it does not seem very useful to me. In fact I find it quite a hindrance, as it causes me to have to dismiss the pop-up at the end of almost every line.
Perhaps an option in the Settings could let the user specify a list of characters not to auto-complete after?
Thanks!
If I have a function definition, e.g.
function test(a :Int, b :String) {
and add a block comment like this:
function test(a :Int, b :String /* hack */) {
then all indentation is lost.
(This error report was generated by Atom. :) )
AtomLinter v0.X.Y API has been deprecated. Please refer to the Linter docs to update and the latest API: https://github.com/AtomLinter/Linter/wiki/Migrating-to-the-new-API
Object.activate (/Users/Daniel/.atom/packages/linter/lib/main.coffee:57:8)
Package.activateNow (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:240:19)
<unknown> (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:221:30)
Package.measure (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:165:15)
Package.activate (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:213:14)
PackageManager.activatePackage (/Applications/Atom.app/Contents/Resources/app.asar/src/package-manager.js:452:21)
when running thorugh some AS3 tutorials. there have been error messages. but they seem backwards
one such line as an example is this
private var _ySpeed:Int;
_ySpeed = 0.05;
then when i run the code it pops up with this message:
Source/Fruit.hx:21: characters 4-18 : Float should be Int
realistically it should be the other way around like this:
Source/Fruit.hx:21: characters 4-18 : Int should be Float
It's not clear that having Haxe is a requirement for this package to work.
Installing this package without this requirement will result on Atom displaying warnings/errors.
Even though it's acceptable to assume that Haxe developers have Haxe installed on their machines, it shouldn't be a "hidden dependence" for this package.
Also, at least for my specific case, I don't have Haxe installed. For now, since Im learning the language, Im using Vagrant/VMs with Haxe.
allows lint etc to rely on the server state better.
[Enter steps to reproduce below:]
Atom Version: 1.0.18
System: MUMLA
Thrown From: haxe package, v0.8.7
Failed to load the haxe package
At Cannot find module 'atom-message-panel'
Error: Cannot find module 'atom-message-panel'
at Module._resolveFilename (module.js:334:15)
at Function.Module._resolveFilename (C:\Users\Mümla\AppData\Local\atom\app-1.0.18\resources\app.asar\src\module-cache.js:383:52)
at Function.Module._load (module.js:284:25)
at Module.require (module.js:363:17)
at require (module.js:382:17)
at Object.<anonymous> (C:\Users\Mümla\.atom\packages\haxe\lib\utils\log.js:3:25)
at Module._compile (module.js:428:26)
at Object.defineProperty.value [as .js] (C:\Users\Mümla\AppData\Local\atom\app-1.0.18\resources\app.asar\src\compile-cache.js:169:21)
at Module.load (module.js:353:32)
at Function.Module._load (module.js:308:12)
at Module.require (module.js:363:17)
at require (module.js:382:17)
at Object.<anonymous> (C:\Users\Mümla\.atom\packages\haxe\lib\haxe-state.js:5:13)
at Module._compile (module.js:428:26)
at Object.defineProperty.value [as .js] (C:\Users\Mümla\AppData\Local\atom\app-1.0.18\resources\app.asar\src\compile-cache.js:169:21)
at Module.load (module.js:353:32)
at Function.Module._load (module.js:308:12)
at Module.require (module.js:363:17)
at require (module.js:382:17)
at Object.<anonymous> (C:\Users\Mümla\.atom\packages\haxe\lib\completion\query.js:7:15)
at Module._compile (module.js:428:26)
at Object.defineProperty.value [as .js] (C:\Users\Mümla\AppData\Local\atom\app-1.0.18\resources\app.asar\src\compile-cache.js:169:21)
at Module.load (module.js:353:32)
at Function.Module._load (module.js:308:12)
at Module.require (module.js:363:17)
at require (module.js:382:17)
at Object.<anonymous> (C:\Users\Mümla\.atom\packages\haxe\lib\haxe.js:4:20)
at Module._compile (module.js:428:26)
at Object.defineProperty.value [as .js] (C:\Users\Mümla\AppData\Local\atom\app-1.0.18\resources\app.asar\src\compile-cache.js:169:21)
at Module.load (module.js:353:32)
at Function.Module._load (module.js:308:12)
at Module.require (module.js:363:17)
at require (module.js:382:17)
at Package.module.exports.Package.requireMainModule (C:\Users\Mümla\AppData\Local\atom\app-1.0.18\resources\app.asar\src\package.js:761:34)
at C:\Users\Mümla\AppData\Local\atom\app-1.0.18\resources\app.asar\src\package.js:192:28
at Package.module.exports.Package.measure (C:\Users\Mümla\AppData\Local\atom\app-1.0.18\resources\app.asar\src\package.js:169:15)
at Package.module.exports.Package.load (C:\Users\Mümla\AppData\Local\atom\app-1.0.18\resources\app.asar\src\package.js:183:12)
at PackageManager.module.exports.PackageManager.loadPackage (C:\Users\Mümla\AppData\Local\atom\app-1.0.18\resources\app.asar\src\package-manager.js:405:14)
at PackageManager.module.exports.PackageManager.activatePackage (C:\Users\Mümla\AppData\Local\atom\app-1.0.18\resources\app.asar\src\package-manager.js:485:30)
at C:\Users\Mümla\AppData\Local\atom\app-1.0.18\resources\app.asar\node_modules\settings-view\lib\package-manager.js:371:29
at exit (C:\Users\Mümla\AppData\Local\atom\app-1.0.18\resources\app.asar\node_modules\settings-view\lib\package-manager.js:60:16)
at triggerExitCallback (C:\Users\Mümla\AppData\Local\atom\app-1.0.18\resources\app.asar\src\buffered-process.js:213:47)
at ChildProcess.<anonymous> (C:\Users\Mümla\AppData\Local\atom\app-1.0.18\resources\app.asar\src\buffered-process.js:235:18)
at emitTwo (events.js:87:13)
at ChildProcess.emit (events.js:172:7)
at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
-2:07.7.0 application:open (atom-workspace.workspace.scrollbars-visible-always.theme-one-dark-syntax.theme-one-dark-ui)
{}
# User
haxe, v0.8.7
# Dev
No dev packages
will handle hxml "natively" to the plugin:
consumers
I can regularly reproduce an an unhandled error by doing the following:
haxe3
//
comment in the otherwise empty file.The following error is thrown after the first /
:
Atom Version: 1.0.2
System: Mac OS X 10.10.4
Thrown From: haxe package, v0.8.1
Uncaught TypeError: Cannot read property 'path' of null
At /Users/michaelmartin/.atom/packages/haxe/lib/completion/provider.js:52
TypeError: Cannot read property 'path' of null
at Object.module.exports.getSuggestions (/Users/michaelmartin/.atom/packages/haxe/lib/completion/provider.js:52:43)
at /Applications/Atom.app/Contents/Resources/app.asar/node_modules/autocomplete-plus/lib/autocomplete-manager.js:255:56
at Array.forEach (native)
at AutocompleteManager.module.exports.AutocompleteManager.getSuggestionsFromProviders (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/autocomplete-plus/lib/autocomplete-manager.js:234:17)
at AutocompleteManager.getSuggestionsFromProviders (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/autocomplete-plus/lib/autocomplete-manager.js:3:61)
at AutocompleteManager.module.exports.AutocompleteManager.findSuggestions (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/autocomplete-plus/lib/autocomplete-manager.js:221:19)
at /Applications/Atom.app/Contents/Resources/app.asar/node_modules/autocomplete-plus/lib/autocomplete-manager.js:3:61
-6:33.2.0 editor:indent (atom-text-editor.editor.is-focused)
-6:32.8.0 editor:move-to-end-of-screen-line (atom-text-editor.editor.is-focused)
-6:13.7.0 core:move-up (atom-text-editor.editor.is-focused.autocomplete-active)
-6:13.6.0 core:move-left (atom-text-editor.editor.is-focused)
-6:13.5.0 linter:set-bubble-transparent (atom-text-editor.editor.is-focused)
6x -6:13.3.0 editor:move-to-beginning-of-word (atom-text-editor.editor.is-focused)
-6:11.8.0 editor:select-to-beginning-of-word (atom-text-editor.editor.is-focused)
-6:04.9.0 core:move-down (atom-text-editor.editor.is-focused)
-6:04.5.0 editor:move-to-end-of-screen-line (atom-text-editor.editor.is-focused)
-6:04.1.0 core:select-up (atom-text-editor.editor.is-focused)
-6:03.9.0 editor:select-to-end-of-line (atom-text-editor.editor.is-focused)
-6:03.6.0 core:delete (atom-text-editor.editor.is-focused)
-0:08.5.0 application:new-file (atom-text-editor.editor.is-focused)
-0:06.9.0 command-palette:toggle (atom-text-editor.editor.is-focused)
-0:04.8.0 core:confirm (atom-text-editor.editor.mini.is-focused)
-0:04.8.0 set-syntax:Haxe3 (atom-text-editor.editor)
{
"core": {
"ignoredNames": [
"node_modules"
],
"projectHome": "/Users/michaelmartin/Projects",
"themes": [
"one-dark-ui",
"monokai"
],
"disabledPackages": [
"docblockr",
"vim-mode"
]
},
"haxe": {}
}
# User
Stylus, v1.0.0
atom-pair, v1.1.6
emmet, v2.3.12
haxe, v0.8.1
highlight-selected, v0.10.1
language-haxe, v0.3.0
language-jade, v0.5.1
linter, v1.2.3
monokai, v0.14.0
pretty-json, v0.4.1
set-syntax, v0.3.0
tasks, v2.2.0
trailing-spaces, v0.3.2
# Dev
tasks, v2.1.0
I am getting this error when I have atom-flow enabled
I've tried setting the haxelib location in atom-haxe settings to multiple locations including '/usr/local/bin/', '/usr/local/bin/haxelib' and even the location I have the libraries 'Users/jonathonyule/dev/haxelib'.
Any help or points in the right direction would help a lot
when something goes wrong, it's nice that we have those red messages with compiler errors, but I'd like to be able to click on them (or just press F4/Shift-F4 to cycle between them like in ST) to jump at error position. that is very useful!
I'm not sure how hard is it to implement on Atom, but for ST it's a builtin feature of build systems, see
https://github.com/clemos/haxe-sublime-bundle/blob/master/Support/Hxml.sublime-build#L3
Demo of changes here: https://vid.me/BndG
Update provider.js file here:
https://gist.github.com/prime31/1e251e204d2e57507999
Changes included:
Feel free to use the changes or not. Just figured I would post them in case others find them useful.
The Atom documentation states (I have read it but cannot find the link anymore) that the package name should not be 'atom-yourpackagename' but 'yourpackagename'
currently there was an overlap on the sort of approach to using the completion provider, I'll wrap this up to expose the correct usage sooner than later
By default files for completion server are saved with .
prefix. When completion query is invoked file is shown in project tree view for a split second. If you change prefix to ._
file will be ignored and will not show up in the tree. By default Atom ignores vcs folders, .ds_store
, thumbs.db
and files matching ._*
mask.
I've changed it at [https://github.com/snowkit/atom-haxe/blob/master/lib/completion/provider.js#L320] in my local copy, but there might be other changes required.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.