Add icons to QuickPick List - visual-studio-code

I'm currently writing an extension that lists files in a QuickPick dialogue. Is there a way to add the icons to the QuickPickItem's label?
Or in other words, re-use the vscode-icons extension?

As far as I know you cannot reference an svg from something like the vscode-icons extension.
You can use Github Octicons in any of the QuickPickItem properties right out of the box:
const items: vscode.QuickPickItem[] = [{label: '$(git-merge) Merge Branch',
description: '$(git-commit) 1 commit',
detail: '$(diff-added) 3 $(diff-modified) 2'}]
vscode.window.showQuickPick(items)
You can even just pass in an array of strings to showQuickPick:
vscode.window.showQuickPick(['$(diff-added) Add', '$(diff-removed) Remove'])

Related

Microsoft Word: Set default styles

I have created a number of styles that I would like to use for many of my future documents. Thus, I want to create a template or set them as default so that whenever I open Word, they are there. I tried creating a template but my styles are not there. How can I do this?

Using default VS Code icons on an extension

I am making a VS Code extension for outlining TypeScript code structure. I am wondering how can I use the same icons VS Code uses in intellisense in my custom tree view:
Update 2022:
It is now possible to use codicons in a tree item:
getChildren() {
return [
{
collapsibleState: vscode.TreeItemCollapsibleState.None,
label: 'label',
// Replace 'circle-outline' with desired codicon: https://microsoft.github.io/vscode-codicons/dist/codicon.html
iconPath: new vscode.ThemeIcon('circle-outline'),
}
];
}
I don't think there's any way to reference built-in icons, so you would have to include copies of these in your extension. This is what the vscode-code-outline extension does (along with many others). There's a relevant feature request here:
[icons] Support to allow re-using VSCode icons in user extensions (#31466)
There's a nice overview of all built-in document symbol / suggest icons here. The .svg assets can be found here:
suggest
documentSymbols

TinyMCE: How can I change the formats ("Paragraph", "Heading 1", etc.)

By default TinyMCE (4) has a "Paragraph ▼" dropdown, and if you click on it you get a list of formatting options ("Paragraph", "Heading 1", etc.).
I'd like to be able to do two things. First, I want to change the options and their names (eg. to "Normal" and "Heading"), and I found the block_formats option which does exactly that:
block_formats: 'Normal=p;Heading=h1'
However, I'm stuck on thing #2: adding classes to the generated elements. Instead of plain <h1> elements, when someone picks "Heading" I want to generate a <h1 class="heading">.
I thought maybe this would work:
block_formats: 'Normal=p;Heading=h1.heading'
... but it doesn't, and I haven't been able to find any other option that would let me do this. Then again, the TinyMCE documentation isn't always the easiest place to find answers, which is why I came here.
Does anyone know how I configure TinyMCE to have a "Paragraph ▼" dropdown with customized names AND custom classes on the generated elements?
I never did find a way to do this, so what I wound up doing instead was remove the block format drop-down entirely and replace it with the (custom) format dropdown. In other words I:
removed the formatselect from the toolbar1 config (removing the un-configurable normal formatting dropdown)
added the custom format dropdown (styleselect) to the toolbar1 config
defined a style_formats config entry with my custom styles
The style_formats config looked like this:
style_formats: [
{
title: 'Header',
inline: 'span',
classes: 'someClass',
styles: {someStyle: '5px'}
},
], // next style would go here
There were only two downsides of this approach. First, the dropdown now says "Formats", and I don't seem to be able to configure that anywhere. However I do have a single formatting dropdown, with only the options I want, and those options add the desired classes to the formatted text, so the dropdown's name isn't a big deal.
The second issue was that TinyMCE uses an <iframe>, which prevents it from using our stylesheet. I could have written a stylesheet for TinyMCE and then appended it to the <iframe> (or used some TinyMCE mechanism, if there is one) ... but I'm lazy so I just used style: entries for each custom format to define the style.

Custom content assist for default java editor in Eclipse

I'm currently trying to develop an Eclipse Plugin to support code replacement, like what the default content assist in Eclipse do. What I want to implement is something like "insert argument names automatically on method completion with visualized box around the argument" and I can "use the Tab key to navigate between the inserted names" and "while navigating, list of optional variables for current argument can be displayed and be chosen".
In short, it comes to two questions:
How to add the visualized box around the already existed variable or even Java keywords that need replacement? And at the meanwhile I can use Tab key to switch between these boxes.
How to display a list of candidates to select from when I trigger on the box?
By now I only figure out the extension point : org.eclipse.jdt.ui.javaCompletionProposalComputer may be useful, but I have no idea where to start at? Thanks in advance.
Oh, finally I've solved it myself...
For the 'box', it should be the LinkedModeModel, this class should work with LinkedPositionGroup and LinkedPosition to add mutiple boxes. And we should use LinkedModeUI to set it up.
For the content assistant, there's no need to use the extension point. There is a ProposalPosition class which extends LinkedPosition for you to add your proposals for the 'box' in its constructor. And we can simply use the CompletionProposal to construct a ICompletionProposal array as the argument of ProposalPosition's constructor.

How to translate a label of a custom field in SugarCRM

I have created a custom field in Opportunities, but I also have to translate its label into Russian and there is no option for it in the "Edit labels" menu.
I prefer to create translated labels without Studio.
Main idea is that module string label is a value of *$mod_strings* array key which is defined in language file(s) located in modules//language/ , custom/modules//language/ and/or custom/modules/Accounts/Ext/Language/*.lang.ext.php
Thus to have an existing string in English translated into your native language manually you should do the following:
Copy your English string to be translated in browser (e.g. "Description")
Use your IDE or OS find/search function to find needed $mod_strings key that has value of the string above (e.g. *$mod_strings['LBL_DESCRIPTION']*)
Copy that key name
Change to custom/Extension/modules//Ext/Language (so called Master Directory) and create new (or append to existing) file named (in your case) ru_ru.custom.lang.php
Add a line like
$mod_strings['LBL_DESCRIPTION'] = 'Описание';
Make Quick Repair and Rebuild
Go to
Studio » Contacts » Labels,
then you can see that label and then select
'US English' or 'Russian'
from the language drop down.