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
Intellisense #546
Intellisense #546
Conversation
Hi - not checked into the code yet, but some Q :) Right - Friendly makes no sense in this case, shouldn't be relevant here. Will it only allow "existing" entity/attribute? I ask for you may want to write "other" than just what is available from the official meta. Must be possible to write anything and to execute it, even without a correct XML-doc. Still possible to have "Live" on/off? The |
Agree on the friendly names, they looked weird there to me too. I've removed them now. It won't stop you typing anything you want. It will only show suggestions based on the metadata, but you can ignore the suggestions and keep typing whatever you want: If you have "Live Update Query" ticked, as soon as you have a valid XML document the Query Builder pane will be refreshed. If you're half way through typing so your query can't be parsed the Query Builder will keep showing the previous state of the query until you've finished. If "Live Update Query" isn't ticked you need to click OK after finishing your changes. This is the same as the existing behaviour if you edit the FetchXML directly. Good question on the fetch.cs changes. The changes I've made don't affect the structure of the XML it will accept, but it produces named types in the schema for each element rather than having them as anonymous types as they were originally presented in the MS version - this is needed to help keep the autocomplete code simpler. The FetchXML schema is still documented so I can only assume it's still the authoritative source of information? |
Good. The |
Yes, fetch.cs would be overwritten if it needs to be regenerated from a new schema in the future. If/when that happens the various |
// Autocomplete entity names for <entity> and <link-entity> elements | ||
if ((e.Element.Name == "entity" || e.Element.Name == "link-entity") && e.Attribute.Name == "name") | ||
{ | ||
e.Suggestions.AddRange(fxb.entities.Values.Select(entity => new EntityMetadataSuggestion(entity))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here I come again... 😉
But it would be good to respect the settings of which entity and attribute to show.
See code for ex: https://github.com/rappen/FetchXMLBuilder/blob/master/FetchXmlBuilder/Controls/entityControl.cs#L24 (ok, old code, but anyway...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point! I've also applied the same filtering for attributes as well now.
Hopefully I'm not butting in, but I actually really like the idea of showing the display name during autocomplete. There are times in which I just don't remember the logical names of something or have a brain fart when trying to remember the logical name of a field...particularly when working with clients who have changed practically all of the standard entity/attribute display names to fit their needs. Perhaps instead of tying it to an all in or all out setting you could press a specific key while typing?..something like alt?...and the autocomplete switches to the display names and functions like how you described above. Once the autocomplete box goes away it goes back to being logical names again. |
Interesting @ThreeTen22 ! It should then be search for both name and logicalname. |
That works too! So long as the search pop-up that usually happens when you are editing is suppressed. |
Thanks for the feedback! I've put the friendly name option back in but it now shows the friendly and logical names together. You can also find suggestions by typing the friendly name even if it's completely unrelated to the logicalname: It's still controlled by the global Use Friendly Names option to keep it consistent. |
Added Intellisense-style autocompletion to the FetchXML text editor using some new shared projects.
As before, if you edit the FetchXML directly you still need to either click OK or have Live Update Query checked for the Query Builder pane to be updated. This will only work once you've entered a full valid FetchXML document though.
The autocomplete suggestions are taken from the FetchXML object model for the list of possible element and attribute names, and the metadata of the current connection for the possible table/column names.
If the full metadata for an entity/attribute is available, the tooltip for those items will show the display name and description. If only the partial metadata is available, only the display name is shown.
With "Friendly Names" enabled, the friendly name is shown in the list but the logical name is still inserted into the FetchXML. I'm not convinced this is the appropriate thing to do - I'm open to suggestions.
I've also added an "Autocomplete" event that will be sent to Application Insights the first time the autocomplete menu is shown in each session so you can track usage.