add linter for css variable names (#176769)

This commit is contained in:
Martin Aeschlimann 2023-03-10 16:33:02 +01:00 committed by GitHub
parent 169bdfe262
commit 780b2f5758
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 905 additions and 22 deletions

View file

@ -194,3 +194,7 @@ module.exports.eslintFilter = [
.filter(line => !!line)
.map(line => `!${line}`)
];
module.exports.stylelintFilter = [
'src/**/*.css'
];

View file

@ -11,7 +11,7 @@ const path = require('path');
const fs = require('fs');
const pall = require('p-all');
const { all, copyrightFilter, unicodeFilter, indentationFilter, tsFormattingFilter, eslintFilter } = require('./filters');
const { all, copyrightFilter, unicodeFilter, indentationFilter, tsFormattingFilter, eslintFilter, stylelintFilter } = require('./filters');
const copyrightHeaderLines = [
'/*---------------------------------------------------------------------------------------------',
@ -22,6 +22,7 @@ const copyrightHeaderLines = [
function hygiene(some, linting = true) {
const gulpeslint = require('gulp-eslint');
const gulpstylelint = require('./stylelint');
const tsfmt = require('typescript-formatter');
let errorCount = 0;
@ -185,6 +186,12 @@ function hygiene(some, linting = true) {
})
)
);
streams.push(
result.pipe(filter(stylelintFilter)).pipe(gulpstylelint((error => {
console.error(error);
errorCount++;
})))
);
}
let count = 0;

View file

