vshaxe / vshaxe Goto Github PK
View Code? Open in Web Editor NEWHaxe Support for Visual Studio Code
Home Page: https://marketplace.visualstudio.com/items?itemName=nadako.vshaxe
License: MIT License
Haxe Support for Visual Studio Code
Home Page: https://marketplace.visualstudio.com/items?itemName=nadako.vshaxe
License: MIT License
On a fresh installation of vscode with the vshaxe extension on multiple different computers, I keep getting the message "Restarting Haxe completion server: Haxe process was killed"
I'm using Windows 10 64 and 32-bit versions, though previously I had the same issue on my Windows 7 64-bit desktop. Any assistance would be greatly appreciated.
(I'm also using 0.1.3 of vshaxe)
It would be quite cool to have potential static extension functions appear in completion, even if there's not a using
for them yet. If selected from completion, the using
would then be added to the file automatically. Example - would be cool if StringTools
functions appeared here:
This is done like I described in ReSharper for C#. Unfortunately, they have it a bit easier than Haxe - static extension methods need an explicit this
keyword. In Haxe, any static method with at least one argument could theoretically be used (unless @:noUsing
).
Maybe there could be an optional metadata that enables static extension methods to appear in completion? @:usingCompletion
?
Btw, here's an example from ReSharper:
As you can see, static extension methods use a different icon that indicates "pull this from somehwere that's not imported yet" with the arrow.
If there's only one build.hxml, the command generates this:
{
// These are configurations used for haxe completion.
//
// Each configuration is an array of arguments that will be passed to the Haxe completion server,
// they should only contain arguments and/or hxml files that are needed for completion,
// such as -cp, -lib, target output settings and defines.
"haxe.displayConfigurations": [
["build.hxml"], // if a hxml file is safe to use, we can just pass it as argument
// you can add more than one configuration and switch between them
//["build-cpp.hxml"]
]
}
Notice the trailing comma after ["build.hxml"]
. This leads to a "Value expected" error when viewing the file in VSCode.
If there are two .hxml
files, the generated json is valid:
{
// These are configurations used for haxe completion.
//
// Each configuration is an array of arguments that will be passed to the Haxe completion server,
// they should only contain arguments and/or hxml files that are needed for completion,
// such as -cp, -lib, target output settings and defines.
"haxe.displayConfigurations": [
["build.hxml"], // if a hxml file is safe to use, we can just pass it as argument
// you can add more than one configuration and switch between them
["build.1.hxml"]
]
}
That would greatly improve quality of life (at least for me).
I even prototyped it using compiler to do things accurately: nadako/haxe@46a7a87, but couldn't get it to output properly..
Are you interested in coordinating the VSCode marketplace offerings? I think there's a few oddities with the current state:
It seems a bit scattered and unofficial.
I think a nice arrangement would be to have the publisher be Haxe Foundation, with both a Haxe extension (vshaxe) and something like Legacy Haxe 3.2.1 extension (vscode-haxe). I don't mind vscode-haxe being labelled legacy as I don't plan on putting more effort into it, and it looks like you guys are actively developing vshaxe with the latest compiler features. Maybe one day we'd remove the legacy plugin entirely.
However, I'm not sure whether we can technically change the names of either the plugins or the publishers (I got stuck on lowercase haxe because of that.) We'd have to look into that - maybe email support? If we had to remove and publish new extensions, that wouldn't be ideal as 1) we'd lose our download counts (which imply Haxe's popularity is higher than dart π ), and 2) current users wouldn't get auto-update notifications.
If we can keep our plugins and download counts and change names, I'd be happy to send my publishing keys to the Haxe Foundation.
Thoughts?
I have un-installed Haxe to update it to the developers branch via brew.
(I have filed an issue here: HaxeFoundation/homebrew-haxe#1)
After deletion, I started VSCode and got this message
The Haxe server crashed 5 times in the last 3 minutes. The server will not be restarted.
A nice-to-have
would be to have a message mentioning that Haxe is not installed and how to install the latest and greatest.
Can
you
please
fix
them?
Aaaaaaaaaahhh
Hi.
To start, let me thank you and congratulate you again for the great work you provided one more time to the community. This IDE plugin is really promising.
I was just wondering if 'Find all references' feature was on your todo list and if it is a tricky one to implement.
Thanks again for all.
Subj. Because now we can have multiple configurations and select one of them as currently active (see #6)
The completion works fine until I added some build macro to a class. The macro was quite complex I am not sure why it doesn't work. How could I debug that?
Now that unused variables are being reported, being able to remove them with a quick-fix like we have for imports would be nice.
I'm not sure if VSCode exposes the API necessary for that yet, wasn't able to find any problems-view-related APIs...
When using global diagnostics as an "acivation event" (use it as the first Haxe command after opening the VSCode window, before the extension has started up, see 0c558bb), it takes two attempts to work.
The first time, there's an empty response:
Haxe language server started
Processing Arguments [-version]
> 3.3.0 (git build development @ a847ec8)
Cached 0 modules
Stats = 0 files, 0 classes, 0 methods, 0 macros
Time spent : 0.000s
Only the second time, there are proper "parsed" messages and a completion response.
How to reproduce:
The UI should be visible right away for the first .hx file that is opened.
I have just installed it, I am on openFL project, but it seems that the extension is not working, no completion, no goto definition..
Any idea what to check?
Just some ideas for IDE services for the HXML files:
--help-defines
and potentionally from HaxeFoundation/haxelib#262)--wait studio
is used to start haxe for completion. If I would like to use the same server for compilation, what would the command line be? --connect stdio
?
This is a related, but different feature than discussed in #2. It should be much easier to actually implement.
haxe-sublime-bundle has a neat feature that allows you to type a fully qualified type path, then press a key combo and have an import statement generated at the top of the file:
It does simple text processing trying to guess what to actually import, it supports simple module and type imports and can have a number of false positives, but it's still very useful.
It would be cool to have the same in vshaxe, but to get it right, I'm afraid we need some compiler support. In Haxe we might want to:
To determine what options do we have and what to actually import (e.g. "is this a main module type? a type within a module? a static field of a class?") we need a display query that tries to resolve a given dot-path and gives us info about it.
Currently there are no folding markers for #if x ... #end
Hi,
I know there's hxcpp debugger for VS Code, but how can I debug apps for flash target?
pick whatever you want
I also plan on making some shortcuts for (mohxa or buddy) unit testing.
{
/*
// Place your snippets for Haxe here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, ${id} and ${id:label} and ${1:label} for variables. Variables with the same id are connected.
// Example:
"Print to console": {
"prefix": "log",
"body": [
"console.log('$1');",
"$2"
],
"description": "Log output to console"
}
*/
/*
"Name": {
"prefix": "...",
"body": [
"",
"",
"",
""
]
},
*/
"Constructor": {
"prefix": "ctor",
"body": [
"public function new() { }"
],
"description": "default constructor in haxe"
},
"main fn": {
"prefix": "main",
"body": [
"static public function main():Void",
"{",
" var args = Sys.args();",
"}" ],
"description": "main function"
},
"static Function": {
"prefix": "stfn",
"body":[
"static function ${1:fn} (${3:arg} ${4: :Type} ${5:, arg2:...} ) : ${ret:retType}",
"{",
" var result:${ret:retType};",
" $6",
"",
" return result;",
"}"
],
"description": "static function"
},
"sfn": {
"description": "simple static fn",
"prefix": "sfn",
"body":[
"static function ${1:func_name} : ${ret:return_type}",
"{",
" var result:${ret};",
" ${body}",
"",
" return result;",
"}"
]
},
"trace": {
"description": "trace",
"prefix": "t",
"body":[
"trace(${var});"
]
},
"fn": {
"description": "simple fn",
"prefix": "fn",
"body":[
"function ${1:func_name} : ${ret:return_type}",
"{",
" var result:${ret};",
" ${body}",
" ",
" return result;",
"}"
]
} ,
"enum flags": {
"description": "enum flags, shamelessly copied from http://blog.stroep.nl/2015/08/biwise-operations-made-easy-with-haxe/ ",
"prefix": "flags",
"body":[
"// enum flags. taken from http://blog.stroep.nl/2015/08/biwise-operations-made-easy-with-haxe/ ",
"@:enum abstract ${1:name}(Int) from Int to Int\n\t{\n\t\tvar None = 0;\n\t\tvar ${2:A} = value(0);\n\t\tvar B = value(1);\n\t\tvar C = value(2);\n\n",
"static inline function value(index:Int) return 1 << index;",
"inline public static function add(bits:Int, mask:Int):Int return bits | mask;",
"inline public static function remove (bits:Int, mask:Int):Int return bits & ~mask;",
"inline public static function contains (bits :Int, mask :Int):Bool return bits & mask != 0;",
"inline function new(v:Int) this = v;",
"inline function toInt():Int return this;",
"}"
]
}
}
Seems like it'd be a really handy feature - should show the documentation text you get with haxe --help
for that arg.
Potentially even docs for specific -D
values based on --help-defines
?
I need to execute the file (swf file) that is a result of a successful compilation, but I have no idea how to do so.
What I know is the full path of the file, so I need to run a command like double click on the file after compilation.. any idea?
Subj.
Right now, it's a bit tedious to apply the quick fix to each unused individually if there are multiple in a file.
I guess ideally, there'd be a context menu here with an entry for that, so you could do it for all warnings in a file at once (sort of works like that in IntelliJ IDEA for Java):
But I suspect VSCode does not support that? I guess an easy solution would be to just have it as an additonal quick fix entry on the current file.
Some of these are documented in the manual, but there's actually a lot more than the ones that are documented:
https://haxe.org/manual/target-javascript-untyped.html
https://haxe.org/manual/target-php-untyped.html
The best option to get a comprehensive list seems to be searching the std lib for __[\w]+__
and manually filtering out false positives.
It would be nice if the highlighting isn't global and only takes effect after the untyped
keyword (they seem to be valid Haxe variable names for instance).
The new is
"keyword" in 3.3.0 should be highlighted, but only in places where it's valid (i.e. surrounded by the mandatory parens):
// should not be highlighted
var is:Int;
// should be highlighted
trace((5 is Int));
When an error occurs in a haxelib, the path is absolute, breaking navigation with the problems view:
The problem matcher assumes relative paths. "fileLocation": "absolute"
helps, but it breaks other errors with relative filepaths.
Waiting on microsoft/vscode#449 to be resolved.
A lot of frameworks have their own project files and an option to generate display arguments from those files. It would probably be nice to support those as an alternative to haxe.displayConfigurations
. To make it generic, I thought we could maybe support pluggable "display arguments provider" system", where haxe.displayConfigurations
config is just one of them, but there's also others, like the one for openfl/lime that would be watching project.xml
and re-read display arguments with lime display <platform>
. I think we don't even need to touch language server for that.
While this isn't implemented, we should steal/adapt the "framework notes" table from vscode-haxe:
https://github.com/jcward/vscode-haxe#framework-notes
I'd imagine a common use case for diagnostics is having them run on an entire project so you can fix all the issues at once. This is similar to what haxe-checkstyle is usually used for.
My use case is that I'd like to get rid of unused imports in Flixel code, but I don't really want to go through each file manually for that (which would be necessary right now).
Of course, this would also be helpful for debugging this feature.
It would be nice to see a green squiggly line under unused variables
Haxe outputs this:
> src/hxparse/RuleBuilder.hx:19: lines 19-69 : Array<haxe.macro.Field> should be haxe.macro.Expr
Which is displayed like this on hovering:
should be haxe.macro.Expr
src/hxparse/RuleBuilder.hx:19: lines 19-69 : Array
As described here snowkit/atom-haxe#36?
Basically this requires a cache of all types from all class paths, even sub-types inside a module. So I think this requires compiler support.
I don't know why, but sometimes when I hover my mouse to a red underlined codes,
I got no error message at all. It just shows me the type info.
But with obvious error like using undefined variable in that line, it underlines again to that word and shows me the error message.
When I try same code at try.haxe.org, it actually shows me right error message.
What would be the problem?
+I think this occurs when the error is related to generics
Copied from Gitter:
on vscode haxe, do the completion requests queue up? I mean when I am typing, the IDE should be sending requests to the completion server continuously, will the server discard the old one when it receive a new one, or they just queue up? My problem is that the haxe process used up 100% CPU for like a few minutes even I stopped typing anything. (and completion just wonβt work during that period)
Calling a deprecated function shows no indication/warning.
For instance trace(Sys.executablePath());
on hover should show the meta content "Warning: Use programPath instead" just like when compiling.
It would be really nice if there was some sort of progress bar or something that indicates the plugin is still working in the background... As is, you're never sure if there was some error running diagnostics, or if it's just taking a while (and it does take a bit with larg-ish projects like Flixel).
There's this blue progess slider thing that sometimes appears (during completion requests mostly) right under the tabs, maybe we can use that somehow via the API?
Now its on name of nadako.
When trying to "Haxe: Initialize VS Code project" with some existing files, but no hxml file at the root, I get the above error message. I think that could be misunderstood as refusing to initialize unless the whole workspace was empty, which wouldn't be the nicest requirement of course :)
It feels a little counter-intuitive to me that the import quick-fix only shows up after a save - at first I thought it wasn't working. Could we detect if there's a pause during typing and run diagnostics then?
The delay after typing stops could be made configurable (also to turn it off completely I guess), since the behavior might potentially annoy some people.
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.