How do I write a VSCode extension to set a file icon for a certain file extension while leaving all other extensions as the default? - vscode-extensions

Here's my icon-config.json:
{
"iconDefinitions": {
"file.myFileExt": {
"iconPath": "./custom-icon.png"
}
},
"fileExtensions": {
"myExtension": "file.myFileExt"
}
}
This works to set the file extension for foo.myExtension files, but any other file types (e.g. bar.py) have their icons removed. How can I specify a custom extension icon without overwriting all other file types to be blank?

You can follow issue 14662.
VScode 1.64 (Jan. 2022) should include issue 140047: "finalize icon property of the language contribution point" (commit d335676)/
Language contributors can define an icon for the language.
{
"contributes": {
"languages": [
{
"id": "latex",
// ...
"icon": {
"light": "./icons/latex-light.png",
"dark": "./icons/latex-dark.png"
}
}
]
The icon is used by file icon themes as fallback if they don't have an icon for the language.

Related

docusaurus about sidebars of docusaurus to multi-language

I use 'Docusaurus' to docs but I don`t know How to config multi-language sideBar.
[
'#docusaurus/preset-classic',
{
docs: {
path: 'docs',
routeBasePath: '/',
sidebarPath: require.resolve('./sidebars.js')
},
theme: {
customCss: require.resolve('./src/css/custom.css'),
},
},
],
]```
The code only use a kind of sidebars, if I switch the language The sidebars can`t switch.
run the write-translations command, for example your locale is zh-cn, when command finished, you will get a current.json file in the i18n/zh-cn/docusaurus-plugin-content-docs directory
yarn run write-translations -- --locale zh-cn
the current.json contains the docs sidebar's category labels, modify it like the following:
{
"version.label": {
"message": "5.0.0.alpha.1",
"description": "The label for version current"
},
"sidebar.docsSidebar.category.Getting Started": {
"message": "开始上手",
"description": "The label for category Getting Started in sidebar docsSidebar"
},
"sidebar.docsSidebar.category.Guides": {
"message": "指南",
"description": "The label for category Guides in sidebar docsSidebar"
}
}
for more details, refer to:https://docusaurus.io/docs/next/i18n/tutorial#translate-plugin-data
Docusaurus allows you to add a navbar item so the user can select the language they want. You can enable the dropdown by adding the code below, as explained in the official documentation, to the docusaurus.config.js file.
If you want to find out more you can also have a look at this video in which I explain all the steps you need to follow to translate your Docusaurus website.
module.exports = {
themeConfig: {
navbar: {
items: [
{
type: 'localeDropdown',
position: 'left',
},
],
},
},
};
if I switch the language The sidebars can`t switch
If you properly prepared i18n JSON files, when you switch the locale (language), the sidebar label will show different languages.

Prop Suggestions/IntelliSense for own vue components

I'm cleaning up my vue.js code and I'm about to create some of my own specific components. I'm using vetur as an extension for VS Code. I read that it's possible to provided auto-complition and descriptions for my component tags and attributes.
The Vetur Docs say I have to create tags.json and attributes.json files and add them to my package.json. After restarting VS Code it should work. But it doesn't. Has anyone managed to achive this and sees where I'm making a mistake?
Thanks in advance!!
This is the content of my tags.json
{
"mex-btn": {
"description": "My Mex Button",
"attributes": "["content"]
}
}
This is the content of my attributes.json
{
"mex-btn/content": { "description": "Content of the Button"}
}
and this is the vetur key in my package.json
"vetur": {
"tags": "./tags.json",
"attributes": "./attributes.json"
}

stylelint on create-react-app #import-normalize throw error

I followed this doc to add CSS reset to my app.
https://create-react-app.dev/docs/adding-css-reset/#indexcss
But it showed this message:
"stylelint": {
"extends": "stylelint-config-recommended",
"rules": {
"at-rule-no-unknown": null
}
How to fix this problem?it is annoying...
To fix this warning you just need to add this line to.vscode/settings.json inside your project (you can create this file if it doesn't already exist):
{
"css.lint.unknownAtRules": "ignore"
}
Source: https://create-react-app.dev/docs/adding-css-reset/#indexcss
For VS Code -
To make the VS Code recognise this custom CSS directive, you can provide custom data for VS Code's CSS Language Service as mentioned here - https://github.com/Microsoft/vscode-css-languageservice/blob/master/docs/customData.md.
Create a CSS custom data set file with the following info. Place it at location .vscode/custom.css-data.json relative to the project root.
{
"version": 1.1,
"properties": [],
"atDirectives": [
{
"name": "#import-normalize",
"description": "bring in normalize.css styles"
}
],
"pseudoClasses": [],
"pseudoElements": []
}
Now, if you don't have already, create a .vscode\settings.json file relative to project root. Add a field with key "css.customData" and value as the path to custom data set. For example,
{
"css.customData": ["./.vscode/custom.css-data.json"]
}
Now, you will no longer get "Unknown at rule" warning. When you hover over "#import-normalize", you will see the description you set for it in custom.css-data.json
#import-normalize is a non-standard at-rule. From the rule's documentation:
This rule considers at-rules defined in the CSS Specifications, up to and including Editor's Drafts, to be known.
However, the rule has an ignoreAtRules secondary option for exactly this use case, where you can list the non-standard imports you are using.
For example, in your package.json:
{
"stylelint": {
"extends": "stylelint-config-recommended",
"rules": {
"at-rule-no-unknown": [true, {
"ignoreAtRules": ["import-normalise"]
}]
}
}
}
Or within your .stylelintrc file:
{
"extends": "stylelint-config-recommended",
"rules": {
"at-rule-no-unknown": [true, {
"ignoreAtRules": ["import-normalise"]
}
}
}

howa to change home to accueil in seedstack Business Theme

I develop an application using the theme seedstack Business Theme, the default theme generates the seedbare part with the home tab, how can I change home by acceuil or another word?
The attached image shows my problem.
!sidebare picture where i want to change the term home for acceuil
this is the code for w20.app.json file:
{
"w20-core": {
"modules": {
"application": {
"home": "/accueil/accueil"
}
}
},
"w20-business-theme": {
"modules": {
"main": {
"sidebar": {
"width": 270
}
}
}
}
}
The home link in the sidebar is automatically generated and its label is based on the translation of i18n key w20.menu.sidebar.home in the currently active culture (or locale).
Since you haven't configured i18n specifically in your application, the default culture is generic english ('en'). To configure i18n, add the following configuration to your w20.app.json file:
{
"w20-core": {
"modules": {
"culture": {
"available": [ "en", "fr" ] // add any culture you need
"default": "fr" // the default culture of your application
}
}
}
}
This configuration make two cultures available in the application (generic english and generic french) with generic french as the default. A culture switcher will be displayed in the topbar.
W20 is provided with translations for english and french only. If you need to add languages, you have to provide your own translations files. Check the documentation for more information about it.

Aurelia and Semantic UI - custom theme

I am building an Aurelia app with TypeScript and decided to try out Semantic UI. I followed this question (Aurelia Semantic dropdown) and it helped me install Semantic into Aurelia. It seems that it got installed already built with default theme. Is there a way I can install semantic into Aurelia TypeScript app, then add some custom gulp tasks to build according to my own theme.config? I would like also to override some variables like colors, font sizes etc. After it is built I'd like to use the built version in Aurelia view models (TypeScript) and in my views. How can I achieve that?
Here is how I solved this:
Installed semantic to some local folder with npm
Copied over the semantic folder and semantic.json to web app root folder (so semantic folder is on the level where I have node_modules and jspm_packages)
Inside semantic.json I specified the list of components I want to include in my app
Inside semantic.json I modified "output" and "clean" paths to match the folders where I serve files from.
The semantic.json:
{
"base": "semantic",
"paths": {
"source": {
"config": "src/theme.config",
"definitions": "src/definitions/",
"site": "src/site/",
"themes": "src/themes/"
},
"output": {
"packaged": "../dist/semantic",
"uncompressed": "../dist/semantic/components/",
"compressed": "../dist/semantic/components/",
"themes": "../dist/semantic/themes/"
},
"clean": "../dist/semantic"
},
"permission": false,
"autoInstall": false,
"rtl": false,
"version": "2.2.4",
"components": [
"button",
...
"site"
]
}
Inside Aurelia's gulp definitions I added semantic build task
The build/tasks/build.js:
var buildSemantic = require('../../semantic/tasks/build');
gulp.task('build-semantic', buildSemantic);
...
gulp.task('build-layout', function (callback) {
return runSequence(
'build-html',
'build-semantic',
'build-less',
callback
);
});
When coding I go into semantic src (e.g. semantic\src\themes\default\globals\site.variables) and modify things in there
Run gulp build-layout
The output is added to my dist folder and I can use it in my views
As for the view models I created some helper components to be used as aurelia attributes e.g. the semantic tooltip:
import {customAttribute, inject} from 'aurelia-framework';
import * as $ from 'jquery';
import '../semantic/semantic.min.js';
#customAttribute('semantic-tooltip')
#inject(Element)
export class SemanticTooltip {
constructor(private element: HTMLElement) {
}
attached() {
$(this.element).popup();
}
}
Usage:
<i class="info circle icon" data-content="Sample tooltip" semantic-tooltip></i>