-
-
Notifications
You must be signed in to change notification settings - Fork 662
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[display] an option to read stdin to get the content of file specified in --display #4651
Comments
Unless I'm missing something, this should be quite easy to implement:
cc @ncannasse |
From my experience with stdin it always seems easy to implement but never actually is. I once tried to get it working for |
I wonder what exact troubles you ran into. I'm looking at Go's completion server docs right now (https://github.com/nsf/gocode/blob/master/docs/IDE_integration.md) - they support reading completion file from stdin and this is actually used by most of Go plugins. |
Okay, one issue is that completion server should not read from stdin, but from the socket somehow. |
TBH that's quite complex versus having the editor save the file before getting completion. |
PS: if you have several open files, you need to save them anyway |
This is a really big deal actually. Having implemented both atom and sublime plugins 99% of the problem comes from the fact that the file has to be persisted to disk. Just a few of the real problems this runs into:
That's just the editor behaviours, It has also been solved in some form once by completing against a temp file, not the real file itself. However in this case, it has to be persisted to disk with an exact matching classpath relative to the build context and cwd when calling haxe. The surrounding structure must match, otherwise it will just fall apart. I've dreamed about just calling --display with source or bytes, stdin, or being able explicitly tell the compiler the path, but specifying another path for it to read. like: This would solve A LOT by allowing us to say which file we are completing against but a different path to read the source content from. The best case for speed and usability would definitely be stdin (or arg based) though. I strongly urge you to consider that completion (plus associated features) and strong tooling is a crucial part of the haxe ecosystem, having it not be the best it possibly can because of lack of perceived relevance will be sad. The newer completion features and improvements have been taking great strides, but to me this is (from the trenches) a higher priority than any of those newer features going forward. |
I experienced exactly the same problems trying to implement a plugin for ST. |
This is crucial. It should never be required to touch the original file for completion (saving a file should only be triggered by the user explicitly). Best option would be to provide the contents through stdin (or arg based), but being able to specify another file path for temporary content would already be a huge improvement. I also agree that this is way more important at the moment than adding more completion features. +1 |
Just a question for those that had this problem : were you not able to trigger the editor "Save" or "SaveAll" functionality? This is what I did when I first created the Haxe plugin for FlashDevelop and I never had such issues. |
@jeremyfa simply saving the files in a temp dir then adding a -cp at the end should work already |
The problems for implementing "file injection" are the following:
|
@ncannasse Having tried in many different ways the temp dir with a For instance, if I want code completion for Suspecting that these inconsistencies are due to having a duplicate file describing the same class path, I tried another solution:
Because this is actually another file describing another class path, the conflict doesn't exist anymore and I can get consistently code completion. However, in addition to the hacks above (that require parsing the content, changing it and adding additional fake files), I have to remove the references to This kinda works (implemented in the atom package and activable from the settings) because the sub-package has access to its parent. But I believe it's not right. I wished there was another way to get code completion without touching the file. |
But the problems you picture of handling the completion : Those problems are currently shifted onto the user space, but they aren't carrying the benefit of the entire haxe typing, parsing, context ready to answer any question about the code at their disposal. Maybe the exact ideas don't fit but the reality is unchanged, dealing with the code completion server as it stands due to the issues mentioned has an imbalance, which is putting the ecosystem and haxe users at a disadvantage. I'll try see what other existing solutions are being used in things like Go. |
Ha, I just ran into this very issue poking at @nadako's vscode plugin. I haven't gotten far, but I have already seen an error message, something like "save failed: contents of file are newer than buffer." It doesn't happen all the time, though. |
I like that! Also we could probably do some optimizations by caching the 2015-12-21 17:48 GMT-02:00 Jeff Ward [email protected]:
|
Just FYI for vscode-haxe users: thanks to @pleclech, users can set a temporary directory in File > Preferences > Workspace Settings, by overriding the "haxe.haxeTmpDirectory": "" setting, which will then be used for completion. |
Hey guys, could you please try this as described in #5120 and see if it works for you? |
Will do, this weekend! cc @jeremyfa |
Thanks! |
A bit delayed, but I confirm |
Subj. This would be REALLY useful for editors since they work with unsaved files a lot and having to use temp file for auto-completion is quite stupid and error-prone.
(btw, I remembered about this when playing with VS Code api: https://github.com/nadako/vscode-haxe)
The text was updated successfully, but these errors were encountered: