xored / f4 Goto Github PK
View Code? Open in Web Editor NEWF4 – Fantom IDE
F4 – Fantom IDE
The default Working Directory for Run Configurations recently changed from ${project_loc}
to ${resource_loc}
- and it's driving me insane!
I generally have a Run All Tests
for a project, which naturally runs from the project root. And lots of my tests requires files, templates and such. Their paths, when referenced from Fantom code, are all relative to the project - so Run All Tests
is happy. So far, all is good.
But when I run an individual test, it fails instantly because it cannot find the test files it depends on. Meaning I have to go in an change the test Run Configuration.
Because the test's run configuration doesn't exist / isn't created until I run the test, I have to run the test first, watch it fail, and then edit the run configuration. Then run the test again to see where the problem is! Argh!
So um, could the default be set back to ${project_loc}
? Or maybe let be specify the default somewhere?
Create a simple class:
class Example2 {
Void main() {
port := 69
uri := `http://host:${port}`
}
}
Close the editor. Re-open the class and you'll notice that (most) of the syntax highlighting has been disabled. While not such an issue in small classes, it's quite annoying when editing large classes.
Also, if you open up the Error Log view, you'll see extra errors logged such as:
sys::ParseErr: Invalid Uri: 'http://host:${port}'
at fan.sys.ParseErr.make(ParseErr.java:39)
at fan.sys.ParseErr.make(ParseErr.java:36)
at fan.sys.ParseErr.make(ParseErr.java:23)
at fan.sys.Uri.fromStr(Uri.java:41)
at fan.sys.Uri.fromStr(Uri.java:26)
at fan.f4parser.Parser.termBase(Parser.fan:1158)
at fan.f4parser.Parser.termExpr(Parser.fan:1075)
at fan.f4parser.Parser.unaryExpr(Parser.fan:1040)
...
It seems the error is caused by any invalid URI (and I've seen this many times before). http://host:${port}
is deemed invalid because before interpolation, the string ${port}
is not a number and hence invalid.
If a project's build.fan
has a compilation or runtime error, nothing is reported in the editor or in the Problems view. Because build.fan
is now broken, it has a nasty side effect of preventing the project from being built.
As far as the user is concerned, all of sudden, F4 silently stops compiling and doesn't tell you why.
This is a particularly nasty trap for newbies who may inadvertently forget to put a trailing slash on a resDir
, or have the wrong syntax for a depends
entry. For them, everything looks fine (no errors anywhere) but they can't get the project to compile.
(Starting off, I personally always had trouble getting new projects to compile in F4. I ended up with a cut and paste solution for my build.fan
files!)
I explain in detail in Argh! F4 Has Stopped Compiling!.
I see this as a bigger issue than F4 launches old version of project when build fails
.
See Q7 tests in f4/tests tagged with issues/23
Hence once the project is created and build starts for the first time, an error is logged into a log
When looking for source code of 3rd party libraries, F4 does not look in the pod file itself for source code.
See F4: View Source Code of 3rd Party Libraries for more details.
My build system currently copies all src code to the FAN_HOME dir so I don't need this resolved for myself - might be useful for others though.
We need to automatically exclude empty projects from FAN_ENV_PATH
Steps to reproduce:
First, create a project in normal way (we need sources, but without any F4 project files):
Second, try to create a project from the existing sources:
Results:
A bunch of error dialogs. 'Finish' button doesn't work, however when 'Cancel' is pressed, the project is created. But this project is broken somehow. 'fan' folder is shown as a package. 'Fantom Testing' doesn't work. Error dialogs are everywhere :)
A minor issue, adding it so it may be tracked.
F4 currently can only parse Version
objects from build.fan
if it is created with a Str
ctor - Version("1.2.3")
. It can not parse Version
objects created with an Int
array such as Version([1,2,3])
Currently if I type "fil" and press ctrl+space, I don't get any proposals. But I want to see File, FileBuf etc.
The following code snippet gives a compilation error in F4 but compiles fine in Fantom:
using fwt
class Example {
Str? text
Void main() {
label := Label { it.text = method(this.&text) } // compilation error -> Expected ',', not '&'
}
Str method(Str s) { s }
}
While the Fantom Test::verifyEq()
does imply actual
and expected
parameter names:
Void verifyEq(Obj? a, Obj? b, Str? msg := null)
It's native Java method implementation does:
public void verifyEq(Object expected, Object actual) { verifyEq(expected, actual, null); }
public void verifyEq(Object expected, Object actual, String msg)
This is apparent when actual
and expected
are strings with a different number of lines:
class MyTest: Test {
Void test1() {
verifyEq("line1 \n line 2", "line 1")
}
}
produces
TEST FAILED
sys::TestErr: Test failed: Expected 2 lines, actual 1 lines
Following the standard of expected
being the first parameter, if I write:
class MyTest : Test {
Void test2() {
verifyEq("expected", "actual")
}
}
It obviously fails, but if I double click on the failure, I get this dialogue:
It could be argued that Fantom should reverse its parameter list, but I don't think Brian will buy it!
Trying to call the methods sys::Type#facet()
or sys::Slot.facet()
gives a compilation error of Expected Expression
:
class Wotever {
Void main() {
Wotever#.facet(Deprecated#) // compile error
}
}
See F4 and The Word 'Facet' for current workarounds.
It does suck that the facet
keyword is also a method name, but I don't think Fantom will change their core API. :\
I installed F4 IDE without 'F4 Extras/Embedded fantom' and it's cause of the many exceptions in the Error Log and UI bugs (F4 explorer, Prefferences pages).
When I install 'Embedded fantom', the bugs disappeared.
As quick fix, I suggest to add dependence from the F4 IDE featire to Embedded fantom for the exclude of this situation.
This is an enhancement, just thought I'd add it as an issue so it may be tracked.
Using the Java Output Folder
as the Fantom output folder is cryptic and not obvious. Fantom should specify it's own output folder in the Fantom Build Path dialog.
f4core::LogUtil
uses deprecated way err?->toJava
, while more correct way is to use fanx.interop::Interop#toJava
Create TODO on line N of fan file and save it. Open Tasks View, it shows line N+1.
Once done, remove skipExecution tag from these tests: createNewTask, disableSearchingForTaskTags
looks like we incorrectly parse build.fan while extracting version
Just need it :)
Need to overwrite FanSourceViewerConfiguration#getHierarchyPresenter. Take a look on java and itcl implementations
In case of several variants, in the top of completion list should be possible case-sensitive completions. Let me provide an example: if there are methods 'doom' and 'doOmega' and I type "doo", then completion should suggest 'doom' and 'doOmega' (the order is important), but if I type "doO" then the completion list should be ['doOmega', 'doom']. In the same way eclipse completion works for java.
JDT's default behavior in this case is to prompt about build errors and ask whether it is ok to launch. Since Java projects just a bunch of class files, it may cause errors in runtime, however in case of Fantom, it's all or nothing – we either have a new pod without errors, or a previously built pod. So I think a prompt message should just inform that there are build errors and launch is terminated.
If you have classes with the same name in multiple projects, when you click to navigate, or select and press F3
, then F4 navigates to any of the classes with the same name. (And because of Murphy's law, it's usually not the class you want!)
F4 should use the using statements and / or the containing project, to resolve the type to the correct project.
Example, most of my projects have a class called ErrMsgs
which contain the msgs for Errs. It's getting increasing difficult to navigate to the correct ErrMsg
!
This is a regression after fixing #2
Create this class:
class Aaa
{
private void bcd() {
}
}
('void' typed in lower-case).
'Expected type name' error is shown, 'bc' is underlined, but not 'd'.
Declare a slot with a facet, placing the facet on the same line as the declaration:
class Broken {
@NoDoc Void broken() {}
}
When you close and reopen that class, note that all syntax highlighting is disabled (all text is black).
Also, that slot does not appear in any autocomplete dropdowns.
Losing autocompletion is more of a problem when using fields:
@Inject MyService myService
Use some Java FFI class. Completion and navigation work fine, but docs are not displayed
Err msgs are often multi-line to show / give the user more information. When such an Err is thrown in a Test, the UIRunner errors because it can not parse every line as a stack frame. The UIRunner then does not any stack traces until F4 is re-started.
I guess essentially, the UIRunner just needs more robust stack frame parsing.
The stack trace that UI Runner throws:
sys::ArgErr: Unable to parse file name from hyperlink
at fan.sys.ArgErr.make(ArgErr.java:32)
at fan.sys.ArgErr.make(ArgErr.java:29)
at fan.f4debugUi.FanHyperlink.fileName$Once(FanFileHyperlink.fan:83)
at fan.f4debugUi.FanHyperlink.fileName(FanFileHyperlink.fan:73)
at fan.f4testing.FanTestRunnerUI.isJavaSource(FanTestRunnerUI.fan:45)
at fan.f4testing.FanTestRunnerUI$filterStackTrace$0.doCall(FanTestRunnerUI.fan:54)
at fan.f4testing.FanTestRunnerUI$filterStackTrace$0.call(FanTestRunnerUI.fan:53)
at fan.sys.Func.callBool(Func.java:51)
at fan.sys.List.exclude(List.java:693)
at fan.f4testing.FanTestRunnerUI.filterStackTrace(FanTestRunnerUI.fan:53)
at org.eclipse.dltk.internal.testing.ui.TextualTrace.<init>(TextualTrace.java:35)
at org.eclipse.dltk.internal.testing.ui.FailureTrace.updateTable(FailureTrace.java:169)
at org.eclipse.dltk.internal.testing.ui.FailureTrace.showFailure(FailureTrace.java:150)
at org.eclipse.dltk.internal.testing.ui.TestRunnerViewPart$7.run(TestRunnerViewPart.java:1916)
at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:180)
at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:150)
So that only selected projects go into FAN_ENV_PATH
F4 adds an extra path of fan/lib/fan/
to whatever is specified as the Java output folder. This is unexpected behaviour and severely limits where the user can build pods.
In a typical Fantom PathEnv environment where a directory, separate to the Fantom installation, is specified for the workDir
- assuming the work dir is /workDir/
, your pods would need to be build in /workDir/lib/fan/
.
This is not possible in F4 because should you specify /workDir/
as your java output folder, pods are built in /workDir/fan/lib/fan/
.
I would recommend that the addition of the extra /fan/lib/fan/
path be scrapped. Or at the very least, be curtailed to just /lib/fan/
. This would give users more control over where their pods are built.
Basically we need to check if project defines a DSL, then during compilation we should load it from file system and use during compilation. After compilation we need to somehow unload/deactivate this DSL, so that it won't be used during compilation of other projects
F4 doesn't generate pod meta data when creating the pod's javascript
Which gives wrong completion proposals
Steps to reproduce:
Result:
'Unable to load page'
Expected result:
Tooltip for 'in.readChar' is opened
Write this code:
then := DateTime.now
elapsed := DateTime.now - then
Note that the above -
operator is short for invoking:
@Operator Duration minusDateTime(DateTime time)
which returns a Duration
.
However F4 thinks elapsed
is a DateTime
. Type elapsed.
+ CRTL+SPACE
to bring up a list of autocomplete options:
And you'll note the list is for DateTime
and not Duration
.
If I have a project open called podA
with a class called ClassA
I can debug it and set breakpoints.
When I close the podA
project, but use ClassA
it from a new podB
project I can still step into and debug ClassA
but I can't set any breakpoints in it, or any class in podA
.
A simple example can be demonstrated with the xml
pod (which is pure Fantom code). From any project and open up the XElem
class and try setting a breakpoint:
Nothing happens.
Steps to recreate:
Create a new Fantom project in F4 using the new project wizard.
Create a new class, and introduce a compilation error. Example:
class Bro ken
{
}
Note the problem in the Problems View.
Add icons 1.0
as a dependency:
using build
class Build : build::BuildPod
{
new make()
{
podName = "wotever"
summary = ""
srcDirs = [`fan/`]
depends = ["sys 1.0", "icons 1.0"]
}
}
Note that the Problems View is now empty!
After #2 change need to add the code which will copy the compiled pod after external builder to the location where launcher expects to find it
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.