Better formatted tree view items with VSCode API - visual-studio-code

I want to create tree view items like these, similarly to the ones you see here with Thunder Client extension, unfortunately, they do not have their source code public. Is there any way to go about this using the VSCode API to tap into creating more sophisticated items.

Related

TreeView instead of WebView?

Once createTreeView() has created a TreeView instance, the reveal() takes your derived implementation of TreeItem. The reveal() does not take a ViewColumn as does the WebView[Panel]. The only way the vscode extension API can specify a ViewColumn is either a ExtHostTestEditor which implements the TextEditor interface, and the WebView. So do all custom editors have to be implemented with WebView? Are TreeView(s) only for activity bar side views?
It seems odd, since there is the admonition to not use WebView(s) since they are so heavy weight. Plus there is additional effort to make the WebView's look-and-feel match the editor. The vscode-json-editor uses a WebView and I haven't found any custom editors that do not use a WebView. Validating the WebView approach would help avoid going down a whole host of rabbit holes. Thank you.
These types of views have different use cases. Here's a quick overview of each VS Code 1.28:
TreeView
TreeViews can be shown in the side bar, such as in the explorer or source control section. Tree views use a data driver api where VS Code controls the presentation. This means that you get a lot for free but that you cannot fully customize the behavior of a tree view.
Use a tree view if you want to add an additional data view. A good example of a tree view would be a custom file explorer, showing the outline of an editor, or presenting a list of resources.
WebView
Webviews can be shown in an editor. They can contain any sort of html content but you are entirely responsible for the user experience of this content.
Use a webview if you need a custom user experience or need to present a completely custom view of data.

Autocomplete in swift with select item and pass object

I have seen many examples and tutorials about setting up autocomplete in swift. Mostly related to the search bar. But they do not include how to select the item in the drop-down and close the table view. Once you select the item how do you get access to the entire object. Also most data is coming from REST based API. Finally the search autocomplete should be incorporated with the existing view components.
Looking for examples or tutorials that address
adding search autocomplete to existing view
drop down data based on REST API. search term passed to API. Data includes entire object, not just name.
select item from drop-down and get entire object
hide table components and if necessary hide search components.

Custom Drop Down Menu in a Custom Word Content Control

I'm able to create a DropDown ContentControl in word such that a user can select an item from the drop down and that item becomes the text displayed in the ContentControl. However I've noticed that when you create a citation that drop down list contains command items that can launch dialogs. Is there any way to replicate this behaviour but with custom content controls that launch custom dialogs.
Apparently this is impossible as mentioned in the link below because:
This isn't a "standard" content control. This is something Word puts around a Citation field (and around Date fields and some other kinds). But the functionality is Word-internal and proprietary. It's not something that's exposed in the API. IOW, you can't do that, I'm afraid...
http://social.msdn.microsoft.com/Forums/vstudio/en-US/40542235-1a32-45e6-9aef-55709021ce53/how-do-i-create-a-contentcontrol-with-a-menu-like-when-inserting-a-placeholder?forum=worddev

Binding to custom built control according to different data

Here's the issue, I build a special book reader/browser (For holy quran), my code behind loads the page and constructs how it should look. and then it should bind that look to a some kind of data-bindable custom control to view it properly. the problem is, the look differs from page to page, so I cannot bind to a certain control or wrap panel.
here's how it generally looks:
The decorative border top of the page is always there at any page, it indicates the part and chapter the viewer is in.
If you're starting a new chapter it have additional image under that decorative border or anywhere in the page (there can be multiple chapters in the same page) something like this
or this:
The normal text is not an issue, it's just a special font, however, I put each individual word in its own text block for reasons of user selection by word.
The issue here is, given the previous information, and knowing how random it is to place the decoration picture or the amount of words (text blocks) per page. how can I bind that to some kind of view to separate the view from the VM and Engine that builds the page.
my past solution was to actually build everything in the VM in a wrappanel built inside a scrollviewer having lots of textblocks and images according to the page. but that's naiive solution. I want to rebuild that in a more professional separated way. I also want to do this for Windows RT beside Windows phone so I need to reuse the code behind in a Portable class library.
I think all you need to do is slightly adjust your current design. So perhaps have a VM that represents the entire content, and that would have a Collection of say Pages or Sections. A second VM would represent the Page/Section, allowing you to create a property for the WrapPanel content (i.e. the words) and another property for the Header and or other things.
In the View you would have the scrollviewer and bind to the main VM collection. Then create another View or DataTemplate that represents the Page/Section.
You should be able to do this is a strict MVVM sense quite easily and it will be dynamic based on the content.
You could even cater for advanced scenarios where each section has a different template/view.

Sitecore - how to persist a Layout change

I developed a Sitecore control I'd like to put into a layout on one page.
In this case it's a registration page, and my control is defined as a sublayout.
What I did is went into the Page Editor interface, and plonked the control into one of the placeholders.
What I want to do now is to create a package only containing the information that this control is on this particular page, without affecting e.g. the content or subitems of this node.
Can you please advise on the best way to create such packag, what exactly to select in the Package Designer?
Thanks
I don't believe the Package Designer gives you granular control to include just specific fields of an item. You need to add the item as whole.
You should configure layouts and renderings in the presentation details of an item OR even better in the __Standard Values of the template.
You can call the presentation details dialog through the content editor. Just select an item in the content tree, click on the Presentation tab in the top ribbon and select Details. You can configure all layouts/renderings for the selected item here.
But ff you want to prevent content changes you really SHOULD configure the presentation in the __Standard Values of the template. This is also the way, which is recommended by Sitecore. If you do this, the layouts are all you have to put into a package.