@ -0,0 +1,34 @@
"use strict";
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.getVariableNameValidator = void 0;
const fs_1 = require("fs");
const path = require("path");
const RE_VAR_PROP = /var\(\s*(--([\w\-\.]+))/g;
let knownVariables;
function getKnownVariableNames() {
if (!knownVariables) {
const knownVariablesFileContent = (0, fs_1.readFileSync)(path.join(__dirname, './vscode-known-variables.json'), 'utf8').toString();
const knownVariablesInfo = JSON.parse(knownVariablesFileContent);
knownVariables = new Set([...knownVariablesInfo.colors, ...knownVariablesInfo.others]);
}
return knownVariables;
}
function getVariableNameValidator() {
const allVariables = getKnownVariableNames();
return (value, report) => {
RE_VAR_PROP.lastIndex = 0; // reset lastIndex just to be sure
let match;
while (match = RE_VAR_PROP.exec(value)) {
const variableName = match[1];
if (variableName && !allVariables.has(variableName)) {
report(variableName);
}
}
};
}
exports.getVariableNameValidator = getVariableNameValidator;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidmFsaWRhdGVWYXJpYWJsZU5hbWVzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsidmFsaWRhdGVWYXJpYWJsZU5hbWVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTs7O2dHQUdnRzs7O0FBRWhHLDJCQUFrQztBQUNsQyw2QkFBOEI7QUFFOUIsTUFBTSxXQUFXLEdBQUcsMEJBQTBCLENBQUM7QUFFL0MsSUFBSSxjQUF1QyxDQUFDO0FBQzVDLFNBQVMscUJBQXFCO0lBQzdCLElBQUksQ0FBQyxjQUFjLEVBQUU7UUFDcEIsTUFBTSx5QkFBeUIsR0FBRyxJQUFBLGlCQUFZLEVBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxTQUFTLEVBQUUsK0JBQStCLENBQUMsRUFBRSxNQUFNLENBQUMsQ0FBQyxRQUFRLEVBQUUsQ0FBQztRQUN6SCxNQUFNLGtCQUFrQixHQUFHLElBQUksQ0FBQyxLQUFLLENBQUMseUJBQXlCLENBQUMsQ0FBQztRQUNqRSxjQUFjLEdBQUcsSUFBSSxHQUFHLENBQUMsQ0FBQyxHQUFHLGtCQUFrQixDQUFDLE1BQU0sRUFBRSxHQUFHLGtCQUFrQixDQUFDLE1BQU0sQ0FBYSxDQUFDLENBQUM7S0FDbkc7SUFDRCxPQUFPLGNBQWMsQ0FBQztBQUN2QixDQUFDO0FBTUQsU0FBZ0Isd0JBQXdCO0lBQ3ZDLE1BQU0sWUFBWSxHQUFHLHFCQUFxQixFQUFFLENBQUM7SUFDN0MsT0FBTyxDQUFDLEtBQWEsRUFBRSxNQUF3QyxFQUFFLEVBQUU7UUFDbEUsV0FBVyxDQUFDLFNBQVMsR0FBRyxDQUFDLENBQUMsQ0FBQyxrQ0FBa0M7UUFDN0QsSUFBSSxLQUFLLENBQUM7UUFDVixPQUFPLEtBQUssR0FBRyxXQUFXLENBQUMsSUFBSSxDQUFDLEtBQUssQ0FBQyxFQUFFO1lBQ3ZDLE1BQU0sWUFBWSxHQUFHLEtBQUssQ0FBQyxDQUFDLENBQUMsQ0FBQztZQUM5QixJQUFJLFlBQVksSUFBSSxDQUFDLFlBQVksQ0FBQyxHQUFHLENBQUMsWUFBWSxDQUFDLEVBQUU7Z0JBQ3BELE1BQU0sQ0FBQyxZQUFZLENBQUMsQ0FBQzthQUNyQjtTQUNEO0lBQ0YsQ0FBQyxDQUFDO0FBQ0gsQ0FBQztBQVpELDREQVlDIn0=

View file

@ -0,0 +1,38 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { readFileSync } from 'fs';
import path = require('path');
const RE_VAR_PROP = /var\(\s*(--([\w\-\.]+))/g;
let knownVariables: Set<string> | undefined;
function getKnownVariableNames() {
if (!knownVariables) {
const knownVariablesFileContent = readFileSync(path.join(__dirname, './vscode-known-variables.json'), 'utf8').toString();
const knownVariablesInfo = JSON.parse(knownVariablesFileContent);
knownVariables = new Set([...knownVariablesInfo.colors, ...knownVariablesInfo.others] as string[]);
}
return knownVariables;
}
export interface IValidator {
(value: string, report: (message: string) => void): void;
}
export function getVariableNameValidator(): IValidator {
const allVariables = getKnownVariableNames();
return (value: string, report: (unknwnVariable: string) => void) => {
RE_VAR_PROP.lastIndex = 0; // reset lastIndex just to be sure
let match;
while (match = RE_VAR_PROP.exec(value)) {
const variableName = match[1];
if (variableName && !allVariables.has(variableName)) {
report(variableName);
}
}
};
}

View file

@ -0,0 +1,723 @@
{
"colors": [
"--vscode-foreground",
"--vscode-disabledForeground",
"--vscode-errorForeground",
"--vscode-descriptionForeground",
"--vscode-icon-foreground",
"--vscode-focusBorder",
"--vscode-contrastBorder",
"--vscode-contrastActiveBorder",
"--vscode-selection-background",
"--vscode-textSeparator-foreground",
"--vscode-textLink-foreground",
"--vscode-textLink-activeForeground",
"--vscode-textPreformat-foreground",
"--vscode-textBlockQuote-background",
"--vscode-textBlockQuote-border",
"--vscode-textCodeBlock-background",
"--vscode-widget-shadow",
"--vscode-widget-border",
"--vscode-input-background",
"--vscode-input-foreground",
"--vscode-input-border",
"--vscode-inputOption-activeBorder",
"--vscode-inputOption-hoverBackground",
"--vscode-inputOption-activeBackground",
"--vscode-inputOption-activeForeground",
"--vscode-input-placeholderForeground",
"--vscode-inputValidation-infoBackground",
"--vscode-inputValidation-infoForeground",
"--vscode-inputValidation-infoBorder",
"--vscode-inputValidation-warningBackground",
"--vscode-inputValidation-warningForeground",
"--vscode-inputValidation-warningBorder",
"--vscode-inputValidation-errorBackground",
"--vscode-inputValidation-errorForeground",
"--vscode-inputValidation-errorBorder",
"--vscode-dropdown-background",
"--vscode-dropdown-listBackground",
"--vscode-dropdown-foreground",
"--vscode-dropdown-border",
"--vscode-button-foreground",
"--vscode-button-separator",
"--vscode-button-background",
"--vscode-button-hoverBackground",
"--vscode-button-border",
"--vscode-button-secondaryForeground",
"--vscode-button-secondaryBackground",
"--vscode-button-secondaryHoverBackground",
"--vscode-badge-background",
"--vscode-badge-foreground",
"--vscode-scrollbar-shadow",
"--vscode-scrollbarSlider-background",
"--vscode-scrollbarSlider-hoverBackground",
"--vscode-scrollbarSlider-activeBackground",
"--vscode-progressBar-background",
"--vscode-editorError-background",
"--vscode-editorError-foreground",
"--vscode-editorError-border",
"--vscode-editorWarning-background",
"--vscode-editorWarning-foreground",
"--vscode-editorWarning-border",
"--vscode-editorInfo-background",
"--vscode-editorInfo-foreground",
"--vscode-editorInfo-border",
"--vscode-editorHint-foreground",
"--vscode-editorHint-border",
"--vscode-sash-hoverBorder",
"--vscode-editor-background",
"--vscode-editor-foreground",
"--vscode-editorStickyScroll-background",
"--vscode-editorStickyScrollHover-background",
"--vscode-editorWidget-background",
"--vscode-editorWidget-foreground",
"--vscode-editorWidget-border",
"--vscode-editorWidget-resizeBorder",
"--vscode-quickInput-background",
"--vscode-quickInput-foreground",
"--vscode-quickInputTitle-background",
"--vscode-pickerGroup-foreground",
"--vscode-pickerGroup-border",
"--vscode-keybindingLabel-background",
"--vscode-keybindingLabel-foreground",
"--vscode-keybindingLabel-border",
"--vscode-keybindingLabel-bottomBorder",
"--vscode-editor-selectionBackground",
"--vscode-editor-selectionForeground",
"--vscode-editor-inactiveSelectionBackground",
"--vscode-editor-selectionHighlightBackground",
"--vscode-editor-selectionHighlightBorder",
"--vscode-editor-findMatchBackground",
"--vscode-editor-findMatchHighlightBackground",
"--vscode-editor-findRangeHighlightBackground",
"--vscode-editor-findMatchBorder",
"--vscode-editor-findMatchHighlightBorder",
"--vscode-editor-findRangeHighlightBorder",
"--vscode-searchEditor-findMatchBackground",
"--vscode-searchEditor-findMatchBorder",
"--vscode-search-resultsInfoForeground",
"--vscode-editor-hoverHighlightBackground",
"--vscode-editorHoverWidget-background",
"--vscode-editorHoverWidget-foreground",
"--vscode-editorHoverWidget-border",
"--vscode-editorHoverWidget-statusBarBackground",
"--vscode-editorLink-activeForeground",
"--vscode-editorInlayHint-foreground",
"--vscode-editorInlayHint-background",
"--vscode-editorInlayHint-typeForeground",
"--vscode-editorInlayHint-typeBackground",
"--vscode-editorInlayHint-parameterForeground",
"--vscode-editorInlayHint-parameterBackground",
"--vscode-editorLightBulb-foreground",
"--vscode-editorLightBulbAutoFix-foreground",
"--vscode-diffEditor-insertedTextBackground",
"--vscode-diffEditor-removedTextBackground",
"--vscode-diffEditor-insertedLineBackground",
"--vscode-diffEditor-removedLineBackground",
"--vscode-diffEditorGutter-insertedLineBackground",
"--vscode-diffEditorGutter-removedLineBackground",
"--vscode-diffEditorOverview-insertedForeground",
"--vscode-diffEditorOverview-removedForeground",
"--vscode-diffEditor-insertedTextBorder",
"--vscode-diffEditor-removedTextBorder",
"--vscode-diffEditor-border",
"--vscode-diffEditor-diagonalFill",
"--vscode-list-focusBackground",
"--vscode-list-focusForeground",
"--vscode-list-focusOutline",
"--vscode-list-focusAndSelectionOutline",
"--vscode-list-activeSelectionBackground",
"--vscode-list-activeSelectionForeground",
"--vscode-list-activeSelectionIconForeground",
"--vscode-list-inactiveSelectionBackground",
"--vscode-list-inactiveSelectionForeground",
"--vscode-list-inactiveSelectionIconForeground",
"--vscode-list-inactiveFocusBackground",
"--vscode-list-inactiveFocusOutline",
"--vscode-list-hoverBackground",
"--vscode-list-hoverForeground",
"--vscode-list-dropBackground",
"--vscode-list-highlightForeground",
"--vscode-list-focusHighlightForeground",
"--vscode-list-invalidItemForeground",
"--vscode-list-errorForeground",
"--vscode-list-warningForeground",
"--vscode-listFilterWidget-background",
"--vscode-listFilterWidget-outline",
"--vscode-listFilterWidget-noMatchesOutline",
"--vscode-listFilterWidget-shadow",
"--vscode-list-filterMatchBackground",
"--vscode-list-filterMatchBorder",
"--vscode-tree-indentGuidesStroke",
"--vscode-tree-inactiveIndentGuidesStroke",
"--vscode-tree-tableColumnsBorder",
"--vscode-tree-tableOddRowsBackground",
"--vscode-list-deemphasizedForeground",
"--vscode-checkbox-background",
"--vscode-checkbox-selectBackground",
"--vscode-checkbox-foreground",
"--vscode-checkbox-border",
"--vscode-checkbox-selectBorder",
"--vscode-quickInputList-focusForeground",
"--vscode-quickInputList-focusIconForeground",
"--vscode-quickInputList-focusBackground",
"--vscode-menu-border",
"--vscode-menu-foreground",
"--vscode-menu-background",
"--vscode-menu-selectionForeground",
"--vscode-menu-selectionBackground",
"--vscode-menu-selectionBorder",
"--vscode-menu-separatorBackground",
"--vscode-toolbar-hoverBackground",
"--vscode-toolbar-hoverOutline",
"--vscode-toolbar-activeBackground",
"--vscode-editor-snippetTabstopHighlightBackground",
"--vscode-editor-snippetTabstopHighlightBorder",
"--vscode-editor-snippetFinalTabstopHighlightBackground",
"--vscode-editor-snippetFinalTabstopHighlightBorder",
"--vscode-breadcrumb-foreground",
"--vscode-breadcrumb-background",
"--vscode-breadcrumb-focusForeground",
"--vscode-breadcrumb-activeSelectionForeground",
"--vscode-breadcrumbPicker-background",
"--vscode-merge-currentHeaderBackground",
"--vscode-merge-currentContentBackground",
"--vscode-merge-incomingHeaderBackground",
"--vscode-merge-incomingContentBackground",
"--vscode-merge-commonHeaderBackground",
"--vscode-merge-commonContentBackground",
"--vscode-merge-border",
"--vscode-editorOverviewRuler-currentContentForeground",
"--vscode-editorOverviewRuler-incomingContentForeground",
"--vscode-editorOverviewRuler-commonContentForeground",
"--vscode-editorOverviewRuler-findMatchForeground",
"--vscode-editorOverviewRuler-selectionHighlightForeground",
"--vscode-minimap-findMatchHighlight",
"--vscode-minimap-selectionOccurrenceHighlight",
"--vscode-minimap-selectionHighlight",
"--vscode-minimap-errorHighlight",
"--vscode-minimap-warningHighlight",
"--vscode-minimap-background",
"--vscode-minimap-foregroundOpacity",
"--vscode-minimapSlider-background",
"--vscode-minimapSlider-hoverBackground",
"--vscode-minimapSlider-activeBackground",
"--vscode-problemsErrorIcon-foreground",
"--vscode-problemsWarningIcon-foreground",
"--vscode-problemsInfoIcon-foreground",
"--vscode-charts-foreground",
"--vscode-charts-lines",
"--vscode-charts-red",
"--vscode-charts-blue",
"--vscode-charts-yellow",
"--vscode-charts-orange",
"--vscode-charts-green",
"--vscode-charts-purple",
"--vscode-editor-lineHighlightBackground",
"--vscode-editor-lineHighlightBorder",
"--vscode-editor-rangeHighlightBackground",
"--vscode-editor-rangeHighlightBorder",
"--vscode-editor-symbolHighlightBackground",
"--vscode-editor-symbolHighlightBorder",
"--vscode-editorCursor-foreground",
"--vscode-editorCursor-background",
"--vscode-editorWhitespace-foreground",
"--vscode-editorIndentGuide-background",
"--vscode-editorIndentGuide-activeBackground",
"--vscode-editorLineNumber-foreground",
"--vscode-editorLineNumber-activeForeground",
"--vscode-editorLineNumber-dimmedForeground",
"--vscode-editorRuler-foreground",
"--vscode-editorCodeLens-foreground",
"--vscode-editorBracketMatch-background",
"--vscode-editorBracketMatch-border",
"--vscode-editorOverviewRuler-border",
"--vscode-editorOverviewRuler-background",
"--vscode-editorGutter-background",
"--vscode-editorUnnecessaryCode-border",
"--vscode-editorUnnecessaryCode-opacity",
"--vscode-editorGhostText-border",
"--vscode-editorGhostText-foreground",
"--vscode-editorGhostText-background",
"--vscode-editorOverviewRuler-rangeHighlightForeground",
"--vscode-editorOverviewRuler-errorForeground",
"--vscode-editorOverviewRuler-warningForeground",
"--vscode-editorOverviewRuler-infoForeground",
"--vscode-editorBracketHighlight-foreground1",
"--vscode-editorBracketHighlight-foreground2",
"--vscode-editorBracketHighlight-foreground3",
"--vscode-editorBracketHighlight-foreground4",
"--vscode-editorBracketHighlight-foreground5",
"--vscode-editorBracketHighlight-foreground6",
"--vscode-editorBracketHighlight-unexpectedBracket-foreground",
"--vscode-editorBracketPairGuide-background1",
"--vscode-editorBracketPairGuide-background2",
"--vscode-editorBracketPairGuide-background3",
"--vscode-editorBracketPairGuide-background4",
"--vscode-editorBracketPairGuide-background5",
"--vscode-editorBracketPairGuide-background6",
"--vscode-editorBracketPairGuide-activeBackground1",
"--vscode-editorBracketPairGuide-activeBackground2",
"--vscode-editorBracketPairGuide-activeBackground3",
"--vscode-editorBracketPairGuide-activeBackground4",
"--vscode-editorBracketPairGuide-activeBackground5",
"--vscode-editorBracketPairGuide-activeBackground6",
"--vscode-editorUnicodeHighlight-border",
"--vscode-editorUnicodeHighlight-background",
"--vscode-tab-activeBackground",
"--vscode-tab-unfocusedActiveBackground",
"--vscode-tab-inactiveBackground",
"--vscode-tab-unfocusedInactiveBackground",
"--vscode-tab-activeForeground",
"--vscode-tab-inactiveForeground",
"--vscode-tab-unfocusedActiveForeground",
"--vscode-tab-unfocusedInactiveForeground",
"--vscode-tab-hoverBackground",
"--vscode-tab-unfocusedHoverBackground",
"--vscode-tab-hoverForeground",
"--vscode-tab-unfocusedHoverForeground",
"--vscode-tab-border",
"--vscode-tab-lastPinnedBorder",
"--vscode-tab-activeBorder",
"--vscode-tab-unfocusedActiveBorder",
"--vscode-tab-activeBorderTop",
"--vscode-tab-unfocusedActiveBorderTop",
"--vscode-tab-hoverBorder",
"--vscode-tab-unfocusedHoverBorder",
"--vscode-tab-activeModifiedBorder",
"--vscode-tab-inactiveModifiedBorder",
"--vscode-tab-unfocusedActiveModifiedBorder",
"--vscode-tab-unfocusedInactiveModifiedBorder",
"--vscode-editorPane-background",
"--vscode-editorGroup-emptyBackground",
"--vscode-editorGroup-focusedEmptyBorder",
"--vscode-editorGroupHeader-tabsBackground",
"--vscode-editorGroupHeader-tabsBorder",
"--vscode-editorGroupHeader-noTabsBackground",
"--vscode-editorGroupHeader-border",
"--vscode-editorGroup-border",
"--vscode-editorGroup-dropBackground",
"--vscode-editorGroup-dropIntoPromptForeground",
"--vscode-editorGroup-dropIntoPromptBackground",
"--vscode-editorGroup-dropIntoPromptBorder",
"--vscode-sideBySideEditor-horizontalBorder",
"--vscode-sideBySideEditor-verticalBorder",
"--vscode-panel-background",
"--vscode-panel-border",
"--vscode-panelTitle-activeForeground",
"--vscode-panelTitle-inactiveForeground",
"--vscode-panelTitle-activeBorder",
"--vscode-panelInput-border",
"--vscode-panel-dropBorder",
"--vscode-panelSection-dropBackground",
"--vscode-panelSectionHeader-background",
"--vscode-panelSectionHeader-foreground",
"--vscode-panelSectionHeader-border",
"--vscode-panelSection-border",
"--vscode-banner-background",
"--vscode-banner-foreground",
"--vscode-banner-iconForeground",
"--vscode-statusBar-foreground",
"--vscode-statusBar-noFolderForeground",
"--vscode-statusBar-background",
"--vscode-statusBar-noFolderBackground",
"--vscode-statusBar-border",
"--vscode-statusBar-focusBorder",
"--vscode-statusBar-noFolderBorder",
"--vscode-statusBarItem-activeBackground",
"--vscode-statusBarItem-focusBorder",
"--vscode-statusBarItem-hoverBackground",
"--vscode-statusBarItem-compactHoverBackground",
"--vscode-statusBarItem-prominentForeground",
"--vscode-statusBarItem-prominentBackground",
"--vscode-statusBarItem-prominentHoverBackground",
"--vscode-statusBarItem-errorBackground",
"--vscode-statusBarItem-errorForeground",
"--vscode-statusBarItem-warningBackground",
"--vscode-statusBarItem-warningForeground",
"--vscode-activityBar-background",
"--vscode-activityBar-foreground",
"--vscode-activityBar-inactiveForeground",
"--vscode-activityBar-border",
"--vscode-activityBar-activeBorder",
"--vscode-activityBar-activeFocusBorder",
"--vscode-activityBar-activeBackground",
"--vscode-activityBar-dropBorder",
"--vscode-activityBarBadge-background",
"--vscode-activityBarBadge-foreground",
"--vscode-profileBadge-background",
"--vscode-profileBadge-foreground",
"--vscode-statusBarItem-remoteBackground",
"--vscode-statusBarItem-remoteForeground",
"--vscode-extensionBadge-remoteBackground",
"--vscode-extensionBadge-remoteForeground",
"--vscode-sideBar-background",
"--vscode-sideBar-foreground",
"--vscode-sideBar-border",
"--vscode-sideBarTitle-foreground",
"--vscode-sideBar-dropBackground",
"--vscode-sideBarSectionHeader-background",
"--vscode-sideBarSectionHeader-foreground",
"--vscode-sideBarSectionHeader-border",
"--vscode-titleBar-activeForeground",
"--vscode-titleBar-inactiveForeground",
"--vscode-titleBar-activeBackground",
"--vscode-titleBar-inactiveBackground",
"--vscode-titleBar-border",
"--vscode-menubar-selectionForeground",
"--vscode-menubar-selectionBackground",
"--vscode-menubar-selectionBorder",
"--vscode-notificationCenter-border",
"--vscode-notificationToast-border",
"--vscode-notifications-foreground",
"--vscode-notifications-background",
"--vscode-notificationLink-foreground",
"--vscode-notificationCenterHeader-foreground",
"--vscode-notificationCenterHeader-background",
"--vscode-notifications-border",
"--vscode-notificationsErrorIcon-foreground",
"--vscode-notificationsWarningIcon-foreground",
"--vscode-notificationsInfoIcon-foreground",
"--vscode-window-activeBorder",
"--vscode-window-inactiveBorder",
"--vscode-interactive-responseBackground",
"--vscode-interactive-responseActiveBackground",
"--vscode-interactive-responseBorder",
"--vscode-debugToolBar-background",
"--vscode-debugToolBar-border",
"--vscode-debugIcon-startForeground",
"--vscode-statusBar-debuggingBackground",
"--vscode-statusBar-debuggingForeground",
"--vscode-statusBar-debuggingBorder",
"--vscode-editor-stackFrameHighlightBackground",
"--vscode-editor-focusedStackFrameHighlightBackground",
"--vscode-settings-headerForeground",
"--vscode-settings-settingsHeaderHoverForeground",
"--vscode-settings-modifiedItemIndicator",
"--vscode-settings-headerBorder",
"--vscode-settings-sashBorder",
"--vscode-settings-dropdownBackground",
"--vscode-settings-dropdownForeground",
"--vscode-settings-dropdownBorder",
"--vscode-settings-dropdownListBorder",
"--vscode-settings-checkboxBackground",
"--vscode-settings-checkboxForeground",
"--vscode-settings-checkboxBorder",
"--vscode-settings-textInputBackground",
"--vscode-settings-textInputForeground",
"--vscode-settings-textInputBorder",
"--vscode-settings-numberInputBackground",
"--vscode-settings-numberInputForeground",
"--vscode-settings-numberInputBorder",
"--vscode-settings-focusedRowBackground",
"--vscode-settings-rowHoverBackground",
"--vscode-settings-focusedRowBorder",
"--vscode-testing-iconFailed",
"--vscode-testing-iconErrored",
"--vscode-testing-iconPassed",
"--vscode-testing-runAction",
"--vscode-testing-iconQueued",
"--vscode-testing-iconUnset",
"--vscode-testing-iconSkipped",
"--vscode-testing-peekBorder",
"--vscode-testing-peekHeaderBackground",
"--vscode-testing-message-error-decorationForeground",
"--vscode-testing-message-error-lineBackground",
"--vscode-testing-message-info-decorationForeground",
"--vscode-testing-message-info-lineBackground",
"--vscode-mergeEditor-change-background",
"--vscode-mergeEditor-change-word-background",
"--vscode-mergeEditor-changeBase-background",
"--vscode-mergeEditor-changeBase-word-background",
"--vscode-mergeEditor-conflict-unhandledUnfocused-border",
"--vscode-mergeEditor-conflict-unhandledFocused-border",
"--vscode-mergeEditor-conflict-handledUnfocused-border",
"--vscode-mergeEditor-conflict-handledFocused-border",
"--vscode-mergeEditor-conflict-handled-minimapOverViewRuler",
"--vscode-mergeEditor-conflict-unhandled-minimapOverViewRuler",
"--vscode-mergeEditor-conflictingLines-background",
"--vscode-mergeEditor-conflict-input1-background",
"--vscode-mergeEditor-conflict-input2-background",
"--vscode-terminal-background",
"--vscode-terminal-foreground",
"--vscode-terminalCursor-foreground",
"--vscode-terminalCursor-background",
"--vscode-terminal-selectionBackground",
"--vscode-terminal-inactiveSelectionBackground",
"--vscode-terminal-selectionForeground",
"--vscode-terminalCommandDecoration-defaultBackground",
"--vscode-terminalCommandDecoration-successBackground",
"--vscode-terminalCommandDecoration-errorBackground",
"--vscode-terminalOverviewRuler-cursorForeground",
"--vscode-terminal-border",
"--vscode-terminal-findMatchBackground",
"--vscode-terminal-hoverHighlightBackground",
"--vscode-terminal-findMatchBorder",
"--vscode-terminal-findMatchHighlightBackground",
"--vscode-terminal-findMatchHighlightBorder",
"--vscode-terminalOverviewRuler-findMatchForeground",
"--vscode-terminal-dropBackground",
"--vscode-terminal-tab-activeBorder",
"--vscode-walkThrough-embeddedEditorBackground",
"--vscode-welcomePage-background",
"--vscode-welcomePage-tileBackground",
"--vscode-welcomePage-tileHoverBackground",
"--vscode-welcomePage-tileBorder",
"--vscode-welcomePage-progress-background",
"--vscode-welcomePage-progress-foreground",
"--vscode-walkthrough-stepTitle-foreground",
"--vscode-symbolIcon-arrayForeground",
"--vscode-symbolIcon-booleanForeground",
"--vscode-symbolIcon-classForeground",
"--vscode-symbolIcon-colorForeground",
"--vscode-symbolIcon-constantForeground",
"--vscode-symbolIcon-constructorForeground",
"--vscode-symbolIcon-enumeratorForeground",
"--vscode-symbolIcon-enumeratorMemberForeground",
"--vscode-symbolIcon-eventForeground",
"--vscode-symbolIcon-fieldForeground",
"--vscode-symbolIcon-fileForeground",
"--vscode-symbolIcon-folderForeground",
"--vscode-symbolIcon-functionForeground",
"--vscode-symbolIcon-interfaceForeground",
"--vscode-symbolIcon-keyForeground",
"--vscode-symbolIcon-keywordForeground",
"--vscode-symbolIcon-methodForeground",
"--vscode-symbolIcon-moduleForeground",
"--vscode-symbolIcon-namespaceForeground",
"--vscode-symbolIcon-nullForeground",
"--vscode-symbolIcon-numberForeground",
"--vscode-symbolIcon-objectForeground",
"--vscode-symbolIcon-operatorForeground",
"--vscode-symbolIcon-packageForeground",
"--vscode-symbolIcon-propertyForeground",
"--vscode-symbolIcon-referenceForeground",
"--vscode-symbolIcon-snippetForeground",
"--vscode-symbolIcon-stringForeground",
"--vscode-symbolIcon-structForeground",
"--vscode-symbolIcon-textForeground",
"--vscode-symbolIcon-typeParameterForeground",
"--vscode-symbolIcon-unitForeground",
"--vscode-symbolIcon-variableForeground",
"--vscode-extensionButton-background",
"--vscode-extensionButton-foreground",
"--vscode-extensionButton-hoverBackground",
"--vscode-extensionButton-separator",
"--vscode-extensionButton-prominentBackground",
"--vscode-extensionButton-prominentForeground",
"--vscode-extensionButton-prominentHoverBackground",
"--vscode-extensionIcon-starForeground",
"--vscode-extensionIcon-verifiedForeground",
"--vscode-extensionIcon-preReleaseForeground",
"--vscode-extensionIcon-sponsorForeground",
"--vscode-commandCenter-foreground",
"--vscode-commandCenter-activeForeground",
"--vscode-commandCenter-inactiveForeground",
"--vscode-commandCenter-background",
"--vscode-commandCenter-activeBackground",
"--vscode-commandCenter-border",
"--vscode-commandCenter-activeBorder",
"--vscode-commandCenter-inactiveBorder",
"--vscode-ports-iconRunningProcessForeground",
"--vscode-editorHoverWidget-highlightForeground",
"--vscode-editorOverviewRuler-bracketMatchForeground",
"--vscode-editor-linkedEditingBackground",
"--vscode-editor-foldBackground",
"--vscode-editorGutter-foldingControlForeground",
"--vscode-editor-wordHighlightBackground",
"--vscode-editor-wordHighlightStrongBackground",
"--vscode-editor-wordHighlightTextBackground",
"--vscode-editor-wordHighlightBorder",
"--vscode-editor-wordHighlightStrongBorder",
"--vscode-editor-wordHighlightTextBorder",
"--vscode-editorOverviewRuler-wordHighlightForeground",
"--vscode-editorOverviewRuler-wordHighlightStrongForeground",
"--vscode-editorOverviewRuler-wordHighlightTextForeground",
"--vscode-debugExceptionWidget-border",
"--vscode-debugExceptionWidget-background",
"--vscode-peekViewTitle-background",
"--vscode-peekViewTitleLabel-foreground",
"--vscode-peekViewTitleDescription-foreground",
"--vscode-peekView-border",
"--vscode-peekViewResult-background",
"--vscode-peekViewResult-lineForeground",
"--vscode-peekViewResult-fileForeground",
"--vscode-peekViewResult-selectionBackground",
"--vscode-peekViewResult-selectionForeground",
"--vscode-peekViewEditor-background",
"--vscode-peekViewEditorGutter-background",
"--vscode-peekViewEditorStickyScroll-background",
"--vscode-peekViewResult-matchHighlightBackground",
"--vscode-peekViewEditor-matchHighlightBackground",
"--vscode-peekViewEditor-matchHighlightBorder",
"--vscode-editorMarkerNavigationError-background",
"--vscode-editorMarkerNavigationError-headerBackground",
"--vscode-editorMarkerNavigationWarning-background",
"--vscode-editorMarkerNavigationWarning-headerBackground",
"--vscode-editorMarkerNavigationInfo-background",
"--vscode-editorMarkerNavigationInfo-headerBackground",
"--vscode-editorMarkerNavigation-background",
"--vscode-editorCommentsWidget-resolvedBorder",
"--vscode-editorCommentsWidget-unresolvedBorder",
"--vscode-editorCommentsWidget-rangeBackground",
"--vscode-editorCommentsWidget-rangeBorder",
"--vscode-editorCommentsWidget-rangeActiveBackground",
"--vscode-editorCommentsWidget-rangeActiveBorder",
"--vscode-editorGutter-modifiedBackground",
"--vscode-editorGutter-addedBackground",
"--vscode-editorGutter-deletedBackground",
"--vscode-minimapGutter-modifiedBackground",
"--vscode-minimapGutter-addedBackground",
"--vscode-minimapGutter-deletedBackground",
"--vscode-editorOverviewRuler-modifiedForeground",
"--vscode-editorOverviewRuler-addedForeground",
"--vscode-editorOverviewRuler-deletedForeground",
"--vscode-editorSuggestWidget-background",
"--vscode-editorSuggestWidget-border",
"--vscode-editorSuggestWidget-foreground",
"--vscode-editorSuggestWidget-selectedForeground",
"--vscode-editorSuggestWidget-selectedIconForeground",
"--vscode-editorSuggestWidget-selectedBackground",
"--vscode-editorSuggestWidget-highlightForeground",
"--vscode-editorSuggestWidget-focusHighlightForeground",
"--vscode-editorSuggestWidgetStatus-foreground",
"--vscode-editor-inlineValuesForeground",
"--vscode-editor-inlineValuesBackground",
"--vscode-scm-providerBorder",
"--vscode-debugIcon-breakpointForeground",
"--vscode-debugIcon-breakpointDisabledForeground",
"--vscode-debugIcon-breakpointUnverifiedForeground",
"--vscode-debugIcon-breakpointCurrentStackframeForeground",
"--vscode-debugIcon-breakpointStackframeForeground",
"--vscode-debugTokenExpression-name",
"--vscode-debugTokenExpression-value",
"--vscode-debugTokenExpression-string",
"--vscode-debugTokenExpression-boolean",
"--vscode-debugTokenExpression-number",
"--vscode-debugTokenExpression-error",
"--vscode-debugView-exceptionLabelForeground",
"--vscode-debugView-exceptionLabelBackground",
"--vscode-debugView-stateLabelForeground",
"--vscode-debugView-stateLabelBackground",
"--vscode-debugView-valueChangedHighlight",
"--vscode-debugConsole-infoForeground",
"--vscode-debugConsole-warningForeground",
"--vscode-debugConsole-errorForeground",
"--vscode-debugConsole-sourceForeground",
"--vscode-debugConsoleInputIcon-foreground",
"--vscode-debugIcon-pauseForeground",
"--vscode-debugIcon-stopForeground",
"--vscode-debugIcon-disconnectForeground",
"--vscode-debugIcon-restartForeground",
"--vscode-debugIcon-stepOverForeground",
"--vscode-debugIcon-stepIntoForeground",
"--vscode-debugIcon-stepOutForeground",
"--vscode-debugIcon-continueForeground",
"--vscode-debugIcon-stepBackForeground",
"--vscode-keybindingTable-headerBackground",
"--vscode-keybindingTable-rowsBackground",
"--vscode-editorGutter-commentRangeForeground",
"--vscode-editorGutter-commentGlyphForground",
"--vscode-notebook-cellBorderColor",
"--vscode-notebook-focusedEditorBorder",
"--vscode-notebookStatusSuccessIcon-foreground",
"--vscode-notebookEditorOverviewRuler-runningCellForeground",
"--vscode-notebookStatusErrorIcon-foreground",
"--vscode-notebookStatusRunningIcon-foreground",
"--vscode-notebook-outputContainerBorderColor",
"--vscode-notebook-outputContainerBackgroundColor",
"--vscode-notebook-cellToolbarSeparator",
"--vscode-notebook-focusedCellBackground",
"--vscode-notebook-selectedCellBackground",
"--vscode-notebook-cellHoverBackground",
"--vscode-notebook-selectedCellBorder",
"--vscode-notebook-inactiveSelectedCellBorder",
"--vscode-notebook-focusedCellBorder",
"--vscode-notebook-inactiveFocusedCellBorder",
"--vscode-notebook-cellStatusBarItemHoverBackground",
"--vscode-notebook-cellInsertionIndicator",
"--vscode-notebookScrollbarSlider-background",
"--vscode-notebookScrollbarSlider-hoverBackground",
"--vscode-notebookScrollbarSlider-activeBackground",
"--vscode-notebook-symbolHighlightBackground",
"--vscode-notebook-cellEditorBackground",
"--vscode-notebook-editorBackground",
"--vscode-searchEditor-textInputBorder",
"--vscode-terminal-ansiBlack",
"--vscode-terminal-ansiRed",
"--vscode-terminal-ansiGreen",
"--vscode-terminal-ansiYellow",
"--vscode-terminal-ansiBlue",
"--vscode-terminal-ansiMagenta",
"--vscode-terminal-ansiCyan",
"--vscode-terminal-ansiWhite",
"--vscode-terminal-ansiBrightBlack",
"--vscode-terminal-ansiBrightRed",
"--vscode-terminal-ansiBrightGreen",
"--vscode-terminal-ansiBrightYellow",
"--vscode-terminal-ansiBrightBlue",
"--vscode-terminal-ansiBrightMagenta",
"--vscode-terminal-ansiBrightCyan",
"--vscode-terminal-ansiBrightWhite"
],
"others": [
"--background-dark",
"--background-light",
"--dropdown-padding-bottom",
"--dropdown-padding-top",
"--insert-border-color",
"--last-tab-margin-right",
"--monaco-monospace-font",
"--monaco-monospace-font",
"--notebook-cell-input-preview-font-family",
"--notebook-cell-input-preview-font-size",
"--notebook-cell-output-font-size",
"--notebook-diff-view-viewport-slider",
"--notebook-find-horizontal-padding",
"--notebook-find-width",
"--outline-element-color",
"--separator-border",
"--status-border-top-color",
"--tab-border-bottom-color",
"--tab-border-top-color",
"--tab-dirty-border-top-color",
"--tabs-border-bottom-color",
"--testMessageDecorationFontFamily",
"--testMessageDecorationFontSize",
"--title-border-bottom-color",
"--vscode-editorCodeLens-fontFamily",
"--vscode-editorCodeLens-fontFamilyDefault",
"--vscode-editorCodeLens-fontFeatureSettings",
"--vscode-editorCodeLens-fontSize",
"--vscode-editorCodeLens-lineHeight",
"--vscode-explorer-align-offset-margin-left",
"--vscode-interactive-result-editor-background-color",
"--vscode-repl-font-family",
"--vscode-repl-font-size-for-twistie",
"--vscode-repl-font-size",
"--vscode-repl-line-height",
"--vscode-sash-hover-size",
"--vscode-sash-size",
"--window-border-color",
"--workspace-trust-check-color",
"--workspace-trust-selected-color",
"--workspace-trust-unselected-color",
"--workspace-trust-x-color",
"--z-index-notebook-cell-bottom-toolbar-container",
"--z-index-notebook-cell-editor-outline",
"--z-index-notebook-cell-expand-part-button",
"--z-index-notebook-cell-output-toolbar",
"--z-index-notebook-cell-status",
"--z-index-notebook-cell-toolbar-dropdown-active",
"--z-index-notebook-cell-toolbar",
"--z-index-notebook-folding-indicator",
"--z-index-notebook-input-collapse-condicon",
"--z-index-notebook-list-insertion-indicator",
"--z-index-notebook-output",
"--z-index-notebook-progress-bar",
"--z-index-notebook-scrollbar",
"--z-index-run-button-container",
"--zoom-factor"
]
}

45
build/stylelint.js Normal file
View file

@ -0,0 +1,45 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
const es = require('event-stream');
const vfs = require('vinyl-fs');
const { stylelintFilter } = require('./filters');
const { getVariableNameValidator } = require('./lib/stylelint/validateVariableNames');
module.exports = gulpstylelint;
/** use regex on lines */
function gulpstylelint(reporter) {
const variableValidator = getVariableNameValidator();
return es.through(function (file) {
const lines = file.__lines || file.contents.toString('utf8').split(/\r\n|\r|\n/);
file.__lines = lines;
lines.forEach((line, i) => {
variableValidator(line, unknownVariable => {
reporter(file.relative + '(' + (i + 1) + ',1): Unknown variable: ' + unknownVariable);
});
});
this.emit('data', file);
});
}
function stylelint() {
return vfs
.src(stylelintFilter, { base: '.', follow: true, allowEmpty: true })
.pipe(gulpstylelint(error => {
console.error(error);
}))
.pipe(es.through(function () { /* noop, important for the stream to end */ }));
}
if (require.main === module) {
stylelint().on('error', (err) => {
console.error();
console.error(err);
process.exit(1);
});
}

View file

@ -48,6 +48,7 @@
"compile-web": "node --max_old_space_size=4095 ./node_modules/gulp/bin/gulp.js compile-web",
"watch-web": "node --max_old_space_size=4095 ./node_modules/gulp/bin/gulp.js watch-web",
"eslint": "node build/eslint",
"stylelint": "node build/stylelint",
"playwright-install": "node build/azure-pipelines/common/installPlaywright.js",
"compile-build": "node --max_old_space_size=4095 ./node_modules/gulp/bin/gulp.js compile-build",
"compile-extensions-build": "node --max_old_space_size=4095 ./node_modules/gulp/bin/gulp.js compile-extensions-build",

View file

@ -5,7 +5,7 @@
.monaco-editor .inlineSuggestionsHints.withBorder {
z-index: 39;
color: var(--vscode-editor-hoverForeground);
color: var(--vscode-editorHoverWidget-foreground);
background-color: var(--vscode-editorHoverWidget-background);
border: 1px solid var(--vscode-editorHoverWidget-border);
}

View file

@ -10,7 +10,7 @@
flex-direction: column;
line-height: 1.5em;
cursor: default;
color: var(--vscode-editor-hoverForeground);
color: var(--vscode-editorHoverWidget-foreground);
background-color: var(--vscode-editorHoverWidget-background);
border: 1px solid var(--vscode-editorHoverWidget-border);
}

View file

@ -66,7 +66,7 @@
.monaco-editor .codicon.codicon-symbol-text,
.monaco-workbench .codicon.codicon-symbol-text { color: var(--vscode-symbolIcon-textForeground); }
.monaco-editor .codicon.codicon-symbol-type-parameter,
.monaco-workbench .codicon.codicon-symbol-type-parameter { color: var(--vscode-typeParameterForeground); }
.monaco-workbench .codicon.codicon-symbol-type-parameter { color: var(--vscode-symbolIcon-typeParameterForeground); }
.monaco-editor .codicon.codicon-symbol-unit,
.monaco-workbench .codicon.codicon-symbol-unit { color: var(--vscode-symbolIcon-unitForeground); }
.monaco-editor .codicon.codicon-symbol-variable,

View file

@ -140,7 +140,7 @@
}
.monaco-workbench .part.titlebar > .titlebar-container > .titlebar-center > .window-title > .command-center .action-item > .action-label {
color: var(--vscode-titleBar-foreground);
color: var(--vscode-titleBar-activeForeground);
}
.monaco-workbench .part.titlebar.inactive > .titlebar-container > .titlebar-center > .window-title > .command-center .action-item > .action-label {
@ -382,7 +382,7 @@
}
.monaco-workbench .part.titlebar .window-controls-container .window-icon {
color: var(--vscode-titleBarActiveForeground);
color: var(--vscode-titleBar-activeForeground);
}
.monaco-workbench .part.titlebar.inactive .window-controls-container .window-icon {

View file

@ -335,7 +335,7 @@
border: 0px;
outline: 1px solid transparent;
background-color: var(--vscode-peekViewTitle-background);
color: var(--vscode--editor-foreground);
color: var(--vscode-editor-foreground);
font-size: inherit;
font-family: var(--monaco-monospace-font);
}

