How can I set a default width for my VS Code Extension webview? - visual-studio-code

I am developing a VS Code extension using a webview. I would like to set the width of the panel when the user first opens it.
I see that there are options for where to place the panel with ViewColumn but I have not been able to figure out how to change the default width. Specifically, I would like the panel to open to the right and for the width to be the smallest possible width, basically what I can achieve by manually dragging the split line as far to the right as VS Code will let me. Where can I specify the width?
const panel = vscode.window.createWebviewPanel(
'catCoding',
'Cat Coding',
vscode.ViewColumn.Two,
{
enableScripts: true
}
);

Related

Show titlebar separator when hovering? (macOS)

I'm creating an NSWindow with title bar (.titled) or tool bar and I tried to adopt a new look for macOS Big Sur.
For example, the titlebar effect of TextEdit is perfect:
As you can see above, when I hover above the title bar, the titlebar's separator shows with transition. Then the separator disappeared after the mouse left.
I found NSTitlebarSeparatorStyle in Apple Documentation:
The automatic style doesn't provide an auto changing separator.
So how can I achieve this? Any good advise? :)
The .automatic style does provide the separator hover effect, but only when the window's content view consumes the full size of the window, that is, the .fullSizeContentView style mask.
So to have the effect you want, you will need to add .fullSizeContentView to your window's style mask:
window.styleMask.insert(.fullSizeContentView)

VS Code only displays 1 row of possible import paths. How do i convert back it to default listbox?

I think I made some setting changes in vs code which made my import statements look like this.
The default VS code import preview shows 3 or more paths.
What would be the option I should change to revert it back to the default list box view?
My settings.json
The last vscode update to v1.51 added the ability to change the size, height and width, of the suggestion box. It also seems to have set the box height to one lineHeight for some people. There is a command in the command palette to reset the suggestion widget's dimensions:
Reset Suggest Widget Size that should fix your situation.
You can also drag the lower boundary of the box down (or the right edge left and right) to change its dimensions.
The old setting that set the suggest widget's height to some user-defined number of entries (I believe the default was 12) is now gone. If you change its height or width (as well as the width of the extra info flyout box connected to the suggestion widget) that change should be remembered.

Toolbar position

I am developing a RCP4 application, where I used toolbar. In some system toolbar and part label are same alignment. But some system toolbar is coming another line of part tab. Why this kind of things are happening?
It looks like this is because the height of the icons in the tool bar are bigger than the calculated height of the part tab area. This causes CTabFolder to move them to the next line.
You can set the height of a CTabFolder in the CSS using swt-tab-height. For the part stack folder this may work:
.MPartStack
{
swt-tab-height: 22px;
}

Placing NSWindow at top of screen without 1 pixel margin.

I am trying to emulate the behaviour of a NSMenu using a NSWindow. However, when I tried anchoring the window just below the status item (at the top of the screen) I became aware that by default all windows have a 1 pixel margin between the top of the window and the status bar. Here is what I mean:
NSWindow at top of screen with unintended margin
I have found an outdated implementation on github that manages to create a custom window below the status bar without this margin, but I am having a hard time figuring out how the implementation achieves this. https://github.com/SquaredTiki/JGMenuWindow
How can I get rid of the margin so that the window fits snuggly against the status bar?
Found the solution!
override func constrainFrameRect(frameRect: NSRect, toScreen screen: NSScreen?) -> NSRect {
return frameRect
}
Override in your NSWindow subclass. Now you can move your NSWindow in any way you wish and it will be able to go above the menubar. This is because this function is normally invoked just before the window is moved to check if the proposed new window position has it's top edge lying on the screen. If this is not the case, the function will return an adjusted position in which the top edge does lie on the screen. By overriding this function and returning frameRect you are not doing any checks or readjustments to the new proposed window position, you are telling the window it can move anywhere.
It appears that you try to attach your "menu" to an NSStatusItem. Is there a reason you don't actually attach a menu and set the respective NSMenuItem's view to be whatever you want it to look like? Apple has an example here: https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/MenuList/Articles/ViewsInMenuItems.html

SAPui 5 Page as a popup window

I want to crate a popup window with close button and the content of the popup will be a split-app master-detail page.Which control should we use to achieve this?
I've tried with a sap.m.page but unable to change height and width.
I've tried with a sap.m.ResponsivePopover but i can't remove the arrow thing on the top from that.
The arrow in sap.m.ResponsivePopover is using the css classes .sapMPopoverArrUp and .sapMPopoverArr so you could probably overwrite them locally to remove the arrow.
Thanks.I have used overlaycontainer to acheive the requirement.