--display and my IDE... Or the hugest design flaw in haXe?

138 views
Skip to first unread message

Петър Петров

unread,
Oct 22, 2012, 1:43:46 AM10/22/12
to haxe...@googlegroups.com
Well, I am writing an IDE.... That must have good autocompletion. However, as it seems, the current server protocol / commandline "api" is critically flawed....

The problem:  Pressing DOT / Opening bracket into my editor must call the compiler with my (still unsaved) file.... yeah, STILL UNSAVED! I do NOT want to force Save all the time user presses DOT!
It is ugly, it's bad!

FEATURE REQUEST: Fix this flawed design. The next code is a dream code that I hope will become reality ASAP...

C:\path\to\project> haxe compile.hxml --display input  [enter]
[haxe.exe is now accepting from STDIN]
class something { 
/* ... */
...
var s = "Test";
s.
[end of stdin - Ctrl+Z or whatever. Now haXe returns to STDOUT as usual:]
<list>
<i n="length"><t>Int</t><d>...</d></i>
<i n="charAt"><t>index : Int -> String</t><d>...</d></i>
<i n="charCodeAt"><t>index : Int -> Int</t><d>...</d></i>
<i n="indexOf">
  <t>value : String -> ?startIndex : Int -> Int</t>
  <d>...</d>
</i>
...
</list>

If this is implemented, my IDE can just use classic STDIN/STDOUT  IPC with Haxe. Without saving! Just that?
Also, I need convenience features like this:

C:\path\to\project> haxe compile.hxml --display class:String
C:\path\to\project> haxe compile.hxml --display class:String --show-private-members
returns data about the specified class so I can index it into my IDE and show it into my class browser.

The Socket / Cache Server API may be similar. Passing --display input, then, sending a packet with the source code till the cursor position.

Also:
C:\path\to\project> haxe compile.hxml --display input@73 [enter] full source code to STDIN followed by EOF / Ctrl+Z

So please, please improve this. You will help not only FlashDevelop! you will help all of us that write IDEs

And also small good features that I hope didn't overlooked if already exist:
C:\path\to\project> haxe --makefile:myProject.xml --classexts:hx,haax,haxe,haxx

The first option allows usage of makefile with different than hxml extension, for example myproject.xml or someTarget.hxtarget
The second option makes haxe to treat *.hx, *.haax, *.haxe and *.haxx files as haxe modules.

Zachary Dremann

unread,
Oct 22, 2012, 1:55:46 AM10/22/12
to haxe...@googlegroups.com
I think most IDE's save to temporary files, and use those as a hidden source directory, which, since it is declared last, will override any existing files.

Петър Петров

unread,
Oct 22, 2012, 2:01:36 AM10/22/12
to haxe...@googlegroups.com
And this is slow. using stdin/stdout directly will be faster. I do not want the complexity of maintaining so much temp files.

Zachary Dremann

unread,
Oct 22, 2012, 2:04:00 AM10/22/12
to haxe...@googlegroups.com
Okay. Fair enough. How would you deal with multiple files not saved, but edited?

PeterSvP

unread,
Oct 22, 2012, 2:06:00 AM10/22/12
to haxe...@googlegroups.com
Compilation cache server, of course. I will pass only the current file / text I want to --display, or even only the current 2-3 lines of it.

2012/10/22 Zachary Dremann <dre...@gmail.com>

Luca

unread,
Oct 22, 2012, 10:41:56 AM10/22/12
to haxe...@googlegroups.com
If you're not using temporary files, then what do you do if IDE or computer crashes whilst editing a file? no automatic backup? I can honestly say this has been a lifesaver for me on 'many' occasions, and I wouldn't want to use an IDE that cannot auto-backup files in that way.

Nicolas Cannasse

unread,
Oct 22, 2012, 10:50:15 AM10/22/12
to haxe...@googlegroups.com
Le 22/10/2012 07:43, Петър Петров a écrit :
> Well, I am writing an IDE.... That must have good autocompletion.
> However, as it seems, the current server protocol / commandline "api" is
> critically flawed....
>
> *The problem: * Pressing DOT / Opening bracket into my editor must call
> the compiler with my (still unsaved) file.... yeah, STILL UNSAVED! I do
> NOT want to force Save all the time user presses DOT!
> It is ugly, it's bad!

If that's our hugest design flaw then I'm quite happy about it :)

More seriously, I'm not sure exactly why it's bad to save files. Usually
you will have to save files anyway when compiling, so why not for
completion also ? Since everybody sane is using VCS, saving is no longer
harmful.

However we could add the possibility to pass the file source as
commandline parameter, but it's not a priority atm.

Best,
Nicolas

Петър Петров

unread,
Oct 24, 2012, 8:23:31 PM10/24/12
to haxe...@googlegroups.com
STDIN will be better than a command line parameter (as commandline can be limited and STDIN/STDOUT is always faster).

And I made a workaround with temporary folder with precedence (defined last in classpath). It works now.

However, I still can't find a way to easily query for class details. See the suggestion about the 
--display class:String --show-private-members
Or Can you provide a work around or idea about how to achieve this? I need to make something that my IDE can analyze all the classes in its classpath.

Nicolas Cannasse

unread,
Oct 25, 2012, 2:12:54 AM10/25/12
to haxe...@googlegroups.com
There are two different things here :
- analyze all the classes, done by -xml output
- get completion at a given point, with --display
- in all cases, using a completion server is more efficient, so command line are sent over TCP in that case

Nicolas
--
Reply all
Reply to author
Forward
0 new messages