APSIMInitiative / ApsimX

ApsimX is the next generation of APSIM
http://www.apsim.info
Other
134 stars 162 forks source link

Issues with intellisense #2617

Closed hol430 closed 6 years ago

hol430 commented 6 years ago

There are a few issues remaining with intellisense in the operations presenter. An unhandled exception under certain conditions, an incomplete completion list, etc.

hol430 commented 6 years ago

Another issue is that it takes a long time to initialize the intellisense presenter, due to the need to load in the assemblies used in one of the underlying data structures. In some cases, this initialization is actually being performed twice.

hol430 commented 6 years ago

Another issue is that if multiple nodes in the simulations tree have the same name, there's no way to tell which one the user is referring to. The wheat example is a good example of this. If the user types [Wheat] into the report, they could be referring to the Wheat simulation or the Wheat crop. Currently the intellisense will generate options for the first node it finds with the name Wheat - in this case, the simulation.

I'm not sure what to do about this - it's an easy trap to fall into, especially since it exists in at least one of our examples.

hol430 commented 6 years ago

An issue with intellisense in report/property/cultivar settings is that no completion options will be generated for members of an array element.

I suspect that this issue will also exist with any other data structures using square bracket syntax (such as dictionaries), but we will deal with such cases if and when we encounter them.

rcichota commented 6 years ago

I've got a couple of issues to add/clarify:

hol430 commented 6 years ago

Yeah, I'm currently working on how the description is displayed - and as part of that, I'm going to add the type column back in, and move the type info out of description.

The bigger problem with description is that many classes have a very long description (>10 lines). Currently, I'm only displaying the first two lines of the description, but I'm open to suggestions about what to do here.

The point about attempting to generate completion options when you're trying to type a number is a good catch - I'll stop it from doing this.

rcichota commented 6 years ago

I was thinking about those very long description too. They arose from we not having sorted out in time how the auto-documentation was going to be made. In my opinion (and following the general recommendation from microsoft) these description should be revised and made one-liners. Additional tags should have been used for a more explanatory description (I use the 'remarks' tag when coding). However I am afraid of the size of the task or revising the tags...

rcichota commented 6 years ago

Found another issue. The crop models are develop using extensively 'Functions'; these have the default output termed 'Value' (which is a method). This is not being picked up by intelisense (on report), which may cause outputs not to be recorded (if one doesn't realise the need to type 'Value'). An example is trying to output [WhiteClover].Phenology.ThermalTime.Value()...

rcichota commented 6 years ago

Hmm, not sure, but I think it is related to my previous comment. I cannot acces all the function for models already released. I tried to output 'Phenology.ThermalTime' from wheat (using the example simulation), but I cannot (throught intelisense) get to Phenology. In fact I cannot get any organ or function after typing "[Wheat]."

hol430 commented 6 years ago

.Value() is not being displayed becuase only properties and model children are displayed in the report intellisense, whereas .Value() is a method. That said though, I'm pretty sure you don't actually need to specify .Value() in the report - APSIM realises that you're reporting a PMF function and calls .Value() for you anyway.

hol430 commented 6 years ago

Hmm, not sure, but I think it is related to my previous comment. I cannot acces all the function for models already released. I tried to output 'Phenology.ThermalTime' from wheat (using the example simulation), but I cannot (throught intelisense) get to Phenology. In fact I cannot get any organ or function after typing "[Wheat]."

Yes, as I mentioned a few days ago in this thread, the intellisense can get confused when there are multiple nodes with the same name in a simulations tree. In the case of the wheat example, you have Wheat the simulation and Wheat the crop. If you rename the simulation and type [Wheat]. you should see the appropriate completion options.

rcichota commented 6 years ago

Yep the issue with getting the [Wheat] properties is due to what you described, changing the simulation to another name allow to access its variables. I had seen your comment above but did not realised it was the same thing. And it is great to know we don't need to add the "Value()" to the end of a function. I probably should go an tidy up my simulations. I was sure that it was needed, but maybe only very early on. Anyway, that is a NonIssue now.

hol430 commented 6 years ago

Another issue is that intellisense suggestions with less than 2 lines in the summary tag will cause an error.