View file

@ -95,10 +95,6 @@
/* BEGIN: .merge-editor-block */
.monaco-workbench .merge-editor .merge-editor-block:not(.handled) {
background-color: var(--vscode-mergeEditor-conflict-unhandledUnfocused-background);
}
.monaco-workbench .merge-editor .merge-editor-block:not(.handled):not(.focused) {
border: 1px solid var(--vscode-mergeEditor-conflict-unhandledUnfocused-border);
}
@ -111,18 +107,10 @@
border: 1px solid var(--vscode-mergeEditor-conflict-handledUnfocused-border);
}
.monaco-workbench .merge-editor .merge-editor-block.handled:not(.focused).conflicting {
background-color: var(--vscode-mergeEditor-conflict-handledUnfocused-background);
}
.monaco-workbench .merge-editor .merge-editor-block.handled.focused {
border: 1px solid var(--vscode-mergeEditor-conflict-handledFocused-border);
}
.monaco-workbench .merge-editor .merge-editor-block.handled.focused.conflicting {
background-color: var(--vscode-mergeEditor-conflict-handledFocused-background);
}
.monaco-workbench .merge-editor .merge-editor-simplified.input.i1, .merge-editor-block.use-simplified-decorations.input.i1 {
background-color: var(--vscode-mergeEditor-conflict-input1-background);
}

View file

@ -240,7 +240,6 @@
.monaco-editor .testing-run-glyph {
cursor: pointer;
color: var(--vscode-testingColorRunAction);
}
.testing-diff-title-widget {

View file

@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import { Registry } from 'vs/platform/registry/common/platform';
import { IColorRegistry, Extensions, ColorContribution } from 'vs/platform/theme/common/colorRegistry';
import { IColorRegistry, Extensions, ColorContribution, asCssVariableName } from 'vs/platform/theme/common/colorRegistry';
import { asTextOrError } from 'vs/platform/request/common/request';
import * as pfs from 'vs/base/node/pfs';
import * as path from 'vs/base/common/path';
@ -33,9 +33,53 @@ interface DescriptionDiff {
export const experimental: string[] = []; // 'settings.modifiedItemForeground', 'editorUnnecessary.foreground' ];
const knwonVariablesFileName = 'vscode-known-variables.json';
suite('Color Registry', function () {
test('all colors documented in theme-color.md', async function () {
test('all colors listed in ./lib/stylelint/vscode-variables.json', async function () {
const varFilePath = FileAccess.asFileUri(`vs/../../build/lib/stylelint/${knwonVariablesFileName}`).fsPath;
const content = (await pfs.Promises.readFile(varFilePath)).toString();
const variablesInfo = JSON.parse(content);
const colorsArray = variablesInfo.colors as string[];
assert.ok(colorsArray && colorsArray.length > 0, '${knwonVariablesFileName} contains no color descriptions');
const colors = new Set(colorsArray);
const missing = [];
const themingRegistry = Registry.as<IColorRegistry>(Extensions.ColorContribution);
for (const color of themingRegistry.getColors()) {
const id = asCssVariableName(color.id);
if (!colors.has(id)) {
if (!color.deprecationMessage) {
missing.push(id);
}
} else {
colors.delete(id);
}
}
const superfluousKeys = [...colors.keys()];
let errorText = '';
if (missing.length > 0) {
errorText += `\n\Add the following colors:\n\n${JSON.stringify(missing, undefined, '\t')}\n`;
}
if (superfluousKeys.length > 0) {
errorText += `\n\Remove the following colors:\n\n${superfluousKeys.join('\n')}\n`;
}
if (errorText.length > 0) {
assert.fail(`\n\nOpen ${path.normalize(varFilePath)}\n\n${errorText}\n`);
}
});
test('all colors listed in theme-color.md', async function () {
// avoid importing the TestEnvironmentService as it brings in a duplicate registration of the file editor input factory.
const environmentService = new class extends mock<INativeEnvironmentService>() { override args = { _: [] }; };