hunk
dict
file
stringlengths
0
11.8M
file_path
stringlengths
2
234
label
int64
0
1
commit_url
stringlengths
74
103
dependency_score
sequencelengths
5
5
{ "id": 7, "code_window": [ " /**\n", " * Mimics performance.now().\n", " */\n", " performance: {\n", " now: () => number;\n", " }\n", "};\n", "\n", "/**\n", " * Lolex clock for a Node environment.\n", " */\n" ], "labels": [ "keep", "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ], "after_edit": [ " };\n" ], "file_path": "types/lolex/index.d.ts", "type": "replace", "edit_start_line_idx": 205 }
/*************************************************************************** * * * This file was automatically generated with idlc.js * * build info: * * - fibjs : 0.25.0 * * - date : Jun 12 2018 07:22:40 * * * ***************************************************************************/ /** * @author Richard <[email protected]> * */ /// <reference path="Buffer.d.ts" /> /// <reference path="BufferedStream.d.ts" /> /// <reference path="Chain.d.ts" /> /// <reference path="Cipher.d.ts" /> /// <reference path="Condition.d.ts" /> /// <reference path="DbConnection.d.ts" /> /// <reference path="DgramSocket.d.ts" /> /// <reference path="Digest.d.ts" /> /// <reference path="Event.d.ts" /> /// <reference path="EventEmitter.d.ts" /> /// <reference path="EventInfo.d.ts" /> /// <reference path="Fiber.d.ts" /> /// <reference path="File.d.ts" /> /// <reference path="Handler.d.ts" /> /// <reference path="HandlerEx.d.ts" /> /// <reference path="HeapGraphEdge.d.ts" /> /// <reference path="HeapGraphNode.d.ts" /> /// <reference path="HeapSnapshot.d.ts" /> /// <reference path="HttpClient.d.ts" /> /// <reference path="HttpCollection.d.ts" /> /// <reference path="HttpCookie.d.ts" /> /// <reference path="HttpHandler.d.ts" /> /// <reference path="HttpMessage.d.ts" /> /// <reference path="HttpRequest.d.ts" /> /// <reference path="HttpResponse.d.ts" /> /// <reference path="HttpServer.d.ts" /> /// <reference path="HttpUploadData.d.ts" /> /// <reference path="HttpsServer.d.ts" /> /// <reference path="Image.d.ts" /> /// <reference path="Int64.d.ts" /> /// <reference path="LevelDB.d.ts" /> /// <reference path="Lock.d.ts" /> /// <reference path="LruCache.d.ts" /> /// <reference path="MSSQL.d.ts" /> /// <reference path="MemoryStream.d.ts" /> /// <reference path="Message.d.ts" /> /// <reference path="MongoCollection.d.ts" /> /// <reference path="MongoCursor.d.ts" /> /// <reference path="MongoDB.d.ts" /> /// <reference path="MongoID.d.ts" /> /// <reference path="MySQL.d.ts" /> /// <reference path="PKey.d.ts" /> /// <reference path="Redis.d.ts" /> /// <reference path="RedisHash.d.ts" /> /// <reference path="RedisList.d.ts" /> /// <reference path="RedisSet.d.ts" /> /// <reference path="RedisSortedSet.d.ts" /> /// <reference path="Routing.d.ts" /> /// <reference path="SQLite.d.ts" /> /// <reference path="SandBox.d.ts" /> /// <reference path="SeekableStream.d.ts" /> /// <reference path="Semaphore.d.ts" /> /// <reference path="Service.d.ts" /> /// <reference path="Smtp.d.ts" /> /// <reference path="Socket.d.ts" /> /// <reference path="SslHandler.d.ts" /> /// <reference path="SslServer.d.ts" /> /// <reference path="SslSocket.d.ts" /> /// <reference path="Stat.d.ts" /> /// <reference path="Stats.d.ts" /> /// <reference path="Stream.d.ts" /> /// <reference path="StringDecoder.d.ts" /> /// <reference path="SubProcess.d.ts" /> /// <reference path="TcpServer.d.ts" /> /// <reference path="Timer.d.ts" /> /// <reference path="UrlObject.d.ts" /> /// <reference path="WebSocket.d.ts" /> /// <reference path="WebSocketMessage.d.ts" /> /// <reference path="WebView.d.ts" /> /// <reference path="Worker.d.ts" /> /// <reference path="X509Cert.d.ts" /> /// <reference path="X509Crl.d.ts" /> /// <reference path="X509Req.d.ts" /> /// <reference path="XmlAttr.d.ts" /> /// <reference path="XmlCDATASection.d.ts" /> /// <reference path="XmlCharacterData.d.ts" /> /// <reference path="XmlComment.d.ts" /> /// <reference path="XmlDocument.d.ts" /> /// <reference path="XmlDocumentType.d.ts" /> /// <reference path="XmlElement.d.ts" /> /// <reference path="XmlNamedNodeMap.d.ts" /> /// <reference path="XmlNode.d.ts" /> /// <reference path="XmlNodeList.d.ts" /> /// <reference path="XmlProcessingInstruction.d.ts" /> /// <reference path="XmlText.d.ts" /> /// <reference path="ZipFile.d.ts" /> /// <reference path="ZmqSocket.d.ts" /> /// <reference path="object.d.ts" /> declare module __iconv { /** * * @brief 用 iconv 将文本转换为二进制数据 * @param charset 指定字符集 * @param data 要转换的文本 * @return 返回解码的二进制数据 * * * */ export function encode(charset: string, data: string): Class_Buffer; /** * * @brief 用 iconv 将 Buffer 内容转换为文本 * @param charset 指定字符集 * @param data 要转换的二进制数据 * @return 返回编码的字符串 * * * */ export function decode(charset: string, data: Class_Buffer): string; /** * * @brief 检测字符集是否被支持 * @param charset 指定字符集 * @return 返回是否支持该字符集 * * * */ export function isEncoding(charset: string): boolean; } /** end of `module iconv` */ /** module Or Internal Object */ /** * @brief iconv 编码与解码模块 * @detail 引用方式:,```JavaScript,var encoding = require('encoding');,var iconv = encoding.iconv;,```,或者,```JavaScript,var iconv = require('iconv');,``` */ declare module "iconv" { export = __iconv } /** endof `module Or Internal Object` */
types/fibjs/declare/iconv.d.ts
0
https://github.com/DefinitelyTyped/DefinitelyTyped/commit/61ee030edd12a3a30459d0cdc1d9128fdf714c5c
[ 0.00020329823018983006, 0.00017532659694552422, 0.00016645077266730368, 0.00017540254339110106, 0.000006370410119416192 ]
{ "id": 7, "code_window": [ " /**\n", " * Mimics performance.now().\n", " */\n", " performance: {\n", " now: () => number;\n", " }\n", "};\n", "\n", "/**\n", " * Lolex clock for a Node environment.\n", " */\n" ], "labels": [ "keep", "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ], "after_edit": [ " };\n" ], "file_path": "types/lolex/index.d.ts", "type": "replace", "edit_start_line_idx": 205 }
// Type definitions for @keyv/mysql 1.1 // Project: https://github.com/lukechilds/keyv-mysql // Definitions by: BendingBender <https://github.com/BendingBender> // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 /// <reference types="node" /> import { Store } from 'keyv'; import { EventEmitter } from 'events'; export = KeyvMysql; declare class KeyvMysql extends EventEmitter implements Store<string | undefined> { readonly ttlSupport: false; namespace?: string; constructor(uri?: string); constructor(options?: KeyvMysql.Options); // tslint:disable-line:unified-signatures get(key: string): Promise<string | undefined>; set(key: string, value: string | undefined): Promise<any>; delete(key: string): Promise<boolean>; clear(): Promise<void>; } declare namespace KeyvMysql { interface Options { uri?: string; table?: string; keySize?: number; } }
types/keyv__mysql/index.d.ts
0
https://github.com/DefinitelyTyped/DefinitelyTyped/commit/61ee030edd12a3a30459d0cdc1d9128fdf714c5c
[ 0.0001715715479804203, 0.00017030086019076407, 0.00016895117005333304, 0.00017034035408869386, 0.00000125806468531664 ]
{ "id": 8, "code_window": [ " */\n", " nextTick: (callback: () => void) => void;\n", "\n", " /**\n", "\t * Run all pending microtasks scheduled with nextTick.\n", "\t */\n", " runMicrotasks: () => void;\n", "};\n", "\n", "/**\n" ], "labels": [ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep" ], "after_edit": [ " * Run all pending microtasks scheduled with nextTick.\n", " */\n" ], "file_path": "types/lolex/index.d.ts", "type": "replace", "edit_start_line_idx": 231 }
// Type definitions for lolex 3.1 // Project: https://github.com/sinonjs/lolex // Definitions by: Wim Looman <https://github.com/Nemo157> // Josh Goldberg <https://github.com/joshuakgoldberg> // Rogier Schouten <https://github.com/rogierschouten> // Yishai Zehavi <https://github.com/zyishai> // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 /** * Names of clock methods that may be faked by install. */ type FakeMethod = "setTimeout" | "clearTimeout" | "setImmediate" | "clearImmediate" | "setInterval" | "clearInterval" | "Date" | "nextTick" | "hrtime" | "requestAnimationFrame" | "cancelAnimationFrame" | "requestIdleCallback" | "cancelIdleCallback"; /** * Global methods avaliable to every clock and also as standalone methods (inside `timers` global object). */ export interface GlobalTimers<TTimerId extends TimerId> { /** * Schedules a callback to be fired once timeout milliseconds have ticked by. * * @param callback Callback to be fired. * @param timeout How many ticks to wait to run the callback. * @param args Any extra arguments to pass to the callback. * @returns Time identifier for cancellation. */ setTimeout: (callback: () => void, timeout: number, ...args: any[]) => TTimerId; /** * Clears a timer, as long as it was created using setTimeout. * * @param id Timer ID or object. */ clearTimeout: (id: TimerId) => void; /** * Schedules a callback to be fired every time timeout milliseconds have ticked by. * * @param callback Callback to be fired. * @param timeout How many ticks to wait between callbacks. * @param args Any extra arguments to pass to the callback. * @returns Time identifier for cancellation. */ setInterval: (callback: () => void, timeout: number, ...args: any[]) => TTimerId; /** * Clears a timer, as long as it was created using setInterval. * * @param id Timer ID or object. */ clearInterval: (id: TTimerId) => void; /** * Schedules the callback to be fired once 0 milliseconds have ticked by. * * @param callback Callback to be fired. * @remarks You'll still have to call clock.tick() for the callback to fire. * @remarks If called during a tick the callback won't fire until 1 millisecond has ticked by. */ setImmediate: (callback: () => void) => TTimerId; /** * Clears a timer, as long as it was created using setImmediate. * * @param id Timer ID or object. */ clearImmediate: (id: TTimerId) => void; /** * Implements the Date object but using this clock to provide the correct time. */ Date: typeof Date; } /** * Timer object used in node. */ export interface NodeTimer { /** * Stub method call. Does nothing. */ ref(): void; /** * Stub method call. Does nothing. */ unref(): void; } /** * Timer identifier for clock scheduling. */ export type TimerId = number | NodeTimer; /** * Controls the flow of time. */ export interface LolexClock<TTimerId extends TimerId> extends GlobalTimers<TTimerId> { /** * Current clock time. */ now: number; /** * Don't know what this prop is for, but it was included in the clocks that `createClock` or * `install` return (it is never used in the code, for now). */ timeouts: {}; /** * Maximum number of timers that will be run when calling runAll(). */ loopLimit: number; /** * Schedule callback to run in the next animation frame. * * @param callback Callback to be fired. * @returns Request id. */ requestAnimationFrame: (callback: (time: number) => void) => TTimerId; /** * Cancel animation frame request. * * @param id The id returned from requestAnimationFrame method. */ cancelAnimationFrame: (id: TTimerId) => void; /** * Queues the callback to be fired during idle periods to perform background and low priority work on the main event loop. * * @param callback Callback to be fired. * @param timeout The maximum number of ticks before the callback must be fired. * @remarks Callbacks which have a timeout option will be fired no later than time in milliseconds. */ requestIdleCallback: (callback: () => void, timeout?: number) => TTimerId; /** * Clears a timer, as long as it was created using requestIdleCallback. * * @param id Timer ID or object. */ cancelIdleCallback: (id: TTimerId) => void; /** * Get the number of waiting timers. * * @returns number of waiting timers. */ countTimers: () => number; /** * Advances the clock to the the moment of the first scheduled timer, firing it. */ next: () => void; /** * Advance the clock, firing callbacks if necessary. * * @param time How many ticks to advance by. */ tick: (time: number | string) => void; /** * Removes all timers and tick without firing them and restore now to its original value. */ reset: () => void; /** * Runs all pending timers until there are none remaining. * * @remarks If new timers are added while it is executing they will be run as well. */ runAll: () => void; /** * Advanced the clock to the next animation frame while firing all scheduled callbacks. */ runToFrame: () => void; /** * Takes note of the last scheduled timer when it is run, and advances the clock to * that time firing callbacks as necessary. */ runToLast: () => void; /** * Simulates a user changing the system clock. * * @param now New system time. * @remarks This affects the current time but it does not in itself cause timers to fire. */ setSystemTime: (now?: number | Date) => void; } /** * Lolex clock for a browser environment. */ type BrowserClock = LolexClock<number> & { /** * Mimics performance.now(). */ performance: { now: () => number; } }; /** * Lolex clock for a Node environment. */ type NodeClock = LolexClock<NodeTimer> & { /** * Mimicks process.hrtime(). * * @param prevTime Previous system time to calculate time elapsed. * @returns High resolution real time as [seconds, nanoseconds]. */ hrtime(prevTime?: [number, number]): [number, number]; /** * Mimics process.nextTick() explicitly dropping additional arguments. */ queueMicrotask: (callback: () => void) => void; /** * Simulates process.nextTick(). */ nextTick: (callback: () => void) => void; /** * Run all pending microtasks scheduled with nextTick. */ runMicrotasks: () => void; }; /** * Clock object created by lolex. */ type Clock = BrowserClock | NodeClock; /** * Additional methods that installed clock have. */ type InstalledMethods = { /** * Restores the original methods on the context that was passed to lolex.install, * or the native timers if no context was given. */ uninstall: () => void; methods: FakeMethod[]; }; /** * Clock object created by calling `install();`. * * @type TClock type of base clock (e.g BrowserClock). */ type InstalledClock<TClock extends Clock = Clock> = TClock & InstalledMethods; /** * Creates a clock. * * @param now Current time for the clock. * @param loopLimit Maximum number of timers that will be run when calling runAll() * before assuming that we have an infinite loop and throwing an error * (by default, 1000). * @type TClock Type of clock to create. * @remarks The default epoch is 0. */ export declare function createClock<TClock extends Clock = Clock>(now?: number | Date, loopLimit?: number): TClock; export interface LolexInstallOpts { /** * Installs lolex onto the specified target context (default: global) */ target?: any; /** * Installs lolex with the specified unix epoch (default: 0) */ now?: number | Date; /** * An array with explicit function names to hijack. When not set, lolex will automatically fake all methods except nextTick * e.g., lolex.install({ toFake: ["setTimeout", "nextTick"]}) will fake only setTimeout and nextTick */ toFake?: FakeMethod[]; /** * The maximum number of timers that will be run when calling runAll() (default: 1000) */ loopLimit?: number; /** * Tells lolex to increment mocked time automatically based on the real system time shift (e.g. the mocked time will be incremented by * 20ms for every 20ms change in the real system time) (default: false) */ shouldAdvanceTime?: boolean; /** * Relevant only when using with shouldAdvanceTime: true. increment mocked time by advanceTimeDelta ms every advanceTimeDelta ms change * in the real system time (default: 20) */ advanceTimeDelta?: number; } /** * Creates a clock and installs it globally. * * @param now Current time for the clock, as with lolex.createClock(). * @param toFake Names of methods that should be faked. * @type TClock Type of clock to create. */ export declare function install<TClock extends Clock = Clock>(opts?: LolexInstallOpts): InstalledClock<TClock>; export interface LolexWithContext { timers: GlobalTimers<TimerId>; createClock: <TClock extends Clock = Clock>(now?: number | Date, loopLimit?: number) => TClock; install: <TClock extends Clock = Clock>(opts?: LolexInstallOpts) => InstalledClock<TClock>; withGlobal: (global: Object) => LolexWithContext; } /** * Apply new context to lolex. * * @param global New context to apply like `window` (in browsers) or `global` (in node). */ export declare function withGlobal(global: Object): LolexWithContext; export declare const timers: GlobalTimers<TimerId>;
types/lolex/index.d.ts
1
https://github.com/DefinitelyTyped/DefinitelyTyped/commit/61ee030edd12a3a30459d0cdc1d9128fdf714c5c
[ 0.8834143877029419, 0.02941466122865677, 0.00016576543566770852, 0.00019266840536147356, 0.14970029890537262 ]
{ "id": 8, "code_window": [ " */\n", " nextTick: (callback: () => void) => void;\n", "\n", " /**\n", "\t * Run all pending microtasks scheduled with nextTick.\n", "\t */\n", " runMicrotasks: () => void;\n", "};\n", "\n", "/**\n" ], "labels": [ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep" ], "after_edit": [ " * Run all pending microtasks scheduled with nextTick.\n", " */\n" ], "file_path": "types/lolex/index.d.ts", "type": "replace", "edit_start_line_idx": 231 }
import { concat } from '../index'; export default concat;
types/ramda/src/concat.d.ts
0
https://github.com/DefinitelyTyped/DefinitelyTyped/commit/61ee030edd12a3a30459d0cdc1d9128fdf714c5c
[ 0.000176388886757195, 0.000176388886757195, 0.000176388886757195, 0.000176388886757195, 0 ]
{ "id": 8, "code_window": [ " */\n", " nextTick: (callback: () => void) => void;\n", "\n", " /**\n", "\t * Run all pending microtasks scheduled with nextTick.\n", "\t */\n", " runMicrotasks: () => void;\n", "};\n", "\n", "/**\n" ], "labels": [ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep" ], "after_edit": [ " * Run all pending microtasks scheduled with nextTick.\n", " */\n" ], "file_path": "types/lolex/index.d.ts", "type": "replace", "edit_start_line_idx": 231 }
import { negate } from '../index'; export default negate;
types/ramda/src/negate.d.ts
0
https://github.com/DefinitelyTyped/DefinitelyTyped/commit/61ee030edd12a3a30459d0cdc1d9128fdf714c5c
[ 0.00017769735131878406, 0.00017769735131878406, 0.00017769735131878406, 0.00017769735131878406, 0 ]
{ "id": 8, "code_window": [ " */\n", " nextTick: (callback: () => void) => void;\n", "\n", " /**\n", "\t * Run all pending microtasks scheduled with nextTick.\n", "\t */\n", " runMicrotasks: () => void;\n", "};\n", "\n", "/**\n" ], "labels": [ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep" ], "after_edit": [ " * Run all pending microtasks scheduled with nextTick.\n", " */\n" ], "file_path": "types/lolex/index.d.ts", "type": "replace", "edit_start_line_idx": 231 }
import { mergeAll } from '../index'; export default mergeAll;
types/ramda/src/mergeAll.d.ts
0
https://github.com/DefinitelyTyped/DefinitelyTyped/commit/61ee030edd12a3a30459d0cdc1d9128fdf714c5c
[ 0.00017562814173288643, 0.00017562814173288643, 0.00017562814173288643, 0.00017562814173288643, 0 ]
{ "id": 9, "code_window": [ "browserClock.tick(\"08\");\n", "\n", "nodeClock.tick(7);\n", "nodeClock.tick(\"08:03\");\n", "\n", "browserClock.next();\n", "nodeClock.next();\n", "\n" ], "labels": [ "keep", "keep", "keep", "keep", "add", "keep", "keep", "keep" ], "after_edit": [ "browserClock.tickAsync(7).then(() => {});\n", "browserClock.tickAsync(\"08\").then(() => {});\n", "\n", "nodeClock.tickAsync(7).then(() => {});\n", "nodeClock.tickAsync(\"08:03\").then(() => {});\n", "\n" ], "file_path": "types/lolex/lolex-tests.ts", "type": "add", "edit_start_line_idx": 93 }
// Type definitions for lolex 3.1 // Project: https://github.com/sinonjs/lolex // Definitions by: Wim Looman <https://github.com/Nemo157> // Josh Goldberg <https://github.com/joshuakgoldberg> // Rogier Schouten <https://github.com/rogierschouten> // Yishai Zehavi <https://github.com/zyishai> // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 /** * Names of clock methods that may be faked by install. */ type FakeMethod = "setTimeout" | "clearTimeout" | "setImmediate" | "clearImmediate" | "setInterval" | "clearInterval" | "Date" | "nextTick" | "hrtime" | "requestAnimationFrame" | "cancelAnimationFrame" | "requestIdleCallback" | "cancelIdleCallback"; /** * Global methods avaliable to every clock and also as standalone methods (inside `timers` global object). */ export interface GlobalTimers<TTimerId extends TimerId> { /** * Schedules a callback to be fired once timeout milliseconds have ticked by. * * @param callback Callback to be fired. * @param timeout How many ticks to wait to run the callback. * @param args Any extra arguments to pass to the callback. * @returns Time identifier for cancellation. */ setTimeout: (callback: () => void, timeout: number, ...args: any[]) => TTimerId; /** * Clears a timer, as long as it was created using setTimeout. * * @param id Timer ID or object. */ clearTimeout: (id: TimerId) => void; /** * Schedules a callback to be fired every time timeout milliseconds have ticked by. * * @param callback Callback to be fired. * @param timeout How many ticks to wait between callbacks. * @param args Any extra arguments to pass to the callback. * @returns Time identifier for cancellation. */ setInterval: (callback: () => void, timeout: number, ...args: any[]) => TTimerId; /** * Clears a timer, as long as it was created using setInterval. * * @param id Timer ID or object. */ clearInterval: (id: TTimerId) => void; /** * Schedules the callback to be fired once 0 milliseconds have ticked by. * * @param callback Callback to be fired. * @remarks You'll still have to call clock.tick() for the callback to fire. * @remarks If called during a tick the callback won't fire until 1 millisecond has ticked by. */ setImmediate: (callback: () => void) => TTimerId; /** * Clears a timer, as long as it was created using setImmediate. * * @param id Timer ID or object. */ clearImmediate: (id: TTimerId) => void; /** * Implements the Date object but using this clock to provide the correct time. */ Date: typeof Date; } /** * Timer object used in node. */ export interface NodeTimer { /** * Stub method call. Does nothing. */ ref(): void; /** * Stub method call. Does nothing. */ unref(): void; } /** * Timer identifier for clock scheduling. */ export type TimerId = number | NodeTimer; /** * Controls the flow of time. */ export interface LolexClock<TTimerId extends TimerId> extends GlobalTimers<TTimerId> { /** * Current clock time. */ now: number; /** * Don't know what this prop is for, but it was included in the clocks that `createClock` or * `install` return (it is never used in the code, for now). */ timeouts: {}; /** * Maximum number of timers that will be run when calling runAll(). */ loopLimit: number; /** * Schedule callback to run in the next animation frame. * * @param callback Callback to be fired. * @returns Request id. */ requestAnimationFrame: (callback: (time: number) => void) => TTimerId; /** * Cancel animation frame request. * * @param id The id returned from requestAnimationFrame method. */ cancelAnimationFrame: (id: TTimerId) => void; /** * Queues the callback to be fired during idle periods to perform background and low priority work on the main event loop. * * @param callback Callback to be fired. * @param timeout The maximum number of ticks before the callback must be fired. * @remarks Callbacks which have a timeout option will be fired no later than time in milliseconds. */ requestIdleCallback: (callback: () => void, timeout?: number) => TTimerId; /** * Clears a timer, as long as it was created using requestIdleCallback. * * @param id Timer ID or object. */ cancelIdleCallback: (id: TTimerId) => void; /** * Get the number of waiting timers. * * @returns number of waiting timers. */ countTimers: () => number; /** * Advances the clock to the the moment of the first scheduled timer, firing it. */ next: () => void; /** * Advance the clock, firing callbacks if necessary. * * @param time How many ticks to advance by. */ tick: (time: number | string) => void; /** * Removes all timers and tick without firing them and restore now to its original value. */ reset: () => void; /** * Runs all pending timers until there are none remaining. * * @remarks If new timers are added while it is executing they will be run as well. */ runAll: () => void; /** * Advanced the clock to the next animation frame while firing all scheduled callbacks. */ runToFrame: () => void; /** * Takes note of the last scheduled timer when it is run, and advances the clock to * that time firing callbacks as necessary. */ runToLast: () => void; /** * Simulates a user changing the system clock. * * @param now New system time. * @remarks This affects the current time but it does not in itself cause timers to fire. */ setSystemTime: (now?: number | Date) => void; } /** * Lolex clock for a browser environment. */ type BrowserClock = LolexClock<number> & { /** * Mimics performance.now(). */ performance: { now: () => number; } }; /** * Lolex clock for a Node environment. */ type NodeClock = LolexClock<NodeTimer> & { /** * Mimicks process.hrtime(). * * @param prevTime Previous system time to calculate time elapsed. * @returns High resolution real time as [seconds, nanoseconds]. */ hrtime(prevTime?: [number, number]): [number, number]; /** * Mimics process.nextTick() explicitly dropping additional arguments. */ queueMicrotask: (callback: () => void) => void; /** * Simulates process.nextTick(). */ nextTick: (callback: () => void) => void; /** * Run all pending microtasks scheduled with nextTick. */ runMicrotasks: () => void; }; /** * Clock object created by lolex. */ type Clock = BrowserClock | NodeClock; /** * Additional methods that installed clock have. */ type InstalledMethods = { /** * Restores the original methods on the context that was passed to lolex.install, * or the native timers if no context was given. */ uninstall: () => void; methods: FakeMethod[]; }; /** * Clock object created by calling `install();`. * * @type TClock type of base clock (e.g BrowserClock). */ type InstalledClock<TClock extends Clock = Clock> = TClock & InstalledMethods; /** * Creates a clock. * * @param now Current time for the clock. * @param loopLimit Maximum number of timers that will be run when calling runAll() * before assuming that we have an infinite loop and throwing an error * (by default, 1000). * @type TClock Type of clock to create. * @remarks The default epoch is 0. */ export declare function createClock<TClock extends Clock = Clock>(now?: number | Date, loopLimit?: number): TClock; export interface LolexInstallOpts { /** * Installs lolex onto the specified target context (default: global) */ target?: any; /** * Installs lolex with the specified unix epoch (default: 0) */ now?: number | Date; /** * An array with explicit function names to hijack. When not set, lolex will automatically fake all methods except nextTick * e.g., lolex.install({ toFake: ["setTimeout", "nextTick"]}) will fake only setTimeout and nextTick */ toFake?: FakeMethod[]; /** * The maximum number of timers that will be run when calling runAll() (default: 1000) */ loopLimit?: number; /** * Tells lolex to increment mocked time automatically based on the real system time shift (e.g. the mocked time will be incremented by * 20ms for every 20ms change in the real system time) (default: false) */ shouldAdvanceTime?: boolean; /** * Relevant only when using with shouldAdvanceTime: true. increment mocked time by advanceTimeDelta ms every advanceTimeDelta ms change * in the real system time (default: 20) */ advanceTimeDelta?: number; } /** * Creates a clock and installs it globally. * * @param now Current time for the clock, as with lolex.createClock(). * @param toFake Names of methods that should be faked. * @type TClock Type of clock to create. */ export declare function install<TClock extends Clock = Clock>(opts?: LolexInstallOpts): InstalledClock<TClock>; export interface LolexWithContext { timers: GlobalTimers<TimerId>; createClock: <TClock extends Clock = Clock>(now?: number | Date, loopLimit?: number) => TClock; install: <TClock extends Clock = Clock>(opts?: LolexInstallOpts) => InstalledClock<TClock>; withGlobal: (global: Object) => LolexWithContext; } /** * Apply new context to lolex. * * @param global New context to apply like `window` (in browsers) or `global` (in node). */ export declare function withGlobal(global: Object): LolexWithContext; export declare const timers: GlobalTimers<TimerId>;
types/lolex/index.d.ts
1
https://github.com/DefinitelyTyped/DefinitelyTyped/commit/61ee030edd12a3a30459d0cdc1d9128fdf714c5c
[ 0.003363155061379075, 0.0004669042828027159, 0.00016492512077093124, 0.0001720125146675855, 0.0007322811870835721 ]
{ "id": 9, "code_window": [ "browserClock.tick(\"08\");\n", "\n", "nodeClock.tick(7);\n", "nodeClock.tick(\"08:03\");\n", "\n", "browserClock.next();\n", "nodeClock.next();\n", "\n" ], "labels": [ "keep", "keep", "keep", "keep", "add", "keep", "keep", "keep" ], "after_edit": [ "browserClock.tickAsync(7).then(() => {});\n", "browserClock.tickAsync(\"08\").then(() => {});\n", "\n", "nodeClock.tickAsync(7).then(() => {});\n", "nodeClock.tickAsync(\"08:03\").then(() => {});\n", "\n" ], "file_path": "types/lolex/lolex-tests.ts", "type": "add", "edit_start_line_idx": 93 }
{ "extends": "dtslint/dt.json", "rules": { // We have some internal types that are helpfully tagged with @private "no-redundant-jsdoc-2": false } }
types/relay-runtime/tslint.json
0
https://github.com/DefinitelyTyped/DefinitelyTyped/commit/61ee030edd12a3a30459d0cdc1d9128fdf714c5c
[ 0.00017317534366156906, 0.00017317534366156906, 0.00017317534366156906, 0.00017317534366156906, 0 ]
{ "id": 9, "code_window": [ "browserClock.tick(\"08\");\n", "\n", "nodeClock.tick(7);\n", "nodeClock.tick(\"08:03\");\n", "\n", "browserClock.next();\n", "nodeClock.next();\n", "\n" ], "labels": [ "keep", "keep", "keep", "keep", "add", "keep", "keep", "keep" ], "after_edit": [ "browserClock.tickAsync(7).then(() => {});\n", "browserClock.tickAsync(\"08\").then(() => {});\n", "\n", "nodeClock.tickAsync(7).then(() => {});\n", "nodeClock.tickAsync(\"08:03\").then(() => {});\n", "\n" ], "file_path": "types/lolex/lolex-tests.ts", "type": "add", "edit_start_line_idx": 93 }
import MarkdownIt = require(".."); import State = require("../rules_core/state_core"); import Token = require("../token"); export = StateBlock; declare class StateBlock extends State { /** Used in lists to determine if they interrupt a paragraph */ parentType: 'blockquote' | 'list' | 'root' | 'paragraph' | 'reference'; eMarks: number[]; bMarks: number[]; bsCount: number[]; sCount: number[]; tShift: number[]; blkIndent: number; ddIndent: number; line: number; lineMax: number; tight: boolean; }
types/markdown-it/lib/rules_block/state_block.d.ts
0
https://github.com/DefinitelyTyped/DefinitelyTyped/commit/61ee030edd12a3a30459d0cdc1d9128fdf714c5c
[ 0.00017940305406227708, 0.00017755066801328212, 0.0001750536757754162, 0.000178195332409814, 0.0000018332026456846506 ]
{ "id": 9, "code_window": [ "browserClock.tick(\"08\");\n", "\n", "nodeClock.tick(7);\n", "nodeClock.tick(\"08:03\");\n", "\n", "browserClock.next();\n", "nodeClock.next();\n", "\n" ], "labels": [ "keep", "keep", "keep", "keep", "add", "keep", "keep", "keep" ], "after_edit": [ "browserClock.tickAsync(7).then(() => {});\n", "browserClock.tickAsync(\"08\").then(() => {});\n", "\n", "nodeClock.tickAsync(7).then(() => {});\n", "nodeClock.tickAsync(\"08:03\").then(() => {});\n", "\n" ], "file_path": "types/lolex/lolex-tests.ts", "type": "add", "edit_start_line_idx": 93 }
import { adjust } from '../index'; export default adjust;
types/ramda/es/adjust.d.ts
0
https://github.com/DefinitelyTyped/DefinitelyTyped/commit/61ee030edd12a3a30459d0cdc1d9128fdf714c5c
[ 0.00017936046060640365, 0.00017936046060640365, 0.00017936046060640365, 0.00017936046060640365, 0 ]
{ "id": 10, "code_window": [ "browserClock.next();\n", "nodeClock.next();\n", "\n", "browserClock.reset();\n", "nodeClock.reset();\n", "\n", "browserClock.runAll();\n", "nodeClock.runAll();\n" ], "labels": [ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ], "after_edit": [ "browserClock.nextAsync().then(() => {});\n", "nodeClock.nextAsync().then(() => {});\n", "\n" ], "file_path": "types/lolex/lolex-tests.ts", "type": "add", "edit_start_line_idx": 96 }
// Type definitions for lolex 3.1 // Project: https://github.com/sinonjs/lolex // Definitions by: Wim Looman <https://github.com/Nemo157> // Josh Goldberg <https://github.com/joshuakgoldberg> // Rogier Schouten <https://github.com/rogierschouten> // Yishai Zehavi <https://github.com/zyishai> // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 /** * Names of clock methods that may be faked by install. */ type FakeMethod = "setTimeout" | "clearTimeout" | "setImmediate" | "clearImmediate" | "setInterval" | "clearInterval" | "Date" | "nextTick" | "hrtime" | "requestAnimationFrame" | "cancelAnimationFrame" | "requestIdleCallback" | "cancelIdleCallback"; /** * Global methods avaliable to every clock and also as standalone methods (inside `timers` global object). */ export interface GlobalTimers<TTimerId extends TimerId> { /** * Schedules a callback to be fired once timeout milliseconds have ticked by. * * @param callback Callback to be fired. * @param timeout How many ticks to wait to run the callback. * @param args Any extra arguments to pass to the callback. * @returns Time identifier for cancellation. */ setTimeout: (callback: () => void, timeout: number, ...args: any[]) => TTimerId; /** * Clears a timer, as long as it was created using setTimeout. * * @param id Timer ID or object. */ clearTimeout: (id: TimerId) => void; /** * Schedules a callback to be fired every time timeout milliseconds have ticked by. * * @param callback Callback to be fired. * @param timeout How many ticks to wait between callbacks. * @param args Any extra arguments to pass to the callback. * @returns Time identifier for cancellation. */ setInterval: (callback: () => void, timeout: number, ...args: any[]) => TTimerId; /** * Clears a timer, as long as it was created using setInterval. * * @param id Timer ID or object. */ clearInterval: (id: TTimerId) => void; /** * Schedules the callback to be fired once 0 milliseconds have ticked by. * * @param callback Callback to be fired. * @remarks You'll still have to call clock.tick() for the callback to fire. * @remarks If called during a tick the callback won't fire until 1 millisecond has ticked by. */ setImmediate: (callback: () => void) => TTimerId; /** * Clears a timer, as long as it was created using setImmediate. * * @param id Timer ID or object. */ clearImmediate: (id: TTimerId) => void; /** * Implements the Date object but using this clock to provide the correct time. */ Date: typeof Date; } /** * Timer object used in node. */ export interface NodeTimer { /** * Stub method call. Does nothing. */ ref(): void; /** * Stub method call. Does nothing. */ unref(): void; } /** * Timer identifier for clock scheduling. */ export type TimerId = number | NodeTimer; /** * Controls the flow of time. */ export interface LolexClock<TTimerId extends TimerId> extends GlobalTimers<TTimerId> { /** * Current clock time. */ now: number; /** * Don't know what this prop is for, but it was included in the clocks that `createClock` or * `install` return (it is never used in the code, for now). */ timeouts: {}; /** * Maximum number of timers that will be run when calling runAll(). */ loopLimit: number; /** * Schedule callback to run in the next animation frame. * * @param callback Callback to be fired. * @returns Request id. */ requestAnimationFrame: (callback: (time: number) => void) => TTimerId; /** * Cancel animation frame request. * * @param id The id returned from requestAnimationFrame method. */ cancelAnimationFrame: (id: TTimerId) => void; /** * Queues the callback to be fired during idle periods to perform background and low priority work on the main event loop. * * @param callback Callback to be fired. * @param timeout The maximum number of ticks before the callback must be fired. * @remarks Callbacks which have a timeout option will be fired no later than time in milliseconds. */ requestIdleCallback: (callback: () => void, timeout?: number) => TTimerId; /** * Clears a timer, as long as it was created using requestIdleCallback. * * @param id Timer ID or object. */ cancelIdleCallback: (id: TTimerId) => void; /** * Get the number of waiting timers. * * @returns number of waiting timers. */ countTimers: () => number; /** * Advances the clock to the the moment of the first scheduled timer, firing it. */ next: () => void; /** * Advance the clock, firing callbacks if necessary. * * @param time How many ticks to advance by. */ tick: (time: number | string) => void; /** * Removes all timers and tick without firing them and restore now to its original value. */ reset: () => void; /** * Runs all pending timers until there are none remaining. * * @remarks If new timers are added while it is executing they will be run as well. */ runAll: () => void; /** * Advanced the clock to the next animation frame while firing all scheduled callbacks. */ runToFrame: () => void; /** * Takes note of the last scheduled timer when it is run, and advances the clock to * that time firing callbacks as necessary. */ runToLast: () => void; /** * Simulates a user changing the system clock. * * @param now New system time. * @remarks This affects the current time but it does not in itself cause timers to fire. */ setSystemTime: (now?: number | Date) => void; } /** * Lolex clock for a browser environment. */ type BrowserClock = LolexClock<number> & { /** * Mimics performance.now(). */ performance: { now: () => number; } }; /** * Lolex clock for a Node environment. */ type NodeClock = LolexClock<NodeTimer> & { /** * Mimicks process.hrtime(). * * @param prevTime Previous system time to calculate time elapsed. * @returns High resolution real time as [seconds, nanoseconds]. */ hrtime(prevTime?: [number, number]): [number, number]; /** * Mimics process.nextTick() explicitly dropping additional arguments. */ queueMicrotask: (callback: () => void) => void; /** * Simulates process.nextTick(). */ nextTick: (callback: () => void) => void; /** * Run all pending microtasks scheduled with nextTick. */ runMicrotasks: () => void; }; /** * Clock object created by lolex. */ type Clock = BrowserClock | NodeClock; /** * Additional methods that installed clock have. */ type InstalledMethods = { /** * Restores the original methods on the context that was passed to lolex.install, * or the native timers if no context was given. */ uninstall: () => void; methods: FakeMethod[]; }; /** * Clock object created by calling `install();`. * * @type TClock type of base clock (e.g BrowserClock). */ type InstalledClock<TClock extends Clock = Clock> = TClock & InstalledMethods; /** * Creates a clock. * * @param now Current time for the clock. * @param loopLimit Maximum number of timers that will be run when calling runAll() * before assuming that we have an infinite loop and throwing an error * (by default, 1000). * @type TClock Type of clock to create. * @remarks The default epoch is 0. */ export declare function createClock<TClock extends Clock = Clock>(now?: number | Date, loopLimit?: number): TClock; export interface LolexInstallOpts { /** * Installs lolex onto the specified target context (default: global) */ target?: any; /** * Installs lolex with the specified unix epoch (default: 0) */ now?: number | Date; /** * An array with explicit function names to hijack. When not set, lolex will automatically fake all methods except nextTick * e.g., lolex.install({ toFake: ["setTimeout", "nextTick"]}) will fake only setTimeout and nextTick */ toFake?: FakeMethod[]; /** * The maximum number of timers that will be run when calling runAll() (default: 1000) */ loopLimit?: number; /** * Tells lolex to increment mocked time automatically based on the real system time shift (e.g. the mocked time will be incremented by * 20ms for every 20ms change in the real system time) (default: false) */ shouldAdvanceTime?: boolean; /** * Relevant only when using with shouldAdvanceTime: true. increment mocked time by advanceTimeDelta ms every advanceTimeDelta ms change * in the real system time (default: 20) */ advanceTimeDelta?: number; } /** * Creates a clock and installs it globally. * * @param now Current time for the clock, as with lolex.createClock(). * @param toFake Names of methods that should be faked. * @type TClock Type of clock to create. */ export declare function install<TClock extends Clock = Clock>(opts?: LolexInstallOpts): InstalledClock<TClock>; export interface LolexWithContext { timers: GlobalTimers<TimerId>; createClock: <TClock extends Clock = Clock>(now?: number | Date, loopLimit?: number) => TClock; install: <TClock extends Clock = Clock>(opts?: LolexInstallOpts) => InstalledClock<TClock>; withGlobal: (global: Object) => LolexWithContext; } /** * Apply new context to lolex. * * @param global New context to apply like `window` (in browsers) or `global` (in node). */ export declare function withGlobal(global: Object): LolexWithContext; export declare const timers: GlobalTimers<TimerId>;
types/lolex/index.d.ts
1
https://github.com/DefinitelyTyped/DefinitelyTyped/commit/61ee030edd12a3a30459d0cdc1d9128fdf714c5c
[ 0.0021891084033995867, 0.0004742393211927265, 0.00016496647731401026, 0.00018074872787110507, 0.0006096232100389898 ]
{ "id": 10, "code_window": [ "browserClock.next();\n", "nodeClock.next();\n", "\n", "browserClock.reset();\n", "nodeClock.reset();\n", "\n", "browserClock.runAll();\n", "nodeClock.runAll();\n" ], "labels": [ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ], "after_edit": [ "browserClock.nextAsync().then(() => {});\n", "nodeClock.nextAsync().then(() => {});\n", "\n" ], "file_path": "types/lolex/lolex-tests.ts", "type": "add", "edit_start_line_idx": 96 }
// Type definitions for promise.prototype.finally 2.0 // Project: https://github.com/es-shims/promise.prototype.finally // Definitions by: Slava Shpitalny <https://github.com/slavik57> // BendingBender <https://github.com/BendingBender> // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare global { interface Promise<T> { finally<U>(onFinally?: () => U | PromiseLike<U>): Promise<T>; } } export = promiseFinally; declare function promiseFinally<T, U>(promise: Promise<T>, onFinally?: () => U | PromiseLike<U>): Promise<T>; declare namespace promiseFinally { function shim(): void; }
types/promise.prototype.finally/index.d.ts
0
https://github.com/DefinitelyTyped/DefinitelyTyped/commit/61ee030edd12a3a30459d0cdc1d9128fdf714c5c
[ 0.00017382766236551106, 0.00017262855544686317, 0.00017142943397630006, 0.00017262855544686317, 0.0000011991141946054995 ]
{ "id": 10, "code_window": [ "browserClock.next();\n", "nodeClock.next();\n", "\n", "browserClock.reset();\n", "nodeClock.reset();\n", "\n", "browserClock.runAll();\n", "nodeClock.runAll();\n" ], "labels": [ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ], "after_edit": [ "browserClock.nextAsync().then(() => {});\n", "nodeClock.nextAsync().then(() => {});\n", "\n" ], "file_path": "types/lolex/lolex-tests.ts", "type": "add", "edit_start_line_idx": 96 }
// Type definitions for react-bootstrap 0.32 // Project: https://github.com/react-bootstrap/react-bootstrap, https://react-bootstrap.github.io // Definitions by: Walker Burgin <https://github.com/walkerburgin>, // Vincent Siao <https://github.com/vsiao>, // Danilo Barros <https://github.com/danilojrr>, // Batbold Gansukh <https://github.com/Batbold-Gansukh>, // Raymond May Jr. <https://github.com/octatone>, // Cheng Sieu Ly <https://github.com/chengsieuly>, // Mercedes Retolaza <https://github.com/mretolaza>, // Kat Busch <https://github.com/katbusch>, // Vito Samson <https://github.com/vitosamson>, // Karol Janyst <https://github.com/LKay> // Aaron Beall <https://github.com/aaronbeall> // Johann Rakotoharisoa <https://github.com/jrakotoharisoa> // Andrew Makarov <https://github.com/r3nya> // Duong Tran <https://github.com/t49tran> // Erik Zivkovic <https://github.com/bes> // Collin Green <https://github.com/collingreen> // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 import * as React from 'react'; export type Omit<T, K extends keyof T> = Pick<T, ({ [P in keyof T]: P } & { [P in K]: never } & { [x: string]: never, [x: number]: never })[keyof T]>; export type Sizes = 'xs' | 'xsmall' | 'sm' | 'small' | 'medium' | 'lg' | 'large'; export interface SelectCallback extends React.EventHandler<any> { (eventKey: any, e: React.SyntheticEvent<{}>): void; /** * @deprecated * This signature is a hack so can still derive from HTMLProps. * It does not reflect the underlying event and should not be used. */ (e: React.MouseEvent<{}>): void; } export interface TransitionCallbacks { onEnter?(node: HTMLElement): any; onEntered?(node: HTMLElement): any; onEntering?(node: HTMLElement): any; onExit?(node: HTMLElement): any; onExited?(node: HTMLElement): any; onExiting?(node: HTMLElement): any; } export * from './lib';
types/react-bootstrap/index.d.ts
0
https://github.com/DefinitelyTyped/DefinitelyTyped/commit/61ee030edd12a3a30459d0cdc1d9128fdf714c5c
[ 0.00017577841936144978, 0.00017216714331880212, 0.00016759103164076805, 0.00017210356600116938, 0.0000028136166747572133 ]
{ "id": 10, "code_window": [ "browserClock.next();\n", "nodeClock.next();\n", "\n", "browserClock.reset();\n", "nodeClock.reset();\n", "\n", "browserClock.runAll();\n", "nodeClock.runAll();\n" ], "labels": [ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ], "after_edit": [ "browserClock.nextAsync().then(() => {});\n", "nodeClock.nextAsync().then(() => {});\n", "\n" ], "file_path": "types/lolex/lolex-tests.ts", "type": "add", "edit_start_line_idx": 96 }
{ "extends": "dtslint/dt.json" }
types/emoji-mart/tslint.json
0
https://github.com/DefinitelyTyped/DefinitelyTyped/commit/61ee030edd12a3a30459d0cdc1d9128fdf714c5c
[ 0.00017335063603240997, 0.00017335063603240997, 0.00017335063603240997, 0.00017335063603240997, 0 ]
{ "id": 11, "code_window": [ "\n", "browserClock.runAll();\n", "nodeClock.runAll();\n", "\n", "nodeClock.runMicrotasks();\n", "\n", "browserClock.runToFrame();\n", "nodeClock.runToFrame();\n" ], "labels": [ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ], "after_edit": [ "browserClock.runAllAsync().then(() => {});\n", "nodeClock.runAllAsync().then(() => {});\n", "\n" ], "file_path": "types/lolex/lolex-tests.ts", "type": "add", "edit_start_line_idx": 102 }
import lolex = require("lolex"); const global: lolex.LolexWithContext = lolex.withGlobal({}); const timers: lolex.GlobalTimers<lolex.TimerId> = lolex.timers; const lolexTimeout: lolex.TimerId = timers.setTimeout(() => {}, 42); const lolexInterval: lolex.TimerId = timers.setInterval(() => {}, 42); const lolexImmediate: lolex.TimerId = timers.setImmediate(() => {}); const lolexDate: Date = new timers.Date(); timers.clearTimeout(lolexTimeout); timers.clearInterval(lolexInterval); timers.clearImmediate(lolexImmediate); let browserClock: lolex.BrowserClock = lolex.createClock() as lolex.BrowserClock; let nodeClock: lolex.NodeClock = lolex.createClock() as lolex.NodeClock; browserClock = lolex.createClock<lolex.BrowserClock>(); nodeClock = lolex.createClock<lolex.NodeClock>(); lolex.createClock<lolex.BrowserClock>(7); lolex.createClock<lolex.BrowserClock>(new Date()); lolex.createClock<lolex.BrowserClock>(7, 9001); lolex.createClock<lolex.BrowserClock>(new Date(), 9001); lolex.createClock<lolex.NodeClock>(7); lolex.createClock<lolex.NodeClock>(new Date()); lolex.createClock<lolex.NodeClock>(7, 9001); lolex.createClock<lolex.NodeClock>(new Date(), 9001); const browserInstalledClock = lolex.install<lolex.BrowserClock>({ advanceTimeDelta: 20, loopLimit: 10, now: 0, shouldAdvanceTime: true, target: {}, toFake: ["setTimeout", "nextTick", "hrtime"] }); const nodeInstalledClock = lolex.install<lolex.NodeClock>({ advanceTimeDelta: 20, loopLimit: 10, now: new Date(0), shouldAdvanceTime: true, target: {}, toFake: ["setTimeout", "nextTick", "hrtime"] }); const browserNow: number = browserClock.now; const browserTimeouts: Object = browserClock.timeouts; const browserLoopLimit: number = browserClock.loopLimit; const browserDate: Date = new browserClock.Date(); const browserPerformanceNow: number = browserClock.performance.now(); const nodeNow: number = nodeClock.now; const nodeDate: Date = new nodeClock.Date(); const browserTimeout: number = browserClock.setTimeout(() => {}, 7); const browserInterval: number = browserClock.setInterval(() => {}, 7); const browserImmediate: number = browserClock.setImmediate(() => {}); const browserAnimationFrame: number = browserClock.requestAnimationFrame(() => {}); const browserIdleCallback: number = browserClock.requestIdleCallback(() => {}); const browserIdleCallbackWithTimeout: number = browserClock.requestIdleCallback(() => {}, 7); const nodeTimeout: lolex.NodeTimer = nodeClock.setTimeout(() => {}, 7); const nodeInterval: lolex.NodeTimer = nodeClock.setInterval(() => {}, 7); const nodeImmediate: lolex.NodeTimer = nodeClock.setImmediate(() => {}); const nodeAnimationFrame: lolex.NodeTimer = nodeClock.requestAnimationFrame(() => {}); const nodeIdleCallback: lolex.NodeTimer = nodeClock.requestIdleCallback(() => {}); const nodeIdleCallbackWithTimeout: lolex.NodeTimer = nodeClock.requestIdleCallback(() => {}, 7); nodeTimeout.ref(); nodeTimeout.unref(); browserClock.clearTimeout(browserTimeout); browserClock.clearInterval(browserInterval); browserClock.clearImmediate(browserImmediate); browserClock.cancelAnimationFrame(browserAnimationFrame); browserClock.cancelIdleCallback(browserIdleCallback); browserClock.cancelIdleCallback(browserIdleCallbackWithTimeout); nodeClock.clearTimeout(nodeTimeout); nodeClock.clearInterval(nodeInterval); nodeClock.clearImmediate(nodeImmediate); nodeClock.cancelAnimationFrame(nodeAnimationFrame); nodeClock.cancelIdleCallback(nodeIdleCallback); nodeClock.cancelIdleCallback(nodeIdleCallbackWithTimeout); browserClock.tick(7); browserClock.tick("08"); nodeClock.tick(7); nodeClock.tick("08:03"); browserClock.next(); nodeClock.next(); browserClock.reset(); nodeClock.reset(); browserClock.runAll(); nodeClock.runAll(); nodeClock.runMicrotasks(); browserClock.runToFrame(); nodeClock.runToFrame(); browserClock.runToLast(); nodeClock.runToLast(); browserClock.setSystemTime(); browserClock.setSystemTime(7); browserClock.setSystemTime(new Date()); nodeClock.setSystemTime(); nodeClock.setSystemTime(7); nodeClock.setSystemTime(new Date()); nodeClock.nextTick(() => undefined); nodeClock.queueMicrotask(() => {}); const browserTimersCount: number = browserClock.countTimers(); const nodeTimersCount: number = nodeClock.countTimers(); let [secs, nanos] = nodeClock.hrtime([0, 0]); [secs, nanos] = nodeClock.hrtime(); // shows that typescript successfully infer the return values as numbers. secs.toFixed(); nanos.toExponential(); browserInstalledClock.performance.now(); nodeInstalledClock.nextTick(() => {}); browserInstalledClock.uninstall(); nodeInstalledClock.uninstall(); // Clocks should be typed to have unbound method signatures that can be passed around const { clearTimeout } = browserClock; clearTimeout(0); // TClock of InstalledClock<TClock> is optional. let installedClock: lolex.InstalledClock; installedClock = nodeInstalledClock; installedClock = browserInstalledClock;
types/lolex/lolex-tests.ts
1
https://github.com/DefinitelyTyped/DefinitelyTyped/commit/61ee030edd12a3a30459d0cdc1d9128fdf714c5c
[ 0.4017729163169861, 0.0698581412434578, 0.00017252615361940116, 0.03272886574268341, 0.10279212146997452 ]
{ "id": 11, "code_window": [ "\n", "browserClock.runAll();\n", "nodeClock.runAll();\n", "\n", "nodeClock.runMicrotasks();\n", "\n", "browserClock.runToFrame();\n", "nodeClock.runToFrame();\n" ], "labels": [ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ], "after_edit": [ "browserClock.runAllAsync().then(() => {});\n", "nodeClock.runAllAsync().then(() => {});\n", "\n" ], "file_path": "types/lolex/lolex-tests.ts", "type": "add", "edit_start_line_idx": 102 }
{ "extends": "dtslint/dt.json", "rules": { // All are TODOs "ban-types": false, "dt-header": false, "max-line-length": false, "no-any-union": false, "no-duplicate-imports": false, "no-duplicate-variable": false, "no-empty-interface": false, "no-inferrable-types": false, "no-internal-module": false, "no-namespace": false, "no-redundant-jsdoc": false, "no-redundant-jsdoc-2": false, "no-single-declare-module": false, "no-unnecessary-class": false, "no-unnecessary-generics": false, "no-unnecessary-qualifier": false, "no-var-keyword": false, "prefer-const": false, "prefer-method-signature": false, "strict-export-declare-modifiers": false, "unified-signatures": false } }
types/node/v9/tslint.json
0
https://github.com/DefinitelyTyped/DefinitelyTyped/commit/61ee030edd12a3a30459d0cdc1d9128fdf714c5c
[ 0.00017461125389672816, 0.00017174922686535865, 0.00016996993508655578, 0.0001706664770608768, 0.0000020436425529624103 ]
{ "id": 11, "code_window": [ "\n", "browserClock.runAll();\n", "nodeClock.runAll();\n", "\n", "nodeClock.runMicrotasks();\n", "\n", "browserClock.runToFrame();\n", "nodeClock.runToFrame();\n" ], "labels": [ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ], "after_edit": [ "browserClock.runAllAsync().then(() => {});\n", "nodeClock.runAllAsync().then(() => {});\n", "\n" ], "file_path": "types/lolex/lolex-tests.ts", "type": "add", "edit_start_line_idx": 102 }
{ "extends": "dtslint/dt.json" }
types/chalk-animation/tslint.json
0
https://github.com/DefinitelyTyped/DefinitelyTyped/commit/61ee030edd12a3a30459d0cdc1d9128fdf714c5c
[ 0.0001735032710712403, 0.0001735032710712403, 0.0001735032710712403, 0.0001735032710712403, 0 ]
{ "id": 11, "code_window": [ "\n", "browserClock.runAll();\n", "nodeClock.runAll();\n", "\n", "nodeClock.runMicrotasks();\n", "\n", "browserClock.runToFrame();\n", "nodeClock.runToFrame();\n" ], "labels": [ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ], "after_edit": [ "browserClock.runAllAsync().then(() => {});\n", "nodeClock.runAllAsync().then(() => {});\n", "\n" ], "file_path": "types/lolex/lolex-tests.ts", "type": "add", "edit_start_line_idx": 102 }
import core = breeze.core; import config = breeze.config; function test_dataType() { var typ = breeze.DataType.DateTime; var nm = typ.getName(); var dv = typ.defaultValue; var isDate = typ.isDate; var isFloat = typ.isFloat; var isInteger = typ.isInteger; var isNumeric = typ.isNumeric; var qjod = typ.quoteJsonOData; var symbs = breeze.DataType.getSymbols(); var x = typ.parentEnum === <breeze.core.IEnum> breeze.DataType; var isFalse = breeze.DataType.contains(breeze.DataType.Double); var dt = breeze.DataType.fromName("Decimal"); } function test_dataProperty() { var lastNameProp = new breeze.DataProperty({ name: "lastName", dataType: breeze.DataType.String, isNullable: true, maxLength: 20 }); var personEntityType: breeze.EntityType; personEntityType.addProperty(lastNameProp); } function test_dataService() { var ds = new breeze.DataService({ serviceName: "breeze/NorthwindIBModel", hasServerMetadata: true }); var em = new breeze.EntityManager({ dataService: ds }); } function test_entityAspect() { var order: breeze.Entity; order.entityAspect.acceptChanges(); var entityKey = order.entityAspect.getKey(); var valErrors = order.entityAspect.getValidationErrors(); var orderDateErrors = order.entityAspect.getValidationErrors("OrderDate"); var orderDateProperty = order.entityType.getProperty("OrderDate"); var orderDateErrors = order.entityAspect.getValidationErrors(orderDateProperty); order.entityAspect.loadNavigationProperty("Orders").then(function (data: breeze.QueryResult) { var orders = data.results; }).catch(function (exception) { }); order.entityAspect.rejectChanges(); order.entityAspect.setDeleted(); order.entityAspect.setModified(); order.entityAspect.setUnchanged(); var isOk = order.entityAspect.validateEntity(); if (!isOk) { var errors = order.entityAspect.getValidationErrors(); } var isOk = order.entityAspect.validateProperty("Order"); var orderDateProperty = order.entityType.getProperty("OrderDate"); //var isOk = order.entityAspect.validateProperty(OrderDateProperty); order.entityAspect.propertyChanged.subscribe(function (propertyChangedArgs) { var entity = propertyChangedArgs.entity; var propertyNameChanged = propertyChangedArgs.propertyName; var oldValue = propertyChangedArgs.oldValue; var newValue = propertyChangedArgs.newValue; }); order.entityAspect.validationErrorsChanged.subscribe(function (validationChangeArgs) { var entity = validationChangeArgs.entity; var errorsAdded = validationChangeArgs.added; var errorsCleared = validationChangeArgs.removed; }); } function test_entityKey() { var em1: breeze.EntityManager; var employee1: breeze.Entity; var empType = em1.metadataStore.getEntityType("Employee"); var entityKey = new breeze.EntityKey(<breeze.EntityType> empType, 1); var empKey = employee1.entityAspect.getKey(); var empTerrType = em1.metadataStore.getEntityType("EmployeeTerritory"); var empTerrKey = new breeze.EntityKey(<breeze.EntityType> empTerrType, [1, 77]); var empType = em1.metadataStore.getEntityType("Employee"); var empKey1 = new breeze.EntityKey(<breeze.EntityType> empType, 1); var empKey2 = employee1.entityAspect.getKey(); if (empKey1.equals(empKey2)) { } if (breeze.EntityKey.equals(empKey1, empKey2)) { } } function test_metadataStore() { var ms = new breeze.MetadataStore(); var entityManager = new breeze.EntityManager({ serviceName: "breeze/NorthwindIBModel", metadataStore: ms }); var em1: breeze.EntityManager; em1.setProperties({ metadataStore: ms }); var metadataAsString = ms.exportMetadata(); window.localStorage.setItem("metadata", metadataAsString); var metadataFromStorage = window.localStorage.getItem("metadata"); var newMetadataStore = new breeze.MetadataStore(); newMetadataStore.importMetadata(metadataFromStorage); var ms = new breeze.MetadataStore(); ms.fetchMetadata("breeze/NorthwindIBModel") .then(function (rawMetadata) { }) .catch(function (exception) { }); var odType = em1.metadataStore.getEntityType("OrderDetail"); var badType = em1.metadataStore.getEntityType("Foo", false); var allTypes = em1.metadataStore.getEntityTypes(); if (!em1.metadataStore.hasMetadataFor("breeze/NorthwindIBModel")) { } var metadataAsString = ms.exportMetadata(); window.localStorage.setItem("metadata", metadataAsString); var metadataFromStorage = window.localStorage.getItem("metadata"); var newMetadataStore = breeze.MetadataStore.importMetadata(metadataFromStorage); var metadataAsString = ms.exportMetadata(); window.localStorage.setItem("metadata", metadataAsString); var metadataFromStorage = window.localStorage.getItem("metadata"); var newMetadataStore = new breeze.MetadataStore(); newMetadataStore.importMetadata(metadataFromStorage); if (em1.metadataStore.isEmpty()) { } var Customer = function () { this.miscData = "asdf"; } em1.metadataStore.registerEntityTypeCtor("Customer", Customer); } function test_entityManager() { var entityManager = new breeze.EntityManager("breeze/NorthwindIBModel"); var em1 = new breeze.EntityManager({ serviceName: "breeze/NorthwindIBModel" }); var metadataStore = new breeze.MetadataStore(); var entityManager = new breeze.EntityManager({ serviceName: "breeze/NorthwindIBModel", metadataStore: metadataStore }); new breeze.QueryOptions({ mergeStrategy: null, fetchStrategy: this.fetchStrategy }); var queryOptions = new breeze.QueryOptions({ mergeStrategy: breeze.MergeStrategy.OverwriteChanges, fetchStrategy: breeze.FetchStrategy.FromServer }); var validationOptions = new breeze.ValidationOptions({ validateOnAttach: true, validateOnSave: true, validateOnQuery: false }); var entityManager = new breeze.EntityManager({ serviceName: "breeze/NorthwindIBModel", queryOptions: queryOptions, validationOptions: validationOptions }); var custType = <breeze.EntityType> em1.metadataStore.getEntityType("Customer"); var cust1 = custType.createEntity(); em1.addEntity(cust1); var cust2 = em1.createEntity("Customer", { companyName: "foo" }); var cust3 = em1.createEntity("foo", { xxx: 3 }, breeze.EntityState.Added); em1.attachEntity(cust1, breeze.EntityState.Added); em1.clear(); var em2 = em1.createEmptyCopy(); em1.detachEntity(cust1); var serviceName: string; var em = new breeze.EntityManager(serviceName); var query = new breeze.EntityQuery("Orders"); em.executeQuery(query) .then(function (data: breeze.QueryResult) { var orders = data.results; }).catch(function (err) { }); var em = new breeze.EntityManager(serviceName); var query = new breeze.EntityQuery("Orders"); em.executeQuery(query, function (data: breeze.QueryResult) { var orders = data.results; }, function (err) { }); var em = new breeze.EntityManager(serviceName); var query = new breeze.EntityQuery("Orders").using(em); query.execute() .then(function (data: breeze.QueryResult) { var orders = data.results; }).catch(function (err) { }); var em = new breeze.EntityManager(serviceName); var query = new breeze.EntityQuery("Orders"); var orders = em.executeQueryLocally(query); var em = new breeze.EntityManager(serviceName); var query = new breeze.EntityQuery("Orders").using(breeze.FetchStrategy.FromLocalCache); em.executeQuery(query) .then(function (data: breeze.QueryResult) { var orders = data.results; }).catch(function (err) { }); var bundle = em1.exportEntities(); window.localStorage.setItem("myEntityManager", bundle); var bundleFromStorage = window.localStorage.getItem("myEntityManager"); var em2 = new breeze.EntityManager({ serviceName: em1.serviceName, metadataStore: em1.metadataStore }); em2.importEntities(bundleFromStorage); var entitiesToExport: breeze.Entity[]; var bundle = em1.exportEntities(entitiesToExport); em2.importEntities(bundle, { mergeStrategy: breeze.MergeStrategy.PreserveChanges }); var em1 = new breeze.EntityManager("breeze/NorthwindIBModel"); em1.fetchMetadata() .then(function () { var metadataStore = em1.metadataStore; }) .catch(function (exception) { }); var employeeType = em1.metadataStore.getEntityType("Employee"); var employeeKey = new breeze.EntityKey(<breeze.EntityType> employeeType, 1); var employee = em1.fetchEntityByKey(employeeKey); var emp2 = em1.fetchEntityByKey("Employee", 6); var emp3 = em1.fetchEntityByKey("Entityee", [6]); var custType = <breeze.EntityType> em1.metadataStore.getEntityType("Customer"); var custumer = custType.createEntity(); var customerId = em.generateTempKeyValue(custumer); em1.saveChanges() .then(function (data: breeze.SaveResult) { var sameCust1 = data.entities[0]; }); var changedEntities = em1.getChanges(); var custType = <breeze.EntityType> em1.metadataStore.getEntityType("Customer"); var changedCustomers = em1.getChanges(custType); var custType = <breeze.EntityType> em1.metadataStore.getEntityType("Customer"); var orderType = <breeze.EntityType> em1.metadataStore.getEntityType("Order"); var changedCustomersAndOrders = em1.getChanges([custType, orderType]); var entities = em1.getEntities(); var custType = <breeze.EntityType> em1.metadataStore.getEntityType("Customer"); var customers = em1.getEntities(custType); var custType = <breeze.EntityType> em1.metadataStore.getEntityType("Customer"); var orderType = <breeze.EntityType> em1.metadataStore.getEntityType("Order"); var customersAndOrders = em1.getChanges([custType, orderType]); var custType = <breeze.EntityType> em1.metadataStore.getEntityType("Customer"); var orderType = <breeze.EntityType> em1.metadataStore.getEntityType("Order"); var addedCustomersAndOrders = em1.getEntities([custType, orderType], breeze.EntityState.Added); if (em1.hasChanges()) { } var custType = <breeze.EntityType> em1.metadataStore.getEntityType("Customer"); if (em1.hasChanges(custType)) { } var custType = <breeze.EntityType> em1.metadataStore.getEntityType("Customer"); var orderType = <breeze.EntityType> em1.metadataStore.getEntityType("Order"); if (em1.hasChanges([custType, orderType])) { }; var bundle = em1.exportEntities(); window.localStorage.setItem("myEntityManager", bundle); var bundleFromStorage = window.localStorage.getItem("myEntityManager"); var em2 = breeze.EntityManager.importEntities(bundleFromStorage); var bundle = em1.exportEntities(); var em2 = new breeze.EntityManager({ serviceName: em1.serviceName, metadataStore: em1.metadataStore }); em2.importEntities(bundle); var bundle2 = em1.exportEntities(null, { asString: true, includeMetadata: true }); em2.importEntities(bundle2, { mergeStrategy: breeze.MergeStrategy.PreserveChanges }); em.saveChanges().then(function (saveResult: breeze.SaveResult) { var savedEntities = saveResult.entities; var keyMappings = saveResult.keyMappings; }).catch(function (e) { }); var saveOptions = new breeze.SaveOptions({ allowConcurrentSaves: true }); var entitiesToSave: breeze.Entity[]; em.saveChanges(entitiesToSave, saveOptions).then(function (saveResult: breeze.SaveResult) { var savedEntities = saveResult.entities; var keyMappings = saveResult.keyMappings; }).catch(function (e) { }); em.saveChanges(entitiesToSave, null, function (saveResult: breeze.SaveResult) { var savedEntities = saveResult.entities; var keyMappings = saveResult.keyMappings; }, function (e) { } ); em1.setProperties({ serviceName: "breeze/foo", }); var em = new breeze.EntityManager({ serviceName: "breeze/NorthwindIBModel" }); em.entityChanged.subscribe(function (changeArgs) { var action = changeArgs.entityAction; var entity = changeArgs.entity; }); var em = new breeze.EntityManager({ serviceName: "breeze/NorthwindIBModel" }); em.hasChangesChanged.subscribe(function (args) { var hasChanges = args.hasChanges; var entityManager = args.entityManager; }); } function test_entityQuery() { var query = new breeze.EntityQuery("Customers"); var query = new breeze.EntityQuery("Customers") .where("CompanyName", "startsWith", "C") .orderBy("Region"); var serviceName: string; var em = new breeze.EntityManager(serviceName); var query = new breeze.EntityQuery("Orders").using(em); query.execute() .then(function (data: breeze.QueryResult) { }) .catch(function (err) { }); var em = new breeze.EntityManager(serviceName); var query = new breeze.EntityQuery("Orders").using(em); query.execute( function (data: breeze.QueryResult) { var orders = data.results; }, function (err) { }); var em = new breeze.EntityManager(serviceName); var query = new breeze.EntityQuery("Orders"); em.executeQuery(query) .then(function (data: breeze.QueryResult) { var orders = data.results; }).catch(function (err) { }); var query = new breeze.EntityQuery("Orders").using(em); var orders = query.executeLocally(); var query = new breeze.EntityQuery("Customers") .where("CompanyName", "startsWith", "C") .expand("Orders"); var query = new breeze.EntityQuery("Orders") .expand("Customer, Employee"); var query = new breeze.EntityQuery("Orders") .expand("Customer, OrderDetails, OrderDetails.Product"); var query = breeze.EntityQuery.from("Customers"); var query = new breeze.EntityQuery("Customers"); var query = new breeze.EntityQuery().from("Customers"); var customer: breeze.Entity; var customers: breeze.Entity[]; var customersQuery = breeze.EntityQuery.fromEntities(customers); var customersQuery = breeze.EntityQuery.fromEntities(customers) .where("Region", breeze.FilterQueryOp.NotEquals, null); var customerQuery = breeze.EntityQuery.fromEntities(customer); var metadataStore: breeze.MetadataStore; var empType = metadataStore.getEntityType("Employee"); var entityKey = new breeze.EntityKey(<breeze.EntityType> empType, 1); var query = breeze.EntityQuery.fromEntityKey(entityKey); var employee: breeze.Entity; var entityKey = employee.entityAspect.getKey(); var query = breeze.EntityQuery.fromEntityKey(entityKey); var ordersNavProp = employee.entityType.getProperty("Orders"); var query = breeze.EntityQuery.fromEntityNavigation(employee, <breeze.NavigationProperty> ordersNavProp); var query = new breeze.EntityQuery("Customers") .orderBy("CompanyName"); var query = new breeze.EntityQuery("Customers") .orderBy("Region, CompanyName"); var query = new breeze.EntityQuery("Products") .orderBy("Category.CategoryName"); var query = new breeze.EntityQuery("Customers") .orderBy("CompanyName desc"); var query = new breeze.EntityQuery("Customers") .orderBy("Region desc, CompanyName desc"); var query = new breeze.EntityQuery("Customers") .orderByDesc("CompanyName"); var query = new breeze.EntityQuery("Customers") .where("CompanyName", "startsWith", "C") .select("CompanyName"); var query = new breeze.EntityQuery("Customers") .where("CompanyName", "startsWith", "C") .select("Orders"); var query = new breeze.EntityQuery("Customers") .where("CompanyName", "startsWith", "C") .select("CompanyName, Orders"); var query = new breeze.EntityQuery("Orders") .where("Customer.CompanyName", "startsWith", "C") .select("Customer.CompanyName, Customer, OrderDate"); var query = new breeze.EntityQuery("Customers") .where("CompanyName", "startsWith", "C") .skip(5); var query = new breeze.EntityQuery("Customers") .take(5); var query = new breeze.EntityQuery("Customers") .top(5); var em = new breeze.EntityManager(serviceName); var query = new breeze.EntityQuery("Orders") .using(em); var em = new breeze.EntityManager(serviceName); var query = new breeze.EntityQuery("Orders") .using(breeze.MergeStrategy.PreserveChanges); var em = new breeze.EntityManager(serviceName); var query = new breeze.EntityQuery("Orders") .using(breeze.FetchStrategy.FromLocalCache); var adapter = new breeze.JsonResultsAdapter({ name: "foo", visitNode: function (x) { return x; } }); var q2 = query.using(adapter); var query = new breeze.EntityQuery("Customers") .where("CompanyName", "startsWith", "C"); var query = new breeze.EntityQuery("Customers") .where("CompanyName", breeze.FilterQueryOp.StartsWith, "C"); var pred = new breeze.Predicate("CompanyName", breeze.FilterQueryOp.StartsWith, "C"); var query = new breeze.EntityQuery("Customers") .where(pred); var pred = breeze.Predicate.create("CompanyName", "startswith", "C").and("Region", breeze.FilterQueryOp.Equals, null); var query = new breeze.EntityQuery("Customers") .where(pred); var query = new breeze.EntityQuery("Products") .where("Category.CategoryName", "startswith", "S"); var query = new breeze.EntityQuery("Customers") .where("toLower(CompanyName)", "startsWith", "c"); var query = new breeze.EntityQuery("Customers") .where("toUpper(substring(CompanyName, 1, 2))", breeze.FilterQueryOp.Equals, "OM"); var q2 = query.toType("foo").orderBy("foo2"); var pred = new breeze.Predicate('items', 'any', 'serialNumber', 'contains', '12345'); var pred = new breeze.Predicate('items', breeze.FilterQueryOp.Any, 'serialNumber', breeze.FilterQueryOp.Contains, '12345'); var pred = breeze.Predicate.create('items', 'any', 'serialNumber', 'contains', '12345'); var pred = breeze.Predicate.create('items', breeze.FilterQueryOp.Any, 'serialNumber', breeze.FilterQueryOp.Contains, '12345'); var json = query.toJSON(); } function test_entityState() { var anEntity: breeze.Entity; var es = anEntity.entityAspect.entityState; es.isAdded(); es === breeze.EntityState.Added; var es = anEntity.entityAspect.entityState; es.isAddedModifiedOrDeleted(); es === breeze.EntityState.Added || es === breeze.EntityState.Modified || es === breeze.EntityState.Deleted; var es = anEntity.entityAspect.entityState; es.isDeleted(); es === breeze.EntityState.Deleted; var es = anEntity.entityAspect.entityState; es.isDetached(); es === breeze.EntityState.Detached; var es = anEntity.entityAspect.entityState; es.isModified(); es === breeze.EntityState.Modified; var es = anEntity.entityAspect.entityState; es.isUnchanged(); es === breeze.EntityState.Unchanged; var es = anEntity.entityAspect.entityState; es.isUnchangedOrModified(); return es === breeze.EntityState.Unchanged || es === breeze.EntityState.Modified; } function test_entityType() { var myMetadataStore: breeze.MetadataStore; var myEntityType: breeze.EntityType; var dataProperty1: breeze.DataProperty, dataProperty2: breeze.DataProperty, navigationProperty1: breeze.DataProperty; var em1: breeze.EntityManager; /* NOTE https://github.com/DefinitelyTyped/DefinitelyTyped/pull/5590 var entityManager = new breeze.EntityType({ metadataStore: myMetadataStore, serviceName: "breeze/NorthwindIBModel", name: "person", namespace: "myAppNamespace" }); */ myEntityType.addProperty(dataProperty1); myEntityType.addProperty(dataProperty2); myEntityType.addProperty(navigationProperty1); var custType = <breeze.EntityType> em1.metadataStore.getEntityType("Customer"); var countryProp = custType.getProperty("Country"); var valFn = function (v: string) { if (v == null) return true; return (v.substring(0,2) === "US"); }; var countryValidator = new breeze.Validator("countryIsUS", valFn, { displayName: "Country", messageTemplate: "'%displayName%' must start with 'US'" }); custType.addValidator(countryValidator, countryProp); countryProp.validators.push(countryValidator); var someEntityLevelValidator: breeze.Validator; custType.addValidator(someEntityLevelValidator); custType.validators.push(someEntityLevelValidator); var custType = <breeze.EntityType> em1.metadataStore.getEntityType("Customer"); var cust1 = custType.createEntity(); em1.addEntity(cust1); var custType = <breeze.EntityType> em1.metadataStore.getEntityType("Customer"); var customerNameDataProp = custType.getDataProperty("CustomerName"); var custType = <breeze.EntityType> em1.metadataStore.getEntityType("Customer"); var customerOrdersNavProp = custType.getDataProperty("Orders"); var custType = <breeze.EntityType> em1.metadataStore.getEntityType("Customer"); var arrayOfProps = custType.getProperties(); var custType = <breeze.EntityType> em1.metadataStore.getEntityType("Customer"); var companyNameProp = custType.getProperty("CompanyName"); var orderDetailType = <breeze.EntityType> em1.metadataStore.getEntityType("OrderDetail"); var companyNameProp2 = orderDetailType.getProperty("Order.Customer.CompanyName"); var custType = <breeze.EntityType> em1.metadataStore.getEntityType("Customer"); var arrayOfPropNames = custType.getPropertyNames(); var custType = <breeze.EntityType> em1.metadataStore.getEntityType("Customer"); custType.setProperties({ autoGeneratedKeyType: breeze.AutoGeneratedKeyType.Identity, defaultResourceName: "CustomersAndIncludedOrders" }); } //function test_enum() { // var prototype = { // nextDay: function () { // var nextIndex = (this.dayIndex + 1) % 7; // return DayOfWeek.getSymbols()[nextIndex]; // } // }; // var DayOfWeek = new core.Enum("DayOfWeek", prototype); // DayOfWeek.Monday = DayOfWeek.addSymbol({ dayIndex: 0 }); // var symbol = DayOfWeek.Friday; // if (DayOfWeek.contains(symbol)) { } // var dayOfWeek = DayOfWeek.from("Thursday"); // var symbols = DayOfWeek.getNames(); // var symbols = DayOfWeek.getSymbols(); // if (core.Enum.isSymbol(DayOfWeek.Wednesday)) { }; // DayOfWeek.seal(); // var name = DayOfWeek.Monday.getName(); // var name = DayOfWeek.Monday.toString(); // var prototype = { // nextDay: function () { // var nextIndex = (this.dayIndex + 1) % 7; // return DayOfWeek.getSymbols()[nextIndex]; // } // }; // var DayOfWeek = new core.Enum("DayOfWeek", prototype); // DayOfWeek.Monday = DayOfWeek.addSymbol({ dayIndex: 0 }); // DayOfWeek.Tuesday = DayOfWeek.addSymbol({ dayIndex: 1 }); // DayOfWeek.Wednesday = DayOfWeek.addSymbol({ dayIndex: 2 }); // DayOfWeek.Thursday = DayOfWeek.addSymbol({ dayIndex: 3 }); // DayOfWeek.Friday = DayOfWeek.addSymbol({ dayIndex: 4 }); // DayOfWeek.Saturday = DayOfWeek.addSymbol({ dayIndex: 5, isWeekend: true }); // DayOfWeek.Sunday = DayOfWeek.addSymbol({ dayIndex: 6, isWeekend: true }); // DayOfWeek.seal(); // DayOfWeek.Monday.nextDay() === DayOfWeek.Tuesday; // DayOfWeek.Sunday.nextDay() === DayOfWeek.Monday; // DayOfWeek.Tuesday.isWeekend === undefined; // DayOfWeek.Saturday.isWeekend == true; // DayOfWeek instanceof core.Enum; // core.Enum.isSymbol(DayOfWeek.Wednesday); // DayOfWeek.contains(DayOfWeek.Thursday); // DayOfWeek.Tuesday.parentEnum == DayOfWeek; // DayOfWeek.getSymbols().length === 7; // DayOfWeek.Friday.toString() === "Friday"; //} interface CustomEntityManager extends breeze.EntityManager { customTag: string; } function test_event() { var myEntityManager: CustomEntityManager; var myEntity: breeze.Entity, person: breeze.Entity; var salaryEvent = new core.Event("salaryEvent", person); core.Event.enable("propertyChanged", myEntityManager, false); core.Event.enable("propertyChanged", myEntityManager, true); core.Event.enable("propertyChanged", myEntity.entityAspect, false); core.Event.enable("propertyChanged", myEntity.entityAspect, <Function> null); core.Event.enable("validationErrorsChanged", myEntityManager, function (em: CustomEntityManager) { return em.customTag === "blue"; }); core.Event.isEnabled("propertyChanged", myEntityManager); salaryEvent.publish({ eventType: "payRaise", amount: 100 }); salaryEvent.publish({ eventType: "payRaise", amount: 100 }, true); salaryEvent.publish({ eventType: "payRaise", amount: 100 }, true, function (error) { }); salaryEvent.publishAsync({ eventType: "payRaise", amount: 100 }); salaryEvent.publishAsync({ eventType: "payRaise", amount: 100 }, function (error) { }); salaryEvent.subscribe(function (eventArgs) { if (eventArgs.eventType === "payRaise") { } }); var order: breeze.Entity; order.entityAspect.propertyChanged.subscribe(function (pcEvent) { if (pcEvent.propertyName === "OrderDate") { } }); var token = order.entityAspect.propertyChanged.subscribe(function (pcEvent) { }); order.entityAspect.propertyChanged.unsubscribe(token); } function test_localQueryComparisonOptions() { var lqco = new breeze.LocalQueryComparisonOptions({ name: "caseSensitive-nonSQL", isCaseSensitive: true, usesSql92CompliantStringComparison: false }); lqco.setAsDefault(); var ms = new breeze.MetadataStore({ localQueryComparisonOptions: lqco }); var em = new breeze.EntityManager({ metadataStore: ms }); var lqco = new breeze.LocalQueryComparisonOptions({ isCaseSensitive: false, usesSql92CompliantStringComparison: true }); lqco.setAsDefault(); } function test_namingConventions() { var namingConv = new breeze.NamingConvention({ serverPropertyNameToClient: function (serverPropertyName) { return serverPropertyName.substr(0, 1).toLowerCase() + serverPropertyName.substr(1); }, clientPropertyNameToServer: function (clientPropertyName) { return clientPropertyName.substr(0, 1).toUpperCase() + clientPropertyName.substr(1); } }); var nc = new breeze.NamingConvention({ serverPropertyNameToClient: function (x) { return "xxx"; } }); var ms = new breeze.MetadataStore({ namingConvention: namingConv }); var em = new breeze.EntityManager({ metadataStore: ms }); var namingConv = new breeze.NamingConvention({ serverPropertyNameToClient: function (serverPropertyName) { return serverPropertyName.substr(0, 1).toLowerCase() + serverPropertyName.substr(1); }, clientPropertyNameToServer: function (clientPropertyName) { return clientPropertyName.substr(0, 1).toUpperCase() + clientPropertyName.substr(1); } }); namingConv.setAsDefault(); } function test_navigationProperty() { var homeAddressProp = new breeze.NavigationProperty({ name: "homeAddress", entityTypeName: "Address:#myNamespace", isScalar: true, associationName: "address_person", foreignKeyNames: ["homeAddressId"] }); var homeAddressIdProp = new breeze.DataProperty({ name: "homeAddressId", dataType: breeze.DataType.Int32 }); var personEntityType: breeze.EntityType; personEntityType.addProperty(homeAddressProp); personEntityType.addProperty(homeAddressIdProp); } function test_predicate() { var p1 = new breeze.Predicate("CompanyName", "StartsWith", "B"); var p1a = breeze.Predicate.create("CompanyName", "==", "City"); var p2a = p1a.and(p1a.not()); var query = new breeze.EntityQuery("Customers").where(p1); var p2 = new breeze.Predicate("Region", breeze.FilterQueryOp.Equals, null); var query = new breeze.EntityQuery("Customers").where(p2); var dt = new Date(88, 9, 12); var p1 = breeze.Predicate.create("OrderDate", "ne", dt); var p2 = breeze.Predicate.create("ShipCity", "startsWith", "C"); var p3 = breeze.Predicate.create("Freight", ">", 100); var newPred = p1.and(p2, p3); var preds = [p2, p3]; var newPred = p1.and(preds); var p4 = breeze.Predicate.create("ShipCity", "startswith", "F") .and("Size", "gt", 2000); var dt = new Date(88, 9, 12); var p1 = breeze.Predicate.create("OrderDate", "ne", dt); var p2 = breeze.Predicate.create("ShipCity", "startsWith", "C"); var p3 = breeze.Predicate.create("Freight", ">", 100); var newPred = breeze.Predicate.and(p1, p2, p3); var preds = [p1, p2, p3]; var newPred = breeze.Predicate.and(preds); var p1 = breeze.Predicate.create("Freight", "gt", 100); var predArgs: any[] = ["Freight", "gt", 100]; var p1 = breeze.Predicate.create(predArgs); var p1 = new breeze.Predicate("Freight", "gt", 100); var p1 = new breeze.Predicate("CompanyName", "StartsWith", "B"); if (breeze.Predicate.isPredicate(p1)) { } var p1 = breeze.Predicate.create("Freight", "gt", 100); var not_p1 = breeze.Predicate.not(p1); var not_p1 = p1.not(); var not_p1 = breeze.Predicate.create("Freight", "le", 100); var dt = new Date(88, 9, 12); var p1 = breeze.Predicate.create("OrderDate", "ne", dt); var p2 = breeze.Predicate.create("ShipCity", "startsWith", "C"); var p3 = breeze.Predicate.create("Freight", ">", 100); var newPred = breeze.Predicate.or(p1, p2, p3); var preds = [p1, p2, p3]; var newPred = breeze.Predicate.or(preds); var dt = new Date(88, 9, 12); var p1 = breeze.Predicate.create("OrderDate", "ne", dt); var p2 = breeze.Predicate.create("ShipCity", "startsWith", "C"); var p3 = breeze.Predicate.create("Freight", ">", 100); var newPred = p1.and(p2, p3); var preds = [p2, p3]; var newPred = p1.and(preds); var p4 = breeze.Predicate.create("ShipCity", "startswith", "F") .or("Size", "gt", 2000); } function test_queryOptions() { var em1: breeze.EntityManager; var newQo = new breeze.QueryOptions({ mergeStrategy: breeze.MergeStrategy.OverwriteChanges }); em1.setProperties({ queryOptions: newQo }); var newQo = new breeze.QueryOptions({ mergeStrategy: breeze.MergeStrategy.OverwriteChanges }); newQo.setAsDefault(); var queryOptions = em1.queryOptions.using(breeze.MergeStrategy.PreserveChanges); var queryOptions = em1.queryOptions.using(breeze.FetchStrategy.FromLocalCache); var queryOptions = em1.queryOptions.using({ mergeStrategy: breeze.MergeStrategy.OverwriteChanges }); } function test_validationOptions() { var newVo = new breeze.ValidationOptions({ validateOnSave: false, validateOnAttach: false }); var em1: breeze.EntityManager; em1.setProperties({ validationOptions: newVo }); var validationOptions = new breeze.ValidationOptions() var newOptions = validationOptions.using({ validateOnQuery: true, validateOnSave: false }); newOptions.setAsDefault(); var validationOptions = new breeze.ValidationOptions(); var newOptions = validationOptions.using({ validateOnQuery: true, validateOnSave: false }); } interface NumericRange{ max: number; min: number; } interface NumericRangeValidatorFunctionContext extends breeze.ValidatorFunctionContext, NumericRange { } function test_validator() { var valFn = function (v: any) { if (v == null) return true; return ( v.substr(0,2)=== "US"); }; var countryValidator = new breeze.Validator("countryIsUS", valFn, { displayName: "Country", messageTemplate: "'%displayName%' must start with 'US'" }); var metadataStore: breeze.MetadataStore; var custType = <breeze.EntityType> metadataStore.getEntityType("Customer"); var countryProp = custType.getProperty("Country"); countryProp.validators.push(countryValidator); function isValidZipCode(value: string) { var re = /^\d{5}([\-]\d{4})?$/; return (re.test(value)); } var valFn = function (v: any) { if (v.getProperty("Country") === "USA") { var postalCode = v.getProperty("PostalCode"); return isValidZipCode(postalCode); } return true; }; var zipCodeValidator = new breeze.Validator("zipCodeValidator", valFn, { messageTemplate: "For the US, this is not a valid PostalCode" }); var em1: breeze.EntityManager; var custType = <breeze.EntityType> em1.metadataStore.getEntityType("Customer"); custType.validators.push(zipCodeValidator); var numericRangeValidator = function (context: NumericRange) { var valFn = function (v: any, ctx: NumericRangeValidatorFunctionContext) { if (v == null) return true; if (typeof (v) !== "number") return false; if (ctx.min != null && v < ctx.min) return false; if (ctx.max != null && v > ctx.max) return false; return true; }; return new breeze.Validator("numericRange", valFn, { messageTemplate: "'%displayName%' must be an integer between the values of %min% and %max%", min: context.min, max: context.max }); }; freightProperty.validators.push(numericRangeValidator({ min: 100, max: 500 })); var productType = <breeze.EntityType> em1.metadataStore.getEntityType("Product"); var discontinuedProperty = productType.getProperty("Discontinued"); discontinuedProperty.validators.push(breeze.Validator.bool()); var orderType = <breeze.EntityType> em1.metadataStore.getEntityType("Order"); var freightProperty = orderType.getProperty("Freight"); regionProperty.validators.push(breeze.Validator.byte()); orderType = <breeze.EntityType> em1.metadataStore.getEntityType("Order"); var orderDateProperty = orderType.getProperty("OrderDate"); orderDateProperty.validators.push(breeze.Validator.date()); /* NOTE https://github.com/DefinitelyTyped/DefinitelyTyped/pull/5590 var v0 = breeze.Validator.maxLength({ maxLength: 5, displayName: "City" }); v0.validate("adasdfasdf"); var errMessage = v0.getMessage(); */ custType = <breeze.EntityType> em1.metadataStore.getEntityType("Customer"); var customerIdProperty = custType.getProperty("CustomerID"); customerIdProperty.validators.push(breeze.Validator.guid()); orderType = <breeze.EntityType> em1.metadataStore.getEntityType("Order"); freightProperty = orderType.getProperty("Freight"); freightProperty.validators.push(breeze.Validator.int16()); orderType = <breeze.EntityType> em1.metadataStore.getEntityType("Order"); freightProperty = orderType.getProperty("Freight"); freightProperty.validators.push(breeze.Validator.int32()); orderType = <breeze.EntityType> em1.metadataStore.getEntityType("Order"); freightProperty = orderType.getProperty("Freight"); freightProperty.validators.push(breeze.Validator.int64()); custType = <breeze.EntityType> em1.metadataStore.getEntityType("Customer"); var regionProperty = custType.getProperty("Region"); regionProperty.validators.push(breeze.Validator.maxLength({ maxLength: 5 })); orderType = <breeze.EntityType> em1.metadataStore.getEntityType("Order"); freightProperty = orderType.getProperty("Freight"); freightProperty.validators.push(breeze.Validator.number()); custType = <breeze.EntityType> em1.metadataStore.getEntityType("Customer"); regionProperty = custType.getProperty("Region"); regionProperty.validators.push(breeze.Validator.required()); custType = <breeze.EntityType> em1.metadataStore.getEntityType("Customer"); regionProperty = custType.getProperty("Region"); regionProperty.validators.push(breeze.Validator.string()); custType = <breeze.EntityType> em1.metadataStore.getEntityType("Customer"); regionProperty = custType.getProperty("Region"); /* NOTE https://github.com/DefinitelyTyped/DefinitelyTyped/pull/5590 regionProperty.validators.push(breeze.Validator.stringLength({ minLength: 2, maxLength: 5 })); var validator = breeze.Validator.maxLength({ maxLength: 5, displayName: "City" }); var result = validator.validate("asdf"); var ok = result === null; result = validator.validate("adasdfasdf"); var errMsg = result.errorMessage; var context = result.context; var sameValidator = result.validator; */ var valFn = function (v: any) { if (v == null) return true; return (v.substr(0,2) === "US"); }; var countryValidator = new breeze.Validator("countryIsUS", valFn, { displayName: "Country" }); breeze.Validator.messageTemplates["countryIsUS"] = "'%displayName%' must start with 'US'"; breeze.Validator.register(countryValidator); breeze.Validator.registerFactory(() => countryValidator, "country"); var urlValidator = breeze.Validator.url({ messageTemplate: 'u got that wrong' }); } function test_demo() { var manager = new breeze.EntityManager('breeze/northwind'); var query = new breeze.EntityQuery() .from("Employees"); manager.executeQuery(query).then(function (data: breeze.QueryResult) { }); } function test_corefns() { var o1: Object; var kvfn = function (p: any) { return p; } core.objectForEach(o1, kvfn); var o2: Object; var o3: Object; o3 = core.extend(o1, o2); var f1: Function; var f2: Function; f1 = core.propEq("name", "Joe"); f1 = core.pluck("name"); var a1: any[]; var a2: any[]; var a3: any[]; var b: boolean; var n: number; var f3 = function (e1: any, e2: any) { return e1 == e2; }; var f4 = function (e1: any) { return false; }; b = core.arrayEquals(a1, a2, f3); b = core.arrayFirst(a1, f4); n = core.arrayIndexOf(a1, f4); b = core.arrayRemoveItem(a1, "whatever", false); a3 = core.arrayZip(a1, a2, f3); var f5 = function () { return false; }; o1 = core.requireLib("libc,stdio", "Library not found"); o1 = core.using(o2, "something", "x", f5); f2 = core.memoize(f4); var s: string; s = core.getUuid(); n = core.durationToSeconds(s); b = core.isDate(s); b = core.isGuid(s); b = core.isDuration(s); b = core.isFunction(s); b = core.isEmpty(s); b = core.isNumeric(s); b = core.stringStartsWith(s, "pre"); b = core.stringEndsWith(s, "suf"); s = core.formatString("My %1 is full of %2", "hovercraft", "eels"); } function test_config() { var s: string; s = config.ajax; s = config.dataService; var o: Object; o = config.functionRegistry; o = config.getAdapter("myInterfaceName", "myAdapterName"); o = config.getAdapterInstance("myInterfaceName", "myAdapterName"); config.initializeAdapterInstance("myInterfaceName", "myAdapterName", true); config.initializeAdapterInstances({ ajax: "", dataService: "" }); s = config.interfaceInitialized.type; o = config.interfaceRegistry; o = config.objectRegistry; var f1: Function; config.registerAdapter("myAdapterName", f1); config.registerFunction(f1, "myFunction"); config.registerType(f1, "myCtor"); s = config.stringifyPad; o = config.typeRegistry; }
types/breeze/breeze-tests.ts
0
https://github.com/DefinitelyTyped/DefinitelyTyped/commit/61ee030edd12a3a30459d0cdc1d9128fdf714c5c
[ 0.0001774685806594789, 0.00017388274136465043, 0.00016826258797664195, 0.00017402567027602345, 0.000002077351609841571 ]
{ "id": 12, "code_window": [ "\n", "browserClock.runToLast();\n", "nodeClock.runToLast();\n", "\n", "browserClock.setSystemTime();\n", "browserClock.setSystemTime(7);\n", "browserClock.setSystemTime(new Date());\n", "\n" ], "labels": [ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ], "after_edit": [ "browserClock.runToLastAsync().then(() => {});\n", "nodeClock.runToLastAsync().then(() => {});\n", "\n" ], "file_path": "types/lolex/lolex-tests.ts", "type": "add", "edit_start_line_idx": 110 }
// Type definitions for lolex 3.1 // Project: https://github.com/sinonjs/lolex // Definitions by: Wim Looman <https://github.com/Nemo157> // Josh Goldberg <https://github.com/joshuakgoldberg> // Rogier Schouten <https://github.com/rogierschouten> // Yishai Zehavi <https://github.com/zyishai> // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 /** * Names of clock methods that may be faked by install. */ type FakeMethod = "setTimeout" | "clearTimeout" | "setImmediate" | "clearImmediate" | "setInterval" | "clearInterval" | "Date" | "nextTick" | "hrtime" | "requestAnimationFrame" | "cancelAnimationFrame" | "requestIdleCallback" | "cancelIdleCallback"; /** * Global methods avaliable to every clock and also as standalone methods (inside `timers` global object). */ export interface GlobalTimers<TTimerId extends TimerId> { /** * Schedules a callback to be fired once timeout milliseconds have ticked by. * * @param callback Callback to be fired. * @param timeout How many ticks to wait to run the callback. * @param args Any extra arguments to pass to the callback. * @returns Time identifier for cancellation. */ setTimeout: (callback: () => void, timeout: number, ...args: any[]) => TTimerId; /** * Clears a timer, as long as it was created using setTimeout. * * @param id Timer ID or object. */ clearTimeout: (id: TimerId) => void; /** * Schedules a callback to be fired every time timeout milliseconds have ticked by. * * @param callback Callback to be fired. * @param timeout How many ticks to wait between callbacks. * @param args Any extra arguments to pass to the callback. * @returns Time identifier for cancellation. */ setInterval: (callback: () => void, timeout: number, ...args: any[]) => TTimerId; /** * Clears a timer, as long as it was created using setInterval. * * @param id Timer ID or object. */ clearInterval: (id: TTimerId) => void; /** * Schedules the callback to be fired once 0 milliseconds have ticked by. * * @param callback Callback to be fired. * @remarks You'll still have to call clock.tick() for the callback to fire. * @remarks If called during a tick the callback won't fire until 1 millisecond has ticked by. */ setImmediate: (callback: () => void) => TTimerId; /** * Clears a timer, as long as it was created using setImmediate. * * @param id Timer ID or object. */ clearImmediate: (id: TTimerId) => void; /** * Implements the Date object but using this clock to provide the correct time. */ Date: typeof Date; } /** * Timer object used in node. */ export interface NodeTimer { /** * Stub method call. Does nothing. */ ref(): void; /** * Stub method call. Does nothing. */ unref(): void; } /** * Timer identifier for clock scheduling. */ export type TimerId = number | NodeTimer; /** * Controls the flow of time. */ export interface LolexClock<TTimerId extends TimerId> extends GlobalTimers<TTimerId> { /** * Current clock time. */ now: number; /** * Don't know what this prop is for, but it was included in the clocks that `createClock` or * `install` return (it is never used in the code, for now). */ timeouts: {}; /** * Maximum number of timers that will be run when calling runAll(). */ loopLimit: number; /** * Schedule callback to run in the next animation frame. * * @param callback Callback to be fired. * @returns Request id. */ requestAnimationFrame: (callback: (time: number) => void) => TTimerId; /** * Cancel animation frame request. * * @param id The id returned from requestAnimationFrame method. */ cancelAnimationFrame: (id: TTimerId) => void; /** * Queues the callback to be fired during idle periods to perform background and low priority work on the main event loop. * * @param callback Callback to be fired. * @param timeout The maximum number of ticks before the callback must be fired. * @remarks Callbacks which have a timeout option will be fired no later than time in milliseconds. */ requestIdleCallback: (callback: () => void, timeout?: number) => TTimerId; /** * Clears a timer, as long as it was created using requestIdleCallback. * * @param id Timer ID or object. */ cancelIdleCallback: (id: TTimerId) => void; /** * Get the number of waiting timers. * * @returns number of waiting timers. */ countTimers: () => number; /** * Advances the clock to the the moment of the first scheduled timer, firing it. */ next: () => void; /** * Advance the clock, firing callbacks if necessary. * * @param time How many ticks to advance by. */ tick: (time: number | string) => void; /** * Removes all timers and tick without firing them and restore now to its original value. */ reset: () => void; /** * Runs all pending timers until there are none remaining. * * @remarks If new timers are added while it is executing they will be run as well. */ runAll: () => void; /** * Advanced the clock to the next animation frame while firing all scheduled callbacks. */ runToFrame: () => void; /** * Takes note of the last scheduled timer when it is run, and advances the clock to * that time firing callbacks as necessary. */ runToLast: () => void; /** * Simulates a user changing the system clock. * * @param now New system time. * @remarks This affects the current time but it does not in itself cause timers to fire. */ setSystemTime: (now?: number | Date) => void; } /** * Lolex clock for a browser environment. */ type BrowserClock = LolexClock<number> & { /** * Mimics performance.now(). */ performance: { now: () => number; } }; /** * Lolex clock for a Node environment. */ type NodeClock = LolexClock<NodeTimer> & { /** * Mimicks process.hrtime(). * * @param prevTime Previous system time to calculate time elapsed. * @returns High resolution real time as [seconds, nanoseconds]. */ hrtime(prevTime?: [number, number]): [number, number]; /** * Mimics process.nextTick() explicitly dropping additional arguments. */ queueMicrotask: (callback: () => void) => void; /** * Simulates process.nextTick(). */ nextTick: (callback: () => void) => void; /** * Run all pending microtasks scheduled with nextTick. */ runMicrotasks: () => void; }; /** * Clock object created by lolex. */ type Clock = BrowserClock | NodeClock; /** * Additional methods that installed clock have. */ type InstalledMethods = { /** * Restores the original methods on the context that was passed to lolex.install, * or the native timers if no context was given. */ uninstall: () => void; methods: FakeMethod[]; }; /** * Clock object created by calling `install();`. * * @type TClock type of base clock (e.g BrowserClock). */ type InstalledClock<TClock extends Clock = Clock> = TClock & InstalledMethods; /** * Creates a clock. * * @param now Current time for the clock. * @param loopLimit Maximum number of timers that will be run when calling runAll() * before assuming that we have an infinite loop and throwing an error * (by default, 1000). * @type TClock Type of clock to create. * @remarks The default epoch is 0. */ export declare function createClock<TClock extends Clock = Clock>(now?: number | Date, loopLimit?: number): TClock; export interface LolexInstallOpts { /** * Installs lolex onto the specified target context (default: global) */ target?: any; /** * Installs lolex with the specified unix epoch (default: 0) */ now?: number | Date; /** * An array with explicit function names to hijack. When not set, lolex will automatically fake all methods except nextTick * e.g., lolex.install({ toFake: ["setTimeout", "nextTick"]}) will fake only setTimeout and nextTick */ toFake?: FakeMethod[]; /** * The maximum number of timers that will be run when calling runAll() (default: 1000) */ loopLimit?: number; /** * Tells lolex to increment mocked time automatically based on the real system time shift (e.g. the mocked time will be incremented by * 20ms for every 20ms change in the real system time) (default: false) */ shouldAdvanceTime?: boolean; /** * Relevant only when using with shouldAdvanceTime: true. increment mocked time by advanceTimeDelta ms every advanceTimeDelta ms change * in the real system time (default: 20) */ advanceTimeDelta?: number; } /** * Creates a clock and installs it globally. * * @param now Current time for the clock, as with lolex.createClock(). * @param toFake Names of methods that should be faked. * @type TClock Type of clock to create. */ export declare function install<TClock extends Clock = Clock>(opts?: LolexInstallOpts): InstalledClock<TClock>; export interface LolexWithContext { timers: GlobalTimers<TimerId>; createClock: <TClock extends Clock = Clock>(now?: number | Date, loopLimit?: number) => TClock; install: <TClock extends Clock = Clock>(opts?: LolexInstallOpts) => InstalledClock<TClock>; withGlobal: (global: Object) => LolexWithContext; } /** * Apply new context to lolex. * * @param global New context to apply like `window` (in browsers) or `global` (in node). */ export declare function withGlobal(global: Object): LolexWithContext; export declare const timers: GlobalTimers<TimerId>;
types/lolex/index.d.ts
1
https://github.com/DefinitelyTyped/DefinitelyTyped/commit/61ee030edd12a3a30459d0cdc1d9128fdf714c5c
[ 0.007493426091969013, 0.0006764893769286573, 0.00016490655252709985, 0.00017731962725520134, 0.00132091180421412 ]
{ "id": 12, "code_window": [ "\n", "browserClock.runToLast();\n", "nodeClock.runToLast();\n", "\n", "browserClock.setSystemTime();\n", "browserClock.setSystemTime(7);\n", "browserClock.setSystemTime(new Date());\n", "\n" ], "labels": [ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ], "after_edit": [ "browserClock.runToLastAsync().then(() => {});\n", "nodeClock.runToLastAsync().then(() => {});\n", "\n" ], "file_path": "types/lolex/lolex-tests.ts", "type": "add", "edit_start_line_idx": 110 }
import { invoke } from "./index"; export = invoke;
types/lodash/ts3.1/invoke.d.ts
0
https://github.com/DefinitelyTyped/DefinitelyTyped/commit/61ee030edd12a3a30459d0cdc1d9128fdf714c5c
[ 0.00017786143871489912, 0.00017786143871489912, 0.00017786143871489912, 0.00017786143871489912, 0 ]
{ "id": 12, "code_window": [ "\n", "browserClock.runToLast();\n", "nodeClock.runToLast();\n", "\n", "browserClock.setSystemTime();\n", "browserClock.setSystemTime(7);\n", "browserClock.setSystemTime(new Date());\n", "\n" ], "labels": [ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ], "after_edit": [ "browserClock.runToLastAsync().then(() => {});\n", "nodeClock.runToLastAsync().then(() => {});\n", "\n" ], "file_path": "types/lolex/lolex-tests.ts", "type": "add", "edit_start_line_idx": 110 }
import inquirer = require("inquirer"); /** * Password prompt example */ const requireLetterAndNumber: inquirer.Validator = value => { if (/\w/.test(value) && /\d/.test(value)) { return true; } return 'Password need to have at least a letter and a number'; }; inquirer .prompt([ { type: 'password', message: 'Enter a password', name: 'password1', validate: requireLetterAndNumber }, { type: 'password', message: 'Enter a masked password', name: 'password2', mask: '*', validate: requireLetterAndNumber } ]) .then(answers => console.log(JSON.stringify(answers, null, ' ')));
types/inquirer/test/password.ts
0
https://github.com/DefinitelyTyped/DefinitelyTyped/commit/61ee030edd12a3a30459d0cdc1d9128fdf714c5c
[ 0.00017704637139104307, 0.00017212735838256776, 0.00016885307559277862, 0.00017130497144535184, 0.0000030128360322123626 ]
{ "id": 12, "code_window": [ "\n", "browserClock.runToLast();\n", "nodeClock.runToLast();\n", "\n", "browserClock.setSystemTime();\n", "browserClock.setSystemTime(7);\n", "browserClock.setSystemTime(new Date());\n", "\n" ], "labels": [ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ], "after_edit": [ "browserClock.runToLastAsync().then(() => {});\n", "nodeClock.runToLastAsync().then(() => {});\n", "\n" ], "file_path": "types/lolex/lolex-tests.ts", "type": "add", "edit_start_line_idx": 110 }
// Type definitions for dotenv-flow 2.0 // Project: https://github.com/kerimdzhanov/dotenv-flow // Definitions by: Vincent Langlet <https://github.com/vincentlanglet> // Dan Kerimdzhanov <https://github.com/kerimdzhanov> // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// <reference types="node" /> export interface DotenvParseOptions { /** * You may turn on logging to help debug why certain keys or values are not being set as you expect. */ debug?: boolean; } export interface DotenvParseOutput { [name: string]: string; } /** * Parses a string or buffer in the .env file format into an object. * * @param src - contents to be parsed * @param options - additional options * @returns an object with keys and values based on `src` */ export function parse( src: string | Buffer, options?: DotenvParseOptions, ): DotenvParseOutput; export interface DotenvConfigOptions { /** * Node environment (development/test/production/etc,.). */ node_env?: string; /** * Default node environment to use if `process.env.NODE_ENV` is not present. */ default_node_env?: string; /** * Path to `.env*` files directory. */ path?: string; /** * Encoding for reading the `.env*` files. */ encoding?: string; /** * In some cases the original "dotenv" library can be used by one of the dependent npm modules. * It causes calling the original `dotenv.config()` that loads the `.env` file from your project before you can call `dotenv-flow.config()`. * * Such cases breaks `.env*` files priority because the previously loaded environment variables are treated as shell-defined thus having the higher priority. * * Setting the `purge_dotenv` option to `true` can gracefully fix this issue. */ purge_dotenv?: boolean; } export interface DotenvConfigOutput { error?: Error; parsed?: DotenvParseOutput; } /** * Loads `.env` file contents into {@link https://nodejs.org/api/process.html#process_process_env | `process.env`}. * Example: 'KEY=value' becomes { parsed: { KEY: 'value' } } * * @param options - controls behavior * @returns an object with a `parsed` key if successful or `error` key if an error occurred */ export function config(options?: DotenvConfigOptions): DotenvConfigOutput;
types/dotenv-flow/v2/index.d.ts
0
https://github.com/DefinitelyTyped/DefinitelyTyped/commit/61ee030edd12a3a30459d0cdc1d9128fdf714c5c
[ 0.00020448157738428563, 0.00017476428183726966, 0.00016667359159328043, 0.0001700224820524454, 0.000011891863323398866 ]
{ "id": 0, "code_window": [ "}\n", "\n", "export const ILanguagePackService = createDecorator<ILanguagePackService>('languagePackService');\n", "\n", "export interface ILanguagePackItem extends IQuickPickItem {\n", "\treadonly extensionId: string;\n", "\treadonly galleryExtension?: IGalleryExtension;\n", "}\n", "\n" ], "labels": [ "keep", "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep" ], "after_edit": [ "\treadonly extensionId?: string;\n" ], "file_path": "src/vs/platform/languagePacks/common/languagePacks.ts", "type": "replace", "edit_start_line_idx": 21 }
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import { createHash } from 'crypto'; import { equals } from 'vs/base/common/arrays'; import { Queue } from 'vs/base/common/async'; import { Disposable } from 'vs/base/common/lifecycle'; import { Schemas } from 'vs/base/common/network'; import { join } from 'vs/base/common/path'; import { Promises } from 'vs/base/node/pfs'; import { INativeEnvironmentService } from 'vs/platform/environment/common/environment'; import { IExtensionGalleryService, IExtensionIdentifier, IExtensionManagementService, ILocalExtension } from 'vs/platform/extensionManagement/common/extensionManagement'; import { areSameExtensions } from 'vs/platform/extensionManagement/common/extensionManagementUtil'; import { ILogService } from 'vs/platform/log/common/log'; import { ILocalizationContribution } from 'vs/platform/extensions/common/extensions'; import { ILanguagePackItem, LanguagePackBaseService } from 'vs/platform/languagePacks/common/languagePacks'; import { Language } from 'vs/base/common/platform'; import { URI } from 'vs/base/common/uri'; interface ILanguagePack { hash: string; label: string | undefined; extensions: { extensionIdentifier: IExtensionIdentifier; version: string; }[]; translations: { [id: string]: string }; } export class NativeLanguagePackService extends LanguagePackBaseService { private readonly cache: LanguagePacksCache; constructor( @IExtensionManagementService private readonly extensionManagementService: IExtensionManagementService, @INativeEnvironmentService environmentService: INativeEnvironmentService, @IExtensionGalleryService extensionGalleryService: IExtensionGalleryService, @ILogService private readonly logService: ILogService ) { super(extensionGalleryService); this.cache = this._register(new LanguagePacksCache(environmentService, logService)); this.extensionManagementService.registerParticipant({ postInstall: async (extension: ILocalExtension): Promise<void> => { return this.postInstallExtension(extension); }, postUninstall: async (extension: ILocalExtension): Promise<void> => { return this.postUninstallExtension(extension); } }); } async getBuiltInExtensionTranslationsUri(id: string): Promise<URI | undefined> { const packs = await this.cache.getLanguagePacks(); const pack = packs[Language.value()]; if (!pack) { this.logService.warn(`No language pack found for ${Language.value()}`); return undefined; } const translation = pack.translations[id]; return translation ? URI.file(translation) : undefined; } async getInstalledLanguages(): Promise<Array<ILanguagePackItem>> { const languagePacks = await this.cache.getLanguagePacks(); const languages = Object.keys(languagePacks).map(locale => { const languagePack = languagePacks[locale]; const baseQuickPick = this.createQuickPickItem(locale, languagePack.label); return { ...baseQuickPick, extensionId: languagePack.extensions[0].extensionIdentifier.id, }; }); languages.push({ ...this.createQuickPickItem('en', 'English'), extensionId: 'default', }); languages.sort((a, b) => a.label.localeCompare(b.label)); return languages; } private async postInstallExtension(extension: ILocalExtension): Promise<void> { if (extension && extension.manifest && extension.manifest.contributes && extension.manifest.contributes.localizations && extension.manifest.contributes.localizations.length) { this.logService.info('Adding language packs from the extension', extension.identifier.id); await this.update(); } } private async postUninstallExtension(extension: ILocalExtension): Promise<void> { const languagePacks = await this.cache.getLanguagePacks(); if (Object.keys(languagePacks).some(language => languagePacks[language] && languagePacks[language].extensions.some(e => areSameExtensions(e.extensionIdentifier, extension.identifier)))) { this.logService.info('Removing language packs from the extension', extension.identifier.id); await this.update(); } } async update(): Promise<boolean> { const [current, installed] = await Promise.all([this.cache.getLanguagePacks(), this.extensionManagementService.getInstalled()]); const updated = await this.cache.update(installed); return !equals(Object.keys(current), Object.keys(updated)); } } class LanguagePacksCache extends Disposable { private languagePacks: { [language: string]: ILanguagePack } = {}; private languagePacksFilePath: string; private languagePacksFileLimiter: Queue<any>; private initializedCache: boolean | undefined; constructor( @INativeEnvironmentService environmentService: INativeEnvironmentService, @ILogService private readonly logService: ILogService ) { super(); this.languagePacksFilePath = join(environmentService.userDataPath, 'languagepacks.json'); this.languagePacksFileLimiter = new Queue(); } getLanguagePacks(): Promise<{ [language: string]: ILanguagePack }> { // if queue is not empty, fetch from disk if (this.languagePacksFileLimiter.size || !this.initializedCache) { return this.withLanguagePacks() .then(() => this.languagePacks); } return Promise.resolve(this.languagePacks); } update(extensions: ILocalExtension[]): Promise<{ [language: string]: ILanguagePack }> { return this.withLanguagePacks(languagePacks => { Object.keys(languagePacks).forEach(language => delete languagePacks[language]); this.createLanguagePacksFromExtensions(languagePacks, ...extensions); }).then(() => this.languagePacks); } private createLanguagePacksFromExtensions(languagePacks: { [language: string]: ILanguagePack }, ...extensions: ILocalExtension[]): void { for (const extension of extensions) { if (extension && extension.manifest && extension.manifest.contributes && extension.manifest.contributes.localizations && extension.manifest.contributes.localizations.length) { this.createLanguagePacksFromExtension(languagePacks, extension); } } Object.keys(languagePacks).forEach(languageId => this.updateHash(languagePacks[languageId])); } private createLanguagePacksFromExtension(languagePacks: { [language: string]: ILanguagePack }, extension: ILocalExtension): void { const extensionIdentifier = extension.identifier; const localizations = extension.manifest.contributes && extension.manifest.contributes.localizations ? extension.manifest.contributes.localizations : []; for (const localizationContribution of localizations) { if (extension.location.scheme === Schemas.file && isValidLocalization(localizationContribution)) { let languagePack = languagePacks[localizationContribution.languageId]; if (!languagePack) { languagePack = { hash: '', extensions: [], translations: {}, label: localizationContribution.localizedLanguageName ?? localizationContribution.languageName }; languagePacks[localizationContribution.languageId] = languagePack; } const extensionInLanguagePack = languagePack.extensions.filter(e => areSameExtensions(e.extensionIdentifier, extensionIdentifier))[0]; if (extensionInLanguagePack) { extensionInLanguagePack.version = extension.manifest.version; } else { languagePack.extensions.push({ extensionIdentifier, version: extension.manifest.version }); } for (const translation of localizationContribution.translations) { languagePack.translations[translation.id] = join(extension.location.fsPath, translation.path); } } } } private updateHash(languagePack: ILanguagePack): void { if (languagePack) { const md5 = createHash('md5'); for (const extension of languagePack.extensions) { md5.update(extension.extensionIdentifier.uuid || extension.extensionIdentifier.id).update(extension.version); } languagePack.hash = md5.digest('hex'); } } private withLanguagePacks<T>(fn: (languagePacks: { [language: string]: ILanguagePack }) => T | null = () => null): Promise<T> { return this.languagePacksFileLimiter.queue(() => { let result: T | null = null; return Promises.readFile(this.languagePacksFilePath, 'utf8') .then(undefined, err => err.code === 'ENOENT' ? Promise.resolve('{}') : Promise.reject(err)) .then<{ [language: string]: ILanguagePack }>(raw => { try { return JSON.parse(raw); } catch (e) { return {}; } }) .then(languagePacks => { result = fn(languagePacks); return languagePacks; }) .then(languagePacks => { for (const language of Object.keys(languagePacks)) { if (!languagePacks[language]) { delete languagePacks[language]; } } this.languagePacks = languagePacks; this.initializedCache = true; const raw = JSON.stringify(this.languagePacks); this.logService.debug('Writing language packs', raw); return Promises.writeFile(this.languagePacksFilePath, raw); }) .then(() => result, error => this.logService.error(error)); }); } } function isValidLocalization(localization: ILocalizationContribution): boolean { if (typeof localization.languageId !== 'string') { return false; } if (!Array.isArray(localization.translations) || localization.translations.length === 0) { return false; } for (const translation of localization.translations) { if (typeof translation.id !== 'string') { return false; } if (typeof translation.path !== 'string') { return false; } } if (localization.languageName && typeof localization.languageName !== 'string') { return false; } if (localization.localizedLanguageName && typeof localization.localizedLanguageName !== 'string') { return false; } return true; }
src/vs/platform/languagePacks/node/languagePacks.ts
1
https://github.com/microsoft/vscode/commit/00e8fdec5dcd099ae21c1b9f9851179f6fb1ab2f
[ 0.9988275170326233, 0.25364795327186584, 0.00016556450282223523, 0.00076436554081738, 0.39680036902427673 ]
{ "id": 0, "code_window": [ "}\n", "\n", "export const ILanguagePackService = createDecorator<ILanguagePackService>('languagePackService');\n", "\n", "export interface ILanguagePackItem extends IQuickPickItem {\n", "\treadonly extensionId: string;\n", "\treadonly galleryExtension?: IGalleryExtension;\n", "}\n", "\n" ], "labels": [ "keep", "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep" ], "after_edit": [ "\treadonly extensionId?: string;\n" ], "file_path": "src/vs/platform/languagePacks/common/languagePacks.ts", "type": "replace", "edit_start_line_idx": 21 }
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import { ICredentialsService } from 'vs/platform/credentials/common/credentials'; import { registerMainProcessRemoteService } from 'vs/platform/ipc/electron-sandbox/services'; registerMainProcessRemoteService(ICredentialsService, 'credentials');
src/vs/workbench/services/credentials/electron-sandbox/credentialsService.ts
0
https://github.com/microsoft/vscode/commit/00e8fdec5dcd099ae21c1b9f9851179f6fb1ab2f
[ 0.00017470768943894655, 0.00017470768943894655, 0.00017470768943894655, 0.00017470768943894655, 0 ]
{ "id": 0, "code_window": [ "}\n", "\n", "export const ILanguagePackService = createDecorator<ILanguagePackService>('languagePackService');\n", "\n", "export interface ILanguagePackItem extends IQuickPickItem {\n", "\treadonly extensionId: string;\n", "\treadonly galleryExtension?: IGalleryExtension;\n", "}\n", "\n" ], "labels": [ "keep", "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep" ], "after_edit": [ "\treadonly extensionId?: string;\n" ], "file_path": "src/vs/platform/languagePacks/common/languagePacks.ts", "type": "replace", "edit_start_line_idx": 21 }
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. # yarn lockfile v1 "@octokit/auth-token@^3.0.0": version "3.0.1" resolved "https://registry.yarnpkg.com/@octokit/auth-token/-/auth-token-3.0.1.tgz#88bc2baf5d706cb258474e722a720a8365dff2ec" integrity sha512-/USkK4cioY209wXRpund6HZzHo9GmjakpV9ycOkpMcMxMk7QVcVFVyCMtzvXYiHsB2crgDgrtNYSELYFBXhhaA== dependencies: "@octokit/types" "^7.0.0" "@octokit/core@^4.0.0": version "4.0.5" resolved "https://registry.yarnpkg.com/@octokit/core/-/core-4.0.5.tgz#589e68c0a35d2afdcd41dafceab072c2fbc6ab5f" integrity sha512-4R3HeHTYVHCfzSAi0C6pbGXV8UDI5Rk+k3G7kLVNckswN9mvpOzW9oENfjfH3nEmzg8y3AmKmzs8Sg6pLCeOCA== dependencies: "@octokit/auth-token" "^3.0.0" "@octokit/graphql" "^5.0.0" "@octokit/request" "^6.0.0" "@octokit/request-error" "^3.0.0" "@octokit/types" "^7.0.0" before-after-hook "^2.2.0" universal-user-agent "^6.0.0" "@octokit/endpoint@^7.0.0": version "7.0.1" resolved "https://registry.yarnpkg.com/@octokit/endpoint/-/endpoint-7.0.1.tgz#cb0d03e62e8762f3c80e52b025179de81899a823" integrity sha512-/wTXAJwt0HzJ2IeE4kQXO+mBScfzyCkI0hMtkIaqyXd9zg76OpOfNQfHL9FlaxAV2RsNiOXZibVWloy8EexENg== dependencies: "@octokit/types" "^7.0.0" is-plain-object "^5.0.0" universal-user-agent "^6.0.0" "@octokit/graphql@^5.0.0": version "5.0.1" resolved "https://registry.yarnpkg.com/@octokit/graphql/-/graphql-5.0.1.tgz#a06982514ad131fb6fbb9da968653b2233fade9b" integrity sha512-sxmnewSwAixkP1TrLdE6yRG53eEhHhDTYUykUwdV9x8f91WcbhunIHk9x1PZLALdBZKRPUO2HRcm4kezZ79HoA== dependencies: "@octokit/request" "^6.0.0" "@octokit/types" "^7.0.0" universal-user-agent "^6.0.0" "@octokit/openapi-types@^13.6.0": version "13.6.0" resolved "https://registry.yarnpkg.com/@octokit/openapi-types/-/openapi-types-13.6.0.tgz#381884008e23fd82fd444553f6b4dcd24a5c4a4d" integrity sha512-bxftLwoZ2J6zsU1rzRvk0O32j7lVB0NWWn+P5CDHn9zPzytasR3hdAeXlTngRDkqv1LyEeuy5psVnDkmOSwrcQ== "@octokit/plugin-paginate-rest@^4.0.0": version "4.2.0" resolved "https://registry.yarnpkg.com/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-4.2.0.tgz#41fc6ca312446a85a4275aca698b4d9c4c5e06ab" integrity sha512-8otLCIK9esfmOCY14CBnG/xPqv0paf14rc+s9tHpbOpeFwrv5CnECKW1qdqMAT60ngAa9eB1bKQ+l2YCpi0HPQ== dependencies: "@octokit/types" "^7.2.0" "@octokit/plugin-request-log@^1.0.4": version "1.0.4" resolved "https://registry.yarnpkg.com/@octokit/plugin-request-log/-/plugin-request-log-1.0.4.tgz#5e50ed7083a613816b1e4a28aeec5fb7f1462e85" integrity sha512-mLUsMkgP7K/cnFEw07kWqXGF5LKrOkD+lhCrKvPHXWDywAwuDUeDwWBpc69XK3pNX0uKiVt8g5z96PJ6z9xCFA== "@octokit/plugin-rest-endpoint-methods@^6.0.0": version "6.4.0" resolved "https://registry.yarnpkg.com/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-6.4.0.tgz#09584dd4e85fc4fe04ade45620b105af582c20ba" integrity sha512-YP4eUqZ6vORy/eZOTdil1ZSrMt0kv7i/CVw+HhC2C0yJN+IqTc/rot957JQ7JfyeJD6HZOjLg6Jp1o9cPhI9KA== dependencies: "@octokit/types" "^7.2.0" deprecation "^2.3.1" "@octokit/request-error@^3.0.0": version "3.0.1" resolved "https://registry.yarnpkg.com/@octokit/request-error/-/request-error-3.0.1.tgz#3fd747913c06ab2195e52004a521889dadb4b295" integrity sha512-ym4Bp0HTP7F3VFssV88WD1ZyCIRoE8H35pXSKwLeMizcdZAYc/t6N9X9Yr9n6t3aG9IH75XDnZ6UeZph0vHMWQ== dependencies: "@octokit/types" "^7.0.0" deprecation "^2.0.0" once "^1.4.0" "@octokit/request@^6.0.0": version "6.2.1" resolved "https://registry.yarnpkg.com/@octokit/request/-/request-6.2.1.tgz#3ceeb22dab09a29595d96594b6720fc14495cf4e" integrity sha512-gYKRCia3cpajRzDSU+3pt1q2OcuC6PK8PmFIyxZDWCzRXRSIBH8jXjFJ8ZceoygBIm0KsEUg4x1+XcYBz7dHPQ== dependencies: "@octokit/endpoint" "^7.0.0" "@octokit/request-error" "^3.0.0" "@octokit/types" "^7.0.0" is-plain-object "^5.0.0" node-fetch "^2.6.7" universal-user-agent "^6.0.0" "@octokit/[email protected]": version "19.0.4" resolved "https://registry.yarnpkg.com/@octokit/rest/-/rest-19.0.4.tgz#fd8bed1cefffa486e9ae46a9dc608ce81bcfcbdd" integrity sha512-LwG668+6lE8zlSYOfwPj4FxWdv/qFXYBpv79TWIQEpBLKA9D/IMcWsF/U9RGpA3YqMVDiTxpgVpEW3zTFfPFTA== dependencies: "@octokit/core" "^4.0.0" "@octokit/plugin-paginate-rest" "^4.0.0" "@octokit/plugin-request-log" "^1.0.4" "@octokit/plugin-rest-endpoint-methods" "^6.0.0" "@octokit/types@^7.0.0", "@octokit/types@^7.2.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@octokit/types/-/types-7.2.0.tgz#7ee0fc27f9f463d7ccf12ca5956988d498b3c6c4" integrity sha512-pYQ/a1U6mHptwhGyp6SvsiM4bWP2s3V95olUeTxas85D/2kN78yN5C8cGN+P4LwJSWUqIEyvq0Qn2WUn6NQRjw== dependencies: "@octokit/openapi-types" "^13.6.0" "@types/[email protected]": version "16.11.6" resolved "https://registry.yarnpkg.com/@types/node/-/node-16.11.6.tgz#6bef7a2a0ad684cf6e90fcfe31cecabd9ce0a3ae" integrity sha512-ua7PgUoeQFjmWPcoo9khiPum3Pd60k4/2ZGXt18sm2Slk0W0xZTqt5Y0Ny1NyBiN1EVQ/+FaF9NcY4Qe6rwk5w== before-after-hook@^2.2.0: version "2.2.2" resolved "https://registry.yarnpkg.com/before-after-hook/-/before-after-hook-2.2.2.tgz#a6e8ca41028d90ee2c24222f201c90956091613e" integrity sha512-3pZEU3NT5BFUo/AD5ERPWOgQOCZITni6iavr5AUw5AUwQjMlI0kzu5btnyD39AF0gUEsDPwJT+oY1ORBJijPjQ== deprecation@^2.0.0, deprecation@^2.3.1: version "2.3.1" resolved "https://registry.yarnpkg.com/deprecation/-/deprecation-2.3.1.tgz#6368cbdb40abf3373b525ac87e4a260c3a700919" integrity sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ== is-plain-object@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-5.0.0.tgz#4427f50ab3429e9025ea7d52e9043a9ef4159344" integrity sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q== node-fetch@^2.6.7: version "2.6.7" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.7.tgz#24de9fba827e3b4ae44dc8b20256a379160052ad" integrity sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ== dependencies: whatwg-url "^5.0.0" once@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E= dependencies: wrappy "1" tr46@~0.0.3: version "0.0.3" resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" integrity sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o= tunnel@^0.0.6: version "0.0.6" resolved "https://registry.yarnpkg.com/tunnel/-/tunnel-0.0.6.tgz#72f1314b34a5b192db012324df2cc587ca47f92c" integrity sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg== universal-user-agent@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/universal-user-agent/-/universal-user-agent-6.0.0.tgz#3381f8503b251c0d9cd21bc1de939ec9df5480ee" integrity sha512-isyNax3wXoKaulPDZWHQqbmIx1k2tb9fb3GGDBRxCscfYV2Ch7WxPArBsFEG8s/safwXTT7H4QGhaIkTp9447w== webidl-conversions@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" integrity sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE= whatwg-url@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d" integrity sha1-lmRU6HZUYuN2RNNib2dCzotwll0= dependencies: tr46 "~0.0.3" webidl-conversions "^3.0.0" wrappy@1: version "1.0.2" resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=
extensions/github/yarn.lock
0
https://github.com/microsoft/vscode/commit/00e8fdec5dcd099ae21c1b9f9851179f6fb1ab2f
[ 0.0001761554303811863, 0.000169046048540622, 0.00016272741777356714, 0.0001692292862571776, 0.000003548435415723361 ]
{ "id": 0, "code_window": [ "}\n", "\n", "export const ILanguagePackService = createDecorator<ILanguagePackService>('languagePackService');\n", "\n", "export interface ILanguagePackItem extends IQuickPickItem {\n", "\treadonly extensionId: string;\n", "\treadonly galleryExtension?: IGalleryExtension;\n", "}\n", "\n" ], "labels": [ "keep", "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep" ], "after_edit": [ "\treadonly extensionId?: string;\n" ], "file_path": "src/vs/platform/languagePacks/common/languagePacks.ts", "type": "replace", "edit_start_line_idx": 21 }
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import { rtrim } from 'vs/base/common/strings'; export function normalizeGitHubUrl(url: string): string { // If the url has a .git suffix, remove it if (url.endsWith('.git')) { url = url.substr(0, url.length - 4); } // Remove trailing slash url = rtrim(url, '/'); if (url.endsWith('/new')) { url = rtrim(url, '/new'); } if (url.endsWith('/issues')) { url = rtrim(url, '/issues'); } return url; }
src/vs/platform/issue/common/issueReporterUtil.ts
0
https://github.com/microsoft/vscode/commit/00e8fdec5dcd099ae21c1b9f9851179f6fb1ab2f
[ 0.00017935293726623058, 0.00017690662934910506, 0.00017468685109633952, 0.00017668008513282984, 0.0000019116450857836753 ]
{ "id": 1, "code_window": [ "\t\t\t\textensionId: lp.identifier.id,\n", "\t\t\t\tgalleryExtension: lp\n", "\t\t\t};\n", "\t\t});\n", "\n", "\t\tallFromMarketplace.push({\n", "\t\t\t...this.createQuickPickItem('en', 'English'),\n", "\t\t\textensionId: 'default',\n", "\t\t});\n", "\n", "\t\treturn allFromMarketplace;\n", "\t}\n", "\n" ], "labels": [ "keep", "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep" ], "after_edit": [ "\t\tallFromMarketplace.push(this.createQuickPickItem('en', 'English'));\n" ], "file_path": "src/vs/platform/languagePacks/common/languagePacks.ts", "type": "replace", "edit_start_line_idx": 70 }
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import { CancellationTokenSource } from 'vs/base/common/cancellation'; import { Disposable } from 'vs/base/common/lifecycle'; import { language } from 'vs/base/common/platform'; import { URI } from 'vs/base/common/uri'; import { IQuickPickItem } from 'vs/base/parts/quickinput/common/quickInput'; import { localize } from 'vs/nls'; import { IExtensionGalleryService, IGalleryExtension } from 'vs/platform/extensionManagement/common/extensionManagement'; import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; export function getLocale(extension: IGalleryExtension): string | undefined { return extension.tags.find(t => t.startsWith('lp-'))?.split('lp-')[1]; } export const ILanguagePackService = createDecorator<ILanguagePackService>('languagePackService'); export interface ILanguagePackItem extends IQuickPickItem { readonly extensionId: string; readonly galleryExtension?: IGalleryExtension; } export interface ILanguagePackService { readonly _serviceBrand: undefined; getAvailableLanguages(): Promise<Array<ILanguagePackItem>>; getInstalledLanguages(): Promise<Array<ILanguagePackItem>>; getBuiltInExtensionTranslationsUri(id: string): Promise<URI | undefined>; } export abstract class LanguagePackBaseService extends Disposable implements ILanguagePackService { declare readonly _serviceBrand: undefined; constructor(@IExtensionGalleryService protected readonly extensionGalleryService: IExtensionGalleryService) { super(); } abstract getBuiltInExtensionTranslationsUri(id: string): Promise<URI | undefined>; abstract getInstalledLanguages(): Promise<Array<ILanguagePackItem>>; async getAvailableLanguages(): Promise<ILanguagePackItem[]> { const timeout = new CancellationTokenSource(); setTimeout(() => timeout.cancel(), 1000); let result; try { result = await this.extensionGalleryService.query({ text: 'category:"language packs"', pageSize: 20 }, timeout.token); } catch (_) { // This method is best effort. So, we ignore any errors. return []; } const languagePackExtensions = result.firstPage.filter(e => e.properties.localizedLanguages?.length && e.tags.some(t => t.startsWith('lp-'))); const allFromMarketplace: ILanguagePackItem[] = languagePackExtensions.map(lp => { const languageName = lp.properties.localizedLanguages?.[0]; const locale = getLocale(lp)!; const baseQuickPick = this.createQuickPickItem(locale, languageName, lp); return { ...baseQuickPick, extensionId: lp.identifier.id, galleryExtension: lp }; }); allFromMarketplace.push({ ...this.createQuickPickItem('en', 'English'), extensionId: 'default', }); return allFromMarketplace; } protected createQuickPickItem(locale: string, languageName?: string, languagePack?: IGalleryExtension): IQuickPickItem { const label = languageName ?? locale; let description: string | undefined; if (label !== locale) { description = `(${locale})`; } if (locale.toLowerCase() === language.toLowerCase()) { description ??= ''; description += localize('currentDisplayLanguage', " (Current)"); } if (languagePack?.installCount) { description ??= ''; const count = languagePack.installCount; let countLabel: string; if (count > 1000000) { countLabel = `${Math.floor(count / 100000) / 10}M`; } else if (count > 1000) { countLabel = `${Math.floor(count / 1000)}K`; } else { countLabel = String(count); } description += ` $(cloud-download) ${countLabel}`; } return { id: locale, label, description }; } }
src/vs/platform/languagePacks/common/languagePacks.ts
1
https://github.com/microsoft/vscode/commit/00e8fdec5dcd099ae21c1b9f9851179f6fb1ab2f
[ 0.047232918441295624, 0.004289979115128517, 0.00016700258129276335, 0.00017525306611787528, 0.012955456040799618 ]
{ "id": 1, "code_window": [ "\t\t\t\textensionId: lp.identifier.id,\n", "\t\t\t\tgalleryExtension: lp\n", "\t\t\t};\n", "\t\t});\n", "\n", "\t\tallFromMarketplace.push({\n", "\t\t\t...this.createQuickPickItem('en', 'English'),\n", "\t\t\textensionId: 'default',\n", "\t\t});\n", "\n", "\t\treturn allFromMarketplace;\n", "\t}\n", "\n" ], "labels": [ "keep", "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep" ], "after_edit": [ "\t\tallFromMarketplace.push(this.createQuickPickItem('en', 'English'));\n" ], "file_path": "src/vs/platform/languagePacks/common/languagePacks.ts", "type": "replace", "edit_start_line_idx": 70 }
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ /* * Interface types for Monarch language definitions * These descriptions are really supposed to be JSON values but if using typescript * to describe them, these type definitions can help check the validity. */ /** * A Monarch language definition */ export interface IMonarchLanguage { /** * map from string to ILanguageRule[] */ tokenizer: { [name: string]: IMonarchLanguageRule[] }; /** * is the language case insensitive? */ ignoreCase?: boolean; /** * is the language unicode-aware? (i.e., /\u{1D306}/) */ unicode?: boolean; /** * if no match in the tokenizer assign this token class (default 'source') */ defaultToken?: string; /** * for example [['{','}','delimiter.curly']] */ brackets?: IMonarchLanguageBracket[]; /** * start symbol in the tokenizer (by default the first entry is used) */ start?: string; /** * attach this to every token class (by default '.' + name) */ tokenPostfix?: string; /** * include line feeds (in the form of a \n character) at the end of lines * Defaults to false */ includeLF?: boolean; /** * Other keys that can be referred to by the tokenizer. */ [key: string]: any; } /** * A rule is either a regular expression and an action * shorthands: [reg,act] == { regex: reg, action: act} * and : [reg,act,nxt] == { regex: reg, action: act{ next: nxt }} */ export type IShortMonarchLanguageRule1 = [string | RegExp, IMonarchLanguageAction]; export type IShortMonarchLanguageRule2 = [string | RegExp, IMonarchLanguageAction, string]; export interface IExpandedMonarchLanguageRule { /** * match tokens */ regex?: string | RegExp; /** * action to take on match */ action?: IMonarchLanguageAction; /** * or an include rule. include all rules from the included state */ include?: string; } export type IMonarchLanguageRule = IShortMonarchLanguageRule1 | IShortMonarchLanguageRule2 | IExpandedMonarchLanguageRule; /** * An action is either an array of actions... * ... or a case statement with guards... * ... or a basic action with a token value. */ export type IShortMonarchLanguageAction = string; export interface IExpandedMonarchLanguageAction { /** * array of actions for each parenthesized match group */ group?: IMonarchLanguageAction[]; /** * map from string to ILanguageAction */ cases?: Object; /** * token class (ie. css class) (or "@brackets" or "@rematch") */ token?: string; /** * the next state to push, or "@push", "@pop", "@popall" */ next?: string; /** * switch to this state */ switchTo?: string; /** * go back n characters in the stream */ goBack?: number; /** * @open or @close */ bracket?: string; /** * switch to embedded language (using the mimetype) or get out using "@pop" */ nextEmbedded?: string; /** * log a message to the browser console window */ log?: string; } export type IMonarchLanguageAction = IShortMonarchLanguageAction | IExpandedMonarchLanguageAction | (IShortMonarchLanguageAction | IExpandedMonarchLanguageAction)[]; /** * This interface can be shortened as an array, ie. ['{','}','delimiter.curly'] */ export interface IMonarchLanguageBracket { /** * open bracket */ open: string; /** * closing bracket */ close: string; /** * token class */ token: string; }
src/vs/editor/standalone/common/monarch/monarchTypes.ts
0
https://github.com/microsoft/vscode/commit/00e8fdec5dcd099ae21c1b9f9851179f6fb1ab2f
[ 0.00017549304175190628, 0.00017143989680334926, 0.00016610228340141475, 0.00017270902753807604, 0.0000032646853469486814 ]
{ "id": 1, "code_window": [ "\t\t\t\textensionId: lp.identifier.id,\n", "\t\t\t\tgalleryExtension: lp\n", "\t\t\t};\n", "\t\t});\n", "\n", "\t\tallFromMarketplace.push({\n", "\t\t\t...this.createQuickPickItem('en', 'English'),\n", "\t\t\textensionId: 'default',\n", "\t\t});\n", "\n", "\t\treturn allFromMarketplace;\n", "\t}\n", "\n" ], "labels": [ "keep", "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep" ], "after_edit": [ "\t\tallFromMarketplace.push(this.createQuickPickItem('en', 'English'));\n" ], "file_path": "src/vs/platform/languagePacks/common/languagePacks.ts", "type": "replace", "edit_start_line_idx": 70 }
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import * as assert from 'assert'; import * as fs from 'fs'; import * as encoding from 'vs/workbench/services/textfile/common/encoding'; import * as streams from 'vs/base/common/stream'; import * as iconv from '@vscode/iconv-lite-umd'; import { newWriteableBufferStream, VSBuffer, VSBufferReadableStream, streamToBufferReadableStream } from 'vs/base/common/buffer'; import { splitLines } from 'vs/base/common/strings'; import { FileAccess } from 'vs/base/common/network'; export async function detectEncodingByBOM(file: string): Promise<typeof encoding.UTF16be | typeof encoding.UTF16le | typeof encoding.UTF8_with_bom | null> { try { const { buffer, bytesRead } = await readExactlyByFile(file, 3); return encoding.detectEncodingByBOMFromBuffer(buffer, bytesRead); } catch (error) { return null; // ignore errors (like file not found) } } interface ReadResult { buffer: VSBuffer | null; bytesRead: number; } function readExactlyByFile(file: string, totalBytes: number): Promise<ReadResult> { return new Promise<ReadResult>((resolve, reject) => { fs.open(file, 'r', null, (err, fd) => { if (err) { return reject(err); } function end(err: Error | null, resultBuffer: Buffer | null, bytesRead: number): void { fs.close(fd, closeError => { if (closeError) { return reject(closeError); } if (err && (<any>err).code === 'EISDIR') { return reject(err); // we want to bubble this error up (file is actually a folder) } return resolve({ buffer: resultBuffer ? VSBuffer.wrap(resultBuffer) : null, bytesRead }); }); } const buffer = Buffer.allocUnsafe(totalBytes); let offset = 0; function readChunk(): void { fs.read(fd, buffer, offset, totalBytes - offset, null, (err, bytesRead) => { if (err) { return end(err, null, 0); } if (bytesRead === 0) { return end(null, buffer, offset); } offset += bytesRead; if (offset === totalBytes) { return end(null, buffer, offset); } return readChunk(); }); } readChunk(); }); }); } suite('Encoding', () => { test('detectBOM does not return error for non existing file', async () => { const file = FileAccess.asFileUri('vs/workbench/services/textfile/test/node/encoding/fixtures/not-exist.css').fsPath; const detectedEncoding = await detectEncodingByBOM(file); assert.strictEqual(detectedEncoding, null); }); test('detectBOM UTF-8', async () => { const file = FileAccess.asFileUri('vs/workbench/services/textfile/test/node/encoding/fixtures/some_utf8.css').fsPath; const detectedEncoding = await detectEncodingByBOM(file); assert.strictEqual(detectedEncoding, 'utf8bom'); }); test('detectBOM UTF-16 LE', async () => { const file = FileAccess.asFileUri('vs/workbench/services/textfile/test/node/encoding/fixtures/some_utf16le.css').fsPath; const detectedEncoding = await detectEncodingByBOM(file); assert.strictEqual(detectedEncoding, 'utf16le'); }); test('detectBOM UTF-16 BE', async () => { const file = FileAccess.asFileUri('vs/workbench/services/textfile/test/node/encoding/fixtures/some_utf16be.css').fsPath; const detectedEncoding = await detectEncodingByBOM(file); assert.strictEqual(detectedEncoding, 'utf16be'); }); test('detectBOM ANSI', async function () { const file = FileAccess.asFileUri('vs/workbench/services/textfile/test/node/encoding/fixtures/some_ansi.css').fsPath; const detectedEncoding = await detectEncodingByBOM(file); assert.strictEqual(detectedEncoding, null); }); test('detectBOM ANSI (2)', async function () { const file = FileAccess.asFileUri('vs/workbench/services/textfile/test/node/encoding/fixtures/empty.txt').fsPath; const detectedEncoding = await detectEncodingByBOM(file); assert.strictEqual(detectedEncoding, null); }); test('detectEncodingFromBuffer (JSON saved as PNG)', async function () { const file = FileAccess.asFileUri('vs/workbench/services/textfile/test/node/encoding/fixtures/some.json.png').fsPath; const buffer = await readExactlyByFile(file, 512); const mimes = encoding.detectEncodingFromBuffer(buffer); assert.strictEqual(mimes.seemsBinary, false); }); test('detectEncodingFromBuffer (PNG saved as TXT)', async function () { const file = FileAccess.asFileUri('vs/workbench/services/textfile/test/node/encoding/fixtures/some.png.txt').fsPath; const buffer = await readExactlyByFile(file, 512); const mimes = encoding.detectEncodingFromBuffer(buffer); assert.strictEqual(mimes.seemsBinary, true); }); test('detectEncodingFromBuffer (XML saved as PNG)', async function () { const file = FileAccess.asFileUri('vs/workbench/services/textfile/test/node/encoding/fixtures/some.xml.png').fsPath; const buffer = await readExactlyByFile(file, 512); const mimes = encoding.detectEncodingFromBuffer(buffer); assert.strictEqual(mimes.seemsBinary, false); }); test('detectEncodingFromBuffer (QWOFF saved as TXT)', async function () { const file = FileAccess.asFileUri('vs/workbench/services/textfile/test/node/encoding/fixtures/some.qwoff.txt').fsPath; const buffer = await readExactlyByFile(file, 512); const mimes = encoding.detectEncodingFromBuffer(buffer); assert.strictEqual(mimes.seemsBinary, true); }); test('detectEncodingFromBuffer (CSS saved as QWOFF)', async function () { const file = FileAccess.asFileUri('vs/workbench/services/textfile/test/node/encoding/fixtures/some.css.qwoff').fsPath; const buffer = await readExactlyByFile(file, 512); const mimes = encoding.detectEncodingFromBuffer(buffer); assert.strictEqual(mimes.seemsBinary, false); }); test('detectEncodingFromBuffer (PDF)', async function () { const file = FileAccess.asFileUri('vs/workbench/services/textfile/test/node/encoding/fixtures/some.pdf').fsPath; const buffer = await readExactlyByFile(file, 512); const mimes = encoding.detectEncodingFromBuffer(buffer); assert.strictEqual(mimes.seemsBinary, true); }); test('detectEncodingFromBuffer (guess UTF-16 LE from content without BOM)', async function () { const file = FileAccess.asFileUri('vs/workbench/services/textfile/test/node/encoding/fixtures/utf16_le_nobom.txt').fsPath; const buffer = await readExactlyByFile(file, 512); const mimes = encoding.detectEncodingFromBuffer(buffer); assert.strictEqual(mimes.encoding, encoding.UTF16le); assert.strictEqual(mimes.seemsBinary, false); }); test('detectEncodingFromBuffer (guess UTF-16 BE from content without BOM)', async function () { const file = FileAccess.asFileUri('vs/workbench/services/textfile/test/node/encoding/fixtures/utf16_be_nobom.txt').fsPath; const buffer = await readExactlyByFile(file, 512); const mimes = encoding.detectEncodingFromBuffer(buffer); assert.strictEqual(mimes.encoding, encoding.UTF16be); assert.strictEqual(mimes.seemsBinary, false); }); test('autoGuessEncoding (UTF8)', async function () { const file = FileAccess.asFileUri('vs/workbench/services/textfile/test/node/encoding/fixtures/some_file.css').fsPath; const buffer = await readExactlyByFile(file, 512 * 8); const mimes = await encoding.detectEncodingFromBuffer(buffer, true); assert.strictEqual(mimes.encoding, 'utf8'); }); test('autoGuessEncoding (ASCII)', async function () { const file = FileAccess.asFileUri('vs/workbench/services/textfile/test/node/encoding/fixtures/some_ansi.css').fsPath; const buffer = await readExactlyByFile(file, 512 * 8); const mimes = await encoding.detectEncodingFromBuffer(buffer, true); assert.strictEqual(mimes.encoding, null); }); test('autoGuessEncoding (ShiftJIS)', async function () { const file = FileAccess.asFileUri('vs/workbench/services/textfile/test/node/encoding/fixtures/some.shiftjis.txt').fsPath; const buffer = await readExactlyByFile(file, 512 * 8); const mimes = await encoding.detectEncodingFromBuffer(buffer, true); assert.strictEqual(mimes.encoding, 'shiftjis'); }); test('autoGuessEncoding (CP1252)', async function () { const file = FileAccess.asFileUri('vs/workbench/services/textfile/test/node/encoding/fixtures/some.cp1252.txt').fsPath; const buffer = await readExactlyByFile(file, 512 * 8); const mimes = await encoding.detectEncodingFromBuffer(buffer, true); assert.strictEqual(mimes.encoding, 'windows1252'); }); async function readAndDecodeFromDisk(path: string, fileEncoding: string | null) { return new Promise<string>((resolve, reject) => { fs.readFile(path, (err, data) => { if (err) { reject(err); } else { resolve(iconv.decode(data, encoding.toNodeEncoding(fileEncoding!))); } }); }); } function newTestReadableStream(buffers: Buffer[]): VSBufferReadableStream { const stream = newWriteableBufferStream(); buffers .map(VSBuffer.wrap) .forEach(buffer => { setTimeout(() => { stream.write(buffer); }); }); setTimeout(() => { stream.end(); }); return stream; } async function readAllAsString(stream: streams.ReadableStream<string>) { return streams.consumeStream(stream, strings => strings.join('')); } test('toDecodeStream - some stream', async function () { const source = newTestReadableStream([ Buffer.from([65, 66, 67]), Buffer.from([65, 66, 67]), Buffer.from([65, 66, 67]), ]); const { detected, stream } = await encoding.toDecodeStream(source, { acceptTextOnly: true, minBytesRequiredForDetection: 4, guessEncoding: false, overwriteEncoding: async detected => detected || encoding.UTF8 }); assert.ok(detected); assert.ok(stream); const content = await readAllAsString(stream); assert.strictEqual(content, 'ABCABCABC'); }); test('toDecodeStream - some stream, expect too much data', async function () { const source = newTestReadableStream([ Buffer.from([65, 66, 67]), Buffer.from([65, 66, 67]), Buffer.from([65, 66, 67]), ]); const { detected, stream } = await encoding.toDecodeStream(source, { acceptTextOnly: true, minBytesRequiredForDetection: 64, guessEncoding: false, overwriteEncoding: async detected => detected || encoding.UTF8 }); assert.ok(detected); assert.ok(stream); const content = await readAllAsString(stream); assert.strictEqual(content, 'ABCABCABC'); }); test('toDecodeStream - some stream, no data', async function () { const source = newWriteableBufferStream(); source.end(); const { detected, stream } = await encoding.toDecodeStream(source, { acceptTextOnly: true, minBytesRequiredForDetection: 512, guessEncoding: false, overwriteEncoding: async detected => detected || encoding.UTF8 }); assert.ok(detected); assert.ok(stream); const content = await readAllAsString(stream); assert.strictEqual(content, ''); }); test('toDecodeStream - encoding, utf16be', async function () { const path = FileAccess.asFileUri('vs/workbench/services/textfile/test/node/encoding/fixtures/some_utf16be.css').fsPath; const source = streamToBufferReadableStream(fs.createReadStream(path)); const { detected, stream } = await encoding.toDecodeStream(source, { acceptTextOnly: true, minBytesRequiredForDetection: 64, guessEncoding: false, overwriteEncoding: async detected => detected || encoding.UTF8 }); assert.strictEqual(detected.encoding, 'utf16be'); assert.strictEqual(detected.seemsBinary, false); const expected = await readAndDecodeFromDisk(path, detected.encoding); const actual = await readAllAsString(stream); assert.strictEqual(actual, expected); }); test('toDecodeStream - empty file', async function () { const path = FileAccess.asFileUri('vs/workbench/services/textfile/test/node/encoding/fixtures/empty.txt').fsPath; const source = streamToBufferReadableStream(fs.createReadStream(path)); const { detected, stream } = await encoding.toDecodeStream(source, { acceptTextOnly: true, guessEncoding: false, overwriteEncoding: async detected => detected || encoding.UTF8 }); const expected = await readAndDecodeFromDisk(path, detected.encoding); const actual = await readAllAsString(stream); assert.strictEqual(actual, expected); }); test('toDecodeStream - decodes buffer entirely', async function () { const emojis = Buffer.from('🖥️💻💾'); const incompleteEmojis = emojis.slice(0, emojis.length - 1); const buffers: Buffer[] = []; for (let i = 0; i < incompleteEmojis.length; i++) { buffers.push(incompleteEmojis.slice(i, i + 1)); } const source = newTestReadableStream(buffers); const { stream } = await encoding.toDecodeStream(source, { acceptTextOnly: true, minBytesRequiredForDetection: 4, guessEncoding: false, overwriteEncoding: async detected => detected || encoding.UTF8 }); const expected = new TextDecoder().decode(incompleteEmojis); const actual = await readAllAsString(stream); assert.strictEqual(actual, expected); }); test('toDecodeStream - some stream (GBK issue #101856)', async function () { const path = FileAccess.asFileUri('vs/workbench/services/textfile/test/node/encoding/fixtures/some_gbk.txt').fsPath; const source = streamToBufferReadableStream(fs.createReadStream(path)); const { detected, stream } = await encoding.toDecodeStream(source, { acceptTextOnly: true, minBytesRequiredForDetection: 4, guessEncoding: false, overwriteEncoding: async () => 'gbk' }); assert.ok(detected); assert.ok(stream); const content = await readAllAsString(stream); assert.strictEqual(content.length, 65537); }); test('toDecodeStream - some stream (UTF-8 issue #102202)', async function () { const path = FileAccess.asFileUri('vs/workbench/services/textfile/test/node/encoding/fixtures/issue_102202.txt').fsPath; const source = streamToBufferReadableStream(fs.createReadStream(path)); const { detected, stream } = await encoding.toDecodeStream(source, { acceptTextOnly: true, minBytesRequiredForDetection: 4, guessEncoding: false, overwriteEncoding: async () => 'utf-8' }); assert.ok(detected); assert.ok(stream); const content = await readAllAsString(stream); const lines = splitLines(content); assert.strictEqual(lines[981].toString(), '啊啊啊啊啊啊aaa啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊,啊啊啊啊啊啊啊啊啊啊啊。'); }); test('toDecodeStream - binary', async function () { const source = () => { return newTestReadableStream([ Buffer.from([0, 0, 0]), Buffer.from('Hello World'), Buffer.from([0]) ]); }; // acceptTextOnly: true let error: Error | undefined = undefined; try { await encoding.toDecodeStream(source(), { acceptTextOnly: true, guessEncoding: false, overwriteEncoding: async detected => detected || encoding.UTF8 }); } catch (e) { error = e; } assert.ok(error instanceof encoding.DecodeStreamError); assert.strictEqual(error.decodeStreamErrorKind, encoding.DecodeStreamErrorKind.STREAM_IS_BINARY); // acceptTextOnly: false const { detected, stream } = await encoding.toDecodeStream(source(), { acceptTextOnly: false, guessEncoding: false, overwriteEncoding: async detected => detected || encoding.UTF8 }); assert.ok(detected); assert.strictEqual(detected.seemsBinary, true); assert.ok(stream); }); test('toEncodeReadable - encoding, utf16be', async function () { const path = FileAccess.asFileUri('vs/workbench/services/textfile/test/node/encoding/fixtures/some_utf16be.css').fsPath; const source = await readAndDecodeFromDisk(path, encoding.UTF16be); const expected = VSBuffer.wrap( iconv.encode(source, encoding.toNodeEncoding(encoding.UTF16be)) ).toString(); const actual = streams.consumeReadable( await encoding.toEncodeReadable(streams.toReadable(source), encoding.UTF16be), VSBuffer.concat ).toString(); assert.strictEqual(actual, expected); }); test('toEncodeReadable - empty readable to utf8', async function () { const source: streams.Readable<string> = { read() { return null; } }; const actual = streams.consumeReadable( await encoding.toEncodeReadable(source, encoding.UTF8), VSBuffer.concat ).toString(); assert.strictEqual(actual, ''); }); [{ utfEncoding: encoding.UTF8, relatedBom: encoding.UTF8_BOM }, { utfEncoding: encoding.UTF8_with_bom, relatedBom: encoding.UTF8_BOM }, { utfEncoding: encoding.UTF16be, relatedBom: encoding.UTF16be_BOM, }, { utfEncoding: encoding.UTF16le, relatedBom: encoding.UTF16le_BOM }].forEach(({ utfEncoding, relatedBom }) => { test(`toEncodeReadable - empty readable to ${utfEncoding} with BOM`, async function () { const source: streams.Readable<string> = { read() { return null; } }; const encodedReadable = encoding.toEncodeReadable(source, utfEncoding, { addBOM: true }); const expected = VSBuffer.wrap(Buffer.from(relatedBom)).toString(); const actual = streams.consumeReadable(await encodedReadable, VSBuffer.concat).toString(); assert.strictEqual(actual, expected); }); }); test('encodingExists', async function () { for (const enc in encoding.SUPPORTED_ENCODINGS) { if (enc === encoding.UTF8_with_bom) { continue; // skip over encodings from us } assert.strictEqual(iconv.encodingExists(enc), true, enc); } }); });
src/vs/workbench/services/textfile/test/node/encoding/encoding.test.ts
0
https://github.com/microsoft/vscode/commit/00e8fdec5dcd099ae21c1b9f9851179f6fb1ab2f
[ 0.00017926248256117105, 0.00017612386727705598, 0.0001719777355901897, 0.00017630288493819535, 0.0000016426865840912797 ]
{ "id": 1, "code_window": [ "\t\t\t\textensionId: lp.identifier.id,\n", "\t\t\t\tgalleryExtension: lp\n", "\t\t\t};\n", "\t\t});\n", "\n", "\t\tallFromMarketplace.push({\n", "\t\t\t...this.createQuickPickItem('en', 'English'),\n", "\t\t\textensionId: 'default',\n", "\t\t});\n", "\n", "\t\treturn allFromMarketplace;\n", "\t}\n", "\n" ], "labels": [ "keep", "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep" ], "after_edit": [ "\t\tallFromMarketplace.push(this.createQuickPickItem('en', 'English'));\n" ], "file_path": "src/vs/platform/languagePacks/common/languagePacks.ts", "type": "replace", "edit_start_line_idx": 70 }
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; import { SymbolItemDragAndDrop, SymbolItemEditorHighlights, SymbolItemNavigation, SymbolTreeInput } from '../references-view'; import { asResourceUrl, del, getThemeIcon, tail } from '../utils'; export class CallsTreeInput implements SymbolTreeInput<CallItem> { readonly title: string; readonly contextValue: string = 'callHierarchy'; constructor( readonly location: vscode.Location, readonly direction: CallsDirection, ) { this.title = direction === CallsDirection.Incoming ? vscode.l10n.t('Callers Of') : vscode.l10n.t('Calls From'); } async resolve() { const items = await Promise.resolve(vscode.commands.executeCommand<vscode.CallHierarchyItem[]>('vscode.prepareCallHierarchy', this.location.uri, this.location.range.start)); const model = new CallsModel(this.direction, items ?? []); const provider = new CallItemDataProvider(model); if (model.roots.length === 0) { return; } return { provider, get message() { return model.roots.length === 0 ? vscode.l10n.t('No results.') : undefined; }, navigation: model, highlights: model, dnd: model, dispose() { provider.dispose(); } }; } with(location: vscode.Location): CallsTreeInput { return new CallsTreeInput(location, this.direction); } } export const enum CallsDirection { Incoming, Outgoing } export class CallItem { children?: CallItem[]; constructor( readonly model: CallsModel, readonly item: vscode.CallHierarchyItem, readonly parent: CallItem | undefined, readonly locations: vscode.Location[] | undefined ) { } remove(): void { this.model.remove(this); } } class CallsModel implements SymbolItemNavigation<CallItem>, SymbolItemEditorHighlights<CallItem>, SymbolItemDragAndDrop<CallItem> { readonly roots: CallItem[] = []; private readonly _onDidChange = new vscode.EventEmitter<CallsModel>(); readonly onDidChange = this._onDidChange.event; constructor(readonly direction: CallsDirection, items: vscode.CallHierarchyItem[]) { this.roots = items.map(item => new CallItem(this, item, undefined, undefined)); } private async _resolveCalls(call: CallItem): Promise<CallItem[]> { if (this.direction === CallsDirection.Incoming) { const calls = await vscode.commands.executeCommand<vscode.CallHierarchyIncomingCall[]>('vscode.provideIncomingCalls', call.item); return calls ? calls.map(item => new CallItem(this, item.from, call, item.fromRanges.map(range => new vscode.Location(item.from.uri, range)))) : []; } else { const calls = await vscode.commands.executeCommand<vscode.CallHierarchyOutgoingCall[]>('vscode.provideOutgoingCalls', call.item); return calls ? calls.map(item => new CallItem(this, item.to, call, item.fromRanges.map(range => new vscode.Location(call.item.uri, range)))) : []; } } async getCallChildren(call: CallItem): Promise<CallItem[]> { if (!call.children) { call.children = await this._resolveCalls(call); } return call.children; } // -- navigation location(item: CallItem) { return new vscode.Location(item.item.uri, item.item.range); } nearest(uri: vscode.Uri, _position: vscode.Position): CallItem | undefined { return this.roots.find(item => item.item.uri.toString() === uri.toString()) ?? this.roots[0]; } next(from: CallItem): CallItem { return this._move(from, true) ?? from; } previous(from: CallItem): CallItem { return this._move(from, false) ?? from; } private _move(item: CallItem, fwd: boolean): CallItem | void { if (item.children?.length) { return fwd ? item.children[0] : tail(item.children); } const array = this.roots.includes(item) ? this.roots : item.parent?.children; if (array?.length) { const idx = array.indexOf(item); const delta = fwd ? 1 : -1; return array[idx + delta + array.length % array.length]; } } // --- dnd getDragUri(item: CallItem): vscode.Uri | undefined { return asResourceUrl(item.item.uri, item.item.range); } // --- highlights getEditorHighlights(item: CallItem, uri: vscode.Uri): vscode.Range[] | undefined { if (!item.locations) { return item.item.uri.toString() === uri.toString() ? [item.item.selectionRange] : undefined; } return item.locations .filter(loc => loc.uri.toString() === uri.toString()) .map(loc => loc.range); } remove(item: CallItem) { const isInRoot = this.roots.includes(item); const siblings = isInRoot ? this.roots : item.parent?.children; if (siblings) { del(siblings, item); this._onDidChange.fire(this); } } } class CallItemDataProvider implements vscode.TreeDataProvider<CallItem> { private readonly _emitter = new vscode.EventEmitter<CallItem | undefined>(); readonly onDidChangeTreeData = this._emitter.event; private readonly _modelListener: vscode.Disposable; constructor(private _model: CallsModel) { this._modelListener = _model.onDidChange(e => this._emitter.fire(e instanceof CallItem ? e : undefined)); } dispose(): void { this._emitter.dispose(); this._modelListener.dispose(); } getTreeItem(element: CallItem): vscode.TreeItem { const item = new vscode.TreeItem(element.item.name); item.description = element.item.detail; item.tooltip = item.label ? `${item.label} - ${element.item.detail}` : element.item.detail; item.contextValue = 'call-item'; item.iconPath = getThemeIcon(element.item.kind); type OpenArgs = [vscode.Uri, vscode.TextDocumentShowOptions]; let openArgs: OpenArgs; if (element.model.direction === CallsDirection.Outgoing) { openArgs = [element.item.uri, { selection: element.item.selectionRange.with({ end: element.item.selectionRange.start }) }]; } else { // incoming call -> reveal first call instead of caller let firstLoctionStart: vscode.Position | undefined; if (element.locations) { for (const loc of element.locations) { if (loc.uri.toString() === element.item.uri.toString()) { firstLoctionStart = firstLoctionStart?.isBefore(loc.range.start) ? firstLoctionStart : loc.range.start; } } } if (!firstLoctionStart) { firstLoctionStart = element.item.selectionRange.start; } openArgs = [element.item.uri, { selection: new vscode.Range(firstLoctionStart, firstLoctionStart) }]; } item.command = { command: 'vscode.open', title: vscode.l10n.t('Open Call'), arguments: openArgs }; item.collapsibleState = vscode.TreeItemCollapsibleState.Collapsed; return item; } getChildren(element?: CallItem | undefined) { return element ? this._model.getCallChildren(element) : this._model.roots; } getParent(element: CallItem) { return element.parent; } }
extensions/references-view/src/calls/model.ts
0
https://github.com/microsoft/vscode/commit/00e8fdec5dcd099ae21c1b9f9851179f6fb1ab2f
[ 0.00017779327754396945, 0.0001745967601891607, 0.00016755764954723418, 0.00017552652570884675, 0.000002809126272040885 ]
{ "id": 2, "code_window": [ "\t\treturn translation ? URI.file(translation) : undefined;\n", "\t}\n", "\n", "\tasync getInstalledLanguages(): Promise<Array<ILanguagePackItem>> {\n", "\t\tconst languagePacks = await this.cache.getLanguagePacks();\n", "\t\tconst languages = Object.keys(languagePacks).map(locale => {\n", "\t\t\tconst languagePack = languagePacks[locale];\n", "\t\t\tconst baseQuickPick = this.createQuickPickItem(locale, languagePack.label);\n", "\t\t\treturn {\n", "\t\t\t\t...baseQuickPick,\n", "\t\t\t\textensionId: languagePack.extensions[0].extensionIdentifier.id,\n" ], "labels": [ "keep", "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ], "after_edit": [ "\t\tconst languages: ILanguagePackItem[] = Object.keys(languagePacks).map(locale => {\n" ], "file_path": "src/vs/platform/languagePacks/node/languagePacks.ts", "type": "replace", "edit_start_line_idx": 66 }
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import { CancellationTokenSource } from 'vs/base/common/cancellation'; import { Disposable } from 'vs/base/common/lifecycle'; import { language } from 'vs/base/common/platform'; import { URI } from 'vs/base/common/uri'; import { IQuickPickItem } from 'vs/base/parts/quickinput/common/quickInput'; import { localize } from 'vs/nls'; import { IExtensionGalleryService, IGalleryExtension } from 'vs/platform/extensionManagement/common/extensionManagement'; import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; export function getLocale(extension: IGalleryExtension): string | undefined { return extension.tags.find(t => t.startsWith('lp-'))?.split('lp-')[1]; } export const ILanguagePackService = createDecorator<ILanguagePackService>('languagePackService'); export interface ILanguagePackItem extends IQuickPickItem { readonly extensionId: string; readonly galleryExtension?: IGalleryExtension; } export interface ILanguagePackService { readonly _serviceBrand: undefined; getAvailableLanguages(): Promise<Array<ILanguagePackItem>>; getInstalledLanguages(): Promise<Array<ILanguagePackItem>>; getBuiltInExtensionTranslationsUri(id: string): Promise<URI | undefined>; } export abstract class LanguagePackBaseService extends Disposable implements ILanguagePackService { declare readonly _serviceBrand: undefined; constructor(@IExtensionGalleryService protected readonly extensionGalleryService: IExtensionGalleryService) { super(); } abstract getBuiltInExtensionTranslationsUri(id: string): Promise<URI | undefined>; abstract getInstalledLanguages(): Promise<Array<ILanguagePackItem>>; async getAvailableLanguages(): Promise<ILanguagePackItem[]> { const timeout = new CancellationTokenSource(); setTimeout(() => timeout.cancel(), 1000); let result; try { result = await this.extensionGalleryService.query({ text: 'category:"language packs"', pageSize: 20 }, timeout.token); } catch (_) { // This method is best effort. So, we ignore any errors. return []; } const languagePackExtensions = result.firstPage.filter(e => e.properties.localizedLanguages?.length && e.tags.some(t => t.startsWith('lp-'))); const allFromMarketplace: ILanguagePackItem[] = languagePackExtensions.map(lp => { const languageName = lp.properties.localizedLanguages?.[0]; const locale = getLocale(lp)!; const baseQuickPick = this.createQuickPickItem(locale, languageName, lp); return { ...baseQuickPick, extensionId: lp.identifier.id, galleryExtension: lp }; }); allFromMarketplace.push({ ...this.createQuickPickItem('en', 'English'), extensionId: 'default', }); return allFromMarketplace; } protected createQuickPickItem(locale: string, languageName?: string, languagePack?: IGalleryExtension): IQuickPickItem { const label = languageName ?? locale; let description: string | undefined; if (label !== locale) { description = `(${locale})`; } if (locale.toLowerCase() === language.toLowerCase()) { description ??= ''; description += localize('currentDisplayLanguage', " (Current)"); } if (languagePack?.installCount) { description ??= ''; const count = languagePack.installCount; let countLabel: string; if (count > 1000000) { countLabel = `${Math.floor(count / 100000) / 10}M`; } else if (count > 1000) { countLabel = `${Math.floor(count / 1000)}K`; } else { countLabel = String(count); } description += ` $(cloud-download) ${countLabel}`; } return { id: locale, label, description }; } }
src/vs/platform/languagePacks/common/languagePacks.ts
1
https://github.com/microsoft/vscode/commit/00e8fdec5dcd099ae21c1b9f9851179f6fb1ab2f
[ 0.9965915679931641, 0.1898331493139267, 0.00016144540859386325, 0.0008399109938181937, 0.3678007423877716 ]
{ "id": 2, "code_window": [ "\t\treturn translation ? URI.file(translation) : undefined;\n", "\t}\n", "\n", "\tasync getInstalledLanguages(): Promise<Array<ILanguagePackItem>> {\n", "\t\tconst languagePacks = await this.cache.getLanguagePacks();\n", "\t\tconst languages = Object.keys(languagePacks).map(locale => {\n", "\t\t\tconst languagePack = languagePacks[locale];\n", "\t\t\tconst baseQuickPick = this.createQuickPickItem(locale, languagePack.label);\n", "\t\t\treturn {\n", "\t\t\t\t...baseQuickPick,\n", "\t\t\t\textensionId: languagePack.extensions[0].extensionIdentifier.id,\n" ], "labels": [ "keep", "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ], "after_edit": [ "\t\tconst languages: ILanguagePackItem[] = Object.keys(languagePacks).map(locale => {\n" ], "file_path": "src/vs/platform/languagePacks/node/languagePacks.ts", "type": "replace", "edit_start_line_idx": 66 }
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import * as assert from 'assert'; import { IndexedDB } from 'vs/base/browser/indexedDB'; import { bufferToReadable, bufferToStream, VSBuffer, VSBufferReadable, VSBufferReadableStream } from 'vs/base/common/buffer'; import { DisposableStore } from 'vs/base/common/lifecycle'; import { Schemas } from 'vs/base/common/network'; import { basename, joinPath } from 'vs/base/common/resources'; import { URI } from 'vs/base/common/uri'; import { flakySuite } from 'vs/base/test/common/testUtils'; import { IndexedDBFileSystemProvider } from 'vs/platform/files/browser/indexedDBFileSystemProvider'; import { FileOperation, FileOperationError, FileOperationEvent, FileOperationResult, FileSystemProviderError, FileSystemProviderErrorCode, FileType } from 'vs/platform/files/common/files'; import { FileService } from 'vs/platform/files/common/fileService'; import { NullLogService } from 'vs/platform/log/common/log'; flakySuite('IndexedDBFileSystemProvider', function () { let service: FileService; let userdataFileProvider: IndexedDBFileSystemProvider; const testDir = '/'; const userdataURIFromPaths = (paths: readonly string[]) => joinPath(URI.from({ scheme: Schemas.vscodeUserData, path: testDir }), ...paths); const disposables = new DisposableStore(); const initFixtures = async () => { await Promise.all( [['fixtures', 'resolver', 'examples'], ['fixtures', 'resolver', 'other', 'deep'], ['fixtures', 'service', 'deep'], ['batched']] .map(path => userdataURIFromPaths(path)) .map(uri => service.createFolder(uri))); await Promise.all( ([ [['fixtures', 'resolver', 'examples', 'company.js'], 'class company {}'], [['fixtures', 'resolver', 'examples', 'conway.js'], 'export function conway() {}'], [['fixtures', 'resolver', 'examples', 'employee.js'], 'export const employee = "jax"'], [['fixtures', 'resolver', 'examples', 'small.js'], ''], [['fixtures', 'resolver', 'other', 'deep', 'company.js'], 'class company {}'], [['fixtures', 'resolver', 'other', 'deep', 'conway.js'], 'export function conway() {}'], [['fixtures', 'resolver', 'other', 'deep', 'employee.js'], 'export const employee = "jax"'], [['fixtures', 'resolver', 'other', 'deep', 'small.js'], ''], [['fixtures', 'resolver', 'index.html'], '<p>p</p>'], [['fixtures', 'resolver', 'site.css'], '.p {color: red;}'], [['fixtures', 'service', 'deep', 'company.js'], 'class company {}'], [['fixtures', 'service', 'deep', 'conway.js'], 'export function conway() {}'], [['fixtures', 'service', 'deep', 'employee.js'], 'export const employee = "jax"'], [['fixtures', 'service', 'deep', 'small.js'], ''], [['fixtures', 'service', 'binary.txt'], '<p>p</p>'], ] as const) .map(([path, contents]) => [userdataURIFromPaths(path), contents] as const) .map(([uri, contents]) => service.createFile(uri, VSBuffer.fromString(contents))) ); }; const reload = async () => { const logService = new NullLogService(); service = new FileService(logService); disposables.add(service); const indexedDB = await IndexedDB.create('vscode-web-db-test', 1, ['vscode-userdata-store', 'vscode-logs-store']); userdataFileProvider = new IndexedDBFileSystemProvider(Schemas.vscodeUserData, indexedDB, 'vscode-userdata-store', true); disposables.add(service.registerProvider(Schemas.vscodeUserData, userdataFileProvider)); disposables.add(userdataFileProvider); }; setup(async function () { this.timeout(15000); await reload(); }); teardown(async () => { await userdataFileProvider.reset(); disposables.clear(); }); test('root is always present', async () => { assert.strictEqual((await userdataFileProvider.stat(userdataURIFromPaths([]))).type, FileType.Directory); await userdataFileProvider.delete(userdataURIFromPaths([]), { recursive: true, useTrash: false }); assert.strictEqual((await userdataFileProvider.stat(userdataURIFromPaths([]))).type, FileType.Directory); }); test('createFolder', async () => { let event: FileOperationEvent | undefined; disposables.add(service.onDidRunOperation(e => event = e)); const parent = await service.resolve(userdataURIFromPaths([])); const newFolderResource = joinPath(parent.resource, 'newFolder'); assert.strictEqual((await userdataFileProvider.readdir(parent.resource)).length, 0); const newFolder = await service.createFolder(newFolderResource); assert.strictEqual(newFolder.name, 'newFolder'); assert.strictEqual((await userdataFileProvider.readdir(parent.resource)).length, 1); assert.strictEqual((await userdataFileProvider.stat(newFolderResource)).type, FileType.Directory); assert.ok(event); assert.strictEqual(event!.resource.path, newFolderResource.path); assert.strictEqual(event!.operation, FileOperation.CREATE); assert.strictEqual(event!.target!.resource.path, newFolderResource.path); assert.strictEqual(event!.target!.isDirectory, true); }); test('createFolder: creating multiple folders at once', async () => { let event: FileOperationEvent; disposables.add(service.onDidRunOperation(e => event = e)); const multiFolderPaths = ['a', 'couple', 'of', 'folders']; const parent = await service.resolve(userdataURIFromPaths([])); const newFolderResource = joinPath(parent.resource, ...multiFolderPaths); const newFolder = await service.createFolder(newFolderResource); const lastFolderName = multiFolderPaths[multiFolderPaths.length - 1]; assert.strictEqual(newFolder.name, lastFolderName); assert.strictEqual((await userdataFileProvider.stat(newFolderResource)).type, FileType.Directory); assert.ok(event!); assert.strictEqual(event!.resource.path, newFolderResource.path); assert.strictEqual(event!.operation, FileOperation.CREATE); assert.strictEqual(event!.target!.resource.path, newFolderResource.path); assert.strictEqual(event!.target!.isDirectory, true); }); test('exists', async () => { let exists = await service.exists(userdataURIFromPaths([])); assert.strictEqual(exists, true); exists = await service.exists(userdataURIFromPaths(['hello'])); assert.strictEqual(exists, false); }); test('resolve - file', async () => { await initFixtures(); const resource = userdataURIFromPaths(['fixtures', 'resolver', 'index.html']); const resolved = await service.resolve(resource); assert.strictEqual(resolved.name, 'index.html'); assert.strictEqual(resolved.isFile, true); assert.strictEqual(resolved.isDirectory, false); assert.strictEqual(resolved.isSymbolicLink, false); assert.strictEqual(resolved.resource.toString(), resource.toString()); assert.strictEqual(resolved.children, undefined); assert.ok(resolved.size! > 0); }); test('resolve - directory', async () => { await initFixtures(); const testsElements = ['examples', 'other', 'index.html', 'site.css']; const resource = userdataURIFromPaths(['fixtures', 'resolver']); const result = await service.resolve(resource); assert.ok(result); assert.strictEqual(result.resource.toString(), resource.toString()); assert.strictEqual(result.name, 'resolver'); assert.ok(result.children); assert.ok(result.children!.length > 0); assert.ok(result!.isDirectory); assert.strictEqual(result.children!.length, testsElements.length); assert.ok(result.children!.every(entry => { return testsElements.some(name => { return basename(entry.resource) === name; }); })); result.children!.forEach(value => { assert.ok(basename(value.resource)); if (['examples', 'other'].indexOf(basename(value.resource)) >= 0) { assert.ok(value.isDirectory); assert.strictEqual(value.mtime, undefined); assert.strictEqual(value.ctime, undefined); } else if (basename(value.resource) === 'index.html') { assert.ok(!value.isDirectory); assert.ok(!value.children); assert.strictEqual(value.mtime, undefined); assert.strictEqual(value.ctime, undefined); } else if (basename(value.resource) === 'site.css') { assert.ok(!value.isDirectory); assert.ok(!value.children); assert.strictEqual(value.mtime, undefined); assert.strictEqual(value.ctime, undefined); } else { assert.ok(!'Unexpected value ' + basename(value.resource)); } }); }); test('createFile', async () => { return assertCreateFile(contents => VSBuffer.fromString(contents)); }); test('createFile (readable)', async () => { return assertCreateFile(contents => bufferToReadable(VSBuffer.fromString(contents))); }); test('createFile (stream)', async () => { return assertCreateFile(contents => bufferToStream(VSBuffer.fromString(contents))); }); async function assertCreateFile(converter: (content: string) => VSBuffer | VSBufferReadable | VSBufferReadableStream): Promise<void> { let event: FileOperationEvent; disposables.add(service.onDidRunOperation(e => event = e)); const contents = 'Hello World'; const resource = userdataURIFromPaths(['test.txt']); assert.strictEqual(await service.canCreateFile(resource), true); const fileStat = await service.createFile(resource, converter(contents)); assert.strictEqual(fileStat.name, 'test.txt'); assert.strictEqual((await userdataFileProvider.stat(fileStat.resource)).type, FileType.File); assert.strictEqual(new TextDecoder().decode(await userdataFileProvider.readFile(fileStat.resource)), contents); assert.ok(event!); assert.strictEqual(event!.resource.path, resource.path); assert.strictEqual(event!.operation, FileOperation.CREATE); assert.strictEqual(event!.target!.resource.path, resource.path); } const fileCreateBatchTester = (size: number, name: string) => { const batch = Array.from({ length: size }).map((_, i) => ({ contents: `Hello${i}`, resource: userdataURIFromPaths(['batched', name, `Hello${i}.txt`]) })); let creationPromises: Promise<any> | undefined = undefined; return { async create() { return creationPromises = Promise.all(batch.map(entry => userdataFileProvider.writeFile(entry.resource, VSBuffer.fromString(entry.contents).buffer, { create: true, overwrite: true, unlock: false }))); }, async assertContentsCorrect() { if (!creationPromises) { throw Error('read called before create'); } await creationPromises; await Promise.all(batch.map(async (entry, i) => { assert.strictEqual((await userdataFileProvider.stat(entry.resource)).type, FileType.File); assert.strictEqual(new TextDecoder().decode(await userdataFileProvider.readFile(entry.resource)), entry.contents); })); } }; }; test('createFile - batch', async () => { const tester = fileCreateBatchTester(20, 'batch'); await tester.create(); await tester.assertContentsCorrect(); }); test('createFile - batch (mixed parallel/sequential)', async () => { const batch1 = fileCreateBatchTester(1, 'batch1'); const batch2 = fileCreateBatchTester(20, 'batch2'); const batch3 = fileCreateBatchTester(1, 'batch3'); const batch4 = fileCreateBatchTester(20, 'batch4'); batch1.create(); batch2.create(); await Promise.all([batch1.assertContentsCorrect(), batch2.assertContentsCorrect()]); batch3.create(); batch4.create(); await Promise.all([batch3.assertContentsCorrect(), batch4.assertContentsCorrect()]); await Promise.all([batch1.assertContentsCorrect(), batch2.assertContentsCorrect()]); }); test('rename not existing resource', async () => { const parent = await service.resolve(userdataURIFromPaths([])); const sourceFile = joinPath(parent.resource, 'sourceFile'); const targetFile = joinPath(parent.resource, 'targetFile'); try { await service.move(sourceFile, targetFile, false); } catch (error) { assert.deepStrictEqual((<FileSystemProviderError>error).code, FileSystemProviderErrorCode.FileNotFound); return; } assert.fail('This should fail with error'); }); test('rename to an existing file without overwrite', async () => { const parent = await service.resolve(userdataURIFromPaths([])); const sourceFile = joinPath(parent.resource, 'sourceFile'); await service.writeFile(sourceFile, VSBuffer.fromString('This is source file')); const targetFile = joinPath(parent.resource, 'targetFile'); await service.writeFile(targetFile, VSBuffer.fromString('This is target file')); try { await service.move(sourceFile, targetFile, false); } catch (error) { assert.deepStrictEqual((<FileOperationError>error).fileOperationResult, FileOperationResult.FILE_MOVE_CONFLICT); return; } assert.fail('This should fail with error'); }); test('rename folder to an existing folder without overwrite', async () => { const parent = await service.resolve(userdataURIFromPaths([])); const sourceFolder = joinPath(parent.resource, 'sourceFolder'); await service.createFolder(sourceFolder); const targetFolder = joinPath(parent.resource, 'targetFolder'); await service.createFolder(targetFolder); try { await service.move(sourceFolder, targetFolder, false); } catch (error) { assert.deepStrictEqual((<FileOperationError>error).fileOperationResult, FileOperationResult.FILE_MOVE_CONFLICT); return; } assert.fail('This should fail with cannot overwrite error'); }); test('rename file to a folder', async () => { const parent = await service.resolve(userdataURIFromPaths([])); const sourceFile = joinPath(parent.resource, 'sourceFile'); await service.writeFile(sourceFile, VSBuffer.fromString('This is source file')); const targetFolder = joinPath(parent.resource, 'targetFolder'); await service.createFolder(targetFolder); try { await service.move(sourceFile, targetFolder, false); } catch (error) { assert.deepStrictEqual((<FileOperationError>error).fileOperationResult, FileOperationResult.FILE_MOVE_CONFLICT); return; } assert.fail('This should fail with error'); }); test('rename folder to a file', async () => { const parent = await service.resolve(userdataURIFromPaths([])); const sourceFolder = joinPath(parent.resource, 'sourceFile'); await service.createFolder(sourceFolder); const targetFile = joinPath(parent.resource, 'targetFile'); await service.writeFile(targetFile, VSBuffer.fromString('This is target file')); try { await service.move(sourceFolder, targetFile, false); } catch (error) { assert.deepStrictEqual((<FileOperationError>error).fileOperationResult, FileOperationResult.FILE_MOVE_CONFLICT); return; } assert.fail('This should fail with error'); }); test('rename file', async () => { const parent = await service.resolve(userdataURIFromPaths([])); const sourceFile = joinPath(parent.resource, 'sourceFile'); await service.writeFile(sourceFile, VSBuffer.fromString('This is source file')); const targetFile = joinPath(parent.resource, 'targetFile'); await service.move(sourceFile, targetFile, false); const content = await service.readFile(targetFile); assert.strictEqual(await service.exists(sourceFile), false); assert.strictEqual(content.value.toString(), 'This is source file'); }); test('rename to an existing file with overwrite', async () => { const parent = await service.resolve(userdataURIFromPaths([])); const sourceFile = joinPath(parent.resource, 'sourceFile'); const targetFile = joinPath(parent.resource, 'targetFile'); await Promise.all([ service.writeFile(sourceFile, VSBuffer.fromString('This is source file')), service.writeFile(targetFile, VSBuffer.fromString('This is target file')) ]); await service.move(sourceFile, targetFile, true); const content = await service.readFile(targetFile); assert.strictEqual(await service.exists(sourceFile), false); assert.strictEqual(content.value.toString(), 'This is source file'); }); test('rename folder to a new folder', async () => { const parent = await service.resolve(userdataURIFromPaths([])); const sourceFolder = joinPath(parent.resource, 'sourceFolder'); await service.createFolder(sourceFolder); const targetFolder = joinPath(parent.resource, 'targetFolder'); await service.move(sourceFolder, targetFolder, false); assert.deepStrictEqual(await service.exists(sourceFolder), false); assert.deepStrictEqual(await service.exists(targetFolder), true); }); test('rename folder to an existing folder', async () => { const parent = await service.resolve(userdataURIFromPaths([])); const sourceFolder = joinPath(parent.resource, 'sourceFolder'); await service.createFolder(sourceFolder); const targetFolder = joinPath(parent.resource, 'targetFolder'); await service.createFolder(targetFolder); await service.move(sourceFolder, targetFolder, true); assert.deepStrictEqual(await service.exists(sourceFolder), false); assert.deepStrictEqual(await service.exists(targetFolder), true); }); test('rename a folder that has multiple files and folders', async () => { const parent = await service.resolve(userdataURIFromPaths([])); const sourceFolder = joinPath(parent.resource, 'sourceFolder'); const sourceFile1 = joinPath(sourceFolder, 'folder1', 'file1'); const sourceFile2 = joinPath(sourceFolder, 'folder2', 'file1'); const sourceEmptyFolder = joinPath(sourceFolder, 'folder3'); await Promise.all([ service.writeFile(sourceFile1, VSBuffer.fromString('Source File 1')), service.writeFile(sourceFile2, VSBuffer.fromString('Source File 2')), service.createFolder(sourceEmptyFolder) ]); const targetFolder = joinPath(parent.resource, 'targetFolder'); const targetFile1 = joinPath(targetFolder, 'folder1', 'file1'); const targetFile2 = joinPath(targetFolder, 'folder2', 'file1'); const targetEmptyFolder = joinPath(targetFolder, 'folder3'); await service.move(sourceFolder, targetFolder, false); assert.deepStrictEqual(await service.exists(sourceFolder), false); assert.deepStrictEqual(await service.exists(targetFolder), true); assert.strictEqual((await service.readFile(targetFile1)).value.toString(), 'Source File 1'); assert.strictEqual((await service.readFile(targetFile2)).value.toString(), 'Source File 2'); assert.deepStrictEqual(await service.exists(targetEmptyFolder), true); }); test('rename a folder to another folder that has some files', async () => { const parent = await service.resolve(userdataURIFromPaths([])); const sourceFolder = joinPath(parent.resource, 'sourceFolder'); const sourceFile1 = joinPath(sourceFolder, 'folder1', 'file1'); const targetFolder = joinPath(parent.resource, 'targetFolder'); const targetFile1 = joinPath(targetFolder, 'folder1', 'file1'); const targetFile2 = joinPath(targetFolder, 'folder1', 'file2'); const targetFile3 = joinPath(targetFolder, 'folder2', 'file1'); await Promise.all([ service.writeFile(sourceFile1, VSBuffer.fromString('Source File 1')), service.writeFile(targetFile2, VSBuffer.fromString('Target File 2')), service.writeFile(targetFile3, VSBuffer.fromString('Target File 3')) ]); await service.move(sourceFolder, targetFolder, true); assert.deepStrictEqual(await service.exists(sourceFolder), false); assert.deepStrictEqual(await service.exists(targetFolder), true); assert.strictEqual((await service.readFile(targetFile1)).value.toString(), 'Source File 1'); assert.strictEqual(await service.exists(targetFile2), false); assert.strictEqual(await service.exists(targetFile3), false); }); test('deleteFile', async () => { await initFixtures(); let event: FileOperationEvent; disposables.add(service.onDidRunOperation(e => event = e)); const anotherResource = userdataURIFromPaths(['fixtures', 'service', 'deep', 'company.js']); const resource = userdataURIFromPaths(['fixtures', 'service', 'deep', 'conway.js']); const source = await service.resolve(resource); assert.strictEqual(await service.canDelete(source.resource, { useTrash: false }), true); await service.del(source.resource, { useTrash: false }); assert.strictEqual(await service.exists(source.resource), false); assert.strictEqual(await service.exists(anotherResource), true); assert.ok(event!); assert.strictEqual(event!.resource.path, resource.path); assert.strictEqual(event!.operation, FileOperation.DELETE); { let error: Error | undefined = undefined; try { await service.del(source.resource, { useTrash: false }); } catch (e) { error = e; } assert.ok(error); assert.strictEqual((<FileOperationError>error).fileOperationResult, FileOperationResult.FILE_NOT_FOUND); } await reload(); { let error: Error | undefined = undefined; try { await service.del(source.resource, { useTrash: false }); } catch (e) { error = e; } assert.ok(error); assert.strictEqual((<FileOperationError>error).fileOperationResult, FileOperationResult.FILE_NOT_FOUND); } }); test('deleteFolder (recursive)', async () => { await initFixtures(); let event: FileOperationEvent; disposables.add(service.onDidRunOperation(e => event = e)); const resource = userdataURIFromPaths(['fixtures', 'service', 'deep']); const subResource1 = userdataURIFromPaths(['fixtures', 'service', 'deep', 'company.js']); const subResource2 = userdataURIFromPaths(['fixtures', 'service', 'deep', 'conway.js']); assert.strictEqual(await service.exists(subResource1), true); assert.strictEqual(await service.exists(subResource2), true); const source = await service.resolve(resource); assert.strictEqual(await service.canDelete(source.resource, { recursive: true, useTrash: false }), true); await service.del(source.resource, { recursive: true, useTrash: false }); assert.strictEqual(await service.exists(source.resource), false); assert.strictEqual(await service.exists(subResource1), false); assert.strictEqual(await service.exists(subResource2), false); assert.ok(event!); assert.strictEqual(event!.resource.fsPath, resource.fsPath); assert.strictEqual(event!.operation, FileOperation.DELETE); }); test('deleteFolder (non recursive)', async () => { await initFixtures(); const resource = userdataURIFromPaths(['fixtures', 'service', 'deep']); const source = await service.resolve(resource); assert.ok((await service.canDelete(source.resource)) instanceof Error); let error; try { await service.del(source.resource); } catch (e) { error = e; } assert.ok(error); }); test('delete empty folder', async () => { const parent = await service.resolve(userdataURIFromPaths([])); const folder = joinPath(parent.resource, 'folder'); await service.createFolder(folder); await service.del(folder); assert.deepStrictEqual(await service.exists(folder), false); }); test('delete empty folder with reccursive', async () => { const parent = await service.resolve(userdataURIFromPaths([])); const folder = joinPath(parent.resource, 'folder'); await service.createFolder(folder); await service.del(folder, { recursive: true }); assert.deepStrictEqual(await service.exists(folder), false); }); test('deleteFolder with folders and files (recursive)', async () => { const parent = await service.resolve(userdataURIFromPaths([])); const targetFolder = joinPath(parent.resource, 'targetFolder'); const file1 = joinPath(targetFolder, 'folder1', 'file1'); await service.createFile(file1); const file2 = joinPath(targetFolder, 'folder2', 'file1'); await service.createFile(file2); const emptyFolder = joinPath(targetFolder, 'folder3'); await service.createFolder(emptyFolder); await service.del(targetFolder, { recursive: true }); assert.deepStrictEqual(await service.exists(targetFolder), false); assert.deepStrictEqual(await service.exists(joinPath(targetFolder, 'folder1')), false); assert.deepStrictEqual(await service.exists(joinPath(targetFolder, 'folder2')), false); assert.deepStrictEqual(await service.exists(file1), false); assert.deepStrictEqual(await service.exists(file2), false); assert.deepStrictEqual(await service.exists(emptyFolder), false); }); });
src/vs/platform/files/test/browser/indexedDBFileService.integrationTest.ts
0
https://github.com/microsoft/vscode/commit/00e8fdec5dcd099ae21c1b9f9851179f6fb1ab2f
[ 0.00022402430477086455, 0.00017348441178910434, 0.00015958122094161808, 0.00017378888151142746, 0.000007597685907967389 ]
{ "id": 2, "code_window": [ "\t\treturn translation ? URI.file(translation) : undefined;\n", "\t}\n", "\n", "\tasync getInstalledLanguages(): Promise<Array<ILanguagePackItem>> {\n", "\t\tconst languagePacks = await this.cache.getLanguagePacks();\n", "\t\tconst languages = Object.keys(languagePacks).map(locale => {\n", "\t\t\tconst languagePack = languagePacks[locale];\n", "\t\t\tconst baseQuickPick = this.createQuickPickItem(locale, languagePack.label);\n", "\t\t\treturn {\n", "\t\t\t\t...baseQuickPick,\n", "\t\t\t\textensionId: languagePack.extensions[0].extensionIdentifier.id,\n" ], "labels": [ "keep", "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ], "after_edit": [ "\t\tconst languages: ILanguagePackItem[] = Object.keys(languagePacks).map(locale => {\n" ], "file_path": "src/vs/platform/languagePacks/node/languagePacks.ts", "type": "replace", "edit_start_line_idx": 66 }
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import { Emitter, Event } from 'vs/base/common/event'; import { addMatchMediaChangeListener } from 'vs/base/browser/browser'; import { InstantiationType, registerSingleton } from 'vs/platform/instantiation/common/extensions'; import { Disposable } from 'vs/base/common/lifecycle'; import { IHostColorSchemeService } from 'vs/workbench/services/themes/common/hostColorSchemeService'; export class BrowserHostColorSchemeService extends Disposable implements IHostColorSchemeService { declare readonly _serviceBrand: undefined; private readonly _onDidSchemeChangeEvent = this._register(new Emitter<void>()); constructor( ) { super(); this.registerListeners(); } private registerListeners(): void { addMatchMediaChangeListener('(prefers-color-scheme: dark)', () => { this._onDidSchemeChangeEvent.fire(); }); addMatchMediaChangeListener('(forced-colors: active)', () => { this._onDidSchemeChangeEvent.fire(); }); } get onDidChangeColorScheme(): Event<void> { return this._onDidSchemeChangeEvent.event; } get dark(): boolean { if (window.matchMedia(`(prefers-color-scheme: light)`).matches) { return false; } else if (window.matchMedia(`(prefers-color-scheme: dark)`).matches) { return true; } return false; } get highContrast(): boolean { if (window.matchMedia(`(forced-colors: active)`).matches) { return true; } return false; } } registerSingleton(IHostColorSchemeService, BrowserHostColorSchemeService, InstantiationType.Delayed);
src/vs/workbench/services/themes/browser/browserHostColorSchemeService.ts
0
https://github.com/microsoft/vscode/commit/00e8fdec5dcd099ae21c1b9f9851179f6fb1ab2f
[ 0.0001750187948346138, 0.00017356115859001875, 0.00017292980919592083, 0.00017323171778116375, 7.40470625260059e-7 ]
{ "id": 2, "code_window": [ "\t\treturn translation ? URI.file(translation) : undefined;\n", "\t}\n", "\n", "\tasync getInstalledLanguages(): Promise<Array<ILanguagePackItem>> {\n", "\t\tconst languagePacks = await this.cache.getLanguagePacks();\n", "\t\tconst languages = Object.keys(languagePacks).map(locale => {\n", "\t\t\tconst languagePack = languagePacks[locale];\n", "\t\t\tconst baseQuickPick = this.createQuickPickItem(locale, languagePack.label);\n", "\t\t\treturn {\n", "\t\t\t\t...baseQuickPick,\n", "\t\t\t\textensionId: languagePack.extensions[0].extensionIdentifier.id,\n" ], "labels": [ "keep", "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ], "after_edit": [ "\t\tconst languages: ILanguagePackItem[] = Object.keys(languagePacks).map(locale => {\n" ], "file_path": "src/vs/platform/languagePacks/node/languagePacks.ts", "type": "replace", "edit_start_line_idx": 66 }
# Jake - JavaScript build tool **Notice:** This extension is bundled with Visual Studio Code. It can be disabled but not uninstalled. ## Features This extension supports running [Jake](http://jakejs.com/) tasks defined in a `Jakefile.js` file as [VS Code tasks](https://code.visualstudio.com/docs/editor/tasks). Jake tasks with the name 'build', 'compile', or 'watch' are treated as build tasks. To run Jake tasks, use the **Tasks** menu. ## Settings - `jake.autoDetect` - Enable detecting tasks from `Jakefile.js` files, the default is `on`.
extensions/jake/README.md
0
https://github.com/microsoft/vscode/commit/00e8fdec5dcd099ae21c1b9f9851179f6fb1ab2f
[ 0.00017237980500794947, 0.00016871129628270864, 0.0001650427730055526, 0.00016871129628270864, 0.000003668516001198441 ]
{ "id": 3, "code_window": [ "\t\t\t\textensionId: languagePack.extensions[0].extensionIdentifier.id,\n", "\t\t\t};\n", "\t\t});\n", "\t\tlanguages.push({\n", "\t\t\t...this.createQuickPickItem('en', 'English'),\n", "\t\t\textensionId: 'default',\n", "\t\t});\n", "\t\tlanguages.sort((a, b) => a.label.localeCompare(b.label));\n", "\t\treturn languages;\n", "\t}\n", "\n" ], "labels": [ "keep", "keep", "keep", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep" ], "after_edit": [ "\t\tlanguages.push(this.createQuickPickItem('en', 'English'));\n" ], "file_path": "src/vs/platform/languagePacks/node/languagePacks.ts", "type": "replace", "edit_start_line_idx": 74 }
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import { localize } from 'vs/nls'; import { IQuickInputService, IQuickPickSeparator } from 'vs/platform/quickinput/common/quickInput'; import { CancellationTokenSource } from 'vs/base/common/cancellation'; import { DisposableStore } from 'vs/base/common/lifecycle'; import { Action2, MenuId } from 'vs/platform/actions/common/actions'; import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; import { ILanguagePackItem, ILanguagePackService } from 'vs/platform/languagePacks/common/languagePacks'; import { ILocaleService } from 'vs/workbench/contrib/localization/common/locale'; export class ConfigureDisplayLanguageAction extends Action2 { public static readonly ID = 'workbench.action.configureLocale'; public static readonly LABEL = localize('configureLocale', "Configure Display Language"); constructor() { super({ id: ConfigureDisplayLanguageAction.ID, title: { original: 'Configure Display Language', value: ConfigureDisplayLanguageAction.LABEL }, menu: { id: MenuId.CommandPalette } }); } public async run(accessor: ServicesAccessor): Promise<void> { const languagePackService: ILanguagePackService = accessor.get(ILanguagePackService); const quickInputService: IQuickInputService = accessor.get(IQuickInputService); const localeService: ILocaleService = accessor.get(ILocaleService); const installedLanguages = await languagePackService.getInstalledLanguages(); const qp = quickInputService.createQuickPick<ILanguagePackItem>(); qp.placeholder = localize('chooseLocale', "Select Display Language"); if (installedLanguages?.length) { const items: Array<ILanguagePackItem | IQuickPickSeparator> = [{ type: 'separator', label: localize('installed', "Installed") }]; qp.items = items.concat(installedLanguages); } const disposables = new DisposableStore(); const source = new CancellationTokenSource(); disposables.add(qp.onDispose(() => { source.cancel(); disposables.dispose(); })); const installedSet = new Set<string>(installedLanguages?.map(language => language.id!) ?? []); languagePackService.getAvailableLanguages().then(availableLanguages => { const newLanguages = availableLanguages.filter(l => l.id && !installedSet.has(l.id)); if (newLanguages.length) { qp.items = [ ...qp.items, { type: 'separator', label: localize('available', "Available") }, ...newLanguages ]; } qp.busy = false; }); disposables.add(qp.onDidAccept(async () => { const selectedLanguage = qp.activeItems[0]; qp.hide(); await localeService.setLocale(selectedLanguage); })); qp.show(); qp.busy = true; } } export class ClearDisplayLanguageAction extends Action2 { public static readonly ID = 'workbench.action.clearLocalePreference'; public static readonly LABEL = localize('clearDisplayLanguage', "Clear Display Language Preference"); constructor() { super({ id: ClearDisplayLanguageAction.ID, title: { original: 'Clear Display Language Preference', value: ClearDisplayLanguageAction.LABEL }, menu: { id: MenuId.CommandPalette } }); } public async run(accessor: ServicesAccessor): Promise<void> { const localeService: ILocaleService = accessor.get(ILocaleService); await localeService.clearLocalePreference(); } }
src/vs/workbench/contrib/localization/browser/localizationsActions.ts
1
https://github.com/microsoft/vscode/commit/00e8fdec5dcd099ae21c1b9f9851179f6fb1ab2f
[ 0.0024356271605938673, 0.00047771065146662295, 0.0001629360776860267, 0.00017191446386277676, 0.0006833826773799956 ]
{ "id": 3, "code_window": [ "\t\t\t\textensionId: languagePack.extensions[0].extensionIdentifier.id,\n", "\t\t\t};\n", "\t\t});\n", "\t\tlanguages.push({\n", "\t\t\t...this.createQuickPickItem('en', 'English'),\n", "\t\t\textensionId: 'default',\n", "\t\t});\n", "\t\tlanguages.sort((a, b) => a.label.localeCompare(b.label));\n", "\t\treturn languages;\n", "\t}\n", "\n" ], "labels": [ "keep", "keep", "keep", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep" ], "after_edit": [ "\t\tlanguages.push(this.createQuickPickItem('en', 'English'));\n" ], "file_path": "src/vs/platform/languagePacks/node/languagePacks.ts", "type": "replace", "edit_start_line_idx": 74 }
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import { InstantiationType, registerSingleton } from 'vs/platform/instantiation/common/extensions'; import { IUserDataSyncEnablementService, SyncResource } from 'vs/platform/userDataSync/common/userDataSync'; import { UserDataSyncEnablementService as BaseUserDataSyncEnablementService } from 'vs/platform/userDataSync/common/userDataSyncEnablementService'; import { IBrowserWorkbenchEnvironmentService } from 'vs/workbench/services/environment/browser/environmentService'; export class UserDataSyncEnablementService extends BaseUserDataSyncEnablementService implements IUserDataSyncEnablementService { protected get workbenchEnvironmentService(): IBrowserWorkbenchEnvironmentService { return <IBrowserWorkbenchEnvironmentService>this.environmentService; } override getResourceSyncStateVersion(resource: SyncResource): string | undefined { return resource === SyncResource.Extensions ? this.workbenchEnvironmentService.options?.settingsSyncOptions?.extensionsSyncStateVersion : undefined; } } registerSingleton(IUserDataSyncEnablementService, UserDataSyncEnablementService, InstantiationType.Delayed);
src/vs/workbench/services/userDataSync/browser/userDataSyncEnablementService.ts
0
https://github.com/microsoft/vscode/commit/00e8fdec5dcd099ae21c1b9f9851179f6fb1ab2f
[ 0.00017499578825663775, 0.00016872449486982077, 0.00016532944573555142, 0.00016584826516918838, 0.000004439526037458563 ]
{ "id": 3, "code_window": [ "\t\t\t\textensionId: languagePack.extensions[0].extensionIdentifier.id,\n", "\t\t\t};\n", "\t\t});\n", "\t\tlanguages.push({\n", "\t\t\t...this.createQuickPickItem('en', 'English'),\n", "\t\t\textensionId: 'default',\n", "\t\t});\n", "\t\tlanguages.sort((a, b) => a.label.localeCompare(b.label));\n", "\t\treturn languages;\n", "\t}\n", "\n" ], "labels": [ "keep", "keep", "keep", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep" ], "after_edit": [ "\t\tlanguages.push(this.createQuickPickItem('en', 'English'));\n" ], "file_path": "src/vs/platform/languagePacks/node/languagePacks.ts", "type": "replace", "edit_start_line_idx": 74 }
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import { URI } from 'vs/base/common/uri'; import { dirname, isEqual, basenameOrAuthority } from 'vs/base/common/resources'; import { IconLabel, IIconLabelValueOptions, IIconLabelCreationOptions } from 'vs/base/browser/ui/iconLabel/iconLabel'; import { ILanguageService } from 'vs/editor/common/languages/language'; import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { IModelService } from 'vs/editor/common/services/model'; import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles'; import { IDecoration, IDecorationsService, IResourceDecorationChangeEvent } from 'vs/workbench/services/decorations/common/decorations'; import { Schemas } from 'vs/base/common/network'; import { FileKind, FILES_ASSOCIATIONS_CONFIG } from 'vs/platform/files/common/files'; import { ITextModel } from 'vs/editor/common/model'; import { IThemeService } from 'vs/platform/theme/common/themeService'; import { Event, Emitter } from 'vs/base/common/event'; import { ILabelService } from 'vs/platform/label/common/label'; import { getIconClasses } from 'vs/editor/common/services/getIconClasses'; import { Disposable, dispose, IDisposable, MutableDisposable } from 'vs/base/common/lifecycle'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { normalizeDriveLetter } from 'vs/base/common/labels'; export interface IResourceLabelProps { resource?: URI | { primary?: URI; secondary?: URI }; name?: string | string[]; description?: string; } function toResource(props: IResourceLabelProps | undefined): URI | undefined { if (!props || !props.resource) { return undefined; } if (URI.isUri(props.resource)) { return props.resource; } return props.resource.primary; } export interface IResourceLabelOptions extends IIconLabelValueOptions { /** * A hint to the file kind of the resource. */ fileKind?: FileKind; /** * File decorations to use for the label. */ readonly fileDecorations?: { colors: boolean; badges: boolean }; /** * Will take the provided label as is and e.g. not override it for untitled files. */ readonly forceLabel?: boolean; } export interface IFileLabelOptions extends IResourceLabelOptions { hideLabel?: boolean; hidePath?: boolean; } export interface IResourceLabel extends IDisposable { readonly element: HTMLElement; readonly onDidRender: Event<void>; /** * Most generic way to apply a label with raw information. */ setLabel(label?: string, description?: string, options?: IIconLabelValueOptions): void; /** * Convenient method to apply a label by passing a resource along. * * Note: for file resources consider to use the #setFile() method instead. */ setResource(label: IResourceLabelProps, options?: IResourceLabelOptions): void; /** * Convenient method to render a file label based on a resource. */ setFile(resource: URI, options?: IFileLabelOptions): void; /** * Resets the label to be empty. */ clear(): void; } export interface IResourceLabelsContainer { readonly onDidChangeVisibility: Event<boolean>; } export const DEFAULT_LABELS_CONTAINER: IResourceLabelsContainer = { onDidChangeVisibility: Event.None }; export class ResourceLabels extends Disposable { private readonly _onDidChangeDecorations = this._register(new Emitter<void>()); readonly onDidChangeDecorations = this._onDidChangeDecorations.event; private widgets: ResourceLabelWidget[] = []; private labels: IResourceLabel[] = []; constructor( container: IResourceLabelsContainer, @IInstantiationService private readonly instantiationService: IInstantiationService, @IConfigurationService private readonly configurationService: IConfigurationService, @IModelService private readonly modelService: IModelService, @IWorkspaceContextService private readonly workspaceService: IWorkspaceContextService, @ILanguageService private readonly languageService: ILanguageService, @IDecorationsService private readonly decorationsService: IDecorationsService, @IThemeService private readonly themeService: IThemeService, @ILabelService private readonly labelService: ILabelService, @ITextFileService private readonly textFileService: ITextFileService ) { super(); this.registerListeners(container); } private registerListeners(container: IResourceLabelsContainer): void { // notify when visibility changes this._register(container.onDidChangeVisibility(visible => { this.widgets.forEach(widget => widget.notifyVisibilityChanged(visible)); })); // notify when extensions are registered with potentially new languages this._register(this.languageService.onDidChange(() => this.widgets.forEach(widget => widget.notifyExtensionsRegistered()))); // notify when model language changes this._register(this.modelService.onModelLanguageChanged(e => { if (!e.model.uri) { return; // we need the resource to compare } this.widgets.forEach(widget => widget.notifyModelLanguageChanged(e.model)); })); // notify when model is added this._register(this.modelService.onModelAdded(model => { if (!model.uri) { return; // we need the resource to compare } this.widgets.forEach(widget => widget.notifyModelAdded(model)); })); // notify when workspace folders changes this._register(this.workspaceService.onDidChangeWorkspaceFolders(() => { this.widgets.forEach(widget => widget.notifyWorkspaceFoldersChange()); })); // notify when file decoration changes this._register(this.decorationsService.onDidChangeDecorations(e => { let notifyDidChangeDecorations = false; this.widgets.forEach(widget => { if (widget.notifyFileDecorationsChanges(e)) { notifyDidChangeDecorations = true; } }); if (notifyDidChangeDecorations) { this._onDidChangeDecorations.fire(); } })); // notify when theme changes this._register(this.themeService.onDidColorThemeChange(() => this.widgets.forEach(widget => widget.notifyThemeChange()))); // notify when files.associations changes this._register(this.configurationService.onDidChangeConfiguration(e => { if (e.affectsConfiguration(FILES_ASSOCIATIONS_CONFIG)) { this.widgets.forEach(widget => widget.notifyFileAssociationsChange()); } })); // notify when label formatters change this._register(this.labelService.onDidChangeFormatters(e => { this.widgets.forEach(widget => widget.notifyFormattersChange(e.scheme)); })); // notify when untitled labels change this._register(this.textFileService.untitled.onDidChangeLabel(model => { this.widgets.forEach(widget => widget.notifyUntitledLabelChange(model.resource)); })); } get(index: number): IResourceLabel { return this.labels[index]; } create(container: HTMLElement, options?: IIconLabelCreationOptions): IResourceLabel { const widget = this.instantiationService.createInstance(ResourceLabelWidget, container, options); // Only expose a handle to the outside const label: IResourceLabel = { element: widget.element, onDidRender: widget.onDidRender, setLabel: (label: string, description?: string, options?: IIconLabelValueOptions) => widget.setLabel(label, description, options), setResource: (label: IResourceLabelProps, options?: IResourceLabelOptions) => widget.setResource(label, options), setFile: (resource: URI, options?: IFileLabelOptions) => widget.setFile(resource, options), clear: () => widget.clear(), dispose: () => this.disposeWidget(widget) }; // Store this.labels.push(label); this.widgets.push(widget); return label; } private disposeWidget(widget: ResourceLabelWidget): void { const index = this.widgets.indexOf(widget); if (index > -1) { this.widgets.splice(index, 1); this.labels.splice(index, 1); } dispose(widget); } clear(): void { this.widgets = dispose(this.widgets); this.labels = []; } override dispose(): void { super.dispose(); this.clear(); } } /** * Note: please consider to use `ResourceLabels` if you are in need * of more than one label for your widget. */ export class ResourceLabel extends ResourceLabels { private label: IResourceLabel; get element(): IResourceLabel { return this.label; } constructor( container: HTMLElement, options: IIconLabelCreationOptions | undefined, @IInstantiationService instantiationService: IInstantiationService, @IConfigurationService configurationService: IConfigurationService, @IModelService modelService: IModelService, @IWorkspaceContextService workspaceService: IWorkspaceContextService, @ILanguageService languageService: ILanguageService, @IDecorationsService decorationsService: IDecorationsService, @IThemeService themeService: IThemeService, @ILabelService labelService: ILabelService, @ITextFileService textFileService: ITextFileService ) { super(DEFAULT_LABELS_CONTAINER, instantiationService, configurationService, modelService, workspaceService, languageService, decorationsService, themeService, labelService, textFileService); this.label = this._register(this.create(container, options)); } } enum Redraw { Basic = 1, Full = 2 } class ResourceLabelWidget extends IconLabel { private readonly _onDidRender = this._register(new Emitter<void>()); readonly onDidRender = this._onDidRender.event; private label: IResourceLabelProps | undefined = undefined; private decoration = this._register(new MutableDisposable<IDecoration>()); private options: IResourceLabelOptions | undefined = undefined; private computedIconClasses: string[] | undefined = undefined; private computedLanguageId: string | undefined = undefined; private computedPathLabel: string | undefined = undefined; private computedWorkspaceFolderLabel: string | undefined = undefined; private needsRedraw: Redraw | undefined = undefined; private isHidden: boolean = false; constructor( container: HTMLElement, options: IIconLabelCreationOptions | undefined, @ILanguageService private readonly languageService: ILanguageService, @IModelService private readonly modelService: IModelService, @IDecorationsService private readonly decorationsService: IDecorationsService, @ILabelService private readonly labelService: ILabelService, @ITextFileService private readonly textFileService: ITextFileService, @IWorkspaceContextService private readonly contextService: IWorkspaceContextService ) { super(container, options); } notifyVisibilityChanged(visible: boolean): void { if (visible === this.isHidden) { this.isHidden = !visible; if (visible && this.needsRedraw) { this.render({ updateIcon: this.needsRedraw === Redraw.Full, updateDecoration: this.needsRedraw === Redraw.Full }); this.needsRedraw = undefined; } } } notifyModelLanguageChanged(model: ITextModel): void { this.handleModelEvent(model); } notifyModelAdded(model: ITextModel): void { this.handleModelEvent(model); } private handleModelEvent(model: ITextModel): void { const resource = toResource(this.label); if (!resource) { return; // only update if resource exists } if (isEqual(model.uri, resource)) { if (this.computedLanguageId !== model.getLanguageId()) { this.computedLanguageId = model.getLanguageId(); this.render({ updateIcon: true, updateDecoration: false }); // update if the language id of the model has changed from our last known state } } } notifyFileDecorationsChanges(e: IResourceDecorationChangeEvent): boolean { if (!this.options) { return false; } const resource = toResource(this.label); if (!resource) { return false; } if (this.options.fileDecorations && e.affectsResource(resource)) { return this.render({ updateIcon: false, updateDecoration: true }); } return false; } notifyExtensionsRegistered(): void { this.render({ updateIcon: true, updateDecoration: false }); } notifyThemeChange(): void { this.render({ updateIcon: false, updateDecoration: false }); } notifyFileAssociationsChange(): void { this.render({ updateIcon: true, updateDecoration: false }); } notifyFormattersChange(scheme: string): void { if (toResource(this.label)?.scheme === scheme) { this.render({ updateIcon: false, updateDecoration: false }); } } notifyUntitledLabelChange(resource: URI): void { if (isEqual(resource, toResource(this.label))) { this.render({ updateIcon: false, updateDecoration: false }); } } notifyWorkspaceFoldersChange(): void { if (typeof this.computedWorkspaceFolderLabel === 'string') { const resource = toResource(this.label); if (URI.isUri(resource) && this.label?.name === this.computedWorkspaceFolderLabel) { this.setFile(resource, this.options); } } } setFile(resource: URI, options?: IFileLabelOptions): void { const hideLabel = options?.hideLabel; let name: string | undefined; if (!hideLabel) { if (options?.fileKind === FileKind.ROOT_FOLDER) { const workspaceFolder = this.contextService.getWorkspaceFolder(resource); if (workspaceFolder) { name = workspaceFolder.name; this.computedWorkspaceFolderLabel = name; } } if (!name) { name = normalizeDriveLetter(basenameOrAuthority(resource)); } } let description: string | undefined; if (!options?.hidePath) { description = this.labelService.getUriLabel(dirname(resource), { relative: true }); } this.setResource({ resource, name, description }, options); } setResource(label: IResourceLabelProps, options: IResourceLabelOptions = Object.create(null)): void { const resource = toResource(label); const isSideBySideEditor = label?.resource && !URI.isUri(label.resource); if (!options.forceLabel && !isSideBySideEditor && resource?.scheme === Schemas.untitled) { // Untitled labels are very dynamic because they may change // whenever the content changes (unless a path is associated). // As such we always ask the actual editor for it's name and // description to get latest in case name/description are // provided. If they are not provided from the label we got // we assume that the client does not want to display them // and as such do not override. // // We do not touch the label if it represents a primary-secondary // because in that case we expect it to carry a proper label // and description. const untitledModel = this.textFileService.untitled.get(resource); if (untitledModel && !untitledModel.hasAssociatedFilePath) { if (typeof label.name === 'string') { label.name = untitledModel.name; } if (typeof label.description === 'string') { const untitledDescription = untitledModel.resource.path; if (label.name !== untitledDescription) { label.description = untitledDescription; } else { label.description = undefined; } } const untitledTitle = untitledModel.resource.path; if (untitledModel.name !== untitledTitle) { options.title = `${untitledModel.name} • ${untitledTitle}`; } else { options.title = untitledTitle; } } } const hasResourceChanged = this.hasResourceChanged(label); const hasPathLabelChanged = hasResourceChanged || this.hasPathLabelChanged(label); const hasFileKindChanged = this.hasFileKindChanged(options); this.label = label; this.options = options; if (hasResourceChanged) { this.computedLanguageId = undefined; // reset computed language since resource changed } if (hasPathLabelChanged) { this.computedPathLabel = undefined; // reset path label due to resource/path-label change } this.render({ updateIcon: hasResourceChanged || hasFileKindChanged, updateDecoration: hasResourceChanged || hasFileKindChanged }); } private hasFileKindChanged(newOptions?: IResourceLabelOptions): boolean { const newFileKind = newOptions?.fileKind; const oldFileKind = this.options?.fileKind; return newFileKind !== oldFileKind; // same resource but different kind (file, folder) } private hasResourceChanged(newLabel: IResourceLabelProps): boolean { const newResource = toResource(newLabel); const oldResource = toResource(this.label); if (newResource && oldResource) { return newResource.toString() !== oldResource.toString(); } if (!newResource && !oldResource) { return false; } return true; } private hasPathLabelChanged(newLabel: IResourceLabelProps): boolean { const newResource = toResource(newLabel); return !!newResource && this.computedPathLabel !== this.labelService.getUriLabel(newResource); } clear(): void { this.label = undefined; this.options = undefined; this.computedLanguageId = undefined; this.computedIconClasses = undefined; this.computedPathLabel = undefined; this.setLabel(''); } private render(options: { updateIcon: boolean; updateDecoration: boolean }): boolean { if (this.isHidden) { if (this.needsRedraw !== Redraw.Full) { this.needsRedraw = (options.updateIcon || options.updateDecoration) ? Redraw.Full : Redraw.Basic; } return false; } if (options.updateIcon) { this.computedIconClasses = undefined; } if (!this.label) { return false; } const iconLabelOptions: IIconLabelValueOptions & { extraClasses: string[] } = { title: '', italic: this.options?.italic, strikethrough: this.options?.strikethrough, matches: this.options?.matches, descriptionMatches: this.options?.descriptionMatches, extraClasses: [], separator: this.options?.separator, domId: this.options?.domId, disabledCommand: this.options?.disabledCommand, labelEscapeNewLines: this.options?.labelEscapeNewLines }; const resource = toResource(this.label); const label = this.label.name; if (this.options?.title !== undefined) { iconLabelOptions.title = this.options.title; } if (resource && resource.scheme !== Schemas.data /* do not accidentally inline Data URIs */ && ( (!this.options?.title) || ((typeof this.options.title !== 'string') && !this.options.title.markdownNotSupportedFallback) )) { if (!this.computedPathLabel) { this.computedPathLabel = this.labelService.getUriLabel(resource); } if (!iconLabelOptions.title || (typeof iconLabelOptions.title === 'string')) { iconLabelOptions.title = this.computedPathLabel; } else if (!iconLabelOptions.title.markdownNotSupportedFallback) { iconLabelOptions.title.markdownNotSupportedFallback = this.computedPathLabel; } } if (this.options && !this.options.hideIcon) { if (!this.computedIconClasses) { this.computedIconClasses = getIconClasses(this.modelService, this.languageService, resource, this.options.fileKind); } iconLabelOptions.extraClasses = this.computedIconClasses.slice(0); } if (this.options?.extraClasses) { iconLabelOptions.extraClasses.push(...this.options.extraClasses); } if (this.options?.fileDecorations && resource) { if (options.updateDecoration) { this.decoration.value = this.decorationsService.getDecoration(resource, this.options.fileKind !== FileKind.FILE); } const decoration = this.decoration.value; if (decoration) { if (decoration.tooltip) { if (typeof iconLabelOptions.title === 'string') { iconLabelOptions.title = `${iconLabelOptions.title} • ${decoration.tooltip}`; } else if (typeof iconLabelOptions.title?.markdown === 'string') { const title = `${iconLabelOptions.title.markdown} • ${decoration.tooltip}`; iconLabelOptions.title = { markdown: title, markdownNotSupportedFallback: title }; } } if (decoration.strikethrough) { iconLabelOptions.strikethrough = true; } if (this.options.fileDecorations.colors) { iconLabelOptions.extraClasses.push(decoration.labelClassName); } if (this.options.fileDecorations.badges) { iconLabelOptions.extraClasses.push(decoration.badgeClassName); iconLabelOptions.extraClasses.push(decoration.iconClassName); } } } this.setLabel(label || '', this.label.description, iconLabelOptions); this._onDidRender.fire(); return true; } override dispose(): void { super.dispose(); this.label = undefined; this.options = undefined; this.computedLanguageId = undefined; this.computedIconClasses = undefined; this.computedPathLabel = undefined; this.computedWorkspaceFolderLabel = undefined; } }
src/vs/workbench/browser/labels.ts
0
https://github.com/microsoft/vscode/commit/00e8fdec5dcd099ae21c1b9f9851179f6fb1ab2f
[ 0.00038140368997119367, 0.00018089768127538264, 0.0001598349481355399, 0.00017258702428080142, 0.00003786474189837463 ]
{ "id": 3, "code_window": [ "\t\t\t\textensionId: languagePack.extensions[0].extensionIdentifier.id,\n", "\t\t\t};\n", "\t\t});\n", "\t\tlanguages.push({\n", "\t\t\t...this.createQuickPickItem('en', 'English'),\n", "\t\t\textensionId: 'default',\n", "\t\t});\n", "\t\tlanguages.sort((a, b) => a.label.localeCompare(b.label));\n", "\t\treturn languages;\n", "\t}\n", "\n" ], "labels": [ "keep", "keep", "keep", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep" ], "after_edit": [ "\t\tlanguages.push(this.createQuickPickItem('en', 'English'));\n" ], "file_path": "src/vs/platform/languagePacks/node/languagePacks.ts", "type": "replace", "edit_start_line_idx": 74 }
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 386 197.26"><defs><style>.cls-1{fill:#252526;}.cls-2{fill:#3c3c3c;stroke:#073655;}.cls-2,.cls-4{stroke-miterlimit:10;}.cls-3{fill:#ccc;}.cls-4{fill:none;stroke:#ccc;}.cls-5{fill:#073655;}.cls-6{opacity:0.52;}</style></defs><title>Asset 8</title><g id="Layer_2" data-name="Layer 2"><g id="Layer_1-2" data-name="Layer 1"><rect class="cls-1" y="0.26" width="386" height="197"/><rect class="cls-2" x="5.25" y="8.26" width="374" height="23"/><path class="cls-3" d="M17.22,21.52l-7.14,3.59V23.87l5.35-2.59v0l-5.35-3V17l7.14,4Z"/><line class="cls-4" x1="18.75" y1="12.26" x2="18.75" y2="28.26"/><rect class="cls-5" y="38.76" width="385.75" height="20.5"/><path class="cls-3" d="M17.65,53.95a5.34,5.34,0,0,1-2.51.53A4.06,4.06,0,0,1,12,53.23,4.61,4.61,0,0,1,10.86,50a4.83,4.83,0,0,1,1.31-3.53,4.46,4.46,0,0,1,3.33-1.35,5.36,5.36,0,0,1,2.15.37v1.14A4.35,4.35,0,0,0,15.49,46a3.31,3.31,0,0,0-2.54,1,3.94,3.94,0,0,0-1,2.8,3.76,3.76,0,0,0,.91,2.65,3.1,3.1,0,0,0,2.39,1,4.48,4.48,0,0,0,2.37-.61Z"/><path class="cls-3" d="M24.76,54.33h-1V50.58q0-2-1.51-2a1.65,1.65,0,0,0-1.28.59,2.19,2.19,0,0,0-.52,1.51v3.68h-1V44.71h1v4.2h0a2.36,2.36,0,0,1,2.13-1.23q2.2,0,2.2,2.65Z"/><path class="cls-3" d="M31.37,54.33h-1v-1h0a2.18,2.18,0,0,1-2,1.17A2.14,2.14,0,0,1,26.79,54a1.78,1.78,0,0,1-.55-1.37q0-1.82,2.14-2.12l1.95-.27q0-1.66-1.34-1.66a3.2,3.2,0,0,0-2.12.8V48.29a4,4,0,0,1,2.21-.61q2.29,0,2.29,2.42Zm-1-3.29-1.57.22a2.55,2.55,0,0,0-1.09.36,1,1,0,0,0-.37.91,1,1,0,0,0,.34.78,1.31,1.31,0,0,0,.9.3,1.67,1.67,0,0,0,1.28-.54,1.94,1.94,0,0,0,.5-1.37Z"/><path class="cls-3" d="M38.73,54.33h-1V50.62q0-2.07-1.51-2.07a1.64,1.64,0,0,0-1.29.59,2.18,2.18,0,0,0-.51,1.48v3.71h-1v-6.5h1v1.08h0a2.35,2.35,0,0,1,2.13-1.23,2,2,0,0,1,1.63.69,3.07,3.07,0,0,1,.57,2Z"/><path class="cls-3" d="M46.24,53.81q0,3.58-3.43,3.58a4.6,4.6,0,0,1-2.11-.46v-1a4.33,4.33,0,0,0,2.09.61q2.4,0,2.4-2.55v-.71h0a2.63,2.63,0,0,1-4.19.38,3.47,3.47,0,0,1-.74-2.33,4,4,0,0,1,.8-2.63,2.66,2.66,0,0,1,2.18-1,2.12,2.12,0,0,1,1.95,1.05h0v-.9h1Zm-1-2.42v-1a1.86,1.86,0,0,0-.52-1.33,1.73,1.73,0,0,0-1.3-.55,1.81,1.81,0,0,0-1.51.7,3.14,3.14,0,0,0-.55,2A2.69,2.69,0,0,0,41.83,53a1.69,1.69,0,0,0,1.39.65A1.81,1.81,0,0,0,44.65,53,2.32,2.32,0,0,0,45.2,51.39Z"/><path class="cls-3" d="M53.57,51.34H49A2.43,2.43,0,0,0,49.56,53a2,2,0,0,0,1.54.59,3.19,3.19,0,0,0,2-.72v1a3.77,3.77,0,0,1-2.27.62,2.75,2.75,0,0,1-2.16-.89,3.62,3.62,0,0,1-.79-2.49,3.55,3.55,0,0,1,.86-2.47,2.76,2.76,0,0,1,2.14-1,2.45,2.45,0,0,1,2,.83,3.44,3.44,0,0,1,.7,2.29Zm-1.07-.88a2.12,2.12,0,0,0-.43-1.4,1.48,1.48,0,0,0-1.19-.5,1.68,1.68,0,0,0-1.25.53A2.39,2.39,0,0,0,49,50.46Z"/><path class="cls-3" d="M63.67,54.33H58.84v-9.1h4.62v1H59.91v3H63.2v1H59.91v3.19h3.76Z"/><path class="cls-3" d="M70.68,54.33h-1V50.62q0-2.07-1.51-2.07a1.64,1.64,0,0,0-1.29.59,2.18,2.18,0,0,0-.51,1.48v3.71h-1v-6.5h1v1.08h0a2.35,2.35,0,0,1,2.13-1.23,2,2,0,0,1,1.63.69,3.07,3.07,0,0,1,.56,2Z"/><path class="cls-3" d="M78.19,54.33h-1v-1.1h0a2.62,2.62,0,0,1-4.19.38,3.58,3.58,0,0,1-.73-2.38A3.9,3.9,0,0,1,73,48.65a2.68,2.68,0,0,1,2.16-1,2.09,2.09,0,0,1,1.95,1.05h0v-4h1Zm-1-2.94v-1a1.86,1.86,0,0,0-.52-1.33,1.74,1.74,0,0,0-1.32-.55,1.8,1.8,0,0,0-1.5.7,3.06,3.06,0,0,0-.54,1.93A2.75,2.75,0,0,0,73.78,53a1.71,1.71,0,0,0,1.41.65A1.78,1.78,0,0,0,76.6,53,2.35,2.35,0,0,0,77.14,51.39Z"/><path class="cls-3" d="M86.57,54.48a3,3,0,0,1-2.3-.91,3.37,3.37,0,0,1-.86-2.42,3.51,3.51,0,0,1,.9-2.56,3.22,3.22,0,0,1,2.42-.92,2.92,2.92,0,0,1,2.27.89,3.56,3.56,0,0,1,.82,2.48,3.49,3.49,0,0,1-.88,2.49A3.08,3.08,0,0,1,86.57,54.48Zm.08-5.93a2,2,0,0,0-1.59.68,2.8,2.8,0,0,0-.58,1.88,2.64,2.64,0,0,0,.59,1.82,2,2,0,0,0,1.58.67A1.9,1.9,0,0,0,88.2,53a2.84,2.84,0,0,0,.54-1.86,2.88,2.88,0,0,0-.54-1.88A1.89,1.89,0,0,0,86.65,48.55Z"/><path class="cls-3" d="M94.45,45.62a1.39,1.39,0,0,0-.69-.17q-1.09,0-1.09,1.38v1h1.52v.89H92.66v5.61h-1V48.72H90.52v-.89h1.11V46.78a2.19,2.19,0,0,1,.59-1.62,2,2,0,0,1,1.47-.59,2,2,0,0,1,.75.11Z"/><path class="cls-3" d="M103.73,54.33H99v-9.1h1.07v8.14h3.66Z"/><path class="cls-3" d="M105.52,46.18A.66.66,0,0,1,105,46a.64.64,0,0,1-.2-.48.67.67,0,0,1,.67-.68A.67.67,0,0,1,106,45a.68.68,0,0,1,0,1A.66.66,0,0,1,105.52,46.18Zm.51,8.15h-1v-6.5h1Z"/><path class="cls-3" d="M113.53,54.33h-1V50.62q0-2.07-1.51-2.07a1.64,1.64,0,0,0-1.29.59,2.18,2.18,0,0,0-.51,1.48v3.71h-1v-6.5h1v1.08h0a2.35,2.35,0,0,1,2.13-1.23,2,2,0,0,1,1.63.69,3.07,3.07,0,0,1,.57,2Z"/><path class="cls-3" d="M120.71,51.34h-4.59a2.43,2.43,0,0,0,.58,1.68,2,2,0,0,0,1.54.59,3.19,3.19,0,0,0,2-.72v1a3.77,3.77,0,0,1-2.27.62,2.75,2.75,0,0,1-2.17-.89,3.63,3.63,0,0,1-.79-2.49,3.55,3.55,0,0,1,.86-2.47,2.76,2.76,0,0,1,2.14-1,2.44,2.44,0,0,1,2,.83,3.44,3.44,0,0,1,.7,2.29Zm-1.07-.88a2.12,2.12,0,0,0-.44-1.4,1.48,1.48,0,0,0-1.19-.5,1.68,1.68,0,0,0-1.25.53,2.4,2.4,0,0,0-.63,1.38Z"/><path class="cls-3" d="M125.56,54V52.71a2.45,2.45,0,0,0,.52.34,4.17,4.17,0,0,0,.63.26,5,5,0,0,0,.67.16,3.72,3.72,0,0,0,.62.06,2.44,2.44,0,0,0,1.47-.36,1.37,1.37,0,0,0,.32-1.69,1.82,1.82,0,0,0-.45-.5,4.46,4.46,0,0,0-.68-.43l-.84-.43c-.32-.16-.61-.32-.89-.49a3.85,3.85,0,0,1-.72-.54,2.28,2.28,0,0,1-.48-.68,2.3,2.3,0,0,1,.1-2,2.33,2.33,0,0,1,.72-.76,3.27,3.27,0,0,1,1-.45,4.67,4.67,0,0,1,1.16-.15,4.45,4.45,0,0,1,2,.32v1.2a3.56,3.56,0,0,0-2.07-.56,3.39,3.39,0,0,0-.7.07,2,2,0,0,0-.62.24,1.36,1.36,0,0,0-.44.42,1.13,1.13,0,0,0-.17.63,1.3,1.3,0,0,0,.13.6,1.46,1.46,0,0,0,.38.46,3.8,3.8,0,0,0,.62.41l.84.43q.49.24.93.51a4.22,4.22,0,0,1,.77.59,2.6,2.6,0,0,1,.52.72,2,2,0,0,1,.19.9,2.29,2.29,0,0,1-.26,1.14,2.16,2.16,0,0,1-.71.76,3.1,3.1,0,0,1-1,.42,5.63,5.63,0,0,1-1.23.13l-.53,0c-.21,0-.43-.06-.65-.1a5.16,5.16,0,0,1-.62-.17A1.94,1.94,0,0,1,125.56,54Z"/><path class="cls-3" d="M138,51.34h-4.59A2.43,2.43,0,0,0,134,53a2,2,0,0,0,1.54.59,3.19,3.19,0,0,0,2-.72v1a3.77,3.77,0,0,1-2.27.62,2.75,2.75,0,0,1-2.17-.89,3.63,3.63,0,0,1-.79-2.49,3.55,3.55,0,0,1,.86-2.47,2.76,2.76,0,0,1,2.14-1,2.44,2.44,0,0,1,2,.83,3.44,3.44,0,0,1,.7,2.29Zm-1.07-.88a2.12,2.12,0,0,0-.44-1.4,1.48,1.48,0,0,0-1.19-.5,1.68,1.68,0,0,0-1.25.53,2.4,2.4,0,0,0-.63,1.38Z"/><path class="cls-3" d="M145.1,57.32h-1V53.21h0a2.33,2.33,0,0,1-2.22,1.27,2.44,2.44,0,0,1-2-.87,3.56,3.56,0,0,1-.74-2.38,3.9,3.9,0,0,1,.81-2.59,2.7,2.7,0,0,1,2.18-1A2,2,0,0,1,144,48.73h0v-.9h1Zm-1-5.92v-.95a1.89,1.89,0,0,0-.52-1.35,1.76,1.76,0,0,0-1.33-.55,1.78,1.78,0,0,0-1.48.7,3.1,3.1,0,0,0-.55,2A2.69,2.69,0,0,0,140.7,53a1.68,1.68,0,0,0,1.36.64,1.83,1.83,0,0,0,1.46-.62A2.31,2.31,0,0,0,144.06,51.4Z"/><path class="cls-3" d="M152.46,54.33h-1v-1h0a2.14,2.14,0,0,1-2,1.18q-2.32,0-2.32-2.77V47.83h1v3.72q0,2.06,1.57,2.06a1.59,1.59,0,0,0,1.25-.56,2.15,2.15,0,0,0,.49-1.47V47.83h1Z"/><path class="cls-3" d="M159.79,51.34H155.2a2.43,2.43,0,0,0,.58,1.68,2,2,0,0,0,1.54.59,3.19,3.19,0,0,0,2-.72v1a3.77,3.77,0,0,1-2.27.62,2.75,2.75,0,0,1-2.17-.89,3.63,3.63,0,0,1-.79-2.49,3.55,3.55,0,0,1,.86-2.47,2.76,2.76,0,0,1,2.14-1,2.44,2.44,0,0,1,2,.83,3.44,3.44,0,0,1,.7,2.29Zm-1.07-.88a2.12,2.12,0,0,0-.44-1.4,1.48,1.48,0,0,0-1.19-.5,1.68,1.68,0,0,0-1.25.53,2.4,2.4,0,0,0-.63,1.38Z"/><path class="cls-3" d="M166.76,54.33h-1V50.62q0-2.07-1.51-2.07a1.64,1.64,0,0,0-1.29.59,2.18,2.18,0,0,0-.51,1.48v3.71h-1v-6.5h1v1.08h0a2.34,2.34,0,0,1,2.13-1.23,2,2,0,0,1,1.63.69,3.07,3.07,0,0,1,.56,2Z"/><path class="cls-3" d="M173.15,54a3.38,3.38,0,0,1-1.78.45,2.94,2.94,0,0,1-2.24-.9,3.28,3.28,0,0,1-.85-2.35,3.6,3.6,0,0,1,.92-2.58,3.22,3.22,0,0,1,2.46-1,3.42,3.42,0,0,1,1.51.32v1.07a2.65,2.65,0,0,0-1.55-.51,2.09,2.09,0,0,0-1.63.71,2.71,2.71,0,0,0-.64,1.88,2.58,2.58,0,0,0,.6,1.8,2.07,2.07,0,0,0,1.61.66,2.61,2.61,0,0,0,1.6-.57Z"/><path class="cls-3" d="M180,51.34h-4.59a2.43,2.43,0,0,0,.58,1.68,2,2,0,0,0,1.54.59,3.19,3.19,0,0,0,2-.72v1a3.77,3.77,0,0,1-2.27.62,2.75,2.75,0,0,1-2.17-.89,3.63,3.63,0,0,1-.79-2.49,3.55,3.55,0,0,1,.86-2.47,2.76,2.76,0,0,1,2.14-1,2.44,2.44,0,0,1,2,.83,3.44,3.44,0,0,1,.7,2.29Zm-1.07-.88a2.12,2.12,0,0,0-.44-1.4,1.48,1.48,0,0,0-1.19-.5,1.68,1.68,0,0,0-1.25.53,2.4,2.4,0,0,0-.63,1.38Z"/><path class="cls-3" d="M17.65,75.95a5.34,5.34,0,0,1-2.51.53A4.06,4.06,0,0,1,12,75.23,4.61,4.61,0,0,1,10.86,72a4.83,4.83,0,0,1,1.31-3.53,4.46,4.46,0,0,1,3.33-1.35,5.36,5.36,0,0,1,2.15.37v1.14A4.35,4.35,0,0,0,15.49,68a3.31,3.31,0,0,0-2.54,1,3.94,3.94,0,0,0-1,2.8,3.76,3.76,0,0,0,.91,2.65,3.1,3.1,0,0,0,2.39,1,4.48,4.48,0,0,0,2.37-.61Z"/><path class="cls-3" d="M24.76,76.33h-1V72.58q0-2-1.51-2a1.65,1.65,0,0,0-1.28.59,2.19,2.19,0,0,0-.52,1.51v3.68h-1V66.71h1v4.2h0a2.36,2.36,0,0,1,2.13-1.23q2.2,0,2.2,2.65Z"/><path class="cls-3" d="M31.37,76.33h-1v-1h0a2.18,2.18,0,0,1-2,1.17A2.14,2.14,0,0,1,26.79,76a1.78,1.78,0,0,1-.55-1.37q0-1.82,2.14-2.12l1.95-.27q0-1.66-1.34-1.66a3.2,3.2,0,0,0-2.12.8V70.29a4,4,0,0,1,2.21-.61q2.29,0,2.29,2.42Zm-1-3.29-1.57.22a2.55,2.55,0,0,0-1.09.36,1,1,0,0,0-.37.91,1,1,0,0,0,.34.78,1.31,1.31,0,0,0,.9.3,1.67,1.67,0,0,0,1.28-.54,1.94,1.94,0,0,0,.5-1.37Z"/><path class="cls-3" d="M38.73,76.33h-1V72.62q0-2.07-1.51-2.07a1.64,1.64,0,0,0-1.29.59,2.18,2.18,0,0,0-.51,1.48v3.71h-1v-6.5h1v1.08h0a2.35,2.35,0,0,1,2.13-1.23,2,2,0,0,1,1.63.69,3.07,3.07,0,0,1,.57,2Z"/><path class="cls-3" d="M46.24,75.81q0,3.58-3.43,3.58a4.6,4.6,0,0,1-2.11-.46v-1a4.33,4.33,0,0,0,2.09.61q2.4,0,2.4-2.55v-.71h0a2.63,2.63,0,0,1-4.19.38,3.47,3.47,0,0,1-.74-2.33,4,4,0,0,1,.8-2.63,2.66,2.66,0,0,1,2.18-1,2.12,2.12,0,0,1,1.95,1.05h0v-.9h1Zm-1-2.42v-1a1.86,1.86,0,0,0-.52-1.33,1.73,1.73,0,0,0-1.3-.55,1.81,1.81,0,0,0-1.51.7,3.14,3.14,0,0,0-.55,2A2.69,2.69,0,0,0,41.83,75a1.69,1.69,0,0,0,1.39.65A1.81,1.81,0,0,0,44.65,75,2.32,2.32,0,0,0,45.2,73.39Z"/><path class="cls-3" d="M53.57,73.34H49A2.43,2.43,0,0,0,49.56,75a2,2,0,0,0,1.54.59,3.19,3.19,0,0,0,2-.72v1a3.77,3.77,0,0,1-2.27.62,2.75,2.75,0,0,1-2.16-.89,3.62,3.62,0,0,1-.79-2.49,3.55,3.55,0,0,1,.86-2.47,2.76,2.76,0,0,1,2.14-1,2.45,2.45,0,0,1,2,.83,3.44,3.44,0,0,1,.7,2.29Zm-1.07-.88a2.12,2.12,0,0,0-.43-1.4,1.48,1.48,0,0,0-1.19-.5,1.68,1.68,0,0,0-1.25.53A2.39,2.39,0,0,0,49,72.46Z"/><path class="cls-3" d="M63.46,68.19H59.91v3.15H63.2v1H59.91v4H58.84v-9.1h4.62Z"/><path class="cls-3" d="M65.58,68.18a.66.66,0,0,1-.48-.19.64.64,0,0,1-.2-.48.67.67,0,0,1,.67-.68.67.67,0,0,1,.49.19.68.68,0,0,1,0,1A.66.66,0,0,1,65.58,68.18Zm.51,8.15h-1v-6.5h1Z"/><path class="cls-3" d="M69.24,76.33h-1V66.71h1Z"/><path class="cls-3" d="M76.57,73.34H72A2.43,2.43,0,0,0,72.57,75a2,2,0,0,0,1.54.59,3.19,3.19,0,0,0,2-.72v1a3.77,3.77,0,0,1-2.27.62,2.75,2.75,0,0,1-2.16-.89,3.62,3.62,0,0,1-.79-2.49,3.55,3.55,0,0,1,.86-2.47,2.76,2.76,0,0,1,2.14-1,2.45,2.45,0,0,1,2,.83,3.44,3.44,0,0,1,.7,2.29Zm-1.07-.88a2.12,2.12,0,0,0-.43-1.4,1.48,1.48,0,0,0-1.19-.5,1.68,1.68,0,0,0-1.25.53A2.39,2.39,0,0,0,72,72.46Z"/><path class="cls-3" d="M86.67,76.33H81.85v-9.1h4.62v1H82.91v3H86.2v1H82.91v3.19h3.76Z"/><path class="cls-3" d="M93.68,76.33h-1V72.62q0-2.07-1.51-2.07a1.64,1.64,0,0,0-1.29.59,2.18,2.18,0,0,0-.51,1.48v3.71h-1v-6.5h1v1.08h0a2.35,2.35,0,0,1,2.13-1.23,2,2,0,0,1,1.63.69,3.07,3.07,0,0,1,.56,2Z"/><path class="cls-3" d="M100.07,76a3.38,3.38,0,0,1-1.78.45,2.94,2.94,0,0,1-2.24-.9,3.28,3.28,0,0,1-.85-2.35,3.6,3.6,0,0,1,.92-2.58,3.22,3.22,0,0,1,2.46-1,3.41,3.41,0,0,1,1.51.32v1.07a2.64,2.64,0,0,0-1.55-.51,2.1,2.1,0,0,0-1.63.71,2.72,2.72,0,0,0-.64,1.88,2.58,2.58,0,0,0,.6,1.8,2.07,2.07,0,0,0,1.61.66,2.61,2.61,0,0,0,1.6-.57Z"/><path class="cls-3" d="M104.36,76.48a3,3,0,0,1-2.3-.91,3.37,3.37,0,0,1-.86-2.42,3.52,3.52,0,0,1,.9-2.56,3.22,3.22,0,0,1,2.42-.92,2.92,2.92,0,0,1,2.27.89,3.56,3.56,0,0,1,.81,2.48,3.49,3.49,0,0,1-.88,2.49A3.08,3.08,0,0,1,104.36,76.48Zm.08-5.93a2,2,0,0,0-1.59.68,2.81,2.81,0,0,0-.58,1.88,2.65,2.65,0,0,0,.59,1.82,2,2,0,0,0,1.58.67A1.9,1.9,0,0,0,106,75a2.83,2.83,0,0,0,.54-1.86,2.88,2.88,0,0,0-.54-1.88A1.89,1.89,0,0,0,104.44,70.55Z"/><path class="cls-3" d="M114.81,76.33h-1v-1.1h0a2.62,2.62,0,0,1-4.19.38,3.57,3.57,0,0,1-.73-2.38,3.9,3.9,0,0,1,.81-2.58,2.68,2.68,0,0,1,2.17-1,2.08,2.08,0,0,1,1.95,1.05h0v-4h1Zm-1-2.94v-1a1.86,1.86,0,0,0-.52-1.33,1.75,1.75,0,0,0-1.32-.55,1.8,1.8,0,0,0-1.5.7,3.06,3.06,0,0,0-.55,1.93,2.76,2.76,0,0,0,.52,1.77,1.71,1.71,0,0,0,1.41.65,1.78,1.78,0,0,0,1.41-.63A2.34,2.34,0,0,0,113.77,73.39Z"/><path class="cls-3" d="M117.45,68.18A.66.66,0,0,1,117,68a.64.64,0,0,1-.2-.48.67.67,0,0,1,.67-.68.67.67,0,0,1,.49.19.68.68,0,0,1,0,1A.66.66,0,0,1,117.45,68.18Zm.51,8.15h-1v-6.5h1Z"/><path class="cls-3" d="M125.46,76.33h-1V72.62q0-2.07-1.51-2.07a1.64,1.64,0,0,0-1.29.59,2.18,2.18,0,0,0-.51,1.48v3.71h-1v-6.5h1v1.08h0a2.35,2.35,0,0,1,2.13-1.23,2,2,0,0,1,1.63.69,3.07,3.07,0,0,1,.57,2Z"/><path class="cls-3" d="M133,75.81q0,3.58-3.43,3.58a4.6,4.6,0,0,1-2.11-.46v-1a4.33,4.33,0,0,0,2.09.61q2.4,0,2.4-2.55v-.71h0a2.63,2.63,0,0,1-4.19.38,3.47,3.47,0,0,1-.74-2.33,4,4,0,0,1,.8-2.63,2.66,2.66,0,0,1,2.18-1,2.12,2.12,0,0,1,1.95,1.05h0v-.9h1Zm-1-2.42v-1a1.86,1.86,0,0,0-.52-1.33,1.73,1.73,0,0,0-1.3-.55,1.81,1.81,0,0,0-1.51.7,3.14,3.14,0,0,0-.55,2,2.69,2.69,0,0,0,.52,1.74,1.69,1.69,0,0,0,1.39.65,1.81,1.81,0,0,0,1.42-.62A2.32,2.32,0,0,0,131.93,73.39Z"/><path class="cls-3" d="M17.65,97.95a5.34,5.34,0,0,1-2.51.53A4.06,4.06,0,0,1,12,97.23,4.61,4.61,0,0,1,10.86,94a4.83,4.83,0,0,1,1.31-3.53,4.46,4.46,0,0,1,3.33-1.35,5.36,5.36,0,0,1,2.15.37v1.14A4.35,4.35,0,0,0,15.49,90a3.31,3.31,0,0,0-2.54,1,3.94,3.94,0,0,0-1,2.8,3.76,3.76,0,0,0,.91,2.65,3.1,3.1,0,0,0,2.39,1,4.48,4.48,0,0,0,2.37-.61Z"/><path class="cls-3" d="M24.76,98.33h-1V94.58q0-2-1.51-2a1.65,1.65,0,0,0-1.28.59,2.19,2.19,0,0,0-.52,1.51v3.68h-1V88.71h1v4.2h0a2.36,2.36,0,0,1,2.13-1.23q2.2,0,2.2,2.65Z"/><path class="cls-3" d="M31.37,98.33h-1v-1h0a2.18,2.18,0,0,1-2,1.17A2.14,2.14,0,0,1,26.79,98a1.78,1.78,0,0,1-.55-1.37q0-1.82,2.14-2.12l1.95-.27q0-1.66-1.34-1.66a3.2,3.2,0,0,0-2.12.8V92.29a4,4,0,0,1,2.21-.61q2.29,0,2.29,2.42Zm-1-3.29-1.57.22a2.55,2.55,0,0,0-1.09.36,1,1,0,0,0-.37.91,1,1,0,0,0,.34.78,1.31,1.31,0,0,0,.9.3,1.67,1.67,0,0,0,1.28-.54,1.94,1.94,0,0,0,.5-1.37Z"/><path class="cls-3" d="M38.73,98.33h-1V94.62q0-2.07-1.51-2.07a1.64,1.64,0,0,0-1.29.59,2.18,2.18,0,0,0-.51,1.48v3.71h-1v-6.5h1v1.08h0a2.35,2.35,0,0,1,2.13-1.23,2,2,0,0,1,1.63.69,3.07,3.07,0,0,1,.57,2Z"/><path class="cls-3" d="M46.24,97.81q0,3.58-3.43,3.58a4.6,4.6,0,0,1-2.11-.46v-1a4.33,4.33,0,0,0,2.09.61q2.4,0,2.4-2.55v-.71h0a2.63,2.63,0,0,1-4.19.38,3.47,3.47,0,0,1-.74-2.33,4,4,0,0,1,.8-2.63,2.66,2.66,0,0,1,2.18-1,2.12,2.12,0,0,1,1.95,1.05h0v-.9h1Zm-1-2.42v-1a1.86,1.86,0,0,0-.52-1.33,1.73,1.73,0,0,0-1.3-.55,1.81,1.81,0,0,0-1.51.7,3.14,3.14,0,0,0-.55,2A2.69,2.69,0,0,0,41.83,97a1.69,1.69,0,0,0,1.39.65A1.81,1.81,0,0,0,44.65,97,2.32,2.32,0,0,0,45.2,95.39Z"/><path class="cls-3" d="M53.57,95.34H49A2.43,2.43,0,0,0,49.56,97a2,2,0,0,0,1.54.59,3.19,3.19,0,0,0,2-.72v1a3.77,3.77,0,0,1-2.27.62,2.75,2.75,0,0,1-2.16-.89,3.62,3.62,0,0,1-.79-2.49,3.55,3.55,0,0,1,.86-2.47,2.76,2.76,0,0,1,2.14-1,2.45,2.45,0,0,1,2,.83,3.44,3.44,0,0,1,.7,2.29Zm-1.07-.88a2.12,2.12,0,0,0-.43-1.4,1.48,1.48,0,0,0-1.19-.5,1.68,1.68,0,0,0-1.25.53A2.39,2.39,0,0,0,49,94.46Z"/><path class="cls-3" d="M63.57,98.33H58.84v-9.1h1.07v8.14h3.66Z"/><path class="cls-3" d="M69.48,98.33h-1v-1h0a2.18,2.18,0,0,1-2,1.17A2.14,2.14,0,0,1,64.89,98a1.78,1.78,0,0,1-.55-1.37q0-1.82,2.15-2.12l1.95-.27q0-1.66-1.34-1.66a3.2,3.2,0,0,0-2.12.8V92.29a4,4,0,0,1,2.21-.61q2.29,0,2.29,2.42Zm-1-3.29-1.57.22a2.55,2.55,0,0,0-1.09.36,1,1,0,0,0-.37.91,1,1,0,0,0,.34.78,1.31,1.31,0,0,0,.9.3,1.67,1.67,0,0,0,1.28-.54,1.94,1.94,0,0,0,.5-1.37Z"/><path class="cls-3" d="M76.83,98.33h-1V94.62q0-2.07-1.51-2.07a1.64,1.64,0,0,0-1.29.59,2.18,2.18,0,0,0-.51,1.48v3.71h-1v-6.5h1v1.08h0a2.34,2.34,0,0,1,2.13-1.23,2,2,0,0,1,1.63.69,3.07,3.07,0,0,1,.57,2Z"/><path class="cls-3" d="M84.34,97.81q0,3.58-3.43,3.58a4.61,4.61,0,0,1-2.11-.46v-1a4.33,4.33,0,0,0,2.1.61q2.4,0,2.4-2.55v-.71h0a2.63,2.63,0,0,1-4.19.38,3.47,3.47,0,0,1-.74-2.33,4,4,0,0,1,.8-2.63,2.66,2.66,0,0,1,2.18-1,2.12,2.12,0,0,1,1.95,1.05h0v-.9h1Zm-1-2.42v-1a1.86,1.86,0,0,0-.52-1.33,1.73,1.73,0,0,0-1.3-.55,1.81,1.81,0,0,0-1.51.7,3.13,3.13,0,0,0-.55,2A2.7,2.7,0,0,0,79.94,97a1.69,1.69,0,0,0,1.39.65A1.81,1.81,0,0,0,82.75,97,2.32,2.32,0,0,0,83.3,95.39Z"/><path class="cls-3" d="M91.71,98.33h-1v-1h0a2.14,2.14,0,0,1-2,1.18q-2.32,0-2.32-2.77V91.83h1v3.72q0,2.06,1.57,2.06A1.59,1.59,0,0,0,90.17,97a2.15,2.15,0,0,0,.49-1.47V91.83h1Z"/><path class="cls-3" d="M98.46,98.33h-1v-1h0a2.18,2.18,0,0,1-2,1.17A2.14,2.14,0,0,1,93.87,98a1.79,1.79,0,0,1-.55-1.37q0-1.82,2.15-2.12l1.95-.27q0-1.66-1.34-1.66a3.2,3.2,0,0,0-2.12.8V92.29a4,4,0,0,1,2.21-.61q2.29,0,2.29,2.42Zm-1-3.29-1.57.22a2.55,2.55,0,0,0-1.09.36,1,1,0,0,0-.37.91,1,1,0,0,0,.34.78,1.31,1.31,0,0,0,.9.3,1.67,1.67,0,0,0,1.28-.54,1.94,1.94,0,0,0,.5-1.37Z"/><path class="cls-3" d="M106,97.81q0,3.58-3.43,3.58a4.6,4.6,0,0,1-2.11-.46v-1a4.33,4.33,0,0,0,2.09.61q2.4,0,2.4-2.55v-.71h0a2.63,2.63,0,0,1-4.19.38,3.46,3.46,0,0,1-.74-2.33,4,4,0,0,1,.8-2.63,2.66,2.66,0,0,1,2.18-1,2.12,2.12,0,0,1,1.95,1.05h0v-.9h1Zm-1-2.42v-1a1.86,1.86,0,0,0-.52-1.33,1.73,1.73,0,0,0-1.3-.55,1.81,1.81,0,0,0-1.51.7,3.13,3.13,0,0,0-.55,2,2.69,2.69,0,0,0,.52,1.74,1.69,1.69,0,0,0,1.39.65,1.81,1.81,0,0,0,1.43-.62A2.32,2.32,0,0,0,104.93,95.39Z"/><path class="cls-3" d="M113.3,95.34h-4.59a2.43,2.43,0,0,0,.58,1.68,2,2,0,0,0,1.54.59,3.19,3.19,0,0,0,2-.72v1a3.77,3.77,0,0,1-2.27.62,2.75,2.75,0,0,1-2.17-.89,3.63,3.63,0,0,1-.79-2.49,3.55,3.55,0,0,1,.86-2.47,2.76,2.76,0,0,1,2.14-1,2.44,2.44,0,0,1,2,.83,3.44,3.44,0,0,1,.7,2.29Zm-1.07-.88a2.12,2.12,0,0,0-.44-1.4,1.48,1.48,0,0,0-1.19-.5,1.68,1.68,0,0,0-1.25.53,2.4,2.4,0,0,0-.63,1.38Z"/><path class="cls-3" d="M127.86,98.33h-1.06V92.22q0-.72.09-1.77h0a5.69,5.69,0,0,1-.27.88l-3.11,7H123l-3.1-6.94a5.42,5.42,0,0,1-.27-.93h0q0,.54.05,1.78v6.09h-1v-9.1H120l2.79,6.35a8.11,8.11,0,0,1,.42,1.09h0q.27-.75.44-1.12l2.85-6.32h1.33Z"/><path class="cls-3" d="M132.83,98.48a3,3,0,0,1-2.3-.91,3.37,3.37,0,0,1-.86-2.42,3.52,3.52,0,0,1,.9-2.56,3.22,3.22,0,0,1,2.42-.92,2.92,2.92,0,0,1,2.27.89,3.56,3.56,0,0,1,.81,2.48,3.49,3.49,0,0,1-.88,2.49A3.08,3.08,0,0,1,132.83,98.48Zm.08-5.93a2,2,0,0,0-1.59.68,2.81,2.81,0,0,0-.58,1.88,2.65,2.65,0,0,0,.59,1.82,2,2,0,0,0,1.58.67,1.9,1.9,0,0,0,1.55-.65,2.83,2.83,0,0,0,.54-1.86,2.88,2.88,0,0,0-.54-1.88A1.89,1.89,0,0,0,132.9,92.55Z"/><path class="cls-3" d="M143.27,98.33h-1v-1.1h0a2.62,2.62,0,0,1-4.19.38,3.57,3.57,0,0,1-.73-2.38,3.9,3.9,0,0,1,.81-2.58,2.68,2.68,0,0,1,2.17-1,2.08,2.08,0,0,1,1.95,1.05h0v-4h1Zm-1-2.94v-1a1.86,1.86,0,0,0-.52-1.33,1.75,1.75,0,0,0-1.32-.55,1.8,1.8,0,0,0-1.5.7,3.06,3.06,0,0,0-.55,1.93,2.76,2.76,0,0,0,.52,1.77,1.71,1.71,0,0,0,1.41.65,1.78,1.78,0,0,0,1.41-.63A2.34,2.34,0,0,0,142.23,95.39Z"/><path class="cls-3" d="M150.61,95.34H146A2.43,2.43,0,0,0,146.6,97a2,2,0,0,0,1.54.59,3.19,3.19,0,0,0,2-.72v1a3.77,3.77,0,0,1-2.27.62,2.74,2.74,0,0,1-2.16-.89,3.62,3.62,0,0,1-.79-2.49,3.55,3.55,0,0,1,.86-2.47,2.76,2.76,0,0,1,2.14-1,2.45,2.45,0,0,1,2,.83,3.44,3.44,0,0,1,.7,2.29Zm-1.07-.88a2.11,2.11,0,0,0-.44-1.4,1.48,1.48,0,0,0-1.19-.5,1.68,1.68,0,0,0-1.25.53,2.38,2.38,0,0,0-.63,1.38Z"/><path class="cls-3" d="M17.65,119.95a5.34,5.34,0,0,1-2.51.53A4.06,4.06,0,0,1,12,119.23,4.61,4.61,0,0,1,10.86,116a4.83,4.83,0,0,1,1.31-3.53,4.46,4.46,0,0,1,3.33-1.35,5.36,5.36,0,0,1,2.15.37v1.14a4.35,4.35,0,0,0-2.16-.55,3.31,3.31,0,0,0-2.54,1,3.94,3.94,0,0,0-1,2.8,3.76,3.76,0,0,0,.91,2.65,3.1,3.1,0,0,0,2.39,1,4.48,4.48,0,0,0,2.37-.61Z"/><path class="cls-3" d="M20.4,120.33h-1v-9.62h1Z"/><path class="cls-3" d="M27.73,117.34H23.14a2.43,2.43,0,0,0,.58,1.68,2,2,0,0,0,1.54.59,3.19,3.19,0,0,0,2-.72v1a3.77,3.77,0,0,1-2.27.62,2.75,2.75,0,0,1-2.17-.89,3.63,3.63,0,0,1-.79-2.49,3.55,3.55,0,0,1,.86-2.47,2.76,2.76,0,0,1,2.14-1,2.44,2.44,0,0,1,2,.83,3.44,3.44,0,0,1,.7,2.29Zm-1.07-.88a2.12,2.12,0,0,0-.44-1.4,1.48,1.48,0,0,0-1.19-.5,1.68,1.68,0,0,0-1.25.53,2.4,2.4,0,0,0-.63,1.38Z"/><path class="cls-3" d="M34,120.33h-1v-1h0a2.18,2.18,0,0,1-2,1.17,2.14,2.14,0,0,1-1.52-.51,1.78,1.78,0,0,1-.55-1.37q0-1.82,2.14-2.12l1.95-.27q0-1.66-1.34-1.66a3.2,3.2,0,0,0-2.12.8v-1.07a4,4,0,0,1,2.21-.61q2.29,0,2.29,2.42Zm-1-3.29-1.57.22a2.55,2.55,0,0,0-1.09.36,1,1,0,0,0-.37.91,1,1,0,0,0,.34.78,1.31,1.31,0,0,0,.9.3,1.67,1.67,0,0,0,1.28-.54,1.94,1.94,0,0,0,.5-1.37Z"/><path class="cls-3" d="M39.31,114.88a1.28,1.28,0,0,0-.79-.21,1.33,1.33,0,0,0-1.12.63A2.92,2.92,0,0,0,37,117v3.31h-1v-6.5h1v1.34h0a2.27,2.27,0,0,1,.68-1.07,1.55,1.55,0,0,1,1-.38,1.7,1.7,0,0,1,.62.09Z"/><path class="cls-3" d="M49,120.33H44.14v-9.1h4.62v1H45.21v3H48.5v1H45.21v3.19H49Z"/><path class="cls-3" d="M56.13,120.33h-1v-1.1h0a2.4,2.4,0,0,1-2.23,1.26,2.43,2.43,0,0,1-2-.87,3.58,3.58,0,0,1-.73-2.38,3.9,3.9,0,0,1,.81-2.58,2.68,2.68,0,0,1,2.16-1,2.08,2.08,0,0,1,1.95,1.05h0v-4h1Zm-1-2.94v-1a1.86,1.86,0,0,0-.52-1.33,1.74,1.74,0,0,0-1.32-.55,1.8,1.8,0,0,0-1.5.7,3.06,3.06,0,0,0-.55,1.93,2.76,2.76,0,0,0,.52,1.77,1.71,1.71,0,0,0,1.41.65,1.78,1.78,0,0,0,1.41-.63A2.34,2.34,0,0,0,55.09,117.39Z"/><path class="cls-3" d="M58.77,112.18a.66.66,0,0,1-.48-.19.64.64,0,0,1-.2-.48.67.67,0,0,1,.67-.68.67.67,0,0,1,.49.19.68.68,0,0,1,0,1A.66.66,0,0,1,58.77,112.18Zm.51,8.15h-1v-6.5h1Z"/><path class="cls-3" d="M64.4,120.27a2,2,0,0,1-1,.2q-1.71,0-1.71-1.9v-3.85H60.6v-.89h1.12v-1.59l1-.34v1.92H64.4v.89H62.76v3.66a1.52,1.52,0,0,0,.22.93.89.89,0,0,0,.74.28,1.1,1.1,0,0,0,.68-.22Z"/><path class="cls-3" d="M68.4,120.48a3,3,0,0,1-2.3-.91,3.37,3.37,0,0,1-.86-2.42,3.52,3.52,0,0,1,.89-2.56,3.22,3.22,0,0,1,2.42-.92,2.92,2.92,0,0,1,2.27.89,3.55,3.55,0,0,1,.82,2.48,3.49,3.49,0,0,1-.88,2.49A3.08,3.08,0,0,1,68.4,120.48Zm.08-5.93a2,2,0,0,0-1.59.68,2.81,2.81,0,0,0-.58,1.88,2.65,2.65,0,0,0,.59,1.82,2,2,0,0,0,1.58.67A1.9,1.9,0,0,0,70,119a2.84,2.84,0,0,0,.54-1.86,2.88,2.88,0,0,0-.54-1.88A1.89,1.89,0,0,0,68.48,114.55Z"/><path class="cls-3" d="M76.69,114.88a1.27,1.27,0,0,0-.79-.21,1.33,1.33,0,0,0-1.11.63,2.91,2.91,0,0,0-.45,1.71v3.31h-1v-6.5h1v1.34h0A2.27,2.27,0,0,1,75,114.1a1.55,1.55,0,0,1,1-.38,1.7,1.7,0,0,1,.62.09Z"/><path class="cls-3" d="M88.37,120.33H87.3v-4.15H82.59v4.15H81.52v-9.1h1.07v4H87.3v-4h1.07Z"/><path class="cls-3" d="M91.15,112.18a.66.66,0,0,1-.48-.19.64.64,0,0,1-.2-.48.67.67,0,0,1,.67-.68.67.67,0,0,1,.49.19.68.68,0,0,1,0,1A.66.66,0,0,1,91.15,112.18Zm.51,8.15h-1v-6.5h1Z"/><path class="cls-3" d="M93.37,120.1V119a3.09,3.09,0,0,0,1.87.63q1.37,0,1.37-.91a.79.79,0,0,0-.12-.44,1.17,1.17,0,0,0-.32-.32,2.44,2.44,0,0,0-.47-.25l-.58-.23a7.45,7.45,0,0,1-.76-.35,2.3,2.3,0,0,1-.55-.39,1.47,1.47,0,0,1-.33-.5,1.76,1.76,0,0,1-.11-.65,1.56,1.56,0,0,1,.21-.81,1.85,1.85,0,0,1,.56-.59,2.6,2.6,0,0,1,.8-.36,3.52,3.52,0,0,1,.92-.12,3.74,3.74,0,0,1,1.51.29V115a2.94,2.94,0,0,0-1.65-.47,2,2,0,0,0-.53.07,1.3,1.3,0,0,0-.4.19.87.87,0,0,0-.26.29.77.77,0,0,0-.09.37.9.9,0,0,0,.09.42.94.94,0,0,0,.27.3,2,2,0,0,0,.43.24l.58.23a8.15,8.15,0,0,1,.78.34,2.64,2.64,0,0,1,.58.39,1.53,1.53,0,0,1,.37.5,1.63,1.63,0,0,1,.13.68,1.61,1.61,0,0,1-.21.84,1.84,1.84,0,0,1-.57.59,2.61,2.61,0,0,1-.82.35,4,4,0,0,1-1,.11A3.69,3.69,0,0,1,93.37,120.1Z"/><path class="cls-3" d="M102.29,120.27a2,2,0,0,1-1,.2q-1.71,0-1.71-1.9v-3.85H98.5v-.89h1.12v-1.59l1-.34v1.92h1.64v.89h-1.64v3.66a1.52,1.52,0,0,0,.22.93.88.88,0,0,0,.74.28,1.09,1.09,0,0,0,.68-.22Z"/><path class="cls-3" d="M106.3,120.48a3,3,0,0,1-2.3-.91,3.37,3.37,0,0,1-.86-2.42,3.51,3.51,0,0,1,.9-2.56,3.22,3.22,0,0,1,2.42-.92,2.92,2.92,0,0,1,2.27.89,3.56,3.56,0,0,1,.82,2.48,3.49,3.49,0,0,1-.88,2.49A3.08,3.08,0,0,1,106.3,120.48Zm.08-5.93a2,2,0,0,0-1.59.68,2.8,2.8,0,0,0-.58,1.88,2.64,2.64,0,0,0,.59,1.82,2,2,0,0,0,1.58.67,1.9,1.9,0,0,0,1.55-.65,2.84,2.84,0,0,0,.54-1.86,2.88,2.88,0,0,0-.54-1.88A1.89,1.89,0,0,0,106.38,114.55Z"/><path class="cls-3" d="M114.59,114.88a1.27,1.27,0,0,0-.79-.21,1.33,1.33,0,0,0-1.11.63,2.91,2.91,0,0,0-.45,1.71v3.31h-1v-6.5h1v1.34h0a2.27,2.27,0,0,1,.68-1.07,1.55,1.55,0,0,1,1-.38,1.69,1.69,0,0,1,.62.09Z"/><path class="cls-3" d="M121.41,113.83l-3,7.54q-.8,2-2.25,2a2.36,2.36,0,0,1-.68-.08v-.93a1.93,1.93,0,0,0,.62.11,1.28,1.28,0,0,0,1.18-.94l.52-1.23-2.54-6.49h1.16l1.76,5q0,.1.13.5h0q0-.15.13-.48l1.85-5Z"/><path class="cls-3" d="M17.65,141.95a5.34,5.34,0,0,1-2.51.53A4.06,4.06,0,0,1,12,141.23,4.61,4.61,0,0,1,10.86,138a4.83,4.83,0,0,1,1.31-3.53,4.46,4.46,0,0,1,3.33-1.35,5.36,5.36,0,0,1,2.15.37v1.14a4.35,4.35,0,0,0-2.16-.55,3.31,3.31,0,0,0-2.54,1,3.94,3.94,0,0,0-1,2.8,3.76,3.76,0,0,0,.91,2.65,3.1,3.1,0,0,0,2.39,1,4.48,4.48,0,0,0,2.37-.61Z"/><path class="cls-3" d="M20.4,142.33h-1v-9.62h1Z"/><path class="cls-3" d="M25.23,142.48a3,3,0,0,1-2.3-.91,3.37,3.37,0,0,1-.86-2.42,3.51,3.51,0,0,1,.9-2.56,3.22,3.22,0,0,1,2.42-.92,2.92,2.92,0,0,1,2.27.89,3.56,3.56,0,0,1,.82,2.48,3.49,3.49,0,0,1-.88,2.49A3.08,3.08,0,0,1,25.23,142.48Zm.08-5.93a2,2,0,0,0-1.59.68,2.8,2.8,0,0,0-.58,1.88,2.64,2.64,0,0,0,.59,1.82,2,2,0,0,0,1.58.67,1.9,1.9,0,0,0,1.55-.65,2.84,2.84,0,0,0,.54-1.86,2.88,2.88,0,0,0-.54-1.88A1.89,1.89,0,0,0,25.3,136.55Z"/><path class="cls-3" d="M29.73,142.1V141a3.09,3.09,0,0,0,1.87.63q1.37,0,1.37-.91a.8.8,0,0,0-.12-.44,1.16,1.16,0,0,0-.32-.32,2.46,2.46,0,0,0-.47-.25l-.58-.23a7.47,7.47,0,0,1-.76-.35,2.29,2.29,0,0,1-.55-.39,1.47,1.47,0,0,1-.33-.5,1.76,1.76,0,0,1-.11-.65,1.56,1.56,0,0,1,.21-.81,1.87,1.87,0,0,1,.56-.59,2.6,2.6,0,0,1,.8-.36,3.51,3.51,0,0,1,.92-.12,3.74,3.74,0,0,1,1.51.29V137a2.94,2.94,0,0,0-1.65-.47,1.94,1.94,0,0,0-.53.07,1.3,1.3,0,0,0-.4.19.86.86,0,0,0-.26.29.77.77,0,0,0-.09.37.9.9,0,0,0,.09.42.92.92,0,0,0,.27.3,2.06,2.06,0,0,0,.43.24l.58.23A8.23,8.23,0,0,1,33,139a2.64,2.64,0,0,1,.58.39,1.52,1.52,0,0,1,.37.5,1.8,1.8,0,0,1-.08,1.52,1.82,1.82,0,0,1-.57.59,2.61,2.61,0,0,1-.82.35,4,4,0,0,1-1,.11A3.69,3.69,0,0,1,29.73,142.1Z"/><path class="cls-3" d="M40.87,139.34H36.28a2.43,2.43,0,0,0,.58,1.68,2,2,0,0,0,1.54.59,3.19,3.19,0,0,0,2-.72v1a3.77,3.77,0,0,1-2.27.62A2.74,2.74,0,0,1,36,141.6a3.62,3.62,0,0,1-.79-2.49,3.55,3.55,0,0,1,.86-2.47,2.76,2.76,0,0,1,2.14-1,2.45,2.45,0,0,1,2,.83,3.44,3.44,0,0,1,.7,2.29Zm-1.07-.88a2.11,2.11,0,0,0-.44-1.4,1.48,1.48,0,0,0-1.19-.5,1.68,1.68,0,0,0-1.25.53,2.38,2.38,0,0,0-.63,1.38Z"/><path class="cls-3" d="M53.48,142.33H52.17l-4.68-7.26a3,3,0,0,1-.29-.57h0a9.48,9.48,0,0,1,.05,1.25v6.58H46.14v-9.1h1.38l4.56,7.14c.19.3.31.5.37.61h0a9.73,9.73,0,0,1-.06-1.34v-6.41h1.07Z"/><path class="cls-3" d="M58.44,142.48a3,3,0,0,1-2.3-.91,3.37,3.37,0,0,1-.86-2.42,3.52,3.52,0,0,1,.89-2.56,3.22,3.22,0,0,1,2.42-.92,2.92,2.92,0,0,1,2.27.89,3.55,3.55,0,0,1,.82,2.48,3.49,3.49,0,0,1-.88,2.49A3.08,3.08,0,0,1,58.44,142.48Zm.08-5.93a2,2,0,0,0-1.59.68,2.8,2.8,0,0,0-.58,1.88,2.65,2.65,0,0,0,.59,1.82,2,2,0,0,0,1.58.67,1.9,1.9,0,0,0,1.55-.65,2.84,2.84,0,0,0,.54-1.86,2.89,2.89,0,0,0-.54-1.88A1.89,1.89,0,0,0,58.52,136.55Z"/><path class="cls-3" d="M66.36,142.27a2,2,0,0,1-1,.2q-1.71,0-1.71-1.9v-3.85H62.56v-.89h1.12v-1.59l1-.34v1.92h1.64v.89H64.72v3.66a1.52,1.52,0,0,0,.22.93.89.89,0,0,0,.74.28,1.1,1.1,0,0,0,.68-.22Z"/><path class="cls-3" d="M68.28,134.18a.66.66,0,0,1-.48-.19.64.64,0,0,1-.2-.48.67.67,0,0,1,.67-.68.67.67,0,0,1,.48.19.67.67,0,0,1,0,1A.66.66,0,0,1,68.28,134.18Zm.51,8.15h-1v-6.5h1Z"/><path class="cls-3" d="M74.11,133.62a1.39,1.39,0,0,0-.69-.17q-1.09,0-1.09,1.38v1h1.52v.89H72.33v5.61h-1v-5.61H70.18v-.89h1.11v-1.05a2.19,2.19,0,0,1,.59-1.62,2,2,0,0,1,1.47-.59,2,2,0,0,1,.75.11Z"/><path class="cls-3" d="M75.5,134.18A.66.66,0,0,1,75,134a.64.64,0,0,1-.2-.48.67.67,0,0,1,.67-.68A.67.67,0,0,1,76,133a.68.68,0,0,1,0,1A.66.66,0,0,1,75.5,134.18Zm.51,8.15H75v-6.5h1Z"/><path class="cls-3" d="M82.55,142a3.38,3.38,0,0,1-1.78.45,2.94,2.94,0,0,1-2.24-.9,3.28,3.28,0,0,1-.85-2.35,3.6,3.6,0,0,1,.92-2.58,3.22,3.22,0,0,1,2.46-1,3.41,3.41,0,0,1,1.51.32v1.07a2.64,2.64,0,0,0-1.55-.51,2.1,2.1,0,0,0-1.63.71,2.71,2.71,0,0,0-.64,1.88,2.58,2.58,0,0,0,.6,1.8,2.07,2.07,0,0,0,1.61.66,2.61,2.61,0,0,0,1.6-.57Z"/><path class="cls-3" d="M88.77,142.33h-1v-1h0a2.18,2.18,0,0,1-2,1.17,2.14,2.14,0,0,1-1.52-.51,1.78,1.78,0,0,1-.55-1.37q0-1.82,2.15-2.12l1.95-.27q0-1.66-1.34-1.66a3.2,3.2,0,0,0-2.12.8v-1.07a4,4,0,0,1,2.21-.61q2.29,0,2.29,2.42Zm-1-3.29-1.57.22a2.55,2.55,0,0,0-1.09.36,1,1,0,0,0-.37.91,1,1,0,0,0,.34.78,1.31,1.31,0,0,0,.9.3,1.67,1.67,0,0,0,1.28-.54,1.94,1.94,0,0,0,.5-1.37Z"/><path class="cls-3" d="M93.75,142.27a2,2,0,0,1-1,.2q-1.71,0-1.71-1.9v-3.85H90v-.89h1.12v-1.59l1-.34v1.92h1.64v.89H92.11v3.66a1.52,1.52,0,0,0,.22.93.89.89,0,0,0,.74.28,1.1,1.1,0,0,0,.68-.22Z"/><path class="cls-3" d="M95.67,134.18a.66.66,0,0,1-.48-.19.64.64,0,0,1-.2-.48.67.67,0,0,1,.67-.68.67.67,0,0,1,.49.19.68.68,0,0,1,0,1A.66.66,0,0,1,95.67,134.18Zm.51,8.15h-1v-6.5h1Z"/><path class="cls-3" d="M101,142.48a3,3,0,0,1-2.3-.91,3.37,3.37,0,0,1-.86-2.42,3.52,3.52,0,0,1,.89-2.56,3.22,3.22,0,0,1,2.42-.92,2.92,2.92,0,0,1,2.27.89,3.55,3.55,0,0,1,.82,2.48,3.49,3.49,0,0,1-.88,2.49A3.08,3.08,0,0,1,101,142.48Zm.08-5.93a2,2,0,0,0-1.59.68,2.81,2.81,0,0,0-.58,1.88,2.65,2.65,0,0,0,.59,1.82,2,2,0,0,0,1.58.67,1.9,1.9,0,0,0,1.55-.65,2.84,2.84,0,0,0,.54-1.86,2.88,2.88,0,0,0-.54-1.88A1.89,1.89,0,0,0,101.08,136.55Z"/><path class="cls-3" d="M111.3,142.33h-1v-3.71q0-2.07-1.51-2.07a1.64,1.64,0,0,0-1.29.59,2.18,2.18,0,0,0-.51,1.48v3.71h-1v-6.5h1v1.08h0a2.35,2.35,0,0,1,2.13-1.23,2,2,0,0,1,1.63.69,3.07,3.07,0,0,1,.56,2Z"/><path class="cls-3" d="M126.24,142.33h-1.06v-6.11q0-.72.09-1.77h0a5.6,5.6,0,0,1-.27.88l-3.11,7h-.52l-3.1-6.94a5.53,5.53,0,0,1-.27-.93h0q.05.54.05,1.78v6.09h-1v-9.1h1.41l2.79,6.35a8.11,8.11,0,0,1,.42,1.09h0q.27-.75.44-1.12l2.85-6.32h1.33Z"/><path class="cls-3" d="M133.72,139.34h-4.59a2.43,2.43,0,0,0,.58,1.68,2,2,0,0,0,1.54.59,3.19,3.19,0,0,0,2-.72v1a3.77,3.77,0,0,1-2.27.62,2.74,2.74,0,0,1-2.16-.89,3.62,3.62,0,0,1-.79-2.49,3.55,3.55,0,0,1,.86-2.47,2.76,2.76,0,0,1,2.14-1,2.45,2.45,0,0,1,2,.83,3.44,3.44,0,0,1,.7,2.29Zm-1.07-.88a2.11,2.11,0,0,0-.44-1.4,1.48,1.48,0,0,0-1.19-.5,1.68,1.68,0,0,0-1.25.53,2.38,2.38,0,0,0-.63,1.38Z"/><path class="cls-3" d="M134.9,142.1V141a3.09,3.09,0,0,0,1.87.63q1.37,0,1.37-.91a.8.8,0,0,0-.12-.44,1.16,1.16,0,0,0-.32-.32,2.46,2.46,0,0,0-.47-.25l-.58-.23a7.47,7.47,0,0,1-.76-.35,2.29,2.29,0,0,1-.55-.39,1.47,1.47,0,0,1-.33-.5,1.76,1.76,0,0,1-.11-.65,1.56,1.56,0,0,1,.21-.81,1.87,1.87,0,0,1,.56-.59,2.6,2.6,0,0,1,.8-.36,3.51,3.51,0,0,1,.92-.12,3.74,3.74,0,0,1,1.51.29V137a2.94,2.94,0,0,0-1.65-.47,1.94,1.94,0,0,0-.53.07,1.3,1.3,0,0,0-.4.19.86.86,0,0,0-.26.29.77.77,0,0,0-.09.37.9.9,0,0,0,.09.42.92.92,0,0,0,.27.3,2.06,2.06,0,0,0,.43.24l.58.23a8.23,8.23,0,0,1,.77.34,2.64,2.64,0,0,1,.58.39,1.52,1.52,0,0,1,.37.5,1.8,1.8,0,0,1-.08,1.52,1.82,1.82,0,0,1-.57.59,2.61,2.61,0,0,1-.82.35,4,4,0,0,1-1,.11A3.69,3.69,0,0,1,134.9,142.1Z"/><path class="cls-3" d="M140.42,142.1V141a3.09,3.09,0,0,0,1.87.63q1.37,0,1.37-.91a.79.79,0,0,0-.12-.44,1.17,1.17,0,0,0-.32-.32,2.44,2.44,0,0,0-.47-.25l-.58-.23a7.45,7.45,0,0,1-.76-.35,2.3,2.3,0,0,1-.55-.39,1.47,1.47,0,0,1-.33-.5,1.76,1.76,0,0,1-.11-.65,1.56,1.56,0,0,1,.21-.81,1.85,1.85,0,0,1,.56-.59,2.6,2.6,0,0,1,.8-.36,3.52,3.52,0,0,1,.92-.12,3.74,3.74,0,0,1,1.51.29V137a2.94,2.94,0,0,0-1.65-.47,2,2,0,0,0-.53.07,1.3,1.3,0,0,0-.4.19.87.87,0,0,0-.26.29.77.77,0,0,0-.09.37.9.9,0,0,0,.09.42.94.94,0,0,0,.27.3,2,2,0,0,0,.43.24l.58.23a8.15,8.15,0,0,1,.78.34,2.64,2.64,0,0,1,.58.39,1.53,1.53,0,0,1,.37.5,1.63,1.63,0,0,1,.13.68,1.61,1.61,0,0,1-.21.84,1.84,1.84,0,0,1-.57.59,2.61,2.61,0,0,1-.82.35,4,4,0,0,1-1,.11A3.69,3.69,0,0,1,140.42,142.1Z"/><path class="cls-3" d="M151,142.33h-1v-1h0a2.18,2.18,0,0,1-2,1.17,2.14,2.14,0,0,1-1.52-.51,1.78,1.78,0,0,1-.55-1.37q0-1.82,2.15-2.12l1.95-.27q0-1.66-1.34-1.66a3.2,3.2,0,0,0-2.12.8v-1.07a4,4,0,0,1,2.21-.61q2.29,0,2.29,2.42Zm-1-3.29-1.57.22a2.55,2.55,0,0,0-1.09.36,1,1,0,0,0-.37.91,1,1,0,0,0,.34.78,1.31,1.31,0,0,0,.9.3,1.67,1.67,0,0,0,1.28-.54,1.94,1.94,0,0,0,.5-1.37Z"/><path class="cls-3" d="M158.49,141.81q0,3.58-3.43,3.58a4.6,4.6,0,0,1-2.11-.46v-1a4.33,4.33,0,0,0,2.09.61q2.4,0,2.4-2.55v-.71h0a2.63,2.63,0,0,1-4.19.38,3.47,3.47,0,0,1-.74-2.33,4,4,0,0,1,.8-2.63,2.66,2.66,0,0,1,2.18-1,2.12,2.12,0,0,1,1.95,1.05h0v-.9h1Zm-1-2.42v-1a1.86,1.86,0,0,0-.52-1.33,1.73,1.73,0,0,0-1.3-.55,1.81,1.81,0,0,0-1.51.7,3.14,3.14,0,0,0-.55,2,2.69,2.69,0,0,0,.52,1.74,1.69,1.69,0,0,0,1.39.65,1.81,1.81,0,0,0,1.42-.62A2.32,2.32,0,0,0,157.45,139.39Z"/><path class="cls-3" d="M165.82,139.34h-4.59a2.43,2.43,0,0,0,.58,1.68,2,2,0,0,0,1.54.59,3.19,3.19,0,0,0,2-.72v1a3.77,3.77,0,0,1-2.27.62,2.75,2.75,0,0,1-2.16-.89,3.62,3.62,0,0,1-.79-2.49,3.55,3.55,0,0,1,.86-2.47,2.76,2.76,0,0,1,2.14-1,2.45,2.45,0,0,1,2,.83,3.44,3.44,0,0,1,.7,2.29Zm-1.07-.88a2.12,2.12,0,0,0-.43-1.4,1.48,1.48,0,0,0-1.19-.5,1.68,1.68,0,0,0-1.25.53,2.39,2.39,0,0,0-.63,1.38Z"/><path class="cls-3" d="M167,142.1V141a3.09,3.09,0,0,0,1.87.63q1.37,0,1.37-.91a.79.79,0,0,0-.12-.44,1.17,1.17,0,0,0-.32-.32,2.44,2.44,0,0,0-.47-.25l-.58-.23a7.45,7.45,0,0,1-.76-.35,2.3,2.3,0,0,1-.55-.39,1.47,1.47,0,0,1-.33-.5,1.76,1.76,0,0,1-.11-.65,1.56,1.56,0,0,1,.21-.81,1.85,1.85,0,0,1,.56-.59,2.6,2.6,0,0,1,.8-.36,3.52,3.52,0,0,1,.92-.12A3.74,3.74,0,0,1,171,136V137a2.94,2.94,0,0,0-1.65-.47,2,2,0,0,0-.53.07,1.3,1.3,0,0,0-.4.19.87.87,0,0,0-.26.29.77.77,0,0,0-.09.37.9.9,0,0,0,.09.42.94.94,0,0,0,.27.3,2,2,0,0,0,.43.24l.58.23a8.15,8.15,0,0,1,.78.34,2.64,2.64,0,0,1,.58.39,1.53,1.53,0,0,1,.37.5,1.63,1.63,0,0,1,.13.68,1.61,1.61,0,0,1-.21.84,1.84,1.84,0,0,1-.57.59,2.61,2.61,0,0,1-.82.35,4,4,0,0,1-1,.11A3.69,3.69,0,0,1,167,142.1Z"/><path class="cls-3" d="M17.65,163.95a5.34,5.34,0,0,1-2.51.53A4.06,4.06,0,0,1,12,163.23,4.61,4.61,0,0,1,10.86,160a4.83,4.83,0,0,1,1.31-3.53,4.46,4.46,0,0,1,3.33-1.35,5.36,5.36,0,0,1,2.15.37v1.14a4.35,4.35,0,0,0-2.16-.55,3.31,3.31,0,0,0-2.54,1,3.94,3.94,0,0,0-1,2.8,3.76,3.76,0,0,0,.91,2.65,3.1,3.1,0,0,0,2.39,1,4.48,4.48,0,0,0,2.37-.61Z"/><path class="cls-3" d="M20.4,164.33h-1v-9.62h1Z"/><path class="cls-3" d="M25.23,164.48a3,3,0,0,1-2.3-.91,3.37,3.37,0,0,1-.86-2.42,3.51,3.51,0,0,1,.9-2.56,3.22,3.22,0,0,1,2.42-.92,2.92,2.92,0,0,1,2.27.89,3.56,3.56,0,0,1,.82,2.48,3.49,3.49,0,0,1-.88,2.49A3.08,3.08,0,0,1,25.23,164.48Zm.08-5.93a2,2,0,0,0-1.59.68,2.8,2.8,0,0,0-.58,1.88,2.64,2.64,0,0,0,.59,1.82,2,2,0,0,0,1.58.67,1.9,1.9,0,0,0,1.55-.65,2.84,2.84,0,0,0,.54-1.86,2.88,2.88,0,0,0-.54-1.88A1.89,1.89,0,0,0,25.3,158.55Z"/><path class="cls-3" d="M29.73,164.1V163a3.09,3.09,0,0,0,1.87.63q1.37,0,1.37-.91a.8.8,0,0,0-.12-.44,1.16,1.16,0,0,0-.32-.32,2.46,2.46,0,0,0-.47-.25l-.58-.23a7.47,7.47,0,0,1-.76-.35,2.29,2.29,0,0,1-.55-.39,1.47,1.47,0,0,1-.33-.5,1.76,1.76,0,0,1-.11-.65,1.56,1.56,0,0,1,.21-.81,1.87,1.87,0,0,1,.56-.59,2.6,2.6,0,0,1,.8-.36,3.51,3.51,0,0,1,.92-.12,3.74,3.74,0,0,1,1.51.29V159a2.94,2.94,0,0,0-1.65-.47,1.94,1.94,0,0,0-.53.07,1.3,1.3,0,0,0-.4.19.86.86,0,0,0-.26.29.77.77,0,0,0-.09.37.9.9,0,0,0,.09.42.92.92,0,0,0,.27.3,2.06,2.06,0,0,0,.43.24l.58.23A8.23,8.23,0,0,1,33,161a2.64,2.64,0,0,1,.58.39,1.52,1.52,0,0,1,.37.5,1.8,1.8,0,0,1-.08,1.52,1.82,1.82,0,0,1-.57.59,2.61,2.61,0,0,1-.82.35,4,4,0,0,1-1,.11A3.69,3.69,0,0,1,29.73,164.1Z"/><path class="cls-3" d="M40.87,161.34H36.28a2.43,2.43,0,0,0,.58,1.68,2,2,0,0,0,1.54.59,3.19,3.19,0,0,0,2-.72v1a3.77,3.77,0,0,1-2.27.62A2.74,2.74,0,0,1,36,163.6a3.62,3.62,0,0,1-.79-2.49,3.55,3.55,0,0,1,.86-2.47,2.76,2.76,0,0,1,2.14-1,2.45,2.45,0,0,1,2,.83,3.44,3.44,0,0,1,.7,2.29Zm-1.07-.88a2.11,2.11,0,0,0-.44-1.4,1.48,1.48,0,0,0-1.19-.5,1.68,1.68,0,0,0-1.25.53,2.38,2.38,0,0,0-.63,1.38Z"/><path class="cls-3" d="M56.93,155.23l-2.57,9.1H53.11l-1.87-6.65a4.11,4.11,0,0,1-.15-.93h0a4.67,4.67,0,0,1-.17.91L49,164.33H47.78l-2.67-9.1h1.17l1.94,7a4.63,4.63,0,0,1,.15.91h0a5.39,5.39,0,0,1,.2-.91l2-7h1l1.93,7a5,5,0,0,1,.15.85h0a5.15,5.15,0,0,1,.17-.88l1.86-7Z"/><path class="cls-3" d="M58.68,156.18a.66.66,0,0,1-.48-.19.64.64,0,0,1-.2-.48.67.67,0,0,1,.67-.68.67.67,0,0,1,.49.19.68.68,0,0,1,0,1A.66.66,0,0,1,58.68,156.18Zm.51,8.15h-1v-6.5h1Z"/><path class="cls-3" d="M66.69,164.33h-1v-3.71q0-2.07-1.51-2.07a1.64,1.64,0,0,0-1.29.59,2.18,2.18,0,0,0-.51,1.48v3.71h-1v-6.5h1v1.08h0a2.35,2.35,0,0,1,2.13-1.23,2,2,0,0,1,1.63.69,3.07,3.07,0,0,1,.56,2Z"/><path class="cls-3" d="M74.2,164.33h-1v-1.1h0a2.62,2.62,0,0,1-4.19.38,3.58,3.58,0,0,1-.73-2.38,3.9,3.9,0,0,1,.81-2.58,2.68,2.68,0,0,1,2.16-1,2.09,2.09,0,0,1,1.95,1.05h0v-4h1Zm-1-2.94v-1a1.86,1.86,0,0,0-.52-1.33,1.74,1.74,0,0,0-1.32-.55,1.8,1.8,0,0,0-1.5.7,3.06,3.06,0,0,0-.54,1.93A2.75,2.75,0,0,0,69.8,163a1.71,1.71,0,0,0,1.41.65,1.78,1.78,0,0,0,1.41-.63A2.35,2.35,0,0,0,73.16,161.39Z"/><path class="cls-3" d="M79,164.48a3,3,0,0,1-2.3-.91,3.37,3.37,0,0,1-.86-2.42,3.52,3.52,0,0,1,.9-2.56,3.22,3.22,0,0,1,2.42-.92,2.92,2.92,0,0,1,2.27.89,3.56,3.56,0,0,1,.81,2.48,3.49,3.49,0,0,1-.88,2.49A3.08,3.08,0,0,1,79,164.48Zm.08-5.93a2,2,0,0,0-1.59.68,2.81,2.81,0,0,0-.58,1.88,2.65,2.65,0,0,0,.59,1.82,2,2,0,0,0,1.58.67,1.9,1.9,0,0,0,1.55-.65,2.83,2.83,0,0,0,.54-1.86,2.88,2.88,0,0,0-.54-1.88A1.89,1.89,0,0,0,79.1,158.55Z"/><path class="cls-3" d="M92.11,157.83l-1.95,6.5H89.08l-1.34-4.65a3.08,3.08,0,0,1-.1-.6h0a2.76,2.76,0,0,1-.13.59L86,164.33H85l-2-6.5h1.09l1.35,4.89a2.94,2.94,0,0,1,.09.58h.05a2.73,2.73,0,0,1,.11-.6l1.5-4.87h1l1.35,4.9a3.47,3.47,0,0,1,.09.58h.05a2.67,2.67,0,0,1,.11-.58l1.32-4.9Z"/><path class="cls-3" d="M17.65,185.95a5.34,5.34,0,0,1-2.51.53A4.06,4.06,0,0,1,12,185.23,4.61,4.61,0,0,1,10.86,182a4.83,4.83,0,0,1,1.31-3.53,4.46,4.46,0,0,1,3.33-1.35,5.36,5.36,0,0,1,2.15.37v1.14a4.35,4.35,0,0,0-2.16-.55,3.31,3.31,0,0,0-2.54,1,3.94,3.94,0,0,0-1,2.8,3.76,3.76,0,0,0,.91,2.65,3.1,3.1,0,0,0,2.39,1,4.48,4.48,0,0,0,2.37-.61Z"/><path class="cls-3" d="M22.08,186.48a3,3,0,0,1-2.3-.91,3.37,3.37,0,0,1-.86-2.42,3.51,3.51,0,0,1,.9-2.56,3.22,3.22,0,0,1,2.42-.92,2.92,2.92,0,0,1,2.27.89,3.56,3.56,0,0,1,.82,2.48,3.49,3.49,0,0,1-.88,2.49A3.08,3.08,0,0,1,22.08,186.48Zm.08-5.93a2,2,0,0,0-1.59.68,2.8,2.8,0,0,0-.58,1.88,2.64,2.64,0,0,0,.59,1.82,2,2,0,0,0,1.58.67,1.9,1.9,0,0,0,1.55-.65,2.84,2.84,0,0,0,.54-1.86,2.88,2.88,0,0,0-.54-1.88A1.89,1.89,0,0,0,22.15,180.55Z"/><path class="cls-3" d="M32.37,186.33h-1v-3.71q0-2.07-1.51-2.07a1.64,1.64,0,0,0-1.29.59,2.18,2.18,0,0,0-.51,1.48v3.71H27v-6.5h1v1.08h0a2.34,2.34,0,0,1,2.13-1.23,2,2,0,0,1,1.63.69,3.07,3.07,0,0,1,.57,2Z"/><path class="cls-3" d="M37.55,177.62a1.39,1.39,0,0,0-.69-.17q-1.09,0-1.09,1.38v1h1.52v.89H35.76v5.61h-1v-5.61H33.62v-.89h1.11v-1.05a2.19,2.19,0,0,1,.59-1.62,2,2,0,0,1,1.47-.59,2,2,0,0,1,.75.11Z"/><path class="cls-3" d="M38.94,178.18a.66.66,0,0,1-.48-.19.64.64,0,0,1-.2-.48.67.67,0,0,1,.67-.68.67.67,0,0,1,.49.19.68.68,0,0,1,0,1A.66.66,0,0,1,38.94,178.18Zm.51,8.15h-1v-6.5h1Z"/><path class="cls-3" d="M47.1,185.81q0,3.58-3.43,3.58a4.6,4.6,0,0,1-2.11-.46v-1a4.33,4.33,0,0,0,2.09.61q2.4,0,2.4-2.55v-.71h0a2.63,2.63,0,0,1-4.19.38,3.47,3.47,0,0,1-.74-2.33,4,4,0,0,1,.8-2.63,2.66,2.66,0,0,1,2.18-1A2.12,2.12,0,0,1,46,180.73h0v-.9h1Zm-1-2.42v-1a1.86,1.86,0,0,0-.52-1.33,1.73,1.73,0,0,0-1.3-.55,1.81,1.81,0,0,0-1.51.7,3.14,3.14,0,0,0-.55,2A2.69,2.69,0,0,0,42.7,185a1.69,1.69,0,0,0,1.39.65,1.81,1.81,0,0,0,1.42-.62A2.32,2.32,0,0,0,46.06,183.39Z"/><path class="cls-3" d="M54.46,186.33h-1v-1h0a2.14,2.14,0,0,1-2,1.18q-2.32,0-2.32-2.77v-3.88h1v3.72q0,2.06,1.57,2.06a1.59,1.59,0,0,0,1.25-.56,2.15,2.15,0,0,0,.49-1.47v-3.75h1Z"/><path class="cls-3" d="M60,180.88a1.28,1.28,0,0,0-.79-.21,1.33,1.33,0,0,0-1.12.63,2.92,2.92,0,0,0-.45,1.71v3.31h-1v-6.5h1v1.34h0a2.27,2.27,0,0,1,.68-1.07,1.55,1.55,0,0,1,1-.38,1.7,1.7,0,0,1,.62.09Z"/><path class="cls-3" d="M66.14,183.34H61.55a2.43,2.43,0,0,0,.58,1.68,2,2,0,0,0,1.54.59,3.19,3.19,0,0,0,2-.72v1a3.77,3.77,0,0,1-2.27.62,2.75,2.75,0,0,1-2.16-.89,3.62,3.62,0,0,1-.79-2.49,3.55,3.55,0,0,1,.86-2.47,2.76,2.76,0,0,1,2.14-1,2.45,2.45,0,0,1,2,.83,3.44,3.44,0,0,1,.7,2.29Zm-1.07-.88a2.12,2.12,0,0,0-.43-1.4,1.48,1.48,0,0,0-1.19-.5,1.68,1.68,0,0,0-1.25.53,2.39,2.39,0,0,0-.63,1.38Z"/><path class="cls-3" d="M76.13,186.33H71.41v-9.1h1.07v8.14h3.66Z"/><path class="cls-3" d="M82,186.33H81v-1h0a2.18,2.18,0,0,1-2,1.17,2.14,2.14,0,0,1-1.52-.51,1.78,1.78,0,0,1-.55-1.37q0-1.82,2.15-2.12l1.95-.27q0-1.66-1.34-1.66a3.2,3.2,0,0,0-2.12.8v-1.07a4,4,0,0,1,2.21-.61q2.29,0,2.29,2.42ZM81,183l-1.57.22a2.55,2.55,0,0,0-1.09.36,1,1,0,0,0-.37.91,1,1,0,0,0,.34.78,1.31,1.31,0,0,0,.9.3,1.67,1.67,0,0,0,1.28-.54,1.94,1.94,0,0,0,.5-1.37Z"/><path class="cls-3" d="M89.4,186.33h-1v-3.71q0-2.07-1.51-2.07a1.64,1.64,0,0,0-1.29.59,2.18,2.18,0,0,0-.51,1.48v3.71H84v-6.5h1v1.08h0a2.34,2.34,0,0,1,2.13-1.23,2,2,0,0,1,1.63.69,3.07,3.07,0,0,1,.57,2Z"/><path class="cls-3" d="M96.91,185.81q0,3.58-3.43,3.58a4.61,4.61,0,0,1-2.11-.46v-1a4.33,4.33,0,0,0,2.1.61q2.4,0,2.4-2.55v-.71h0a2.63,2.63,0,0,1-4.19.38,3.47,3.47,0,0,1-.74-2.33,4,4,0,0,1,.8-2.63,2.66,2.66,0,0,1,2.18-1,2.12,2.12,0,0,1,1.95,1.05h0v-.9h1Zm-1-2.42v-1a1.86,1.86,0,0,0-.52-1.33,1.73,1.73,0,0,0-1.3-.55,1.81,1.81,0,0,0-1.51.7,3.13,3.13,0,0,0-.55,2,2.7,2.7,0,0,0,.52,1.74,1.69,1.69,0,0,0,1.39.65,1.81,1.81,0,0,0,1.42-.62A2.32,2.32,0,0,0,95.87,183.39Z"/><path class="cls-3" d="M104.27,186.33h-1v-1h0a2.14,2.14,0,0,1-2,1.18q-2.32,0-2.32-2.77v-3.88h1v3.72q0,2.06,1.57,2.06a1.59,1.59,0,0,0,1.25-.56,2.15,2.15,0,0,0,.49-1.47v-3.75h1Z"/><path class="cls-3" d="M111,186.33h-1v-1h0a2.18,2.18,0,0,1-2,1.17,2.14,2.14,0,0,1-1.52-.51,1.79,1.79,0,0,1-.55-1.37q0-1.82,2.15-2.12l1.95-.27q0-1.66-1.34-1.66a3.2,3.2,0,0,0-2.12.8v-1.07a4,4,0,0,1,2.21-.61q2.29,0,2.29,2.42ZM110,183l-1.57.22a2.55,2.55,0,0,0-1.09.36,1,1,0,0,0-.37.91,1,1,0,0,0,.34.78,1.31,1.31,0,0,0,.9.3,1.67,1.67,0,0,0,1.28-.54,1.94,1.94,0,0,0,.5-1.37Z"/><path class="cls-3" d="M118.54,185.81q0,3.58-3.43,3.58a4.6,4.6,0,0,1-2.11-.46v-1a4.33,4.33,0,0,0,2.09.61q2.4,0,2.4-2.55v-.71h0a2.63,2.63,0,0,1-4.19.38,3.46,3.46,0,0,1-.74-2.33,4,4,0,0,1,.8-2.63,2.66,2.66,0,0,1,2.18-1,2.12,2.12,0,0,1,1.95,1.05h0v-.9h1Zm-1-2.42v-1a1.86,1.86,0,0,0-.52-1.33,1.73,1.73,0,0,0-1.3-.55,1.81,1.81,0,0,0-1.51.7,3.13,3.13,0,0,0-.55,2,2.69,2.69,0,0,0,.52,1.74,1.69,1.69,0,0,0,1.39.65,1.81,1.81,0,0,0,1.43-.62A2.32,2.32,0,0,0,117.5,183.39Z"/><path class="cls-3" d="M125.87,183.34h-4.59a2.43,2.43,0,0,0,.58,1.68,2,2,0,0,0,1.54.59,3.19,3.19,0,0,0,2-.72v1a3.77,3.77,0,0,1-2.27.62,2.75,2.75,0,0,1-2.17-.89,3.63,3.63,0,0,1-.79-2.49,3.55,3.55,0,0,1,.86-2.47,2.76,2.76,0,0,1,2.14-1,2.44,2.44,0,0,1,2,.83,3.44,3.44,0,0,1,.7,2.29Zm-1.07-.88a2.12,2.12,0,0,0-.44-1.4,1.48,1.48,0,0,0-1.19-.5,1.68,1.68,0,0,0-1.25.53,2.4,2.4,0,0,0-.63,1.38Z"/><rect class="cls-6" width="386" height="197"/></g></g></svg>
src/vs/workbench/contrib/welcomeOverlay/browser/media/commandpalette-dark.svg
0
https://github.com/microsoft/vscode/commit/00e8fdec5dcd099ae21c1b9f9851179f6fb1ab2f
[ 0.00017246545758098364, 0.00017246545758098364, 0.00017246545758098364, 0.00017246545758098364, 0 ]
{ "id": 4, "code_window": [ "import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';\n", "import { ILanguagePackItem, ILanguagePackService } from 'vs/platform/languagePacks/common/languagePacks';\n", "import { ILocaleService } from 'vs/workbench/contrib/localization/common/locale';\n", "\n", "export class ConfigureDisplayLanguageAction extends Action2 {\n", "\tpublic static readonly ID = 'workbench.action.configureLocale';\n" ], "labels": [ "keep", "keep", "add", "keep", "keep", "keep" ], "after_edit": [ "import { IExtensionsWorkbenchService } from 'vs/workbench/contrib/extensions/common/extensions';\n" ], "file_path": "src/vs/workbench/contrib/localization/browser/localizationsActions.ts", "type": "add", "edit_start_line_idx": 13 }
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import { createHash } from 'crypto'; import { equals } from 'vs/base/common/arrays'; import { Queue } from 'vs/base/common/async'; import { Disposable } from 'vs/base/common/lifecycle'; import { Schemas } from 'vs/base/common/network'; import { join } from 'vs/base/common/path'; import { Promises } from 'vs/base/node/pfs'; import { INativeEnvironmentService } from 'vs/platform/environment/common/environment'; import { IExtensionGalleryService, IExtensionIdentifier, IExtensionManagementService, ILocalExtension } from 'vs/platform/extensionManagement/common/extensionManagement'; import { areSameExtensions } from 'vs/platform/extensionManagement/common/extensionManagementUtil'; import { ILogService } from 'vs/platform/log/common/log'; import { ILocalizationContribution } from 'vs/platform/extensions/common/extensions'; import { ILanguagePackItem, LanguagePackBaseService } from 'vs/platform/languagePacks/common/languagePacks'; import { Language } from 'vs/base/common/platform'; import { URI } from 'vs/base/common/uri'; interface ILanguagePack { hash: string; label: string | undefined; extensions: { extensionIdentifier: IExtensionIdentifier; version: string; }[]; translations: { [id: string]: string }; } export class NativeLanguagePackService extends LanguagePackBaseService { private readonly cache: LanguagePacksCache; constructor( @IExtensionManagementService private readonly extensionManagementService: IExtensionManagementService, @INativeEnvironmentService environmentService: INativeEnvironmentService, @IExtensionGalleryService extensionGalleryService: IExtensionGalleryService, @ILogService private readonly logService: ILogService ) { super(extensionGalleryService); this.cache = this._register(new LanguagePacksCache(environmentService, logService)); this.extensionManagementService.registerParticipant({ postInstall: async (extension: ILocalExtension): Promise<void> => { return this.postInstallExtension(extension); }, postUninstall: async (extension: ILocalExtension): Promise<void> => { return this.postUninstallExtension(extension); } }); } async getBuiltInExtensionTranslationsUri(id: string): Promise<URI | undefined> { const packs = await this.cache.getLanguagePacks(); const pack = packs[Language.value()]; if (!pack) { this.logService.warn(`No language pack found for ${Language.value()}`); return undefined; } const translation = pack.translations[id]; return translation ? URI.file(translation) : undefined; } async getInstalledLanguages(): Promise<Array<ILanguagePackItem>> { const languagePacks = await this.cache.getLanguagePacks(); const languages = Object.keys(languagePacks).map(locale => { const languagePack = languagePacks[locale]; const baseQuickPick = this.createQuickPickItem(locale, languagePack.label); return { ...baseQuickPick, extensionId: languagePack.extensions[0].extensionIdentifier.id, }; }); languages.push({ ...this.createQuickPickItem('en', 'English'), extensionId: 'default', }); languages.sort((a, b) => a.label.localeCompare(b.label)); return languages; } private async postInstallExtension(extension: ILocalExtension): Promise<void> { if (extension && extension.manifest && extension.manifest.contributes && extension.manifest.contributes.localizations && extension.manifest.contributes.localizations.length) { this.logService.info('Adding language packs from the extension', extension.identifier.id); await this.update(); } } private async postUninstallExtension(extension: ILocalExtension): Promise<void> { const languagePacks = await this.cache.getLanguagePacks(); if (Object.keys(languagePacks).some(language => languagePacks[language] && languagePacks[language].extensions.some(e => areSameExtensions(e.extensionIdentifier, extension.identifier)))) { this.logService.info('Removing language packs from the extension', extension.identifier.id); await this.update(); } } async update(): Promise<boolean> { const [current, installed] = await Promise.all([this.cache.getLanguagePacks(), this.extensionManagementService.getInstalled()]); const updated = await this.cache.update(installed); return !equals(Object.keys(current), Object.keys(updated)); } } class LanguagePacksCache extends Disposable { private languagePacks: { [language: string]: ILanguagePack } = {}; private languagePacksFilePath: string; private languagePacksFileLimiter: Queue<any>; private initializedCache: boolean | undefined; constructor( @INativeEnvironmentService environmentService: INativeEnvironmentService, @ILogService private readonly logService: ILogService ) { super(); this.languagePacksFilePath = join(environmentService.userDataPath, 'languagepacks.json'); this.languagePacksFileLimiter = new Queue(); } getLanguagePacks(): Promise<{ [language: string]: ILanguagePack }> { // if queue is not empty, fetch from disk if (this.languagePacksFileLimiter.size || !this.initializedCache) { return this.withLanguagePacks() .then(() => this.languagePacks); } return Promise.resolve(this.languagePacks); } update(extensions: ILocalExtension[]): Promise<{ [language: string]: ILanguagePack }> { return this.withLanguagePacks(languagePacks => { Object.keys(languagePacks).forEach(language => delete languagePacks[language]); this.createLanguagePacksFromExtensions(languagePacks, ...extensions); }).then(() => this.languagePacks); } private createLanguagePacksFromExtensions(languagePacks: { [language: string]: ILanguagePack }, ...extensions: ILocalExtension[]): void { for (const extension of extensions) { if (extension && extension.manifest && extension.manifest.contributes && extension.manifest.contributes.localizations && extension.manifest.contributes.localizations.length) { this.createLanguagePacksFromExtension(languagePacks, extension); } } Object.keys(languagePacks).forEach(languageId => this.updateHash(languagePacks[languageId])); } private createLanguagePacksFromExtension(languagePacks: { [language: string]: ILanguagePack }, extension: ILocalExtension): void { const extensionIdentifier = extension.identifier; const localizations = extension.manifest.contributes && extension.manifest.contributes.localizations ? extension.manifest.contributes.localizations : []; for (const localizationContribution of localizations) { if (extension.location.scheme === Schemas.file && isValidLocalization(localizationContribution)) { let languagePack = languagePacks[localizationContribution.languageId]; if (!languagePack) { languagePack = { hash: '', extensions: [], translations: {}, label: localizationContribution.localizedLanguageName ?? localizationContribution.languageName }; languagePacks[localizationContribution.languageId] = languagePack; } const extensionInLanguagePack = languagePack.extensions.filter(e => areSameExtensions(e.extensionIdentifier, extensionIdentifier))[0]; if (extensionInLanguagePack) { extensionInLanguagePack.version = extension.manifest.version; } else { languagePack.extensions.push({ extensionIdentifier, version: extension.manifest.version }); } for (const translation of localizationContribution.translations) { languagePack.translations[translation.id] = join(extension.location.fsPath, translation.path); } } } } private updateHash(languagePack: ILanguagePack): void { if (languagePack) { const md5 = createHash('md5'); for (const extension of languagePack.extensions) { md5.update(extension.extensionIdentifier.uuid || extension.extensionIdentifier.id).update(extension.version); } languagePack.hash = md5.digest('hex'); } } private withLanguagePacks<T>(fn: (languagePacks: { [language: string]: ILanguagePack }) => T | null = () => null): Promise<T> { return this.languagePacksFileLimiter.queue(() => { let result: T | null = null; return Promises.readFile(this.languagePacksFilePath, 'utf8') .then(undefined, err => err.code === 'ENOENT' ? Promise.resolve('{}') : Promise.reject(err)) .then<{ [language: string]: ILanguagePack }>(raw => { try { return JSON.parse(raw); } catch (e) { return {}; } }) .then(languagePacks => { result = fn(languagePacks); return languagePacks; }) .then(languagePacks => { for (const language of Object.keys(languagePacks)) { if (!languagePacks[language]) { delete languagePacks[language]; } } this.languagePacks = languagePacks; this.initializedCache = true; const raw = JSON.stringify(this.languagePacks); this.logService.debug('Writing language packs', raw); return Promises.writeFile(this.languagePacksFilePath, raw); }) .then(() => result, error => this.logService.error(error)); }); } } function isValidLocalization(localization: ILocalizationContribution): boolean { if (typeof localization.languageId !== 'string') { return false; } if (!Array.isArray(localization.translations) || localization.translations.length === 0) { return false; } for (const translation of localization.translations) { if (typeof translation.id !== 'string') { return false; } if (typeof translation.path !== 'string') { return false; } } if (localization.languageName && typeof localization.languageName !== 'string') { return false; } if (localization.localizedLanguageName && typeof localization.localizedLanguageName !== 'string') { return false; } return true; }
src/vs/platform/languagePacks/node/languagePacks.ts
1
https://github.com/microsoft/vscode/commit/00e8fdec5dcd099ae21c1b9f9851179f6fb1ab2f
[ 0.008211708627641201, 0.0008470381144434214, 0.00016279894043691456, 0.00022235835785977542, 0.0016348345670849085 ]
{ "id": 4, "code_window": [ "import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';\n", "import { ILanguagePackItem, ILanguagePackService } from 'vs/platform/languagePacks/common/languagePacks';\n", "import { ILocaleService } from 'vs/workbench/contrib/localization/common/locale';\n", "\n", "export class ConfigureDisplayLanguageAction extends Action2 {\n", "\tpublic static readonly ID = 'workbench.action.configureLocale';\n" ], "labels": [ "keep", "keep", "add", "keep", "keep", "keep" ], "after_edit": [ "import { IExtensionsWorkbenchService } from 'vs/workbench/contrib/extensions/common/extensions';\n" ], "file_path": "src/vs/workbench/contrib/localization/browser/localizationsActions.ts", "type": "add", "edit_start_line_idx": 13 }
[ { "c": "<", "t": "text.html.php meta.embedded.block.html meta.tag.metadata.script.start.html punctuation.definition.tag.begin.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", "dark_vs": "punctuation.definition.tag: #808080", "light_vs": "punctuation.definition.tag: #800000", "hc_black": "punctuation.definition.tag: #808080", "dark_plus_experimental": "punctuation.definition.tag: #808080", "hc_light": "punctuation.definition.tag: #0F4A85", "light_plus_experimental": "punctuation.definition.tag: #800000" } }, { "c": "script", "t": "text.html.php meta.embedded.block.html meta.tag.metadata.script.start.html entity.name.tag.html", "r": { "dark_plus": "entity.name.tag: #569CD6", "light_plus": "entity.name.tag: #800000", "dark_vs": "entity.name.tag: #569CD6", "light_vs": "entity.name.tag: #800000", "hc_black": "entity.name.tag: #569CD6", "dark_plus_experimental": "entity.name.tag: #569CD6", "hc_light": "entity.name.tag: #0F4A85", "light_plus_experimental": "entity.name.tag: #800000" } }, { "c": ">", "t": "text.html.php meta.embedded.block.html meta.tag.metadata.script.start.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", "dark_vs": "punctuation.definition.tag: #808080", "light_vs": "punctuation.definition.tag: #800000", "hc_black": "punctuation.definition.tag: #808080", "dark_plus_experimental": "punctuation.definition.tag: #808080", "hc_light": "punctuation.definition.tag: #0F4A85", "light_plus_experimental": "punctuation.definition.tag: #800000" } }, { "c": " ", "t": "text.html.php meta.embedded.block.html source.js", "r": { "dark_plus": "meta.embedded: #D4D4D4", "light_plus": "meta.embedded: #000000", "dark_vs": "meta.embedded: #D4D4D4", "light_vs": "meta.embedded: #000000", "hc_black": "meta.embedded: #FFFFFF", "dark_plus_experimental": "meta.embedded: #D4D4D4", "hc_light": "meta.embedded: #292929", "light_plus_experimental": "meta.embedded: #000000" } }, { "c": "...", "t": "text.html.php meta.embedded.block.html source.js keyword.operator.spread.js", "r": { "dark_plus": "keyword.operator: #D4D4D4", "light_plus": "keyword.operator: #000000", "dark_vs": "keyword.operator: #D4D4D4", "light_vs": "keyword.operator: #000000", "hc_black": "keyword.operator: #D4D4D4", "dark_plus_experimental": "keyword.operator: #D4D4D4", "hc_light": "keyword.operator: #000000", "light_plus_experimental": "keyword.operator: #000000" } }, { "c": " ", "t": "text.html.php meta.embedded.block.html source.js", "r": { "dark_plus": "meta.embedded: #D4D4D4", "light_plus": "meta.embedded: #000000", "dark_vs": "meta.embedded: #D4D4D4", "light_vs": "meta.embedded: #000000", "hc_black": "meta.embedded: #FFFFFF", "dark_plus_experimental": "meta.embedded: #D4D4D4", "hc_light": "meta.embedded: #292929", "light_plus_experimental": "meta.embedded: #000000" } }, { "c": "<?php", "t": "text.html.php meta.embedded.block.html source.js meta.embedded.block.php punctuation.section.embedded.begin.php", "r": { "dark_plus": "punctuation.section.embedded.begin.php: #569CD6", "light_plus": "punctuation.section.embedded.begin.php: #800000", "dark_vs": "punctuation.section.embedded.begin.php: #569CD6", "light_vs": "punctuation.section.embedded.begin.php: #800000", "hc_black": "punctuation.section.embedded: #569CD6", "dark_plus_experimental": "punctuation.section.embedded.begin.php: #569CD6", "hc_light": "punctuation.section.embedded.begin.php: #0F4A85", "light_plus_experimental": "punctuation.section.embedded.begin.php: #800000" } }, { "c": " ", "t": "text.html.php meta.embedded.block.html source.js meta.embedded.block.php source.php", "r": { "dark_plus": "meta.embedded: #D4D4D4", "light_plus": "meta.embedded: #000000", "dark_vs": "meta.embedded: #D4D4D4", "light_vs": "meta.embedded: #000000", "hc_black": "meta.embedded: #FFFFFF", "dark_plus_experimental": "meta.embedded: #D4D4D4", "hc_light": "meta.embedded: #292929", "light_plus_experimental": "meta.embedded: #000000" } }, { "c": "foreach", "t": "text.html.php meta.embedded.block.html source.js meta.embedded.block.php source.php keyword.control.foreach.php", "r": { "dark_plus": "keyword.control: #C586C0", "light_plus": "keyword.control: #AF00DB", "dark_vs": "keyword.control: #569CD6", "light_vs": "keyword.control: #0000FF", "hc_black": "keyword.control: #C586C0", "dark_plus_experimental": "keyword.control: #C586C0", "hc_light": "keyword.control: #B5200D", "light_plus_experimental": "keyword.control: #AF00DB" } }, { "c": "(", "t": "text.html.php meta.embedded.block.html source.js meta.embedded.block.php source.php punctuation.definition.begin.bracket.round.php", "r": { "dark_plus": "meta.embedded: #D4D4D4", "light_plus": "meta.embedded: #000000", "dark_vs": "meta.embedded: #D4D4D4", "light_vs": "meta.embedded: #000000", "hc_black": "meta.embedded: #FFFFFF", "dark_plus_experimental": "meta.embedded: #D4D4D4", "hc_light": "meta.embedded: #292929", "light_plus_experimental": "meta.embedded: #000000" } }, { "c": "$", "t": "text.html.php meta.embedded.block.html source.js meta.embedded.block.php source.php variable.other.php punctuation.definition.variable.php", "r": { "dark_plus": "variable: #9CDCFE", "light_plus": "variable: #001080", "dark_vs": "meta.embedded: #D4D4D4", "light_vs": "meta.embedded: #000000", "hc_black": "variable: #9CDCFE", "dark_plus_experimental": "variable: #9CDCFE", "hc_light": "variable: #001080", "light_plus_experimental": "variable: #001080" } }, { "c": "actID", "t": "text.html.php meta.embedded.block.html source.js meta.embedded.block.php source.php variable.other.php", "r": { "dark_plus": "variable: #9CDCFE", "light_plus": "variable: #001080", "dark_vs": "meta.embedded: #D4D4D4", "light_vs": "meta.embedded: #000000", "hc_black": "variable: #9CDCFE", "dark_plus_experimental": "variable: #9CDCFE", "hc_light": "variable: #001080", "light_plus_experimental": "variable: #001080" } }, { "c": " ", "t": "text.html.php meta.embedded.block.html source.js meta.embedded.block.php source.php", "r": { "dark_plus": "meta.embedded: #D4D4D4", "light_plus": "meta.embedded: #000000", "dark_vs": "meta.embedded: #D4D4D4", "light_vs": "meta.embedded: #000000", "hc_black": "meta.embedded: #FFFFFF", "dark_plus_experimental": "meta.embedded: #D4D4D4", "hc_light": "meta.embedded: #292929", "light_plus_experimental": "meta.embedded: #000000" } }, { "c": "AS", "t": "text.html.php meta.embedded.block.html source.js meta.embedded.block.php source.php keyword.operator.logical.php", "r": { "dark_plus": "keyword.operator: #D4D4D4", "light_plus": "keyword.operator: #000000", "dark_vs": "keyword.operator: #D4D4D4", "light_vs": "keyword.operator: #000000", "hc_black": "keyword.operator: #D4D4D4", "dark_plus_experimental": "keyword.operator: #D4D4D4", "hc_light": "keyword.operator: #000000", "light_plus_experimental": "keyword.operator: #000000" } }, { "c": " ", "t": "text.html.php meta.embedded.block.html source.js meta.embedded.block.php source.php", "r": { "dark_plus": "meta.embedded: #D4D4D4", "light_plus": "meta.embedded: #000000", "dark_vs": "meta.embedded: #D4D4D4", "light_vs": "meta.embedded: #000000", "hc_black": "meta.embedded: #FFFFFF", "dark_plus_experimental": "meta.embedded: #D4D4D4", "hc_light": "meta.embedded: #292929", "light_plus_experimental": "meta.embedded: #000000" } }, { "c": "$", "t": "text.html.php meta.embedded.block.html source.js meta.embedded.block.php source.php variable.other.php punctuation.definition.variable.php", "r": { "dark_plus": "variable: #9CDCFE", "light_plus": "variable: #001080", "dark_vs": "meta.embedded: #D4D4D4", "light_vs": "meta.embedded: #000000", "hc_black": "variable: #9CDCFE", "dark_plus_experimental": "variable: #9CDCFE", "hc_light": "variable: #001080", "light_plus_experimental": "variable: #001080" } }, { "c": "act", "t": "text.html.php meta.embedded.block.html source.js meta.embedded.block.php source.php variable.other.php", "r": { "dark_plus": "variable: #9CDCFE", "light_plus": "variable: #001080", "dark_vs": "meta.embedded: #D4D4D4", "light_vs": "meta.embedded: #000000", "hc_black": "variable: #9CDCFE", "dark_plus_experimental": "variable: #9CDCFE", "hc_light": "variable: #001080", "light_plus_experimental": "variable: #001080" } }, { "c": ")", "t": "text.html.php meta.embedded.block.html source.js meta.embedded.block.php source.php punctuation.definition.end.bracket.round.php", "r": { "dark_plus": "meta.embedded: #D4D4D4", "light_plus": "meta.embedded: #000000", "dark_vs": "meta.embedded: #D4D4D4", "light_vs": "meta.embedded: #000000", "hc_black": "meta.embedded: #FFFFFF", "dark_plus_experimental": "meta.embedded: #D4D4D4", "hc_light": "meta.embedded: #292929", "light_plus_experimental": "meta.embedded: #000000" } }, { "c": " ", "t": "text.html.php meta.embedded.block.html source.js meta.embedded.block.php source.php", "r": { "dark_plus": "meta.embedded: #D4D4D4", "light_plus": "meta.embedded: #000000", "dark_vs": "meta.embedded: #D4D4D4", "light_vs": "meta.embedded: #000000", "hc_black": "meta.embedded: #FFFFFF", "dark_plus_experimental": "meta.embedded: #D4D4D4", "hc_light": "meta.embedded: #292929", "light_plus_experimental": "meta.embedded: #000000" } }, { "c": "{", "t": "text.html.php meta.embedded.block.html source.js meta.embedded.block.php source.php punctuation.definition.begin.bracket.curly.php", "r": { "dark_plus": "meta.embedded: #D4D4D4", "light_plus": "meta.embedded: #000000", "dark_vs": "meta.embedded: #D4D4D4", "light_vs": "meta.embedded: #000000", "hc_black": "meta.embedded: #FFFFFF", "dark_plus_experimental": "meta.embedded: #D4D4D4", "hc_light": "meta.embedded: #292929", "light_plus_experimental": "meta.embedded: #000000" } }, { "c": " ", "t": "text.html.php meta.embedded.block.html source.js meta.embedded.block.php source.php", "r": { "dark_plus": "meta.embedded: #D4D4D4", "light_plus": "meta.embedded: #000000", "dark_vs": "meta.embedded: #D4D4D4", "light_vs": "meta.embedded: #000000", "hc_black": "meta.embedded: #FFFFFF", "dark_plus_experimental": "meta.embedded: #D4D4D4", "hc_light": "meta.embedded: #292929", "light_plus_experimental": "meta.embedded: #000000" } }, { "c": "echo", "t": "text.html.php meta.embedded.block.html source.js meta.embedded.block.php source.php support.function.construct.output.php", "r": { "dark_plus": "support.function: #DCDCAA", "light_plus": "support.function: #795E26", "dark_vs": "meta.embedded: #D4D4D4", "light_vs": "meta.embedded: #000000", "hc_black": "support.function: #DCDCAA", "dark_plus_experimental": "support.function: #DCDCAA", "hc_light": "support.function: #5E2CBC", "light_plus_experimental": "support.function: #795E26" } }, { "c": " ", "t": "text.html.php meta.embedded.block.html source.js meta.embedded.block.php source.php", "r": { "dark_plus": "meta.embedded: #D4D4D4", "light_plus": "meta.embedded: #000000", "dark_vs": "meta.embedded: #D4D4D4", "light_vs": "meta.embedded: #000000", "hc_black": "meta.embedded: #FFFFFF", "dark_plus_experimental": "meta.embedded: #D4D4D4", "hc_light": "meta.embedded: #292929", "light_plus_experimental": "meta.embedded: #000000" } }, { "c": "'", "t": "text.html.php meta.embedded.block.html source.js meta.embedded.block.php source.php string.quoted.single.php punctuation.definition.string.begin.php", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", "dark_vs": "string: #CE9178", "light_vs": "string: #A31515", "hc_black": "string: #CE9178", "dark_plus_experimental": "string: #CE9178", "hc_light": "string: #0F4A85", "light_plus_experimental": "string: #A31515" } }, { "c": "divNames.push(", "t": "text.html.php meta.embedded.block.html source.js meta.embedded.block.php source.php string.quoted.single.php", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", "dark_vs": "string: #CE9178", "light_vs": "string: #A31515", "hc_black": "string: #CE9178", "dark_plus_experimental": "string: #CE9178", "hc_light": "string: #0F4A85", "light_plus_experimental": "string: #A31515" } }, { "c": "\\'", "t": "text.html.php meta.embedded.block.html source.js meta.embedded.block.php source.php string.quoted.single.php constant.character.escape.php", "r": { "dark_plus": "constant.character.escape: #D7BA7D", "light_plus": "constant.character.escape: #EE0000", "dark_vs": "string: #CE9178", "light_vs": "string: #A31515", "hc_black": "constant.character: #569CD6", "dark_plus_experimental": "constant.character.escape: #D7BA7D", "hc_light": "constant.character.escape: #EE0000", "light_plus_experimental": "constant.character.escape: #EE0000" } }, { "c": "[nid=", "t": "text.html.php meta.embedded.block.html source.js meta.embedded.block.php source.php string.quoted.single.php", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", "dark_vs": "string: #CE9178", "light_vs": "string: #A31515", "hc_black": "string: #CE9178", "dark_plus_experimental": "string: #CE9178", "hc_light": "string: #0F4A85", "light_plus_experimental": "string: #A31515" } }, { "c": "'", "t": "text.html.php meta.embedded.block.html source.js meta.embedded.block.php source.php string.quoted.single.php punctuation.definition.string.end.php", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", "dark_vs": "string: #CE9178", "light_vs": "string: #A31515", "hc_black": "string: #CE9178", "dark_plus_experimental": "string: #CE9178", "hc_light": "string: #0F4A85", "light_plus_experimental": "string: #A31515" } }, { "c": ".", "t": "text.html.php meta.embedded.block.html source.js meta.embedded.block.php source.php keyword.operator.string.php", "r": { "dark_plus": "keyword.operator: #D4D4D4", "light_plus": "keyword.operator: #000000", "dark_vs": "keyword.operator: #D4D4D4", "light_vs": "keyword.operator: #000000", "hc_black": "keyword.operator: #D4D4D4", "dark_plus_experimental": "keyword.operator: #D4D4D4", "hc_light": "keyword.operator: #000000", "light_plus_experimental": "keyword.operator: #000000" } }, { "c": "$", "t": "text.html.php meta.embedded.block.html source.js meta.embedded.block.php source.php variable.other.php punctuation.definition.variable.php", "r": { "dark_plus": "variable: #9CDCFE", "light_plus": "variable: #001080", "dark_vs": "meta.embedded: #D4D4D4", "light_vs": "meta.embedded: #000000", "hc_black": "variable: #9CDCFE", "dark_plus_experimental": "variable: #9CDCFE", "hc_light": "variable: #001080", "light_plus_experimental": "variable: #001080" } }, { "c": "act", "t": "text.html.php meta.embedded.block.html source.js meta.embedded.block.php source.php variable.other.php", "r": { "dark_plus": "variable: #9CDCFE", "light_plus": "variable: #001080", "dark_vs": "meta.embedded: #D4D4D4", "light_vs": "meta.embedded: #000000", "hc_black": "variable: #9CDCFE", "dark_plus_experimental": "variable: #9CDCFE", "hc_light": "variable: #001080", "light_plus_experimental": "variable: #001080" } }, { "c": ".", "t": "text.html.php meta.embedded.block.html source.js meta.embedded.block.php source.php keyword.operator.string.php", "r": { "dark_plus": "keyword.operator: #D4D4D4", "light_plus": "keyword.operator: #000000", "dark_vs": "keyword.operator: #D4D4D4", "light_vs": "keyword.operator: #000000", "hc_black": "keyword.operator: #D4D4D4", "dark_plus_experimental": "keyword.operator: #D4D4D4", "hc_light": "keyword.operator: #000000", "light_plus_experimental": "keyword.operator: #000000" } }, { "c": "'", "t": "text.html.php meta.embedded.block.html source.js meta.embedded.block.php source.php string.quoted.single.php punctuation.definition.string.begin.php", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", "dark_vs": "string: #CE9178", "light_vs": "string: #A31515", "hc_black": "string: #CE9178", "dark_plus_experimental": "string: #CE9178", "hc_light": "string: #0F4A85", "light_plus_experimental": "string: #A31515" } }, { "c": "]", "t": "text.html.php meta.embedded.block.html source.js meta.embedded.block.php source.php string.quoted.single.php", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", "dark_vs": "string: #CE9178", "light_vs": "string: #A31515", "hc_black": "string: #CE9178", "dark_plus_experimental": "string: #CE9178", "hc_light": "string: #0F4A85", "light_plus_experimental": "string: #A31515" } }, { "c": "\\'", "t": "text.html.php meta.embedded.block.html source.js meta.embedded.block.php source.php string.quoted.single.php constant.character.escape.php", "r": { "dark_plus": "constant.character.escape: #D7BA7D", "light_plus": "constant.character.escape: #EE0000", "dark_vs": "string: #CE9178", "light_vs": "string: #A31515", "hc_black": "constant.character: #569CD6", "dark_plus_experimental": "constant.character.escape: #D7BA7D", "hc_light": "constant.character.escape: #EE0000", "light_plus_experimental": "constant.character.escape: #EE0000" } }, { "c": ");", "t": "text.html.php meta.embedded.block.html source.js meta.embedded.block.php source.php string.quoted.single.php", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", "dark_vs": "string: #CE9178", "light_vs": "string: #A31515", "hc_black": "string: #CE9178", "dark_plus_experimental": "string: #CE9178", "hc_light": "string: #0F4A85", "light_plus_experimental": "string: #A31515" } }, { "c": "'", "t": "text.html.php meta.embedded.block.html source.js meta.embedded.block.php source.php string.quoted.single.php punctuation.definition.string.end.php", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", "dark_vs": "string: #CE9178", "light_vs": "string: #A31515", "hc_black": "string: #CE9178", "dark_plus_experimental": "string: #CE9178", "hc_light": "string: #0F4A85", "light_plus_experimental": "string: #A31515" } }, { "c": ";", "t": "text.html.php meta.embedded.block.html source.js meta.embedded.block.php source.php punctuation.terminator.expression.php", "r": { "dark_plus": "meta.embedded: #D4D4D4", "light_plus": "meta.embedded: #000000", "dark_vs": "meta.embedded: #D4D4D4", "light_vs": "meta.embedded: #000000", "hc_black": "meta.embedded: #FFFFFF", "dark_plus_experimental": "meta.embedded: #D4D4D4", "hc_light": "meta.embedded: #292929", "light_plus_experimental": "meta.embedded: #000000" } }, { "c": " ", "t": "text.html.php meta.embedded.block.html source.js meta.embedded.block.php source.php", "r": { "dark_plus": "meta.embedded: #D4D4D4", "light_plus": "meta.embedded: #000000", "dark_vs": "meta.embedded: #D4D4D4", "light_vs": "meta.embedded: #000000", "hc_black": "meta.embedded: #FFFFFF", "dark_plus_experimental": "meta.embedded: #D4D4D4", "hc_light": "meta.embedded: #292929", "light_plus_experimental": "meta.embedded: #000000" } }, { "c": "}", "t": "text.html.php meta.embedded.block.html source.js meta.embedded.block.php source.php punctuation.definition.end.bracket.curly.php", "r": { "dark_plus": "meta.embedded: #D4D4D4", "light_plus": "meta.embedded: #000000", "dark_vs": "meta.embedded: #D4D4D4", "light_vs": "meta.embedded: #000000", "hc_black": "meta.embedded: #FFFFFF", "dark_plus_experimental": "meta.embedded: #D4D4D4", "hc_light": "meta.embedded: #292929", "light_plus_experimental": "meta.embedded: #000000" } }, { "c": " ", "t": "text.html.php meta.embedded.block.html source.js meta.embedded.block.php source.php", "r": { "dark_plus": "meta.embedded: #D4D4D4", "light_plus": "meta.embedded: #000000", "dark_vs": "meta.embedded: #D4D4D4", "light_vs": "meta.embedded: #000000", "hc_black": "meta.embedded: #FFFFFF", "dark_plus_experimental": "meta.embedded: #D4D4D4", "hc_light": "meta.embedded: #292929", "light_plus_experimental": "meta.embedded: #000000" } }, { "c": "?", "t": "text.html.php meta.embedded.block.html source.js meta.embedded.block.php punctuation.section.embedded.end.php source.php", "r": { "dark_plus": "punctuation.section.embedded.end.php: #569CD6", "light_plus": "punctuation.section.embedded.end.php: #800000", "dark_vs": "punctuation.section.embedded.end.php: #569CD6", "light_vs": "punctuation.section.embedded.end.php: #800000", "hc_black": "punctuation.section.embedded: #569CD6", "dark_plus_experimental": "punctuation.section.embedded.end.php: #569CD6", "hc_light": "punctuation.section.embedded.end.php: #0F4A85", "light_plus_experimental": "punctuation.section.embedded.end.php: #800000" } }, { "c": ">", "t": "text.html.php meta.embedded.block.html source.js meta.embedded.block.php punctuation.section.embedded.end.php", "r": { "dark_plus": "punctuation.section.embedded.end.php: #569CD6", "light_plus": "punctuation.section.embedded.end.php: #800000", "dark_vs": "punctuation.section.embedded.end.php: #569CD6", "light_vs": "punctuation.section.embedded.end.php: #800000", "hc_black": "punctuation.section.embedded: #569CD6", "dark_plus_experimental": "punctuation.section.embedded.end.php: #569CD6", "hc_light": "punctuation.section.embedded.end.php: #0F4A85", "light_plus_experimental": "punctuation.section.embedded.end.php: #800000" } }, { "c": " ", "t": "text.html.php meta.embedded.block.html source.js", "r": { "dark_plus": "meta.embedded: #D4D4D4", "light_plus": "meta.embedded: #000000", "dark_vs": "meta.embedded: #D4D4D4", "light_vs": "meta.embedded: #000000", "hc_black": "meta.embedded: #FFFFFF", "dark_plus_experimental": "meta.embedded: #D4D4D4", "hc_light": "meta.embedded: #292929", "light_plus_experimental": "meta.embedded: #000000" } }, { "c": "...", "t": "text.html.php meta.embedded.block.html source.js keyword.operator.spread.js", "r": { "dark_plus": "keyword.operator: #D4D4D4", "light_plus": "keyword.operator: #000000", "dark_vs": "keyword.operator: #D4D4D4", "light_vs": "keyword.operator: #000000", "hc_black": "keyword.operator: #D4D4D4", "dark_plus_experimental": "keyword.operator: #D4D4D4", "hc_light": "keyword.operator: #000000", "light_plus_experimental": "keyword.operator: #000000" } }, { "c": "<", "t": "text.html.php meta.embedded.block.html meta.tag.metadata.script.end.html punctuation.definition.tag.begin.html source.js-ignored-vscode", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", "dark_vs": "punctuation.definition.tag: #808080", "light_vs": "punctuation.definition.tag: #800000", "hc_black": "punctuation.definition.tag: #808080", "dark_plus_experimental": "punctuation.definition.tag: #808080", "hc_light": "punctuation.definition.tag: #0F4A85", "light_plus_experimental": "punctuation.definition.tag: #800000" } }, { "c": "/", "t": "text.html.php meta.embedded.block.html meta.tag.metadata.script.end.html punctuation.definition.tag.begin.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", "dark_vs": "punctuation.definition.tag: #808080", "light_vs": "punctuation.definition.tag: #800000", "hc_black": "punctuation.definition.tag: #808080", "dark_plus_experimental": "punctuation.definition.tag: #808080", "hc_light": "punctuation.definition.tag: #0F4A85", "light_plus_experimental": "punctuation.definition.tag: #800000" } }, { "c": "script", "t": "text.html.php meta.embedded.block.html meta.tag.metadata.script.end.html entity.name.tag.html", "r": { "dark_plus": "entity.name.tag: #569CD6", "light_plus": "entity.name.tag: #800000", "dark_vs": "entity.name.tag: #569CD6", "light_vs": "entity.name.tag: #800000", "hc_black": "entity.name.tag: #569CD6", "dark_plus_experimental": "entity.name.tag: #569CD6", "hc_light": "entity.name.tag: #0F4A85", "light_plus_experimental": "entity.name.tag: #800000" } }, { "c": ">", "t": "text.html.php meta.embedded.block.html meta.tag.metadata.script.end.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", "dark_vs": "punctuation.definition.tag: #808080", "light_vs": "punctuation.definition.tag: #800000", "hc_black": "punctuation.definition.tag: #808080", "dark_plus_experimental": "punctuation.definition.tag: #808080", "hc_light": "punctuation.definition.tag: #0F4A85", "light_plus_experimental": "punctuation.definition.tag: #800000" } } ]
extensions/vscode-colorize-tests/test/colorize-results/issue-28354_php.json
0
https://github.com/microsoft/vscode/commit/00e8fdec5dcd099ae21c1b9f9851179f6fb1ab2f
[ 0.0001771345268934965, 0.00017334478616248816, 0.0001694753736956045, 0.00017318261961918324, 0.0000014420874094867031 ]
{ "id": 4, "code_window": [ "import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';\n", "import { ILanguagePackItem, ILanguagePackService } from 'vs/platform/languagePacks/common/languagePacks';\n", "import { ILocaleService } from 'vs/workbench/contrib/localization/common/locale';\n", "\n", "export class ConfigureDisplayLanguageAction extends Action2 {\n", "\tpublic static readonly ID = 'workbench.action.configureLocale';\n" ], "labels": [ "keep", "keep", "add", "keep", "keep", "keep" ], "after_edit": [ "import { IExtensionsWorkbenchService } from 'vs/workbench/contrib/extensions/common/extensions';\n" ], "file_path": "src/vs/workbench/contrib/localization/browser/localizationsActions.ts", "type": "add", "edit_start_line_idx": 13 }
echo "------------------------------------" tasklist /V echo "------------------------------------"
build/azure-pipelines/win32/listprocesses.bat
0
https://github.com/microsoft/vscode/commit/00e8fdec5dcd099ae21c1b9f9851179f6fb1ab2f
[ 0.00017109564214479178, 0.00017109564214479178, 0.00017109564214479178, 0.00017109564214479178, 0 ]
{ "id": 4, "code_window": [ "import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';\n", "import { ILanguagePackItem, ILanguagePackService } from 'vs/platform/languagePacks/common/languagePacks';\n", "import { ILocaleService } from 'vs/workbench/contrib/localization/common/locale';\n", "\n", "export class ConfigureDisplayLanguageAction extends Action2 {\n", "\tpublic static readonly ID = 'workbench.action.configureLocale';\n" ], "labels": [ "keep", "keep", "add", "keep", "keep", "keep" ], "after_edit": [ "import { IExtensionsWorkbenchService } from 'vs/workbench/contrib/extensions/common/extensions';\n" ], "file_path": "src/vs/workbench/contrib/localization/browser/localizationsActions.ts", "type": "add", "edit_start_line_idx": 13 }
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ .monaco-breadcrumbs { user-select: none; -webkit-user-select: none; display: flex; flex-direction: row; flex-wrap: nowrap; justify-content: flex-start; outline-style: none; } .monaco-breadcrumbs .monaco-breadcrumb-item { display: flex; align-items: center; flex: 0 1 auto; white-space: nowrap; cursor: pointer; align-self: center; height: 100%; outline: none; } .monaco-breadcrumbs.disabled .monaco-breadcrumb-item { cursor: default; } .monaco-breadcrumbs .monaco-breadcrumb-item .codicon-breadcrumb-separator { color: inherit; } .monaco-breadcrumbs .monaco-breadcrumb-item:first-of-type::before { content: ' '; }
src/vs/base/browser/ui/breadcrumbs/breadcrumbsWidget.css
0
https://github.com/microsoft/vscode/commit/00e8fdec5dcd099ae21c1b9f9851179f6fb1ab2f
[ 0.0001765536144375801, 0.0001741714950185269, 0.0001718839630484581, 0.00017412420129403472, 0.000001661802798480494 ]
{ "id": 5, "code_window": [ "\tpublic async run(accessor: ServicesAccessor): Promise<void> {\n", "\t\tconst languagePackService: ILanguagePackService = accessor.get(ILanguagePackService);\n", "\t\tconst quickInputService: IQuickInputService = accessor.get(IQuickInputService);\n", "\t\tconst localeService: ILocaleService = accessor.get(ILocaleService);\n", "\n", "\t\tconst installedLanguages = await languagePackService.getInstalledLanguages();\n", "\n", "\t\tconst qp = quickInputService.createQuickPick<ILanguagePackItem>();\n" ], "labels": [ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ], "after_edit": [ "\t\tconst extensionWorkbenchService: IExtensionsWorkbenchService = accessor.get(IExtensionsWorkbenchService);\n" ], "file_path": "src/vs/workbench/contrib/localization/browser/localizationsActions.ts", "type": "add", "edit_start_line_idx": 32 }
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import { localize } from 'vs/nls'; import { IQuickInputService, IQuickPickSeparator } from 'vs/platform/quickinput/common/quickInput'; import { CancellationTokenSource } from 'vs/base/common/cancellation'; import { DisposableStore } from 'vs/base/common/lifecycle'; import { Action2, MenuId } from 'vs/platform/actions/common/actions'; import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; import { ILanguagePackItem, ILanguagePackService } from 'vs/platform/languagePacks/common/languagePacks'; import { ILocaleService } from 'vs/workbench/contrib/localization/common/locale'; export class ConfigureDisplayLanguageAction extends Action2 { public static readonly ID = 'workbench.action.configureLocale'; public static readonly LABEL = localize('configureLocale', "Configure Display Language"); constructor() { super({ id: ConfigureDisplayLanguageAction.ID, title: { original: 'Configure Display Language', value: ConfigureDisplayLanguageAction.LABEL }, menu: { id: MenuId.CommandPalette } }); } public async run(accessor: ServicesAccessor): Promise<void> { const languagePackService: ILanguagePackService = accessor.get(ILanguagePackService); const quickInputService: IQuickInputService = accessor.get(IQuickInputService); const localeService: ILocaleService = accessor.get(ILocaleService); const installedLanguages = await languagePackService.getInstalledLanguages(); const qp = quickInputService.createQuickPick<ILanguagePackItem>(); qp.placeholder = localize('chooseLocale', "Select Display Language"); if (installedLanguages?.length) { const items: Array<ILanguagePackItem | IQuickPickSeparator> = [{ type: 'separator', label: localize('installed', "Installed") }]; qp.items = items.concat(installedLanguages); } const disposables = new DisposableStore(); const source = new CancellationTokenSource(); disposables.add(qp.onDispose(() => { source.cancel(); disposables.dispose(); })); const installedSet = new Set<string>(installedLanguages?.map(language => language.id!) ?? []); languagePackService.getAvailableLanguages().then(availableLanguages => { const newLanguages = availableLanguages.filter(l => l.id && !installedSet.has(l.id)); if (newLanguages.length) { qp.items = [ ...qp.items, { type: 'separator', label: localize('available', "Available") }, ...newLanguages ]; } qp.busy = false; }); disposables.add(qp.onDidAccept(async () => { const selectedLanguage = qp.activeItems[0]; qp.hide(); await localeService.setLocale(selectedLanguage); })); qp.show(); qp.busy = true; } } export class ClearDisplayLanguageAction extends Action2 { public static readonly ID = 'workbench.action.clearLocalePreference'; public static readonly LABEL = localize('clearDisplayLanguage', "Clear Display Language Preference"); constructor() { super({ id: ClearDisplayLanguageAction.ID, title: { original: 'Clear Display Language Preference', value: ClearDisplayLanguageAction.LABEL }, menu: { id: MenuId.CommandPalette } }); } public async run(accessor: ServicesAccessor): Promise<void> { const localeService: ILocaleService = accessor.get(ILocaleService); await localeService.clearLocalePreference(); } }
src/vs/workbench/contrib/localization/browser/localizationsActions.ts
1
https://github.com/microsoft/vscode/commit/00e8fdec5dcd099ae21c1b9f9851179f6fb1ab2f
[ 0.9989066123962402, 0.6217649579048157, 0.00016481113561894745, 0.9351328611373901, 0.4432702362537384 ]
{ "id": 5, "code_window": [ "\tpublic async run(accessor: ServicesAccessor): Promise<void> {\n", "\t\tconst languagePackService: ILanguagePackService = accessor.get(ILanguagePackService);\n", "\t\tconst quickInputService: IQuickInputService = accessor.get(IQuickInputService);\n", "\t\tconst localeService: ILocaleService = accessor.get(ILocaleService);\n", "\n", "\t\tconst installedLanguages = await languagePackService.getInstalledLanguages();\n", "\n", "\t\tconst qp = quickInputService.createQuickPick<ILanguagePackItem>();\n" ], "labels": [ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ], "after_edit": [ "\t\tconst extensionWorkbenchService: IExtensionsWorkbenchService = accessor.get(IExtensionsWorkbenchService);\n" ], "file_path": "src/vs/workbench/contrib/localization/browser/localizationsActions.ts", "type": "add", "edit_start_line_idx": 32 }
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import * as nls from 'vs/nls'; import { ToggleAutoSaveAction, FocusFilesExplorer, GlobalCompareResourcesAction, ShowActiveFileInExplorer, CompareWithClipboardAction, NEW_FILE_COMMAND_ID, NEW_FILE_LABEL, NEW_FOLDER_COMMAND_ID, NEW_FOLDER_LABEL, TRIGGER_RENAME_LABEL, MOVE_FILE_TO_TRASH_LABEL, COPY_FILE_LABEL, PASTE_FILE_LABEL, FileCopiedContext, renameHandler, moveFileToTrashHandler, copyFileHandler, pasteFileHandler, deleteFileHandler, cutFileHandler, DOWNLOAD_COMMAND_ID, openFilePreserveFocusHandler, DOWNLOAD_LABEL, ShowOpenedFileInNewWindow, UPLOAD_COMMAND_ID, UPLOAD_LABEL, fileCategory, CompareNewUntitledTextFilesAction } from 'vs/workbench/contrib/files/browser/fileActions'; import { revertLocalChangesCommand, acceptLocalChangesCommand, CONFLICT_RESOLUTION_CONTEXT } from 'vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler'; import { MenuId, MenuRegistry, registerAction2 } from 'vs/platform/actions/common/actions'; import { ILocalizedString } from 'vs/platform/action/common/action'; import { KeyMod, KeyCode } from 'vs/base/common/keyCodes'; import { openWindowCommand, newWindowCommand } from 'vs/workbench/contrib/files/browser/fileCommands'; import { COPY_PATH_COMMAND_ID, REVEAL_IN_EXPLORER_COMMAND_ID, OPEN_TO_SIDE_COMMAND_ID, REVERT_FILE_COMMAND_ID, SAVE_FILE_COMMAND_ID, SAVE_FILE_LABEL, SAVE_FILE_AS_COMMAND_ID, SAVE_FILE_AS_LABEL, SAVE_ALL_IN_GROUP_COMMAND_ID, OpenEditorsGroupContext, COMPARE_WITH_SAVED_COMMAND_ID, COMPARE_RESOURCE_COMMAND_ID, SELECT_FOR_COMPARE_COMMAND_ID, ResourceSelectedForCompareContext, OpenEditorsDirtyEditorContext, COMPARE_SELECTED_COMMAND_ID, REMOVE_ROOT_FOLDER_COMMAND_ID, REMOVE_ROOT_FOLDER_LABEL, SAVE_FILES_COMMAND_ID, COPY_RELATIVE_PATH_COMMAND_ID, SAVE_FILE_WITHOUT_FORMATTING_COMMAND_ID, SAVE_FILE_WITHOUT_FORMATTING_LABEL, OpenEditorsReadonlyEditorContext, OPEN_WITH_EXPLORER_COMMAND_ID, NEW_UNTITLED_FILE_COMMAND_ID, NEW_UNTITLED_FILE_LABEL, SAVE_ALL_COMMAND_ID } from 'vs/workbench/contrib/files/browser/fileConstants'; import { CommandsRegistry, ICommandHandler } from 'vs/platform/commands/common/commands'; import { ContextKeyExpr, ContextKeyExpression } from 'vs/platform/contextkey/common/contextkey'; import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { FilesExplorerFocusCondition, ExplorerRootContext, ExplorerFolderContext, ExplorerResourceNotReadonlyContext, ExplorerResourceCut, ExplorerResourceMoveableToTrash, ExplorerViewletVisibleContext, ExplorerResourceAvailableEditorIdsContext } from 'vs/workbench/contrib/files/common/files'; import { ADD_ROOT_FOLDER_COMMAND_ID, ADD_ROOT_FOLDER_LABEL } from 'vs/workbench/browser/actions/workspaceCommands'; import { CLOSE_SAVED_EDITORS_COMMAND_ID, CLOSE_EDITORS_IN_GROUP_COMMAND_ID, CLOSE_EDITOR_COMMAND_ID, CLOSE_OTHER_EDITORS_IN_GROUP_COMMAND_ID, REOPEN_WITH_COMMAND_ID } from 'vs/workbench/browser/parts/editor/editorCommands'; import { AutoSaveAfterShortDelayContext } from 'vs/workbench/services/filesConfiguration/common/filesConfigurationService'; import { WorkbenchListDoubleSelection } from 'vs/platform/list/browser/listService'; import { Schemas } from 'vs/base/common/network'; import { DirtyWorkingCopiesContext, EnterMultiRootWorkspaceSupportContext, HasWebFileSystemAccess, WorkbenchStateContext, WorkspaceFolderCountContext, SidebarFocusContext, ActiveEditorCanRevertContext, ActiveEditorContext, ResourceContextKey, ActiveEditorAvailableEditorIdsContext } from 'vs/workbench/common/contextkeys'; import { IsWebContext } from 'vs/platform/contextkey/common/contextkeys'; import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; import { ThemeIcon } from 'vs/base/common/themables'; import { IExplorerService } from 'vs/workbench/contrib/files/browser/files'; import { Codicon } from 'vs/base/common/codicons'; // Contribute Global Actions registerAction2(GlobalCompareResourcesAction); registerAction2(FocusFilesExplorer); registerAction2(ShowActiveFileInExplorer); registerAction2(CompareWithClipboardAction); registerAction2(CompareNewUntitledTextFilesAction); registerAction2(ToggleAutoSaveAction); registerAction2(ShowOpenedFileInNewWindow); // Commands CommandsRegistry.registerCommand('_files.windowOpen', openWindowCommand); CommandsRegistry.registerCommand('_files.newWindow', newWindowCommand); const explorerCommandsWeightBonus = 10; // give our commands a little bit more weight over other default list/tree commands const RENAME_ID = 'renameFile'; KeybindingsRegistry.registerCommandAndKeybindingRule({ id: RENAME_ID, weight: KeybindingWeight.WorkbenchContrib + explorerCommandsWeightBonus, when: ContextKeyExpr.and(FilesExplorerFocusCondition, ExplorerRootContext.toNegated(), ExplorerResourceNotReadonlyContext), primary: KeyCode.F2, mac: { primary: KeyCode.Enter }, handler: renameHandler }); const MOVE_FILE_TO_TRASH_ID = 'moveFileToTrash'; KeybindingsRegistry.registerCommandAndKeybindingRule({ id: MOVE_FILE_TO_TRASH_ID, weight: KeybindingWeight.WorkbenchContrib + explorerCommandsWeightBonus, when: ContextKeyExpr.and(FilesExplorerFocusCondition, ExplorerResourceNotReadonlyContext, ExplorerResourceMoveableToTrash), primary: KeyCode.Delete, mac: { primary: KeyMod.CtrlCmd | KeyCode.Backspace, secondary: [KeyCode.Delete] }, handler: moveFileToTrashHandler }); const DELETE_FILE_ID = 'deleteFile'; KeybindingsRegistry.registerCommandAndKeybindingRule({ id: DELETE_FILE_ID, weight: KeybindingWeight.WorkbenchContrib + explorerCommandsWeightBonus, when: ContextKeyExpr.and(FilesExplorerFocusCondition, ExplorerResourceNotReadonlyContext), primary: KeyMod.Shift | KeyCode.Delete, mac: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.Backspace }, handler: deleteFileHandler }); KeybindingsRegistry.registerCommandAndKeybindingRule({ id: DELETE_FILE_ID, weight: KeybindingWeight.WorkbenchContrib + explorerCommandsWeightBonus, when: ContextKeyExpr.and(FilesExplorerFocusCondition, ExplorerResourceNotReadonlyContext, ExplorerResourceMoveableToTrash.toNegated()), primary: KeyCode.Delete, mac: { primary: KeyMod.CtrlCmd | KeyCode.Backspace }, handler: deleteFileHandler }); const CUT_FILE_ID = 'filesExplorer.cut'; KeybindingsRegistry.registerCommandAndKeybindingRule({ id: CUT_FILE_ID, weight: KeybindingWeight.WorkbenchContrib + explorerCommandsWeightBonus, when: ContextKeyExpr.and(FilesExplorerFocusCondition, ExplorerRootContext.toNegated(), ExplorerResourceNotReadonlyContext), primary: KeyMod.CtrlCmd | KeyCode.KeyX, handler: cutFileHandler, }); const COPY_FILE_ID = 'filesExplorer.copy'; KeybindingsRegistry.registerCommandAndKeybindingRule({ id: COPY_FILE_ID, weight: KeybindingWeight.WorkbenchContrib + explorerCommandsWeightBonus, when: ContextKeyExpr.and(FilesExplorerFocusCondition, ExplorerRootContext.toNegated()), primary: KeyMod.CtrlCmd | KeyCode.KeyC, handler: copyFileHandler, }); const PASTE_FILE_ID = 'filesExplorer.paste'; KeybindingsRegistry.registerCommandAndKeybindingRule({ id: PASTE_FILE_ID, weight: KeybindingWeight.WorkbenchContrib + explorerCommandsWeightBonus, when: ContextKeyExpr.and(FilesExplorerFocusCondition, ExplorerResourceNotReadonlyContext), primary: KeyMod.CtrlCmd | KeyCode.KeyV, handler: pasteFileHandler }); KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'filesExplorer.cancelCut', weight: KeybindingWeight.WorkbenchContrib + explorerCommandsWeightBonus, when: ContextKeyExpr.and(FilesExplorerFocusCondition, ExplorerResourceCut), primary: KeyCode.Escape, handler: async (accessor: ServicesAccessor) => { const explorerService = accessor.get(IExplorerService); await explorerService.setToCopy([], true); } }); KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'filesExplorer.openFilePreserveFocus', weight: KeybindingWeight.WorkbenchContrib + explorerCommandsWeightBonus, when: ContextKeyExpr.and(FilesExplorerFocusCondition, ExplorerFolderContext.toNegated()), primary: KeyCode.Space, handler: openFilePreserveFocusHandler }); const copyPathCommand = { id: COPY_PATH_COMMAND_ID, title: nls.localize('copyPath', "Copy Path") }; const copyRelativePathCommand = { id: COPY_RELATIVE_PATH_COMMAND_ID, title: nls.localize('copyRelativePath', "Copy Relative Path") }; // Editor Title Context Menu appendEditorTitleContextMenuItem(COPY_PATH_COMMAND_ID, copyPathCommand.title, ResourceContextKey.IsFileSystemResource, '1_cutcopypaste'); appendEditorTitleContextMenuItem(COPY_RELATIVE_PATH_COMMAND_ID, copyRelativePathCommand.title, ResourceContextKey.IsFileSystemResource, '1_cutcopypaste'); appendEditorTitleContextMenuItem(REVEAL_IN_EXPLORER_COMMAND_ID, nls.localize('revealInSideBar', "Reveal in Explorer View"), ResourceContextKey.IsFileSystemResource, '2_files', 1); export function appendEditorTitleContextMenuItem(id: string, title: string, when: ContextKeyExpression | undefined, group: string, order?: number): void { // Menu MenuRegistry.appendMenuItem(MenuId.EditorTitleContext, { command: { id, title }, when, group, order }); } // Editor Title Menu for Conflict Resolution appendSaveConflictEditorTitleAction('workbench.files.action.acceptLocalChanges', nls.localize('acceptLocalChanges', "Use your changes and overwrite file contents"), Codicon.check, -10, acceptLocalChangesCommand); appendSaveConflictEditorTitleAction('workbench.files.action.revertLocalChanges', nls.localize('revertLocalChanges', "Discard your changes and revert to file contents"), Codicon.discard, -9, revertLocalChangesCommand); function appendSaveConflictEditorTitleAction(id: string, title: string, icon: ThemeIcon, order: number, command: ICommandHandler): void { // Command CommandsRegistry.registerCommand(id, command); // Action MenuRegistry.appendMenuItem(MenuId.EditorTitle, { command: { id, title, icon }, when: ContextKeyExpr.equals(CONFLICT_RESOLUTION_CONTEXT, true), group: 'navigation', order }); } // Menu registration - command palette export function appendToCommandPalette(id: string, title: ILocalizedString, category: ILocalizedString, when?: ContextKeyExpression): void { MenuRegistry.appendMenuItem(MenuId.CommandPalette, { command: { id, title, category }, when }); } appendToCommandPalette(COPY_PATH_COMMAND_ID, { value: nls.localize('copyPathOfActive', "Copy Path of Active File"), original: 'Copy Path of Active File' }, fileCategory); appendToCommandPalette(COPY_RELATIVE_PATH_COMMAND_ID, { value: nls.localize('copyRelativePathOfActive', "Copy Relative Path of Active File"), original: 'Copy Relative Path of Active File' }, fileCategory); appendToCommandPalette(SAVE_FILE_COMMAND_ID, { value: SAVE_FILE_LABEL, original: 'Save' }, fileCategory); appendToCommandPalette(SAVE_FILE_WITHOUT_FORMATTING_COMMAND_ID, { value: SAVE_FILE_WITHOUT_FORMATTING_LABEL, original: 'Save without Formatting' }, fileCategory); appendToCommandPalette(SAVE_ALL_IN_GROUP_COMMAND_ID, { value: nls.localize('saveAllInGroup', "Save All in Group"), original: 'Save All in Group' }, fileCategory); appendToCommandPalette(SAVE_FILES_COMMAND_ID, { value: nls.localize('saveFiles', "Save All Files"), original: 'Save All Files' }, fileCategory); appendToCommandPalette(REVERT_FILE_COMMAND_ID, { value: nls.localize('revert', "Revert File"), original: 'Revert File' }, fileCategory); appendToCommandPalette(COMPARE_WITH_SAVED_COMMAND_ID, { value: nls.localize('compareActiveWithSaved', "Compare Active File with Saved"), original: 'Compare Active File with Saved' }, fileCategory); appendToCommandPalette(SAVE_FILE_AS_COMMAND_ID, { value: SAVE_FILE_AS_LABEL, original: 'Save As...' }, fileCategory); appendToCommandPalette(NEW_FILE_COMMAND_ID, { value: NEW_FILE_LABEL, original: 'New File' }, fileCategory, WorkspaceFolderCountContext.notEqualsTo('0')); appendToCommandPalette(NEW_FOLDER_COMMAND_ID, { value: NEW_FOLDER_LABEL, original: 'New Folder' }, fileCategory, WorkspaceFolderCountContext.notEqualsTo('0')); appendToCommandPalette(NEW_UNTITLED_FILE_COMMAND_ID, { value: NEW_UNTITLED_FILE_LABEL, original: 'New Untitled Text File' }, fileCategory); // Menu registration - open editors const isFileOrUntitledResourceContextKey = ContextKeyExpr.or(ResourceContextKey.IsFileSystemResource, ResourceContextKey.Scheme.isEqualTo(Schemas.untitled)); const openToSideCommand = { id: OPEN_TO_SIDE_COMMAND_ID, title: nls.localize('openToSide', "Open to the Side") }; MenuRegistry.appendMenuItem(MenuId.OpenEditorsContext, { group: 'navigation', order: 10, command: openToSideCommand, when: isFileOrUntitledResourceContextKey }); MenuRegistry.appendMenuItem(MenuId.OpenEditorsContext, { group: '1_open', order: 10, command: { id: REOPEN_WITH_COMMAND_ID, title: nls.localize('reopenWith', "Reopen Editor With...") }, when: ActiveEditorAvailableEditorIdsContext }); MenuRegistry.appendMenuItem(MenuId.OpenEditorsContext, { group: '1_cutcopypaste', order: 10, command: copyPathCommand, when: ResourceContextKey.IsFileSystemResource }); MenuRegistry.appendMenuItem(MenuId.OpenEditorsContext, { group: '1_cutcopypaste', order: 20, command: copyRelativePathCommand, when: ResourceContextKey.IsFileSystemResource }); MenuRegistry.appendMenuItem(MenuId.OpenEditorsContext, { group: '2_save', order: 10, command: { id: SAVE_FILE_COMMAND_ID, title: SAVE_FILE_LABEL, precondition: OpenEditorsDirtyEditorContext }, when: ContextKeyExpr.or( // Untitled Editors ResourceContextKey.Scheme.isEqualTo(Schemas.untitled), // Or: ContextKeyExpr.and( // Not: editor groups OpenEditorsGroupContext.toNegated(), // Not: readonly editors OpenEditorsReadonlyEditorContext.toNegated(), // Not: auto save after short delay AutoSaveAfterShortDelayContext.toNegated() ) ) }); MenuRegistry.appendMenuItem(MenuId.OpenEditorsContext, { group: '2_save', order: 20, command: { id: REVERT_FILE_COMMAND_ID, title: nls.localize('revert', "Revert File"), precondition: OpenEditorsDirtyEditorContext }, when: ContextKeyExpr.and( // Not: editor groups OpenEditorsGroupContext.toNegated(), // Not: readonly editors OpenEditorsReadonlyEditorContext.toNegated(), // Not: untitled editors (revert closes them) ResourceContextKey.Scheme.notEqualsTo(Schemas.untitled), // Not: auto save after short delay AutoSaveAfterShortDelayContext.toNegated() ) }); MenuRegistry.appendMenuItem(MenuId.OpenEditorsContext, { group: '2_save', order: 30, command: { id: SAVE_ALL_IN_GROUP_COMMAND_ID, title: nls.localize('saveAll', "Save All"), precondition: DirtyWorkingCopiesContext }, // Editor Group when: OpenEditorsGroupContext }); MenuRegistry.appendMenuItem(MenuId.OpenEditorsContext, { group: '3_compare', order: 10, command: { id: COMPARE_WITH_SAVED_COMMAND_ID, title: nls.localize('compareWithSaved', "Compare with Saved"), precondition: OpenEditorsDirtyEditorContext }, when: ContextKeyExpr.and(ResourceContextKey.IsFileSystemResource, AutoSaveAfterShortDelayContext.toNegated(), WorkbenchListDoubleSelection.toNegated()) }); const compareResourceCommand = { id: COMPARE_RESOURCE_COMMAND_ID, title: nls.localize('compareWithSelected', "Compare with Selected") }; MenuRegistry.appendMenuItem(MenuId.OpenEditorsContext, { group: '3_compare', order: 20, command: compareResourceCommand, when: ContextKeyExpr.and(ResourceContextKey.HasResource, ResourceSelectedForCompareContext, isFileOrUntitledResourceContextKey, WorkbenchListDoubleSelection.toNegated()) }); const selectForCompareCommand = { id: SELECT_FOR_COMPARE_COMMAND_ID, title: nls.localize('compareSource', "Select for Compare") }; MenuRegistry.appendMenuItem(MenuId.OpenEditorsContext, { group: '3_compare', order: 30, command: selectForCompareCommand, when: ContextKeyExpr.and(ResourceContextKey.HasResource, isFileOrUntitledResourceContextKey, WorkbenchListDoubleSelection.toNegated()) }); const compareSelectedCommand = { id: COMPARE_SELECTED_COMMAND_ID, title: nls.localize('compareSelected', "Compare Selected") }; MenuRegistry.appendMenuItem(MenuId.OpenEditorsContext, { group: '3_compare', order: 30, command: compareSelectedCommand, when: ContextKeyExpr.and(ResourceContextKey.HasResource, WorkbenchListDoubleSelection, isFileOrUntitledResourceContextKey) }); MenuRegistry.appendMenuItem(MenuId.OpenEditorsContext, { group: '4_close', order: 10, command: { id: CLOSE_EDITOR_COMMAND_ID, title: nls.localize('close', "Close") }, when: OpenEditorsGroupContext.toNegated() }); MenuRegistry.appendMenuItem(MenuId.OpenEditorsContext, { group: '4_close', order: 20, command: { id: CLOSE_OTHER_EDITORS_IN_GROUP_COMMAND_ID, title: nls.localize('closeOthers', "Close Others") }, when: OpenEditorsGroupContext.toNegated() }); MenuRegistry.appendMenuItem(MenuId.OpenEditorsContext, { group: '4_close', order: 30, command: { id: CLOSE_SAVED_EDITORS_COMMAND_ID, title: nls.localize('closeSaved', "Close Saved") } }); MenuRegistry.appendMenuItem(MenuId.OpenEditorsContext, { group: '4_close', order: 40, command: { id: CLOSE_EDITORS_IN_GROUP_COMMAND_ID, title: nls.localize('closeAll', "Close All") } }); // Menu registration - explorer MenuRegistry.appendMenuItem(MenuId.ExplorerContext, { group: 'navigation', order: 4, command: { id: NEW_FILE_COMMAND_ID, title: NEW_FILE_LABEL, precondition: ExplorerResourceNotReadonlyContext }, when: ExplorerFolderContext }); MenuRegistry.appendMenuItem(MenuId.ExplorerContext, { group: 'navigation', order: 6, command: { id: NEW_FOLDER_COMMAND_ID, title: NEW_FOLDER_LABEL, precondition: ExplorerResourceNotReadonlyContext }, when: ExplorerFolderContext }); MenuRegistry.appendMenuItem(MenuId.ExplorerContext, { group: 'navigation', order: 10, command: openToSideCommand, when: ContextKeyExpr.and(ExplorerFolderContext.toNegated(), ResourceContextKey.HasResource) }); MenuRegistry.appendMenuItem(MenuId.ExplorerContext, { group: 'navigation', order: 20, command: { id: OPEN_WITH_EXPLORER_COMMAND_ID, title: nls.localize('explorerOpenWith', "Open With..."), }, when: ContextKeyExpr.and(ExplorerFolderContext.toNegated(), ExplorerResourceAvailableEditorIdsContext), }); MenuRegistry.appendMenuItem(MenuId.ExplorerContext, { group: '3_compare', order: 20, command: compareResourceCommand, when: ContextKeyExpr.and(ExplorerFolderContext.toNegated(), ResourceContextKey.HasResource, ResourceSelectedForCompareContext, WorkbenchListDoubleSelection.toNegated()) }); MenuRegistry.appendMenuItem(MenuId.ExplorerContext, { group: '3_compare', order: 30, command: selectForCompareCommand, when: ContextKeyExpr.and(ExplorerFolderContext.toNegated(), ResourceContextKey.HasResource, WorkbenchListDoubleSelection.toNegated()) }); MenuRegistry.appendMenuItem(MenuId.ExplorerContext, { group: '3_compare', order: 30, command: compareSelectedCommand, when: ContextKeyExpr.and(ExplorerFolderContext.toNegated(), ResourceContextKey.HasResource, WorkbenchListDoubleSelection) }); MenuRegistry.appendMenuItem(MenuId.ExplorerContext, { group: '5_cutcopypaste', order: 8, command: { id: CUT_FILE_ID, title: nls.localize('cut', "Cut") }, when: ContextKeyExpr.and(ExplorerRootContext.toNegated(), ExplorerResourceNotReadonlyContext) }); MenuRegistry.appendMenuItem(MenuId.ExplorerContext, { group: '5_cutcopypaste', order: 10, command: { id: COPY_FILE_ID, title: COPY_FILE_LABEL }, when: ExplorerRootContext.toNegated() }); MenuRegistry.appendMenuItem(MenuId.ExplorerContext, { group: '5_cutcopypaste', order: 20, command: { id: PASTE_FILE_ID, title: PASTE_FILE_LABEL, precondition: ContextKeyExpr.and(ExplorerResourceNotReadonlyContext, FileCopiedContext) }, when: ExplorerFolderContext }); MenuRegistry.appendMenuItem(MenuId.ExplorerContext, ({ group: '5b_importexport', order: 10, command: { id: DOWNLOAD_COMMAND_ID, title: DOWNLOAD_LABEL }, when: ContextKeyExpr.or( // native: for any remote resource ContextKeyExpr.and(IsWebContext.toNegated(), ResourceContextKey.Scheme.notEqualsTo(Schemas.file)), // web: for any files ContextKeyExpr.and(IsWebContext, ExplorerFolderContext.toNegated(), ExplorerRootContext.toNegated()), // web: for any folders if file system API support is provided ContextKeyExpr.and(IsWebContext, HasWebFileSystemAccess) ) })); MenuRegistry.appendMenuItem(MenuId.ExplorerContext, ({ group: '5b_importexport', order: 20, command: { id: UPLOAD_COMMAND_ID, title: UPLOAD_LABEL, }, when: ContextKeyExpr.and( // only in web IsWebContext, // only on folders ExplorerFolderContext, // only on editable folders ExplorerResourceNotReadonlyContext ) })); MenuRegistry.appendMenuItem(MenuId.ExplorerContext, { group: '6_copypath', order: 10, command: copyPathCommand, when: ResourceContextKey.IsFileSystemResource }); MenuRegistry.appendMenuItem(MenuId.ExplorerContext, { group: '6_copypath', order: 20, command: copyRelativePathCommand, when: ResourceContextKey.IsFileSystemResource }); MenuRegistry.appendMenuItem(MenuId.ExplorerContext, { group: '2_workspace', order: 10, command: { id: ADD_ROOT_FOLDER_COMMAND_ID, title: ADD_ROOT_FOLDER_LABEL }, when: ContextKeyExpr.and(ExplorerRootContext, ContextKeyExpr.or(EnterMultiRootWorkspaceSupportContext, WorkbenchStateContext.isEqualTo('workspace'))) }); MenuRegistry.appendMenuItem(MenuId.ExplorerContext, { group: '2_workspace', order: 30, command: { id: REMOVE_ROOT_FOLDER_COMMAND_ID, title: REMOVE_ROOT_FOLDER_LABEL }, when: ContextKeyExpr.and(ExplorerRootContext, ExplorerFolderContext, ContextKeyExpr.and(WorkspaceFolderCountContext.notEqualsTo('0'), ContextKeyExpr.or(EnterMultiRootWorkspaceSupportContext, WorkbenchStateContext.isEqualTo('workspace')))) }); MenuRegistry.appendMenuItem(MenuId.ExplorerContext, { group: '7_modification', order: 10, command: { id: RENAME_ID, title: TRIGGER_RENAME_LABEL, precondition: ExplorerResourceNotReadonlyContext }, when: ExplorerRootContext.toNegated() }); MenuRegistry.appendMenuItem(MenuId.ExplorerContext, { group: '7_modification', order: 20, command: { id: MOVE_FILE_TO_TRASH_ID, title: MOVE_FILE_TO_TRASH_LABEL, precondition: ExplorerResourceNotReadonlyContext }, alt: { id: DELETE_FILE_ID, title: nls.localize('deleteFile', "Delete Permanently"), precondition: ExplorerResourceNotReadonlyContext }, when: ContextKeyExpr.and(ExplorerRootContext.toNegated(), ExplorerResourceMoveableToTrash) }); MenuRegistry.appendMenuItem(MenuId.ExplorerContext, { group: '7_modification', order: 20, command: { id: DELETE_FILE_ID, title: nls.localize('deleteFile', "Delete Permanently"), precondition: ExplorerResourceNotReadonlyContext }, when: ContextKeyExpr.and(ExplorerRootContext.toNegated(), ExplorerResourceMoveableToTrash.toNegated()) }); // Empty Editor Group Context Menu MenuRegistry.appendMenuItem(MenuId.EmptyEditorGroupContext, { command: { id: NEW_UNTITLED_FILE_COMMAND_ID, title: nls.localize('newFile', "New Text File") }, group: '1_file', order: 10 }); MenuRegistry.appendMenuItem(MenuId.EmptyEditorGroupContext, { command: { id: 'workbench.action.quickOpen', title: nls.localize('openFile', "Open File...") }, group: '1_file', order: 20 }); // File menu MenuRegistry.appendMenuItem(MenuId.MenubarFileMenu, { group: '1_new', command: { id: NEW_UNTITLED_FILE_COMMAND_ID, title: nls.localize({ key: 'miNewFile', comment: ['&& denotes a mnemonic'] }, "&&New Text File") }, order: 1 }); MenuRegistry.appendMenuItem(MenuId.MenubarFileMenu, { group: '4_save', command: { id: SAVE_FILE_COMMAND_ID, title: nls.localize({ key: 'miSave', comment: ['&& denotes a mnemonic'] }, "&&Save"), precondition: ContextKeyExpr.or(ActiveEditorContext, ContextKeyExpr.and(ExplorerViewletVisibleContext, SidebarFocusContext)) }, order: 1 }); MenuRegistry.appendMenuItem(MenuId.MenubarFileMenu, { group: '4_save', command: { id: SAVE_FILE_AS_COMMAND_ID, title: nls.localize({ key: 'miSaveAs', comment: ['&& denotes a mnemonic'] }, "Save &&As..."), precondition: ContextKeyExpr.or(ActiveEditorContext, ContextKeyExpr.and(ExplorerViewletVisibleContext, SidebarFocusContext)) }, order: 2 }); MenuRegistry.appendMenuItem(MenuId.MenubarFileMenu, { group: '4_save', command: { id: SAVE_ALL_COMMAND_ID, title: nls.localize({ key: 'miSaveAll', comment: ['&& denotes a mnemonic'] }, "Save A&&ll"), precondition: DirtyWorkingCopiesContext }, order: 3 }); MenuRegistry.appendMenuItem(MenuId.MenubarFileMenu, { group: '5_autosave', command: { id: ToggleAutoSaveAction.ID, title: nls.localize({ key: 'miAutoSave', comment: ['&& denotes a mnemonic'] }, "A&&uto Save"), toggled: ContextKeyExpr.notEquals('config.files.autoSave', 'off') }, order: 1 }); MenuRegistry.appendMenuItem(MenuId.MenubarFileMenu, { group: '6_close', command: { id: REVERT_FILE_COMMAND_ID, title: nls.localize({ key: 'miRevert', comment: ['&& denotes a mnemonic'] }, "Re&&vert File"), precondition: ContextKeyExpr.or( // Active editor can revert ContextKeyExpr.and(ActiveEditorCanRevertContext), // Explorer focused but not on untitled ContextKeyExpr.and(ResourceContextKey.Scheme.notEqualsTo(Schemas.untitled), ExplorerViewletVisibleContext, SidebarFocusContext) ), }, order: 1 }); MenuRegistry.appendMenuItem(MenuId.MenubarFileMenu, { group: '6_close', command: { id: CLOSE_EDITOR_COMMAND_ID, title: nls.localize({ key: 'miCloseEditor', comment: ['&& denotes a mnemonic'] }, "&&Close Editor"), precondition: ContextKeyExpr.or(ActiveEditorContext, ContextKeyExpr.and(ExplorerViewletVisibleContext, SidebarFocusContext)) }, order: 2 }); // Go to menu MenuRegistry.appendMenuItem(MenuId.MenubarGoMenu, { group: '3_global_nav', command: { id: 'workbench.action.quickOpen', title: nls.localize({ key: 'miGotoFile', comment: ['&& denotes a mnemonic'] }, "Go to &&File...") }, order: 1 });
src/vs/workbench/contrib/files/browser/fileActions.contribution.ts
0
https://github.com/microsoft/vscode/commit/00e8fdec5dcd099ae21c1b9f9851179f6fb1ab2f
[ 0.0004845300572924316, 0.00017961501725949347, 0.0001659878034843132, 0.00017522294365335256, 0.00003739523162948899 ]
{ "id": 5, "code_window": [ "\tpublic async run(accessor: ServicesAccessor): Promise<void> {\n", "\t\tconst languagePackService: ILanguagePackService = accessor.get(ILanguagePackService);\n", "\t\tconst quickInputService: IQuickInputService = accessor.get(IQuickInputService);\n", "\t\tconst localeService: ILocaleService = accessor.get(ILocaleService);\n", "\n", "\t\tconst installedLanguages = await languagePackService.getInstalledLanguages();\n", "\n", "\t\tconst qp = quickInputService.createQuickPick<ILanguagePackItem>();\n" ], "labels": [ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ], "after_edit": [ "\t\tconst extensionWorkbenchService: IExtensionsWorkbenchService = accessor.get(IExtensionsWorkbenchService);\n" ], "file_path": "src/vs/workbench/contrib/localization/browser/localizationsActions.ts", "type": "add", "edit_start_line_idx": 32 }
{ // Note that this file should stay in sync with 'typescript-language-basics/language-configuration.json' "comments": { "lineComment": "//", "blockComment": [ "/*", "*/" ] }, "brackets": [ [ "${", "}" ], [ "{", "}" ], [ "[", "]" ], [ "(", ")" ] ], "autoClosingPairs": [ { "open": "{", "close": "}" }, { "open": "[", "close": "]" }, { "open": "(", "close": ")" }, { "open": "'", "close": "'", "notIn": [ "string", "comment" ] }, { "open": "\"", "close": "\"", "notIn": [ "string" ] }, { "open": "`", "close": "`", "notIn": [ "string", "comment" ] }, { "open": "/**", "close": " */", "notIn": [ "string" ] } ], "surroundingPairs": [ [ "{", "}" ], [ "[", "]" ], [ "(", ")" ], [ "'", "'" ], [ "\"", "\"" ], [ "`", "`" ], [ "<", ">" ] ], "autoCloseBefore": ";:.,=}])>` \n\t", "folding": { "markers": { "start": "^\\s*//\\s*#?region\\b", "end": "^\\s*//\\s*#?endregion\\b" } }, "wordPattern": { "pattern": "(-?\\d*\\.\\d\\w*)|([^\\`\\~\\@\\!\\%\\^\\&\\*\\(\\)\\-\\=\\+\\[\\{\\]\\}\\\\\\|\\;\\:\\'\\\"\\,\\.\\<\\>/\\?\\s]+)", }, "indentationRules": { "decreaseIndentPattern": { "pattern": "^((?!.*?/\\*).*\\*\/)?\\s*[\\}\\]].*$" }, "increaseIndentPattern": { "pattern": "^((?!//).)*(\\{([^}\"'`/]*|(\\t|[ ])*//.*)|\\([^)\"'`/]*|\\[[^\\]\"'`/]*)$" }, // e.g. * ...| or */| or *-----*/| "unIndentedLinePattern": { "pattern": "^(\\t|[ ])*[ ]\\*[^/]*\\*/\\s*$|^(\\t|[ ])*[ ]\\*/\\s*$|^(\\t|[ ])*[ ]\\*([ ]([^\\*]|\\*(?!/))*)?$" } }, "onEnterRules": [ { // e.g. /** | */ "beforeText": { "pattern": "^\\s*/\\*\\*(?!/)([^\\*]|\\*(?!/))*$" }, "afterText": { "pattern": "^\\s*\\*/$" }, "action": { "indent": "indentOutdent", "appendText": " * " } }, { // e.g. /** ...| "beforeText": { "pattern": "^\\s*/\\*\\*(?!/)([^\\*]|\\*(?!/))*$" }, "action": { "indent": "none", "appendText": " * " } }, { // e.g. * ...| "beforeText": { "pattern": "^(\\t|[ ])*[ ]\\*([ ]([^\\*]|\\*(?!/))*)?$" }, "previousLineText": { "pattern": "(?=^(\\s*(/\\*\\*|\\*)).*)(?=(?!(\\s*\\*/)))" }, "action": { "indent": "none", "appendText": "* " } }, { // e.g. */| "beforeText": { "pattern": "^(\\t|[ ])*[ ]\\*/\\s*$" }, "action": { "indent": "none", "removeText": 1 }, }, { // e.g. *-----*/| "beforeText": { "pattern": "^(\\t|[ ])*[ ]\\*[^/]*\\*/\\s*$" }, "action": { "indent": "none", "removeText": 1 }, }, { "beforeText": { "pattern": "^\\s*(\\bcase\\s.+:|\\bdefault:)$" }, "afterText": { "pattern": "^(?!\\s*(\\bcase\\b|\\bdefault\\b))" }, "action": { "indent": "indent" } } ] }
extensions/javascript/javascript-language-configuration.json
0
https://github.com/microsoft/vscode/commit/00e8fdec5dcd099ae21c1b9f9851179f6fb1ab2f
[ 0.00017570334603078663, 0.00017267579096369445, 0.000169955994351767, 0.00017259406740777194, 0.000001483394839851826 ]
{ "id": 5, "code_window": [ "\tpublic async run(accessor: ServicesAccessor): Promise<void> {\n", "\t\tconst languagePackService: ILanguagePackService = accessor.get(ILanguagePackService);\n", "\t\tconst quickInputService: IQuickInputService = accessor.get(IQuickInputService);\n", "\t\tconst localeService: ILocaleService = accessor.get(ILocaleService);\n", "\n", "\t\tconst installedLanguages = await languagePackService.getInstalledLanguages();\n", "\n", "\t\tconst qp = quickInputService.createQuickPick<ILanguagePackItem>();\n" ], "labels": [ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ], "after_edit": [ "\t\tconst extensionWorkbenchService: IExtensionsWorkbenchService = accessor.get(IExtensionsWorkbenchService);\n" ], "file_path": "src/vs/workbench/contrib/localization/browser/localizationsActions.ts", "type": "add", "edit_start_line_idx": 32 }
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import { onUnexpectedError } from 'vs/base/common/errors'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { Registry } from 'vs/platform/registry/common/platform'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { Extensions as WorkbenchExtensions, IWorkbenchContributionsRegistry } from 'vs/workbench/common/contributions'; import { IExtensionsWorkbenchService } from 'vs/workbench/contrib/extensions/common/extensions'; import { EnablementState } from 'vs/workbench/services/extensionManagement/common/extensionManagement'; import { LifecyclePhase } from 'vs/workbench/services/lifecycle/common/lifecycle'; class BracketPairColorizer2TelemetryContribution { constructor( @IConfigurationService private readonly configurationService: IConfigurationService, @IExtensionsWorkbenchService private readonly extensionsWorkbenchService: IExtensionsWorkbenchService, @ITelemetryService private readonly telemetryService: ITelemetryService ) { this.init().catch(onUnexpectedError); } private async init(): Promise<void> { const bracketPairColorizerId = 'coenraads.bracket-pair-colorizer-2'; await this.extensionsWorkbenchService.queryLocal(); const extension = this.extensionsWorkbenchService.installed.find(e => e.identifier.id === bracketPairColorizerId); if ( !extension || ((extension.enablementState !== EnablementState.EnabledGlobally) && (extension.enablementState !== EnablementState.EnabledWorkspace)) ) { return; } const nativeBracketPairColorizationEnabledKey = 'editor.bracketPairColorization.enabled'; const nativeColorizationEnabled = !!this.configurationService.getValue(nativeBracketPairColorizationEnabledKey); type BracketPairColorizer2InstalledClassification = { owner: 'hediet'; nativeColorizationEnabled: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Whether or not built-in bracket pair colorization is being used' }; comment: 'We use this to understand how many users have the bracket pair colorizer extension installed (and how many of them have native bracket pair colorization enabled), as the extension does not do anything if native bracket pair colorization is enabled.'; }; type BracketPairColorizer2Event = { nativeColorizationEnabled: boolean; }; this.telemetryService.publicLog2<BracketPairColorizer2Event, BracketPairColorizer2InstalledClassification>('bracketPairColorizerTwoUsage', { nativeColorizationEnabled }); } } Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(BracketPairColorizer2TelemetryContribution, LifecyclePhase.Restored);
src/vs/workbench/contrib/bracketPairColorizer2Telemetry/browser/bracketPairColorizer2Telemetry.contribution.ts
0
https://github.com/microsoft/vscode/commit/00e8fdec5dcd099ae21c1b9f9851179f6fb1ab2f
[ 0.00017836532788351178, 0.00017257365107070655, 0.0001650769409025088, 0.00017378403572365642, 0.000004408942913869396 ]
{ "id": 6, "code_window": [ "\t\tqp.placeholder = localize('chooseLocale', \"Select Display Language\");\n", "\n", "\t\tif (installedLanguages?.length) {\n", "\t\t\tconst items: Array<ILanguagePackItem | IQuickPickSeparator> = [{ type: 'separator', label: localize('installed', \"Installed\") }];\n", "\t\t\tqp.items = items.concat(installedLanguages);\n", "\t\t}\n", "\n", "\t\tconst disposables = new DisposableStore();\n", "\t\tconst source = new CancellationTokenSource();\n" ], "labels": [ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep" ], "after_edit": [ "\t\t\tqp.items = items.concat(this.withMoreInfoButton(installedLanguages));\n" ], "file_path": "src/vs/workbench/contrib/localization/browser/localizationsActions.ts", "type": "replace", "edit_start_line_idx": 40 }
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import { createHash } from 'crypto'; import { equals } from 'vs/base/common/arrays'; import { Queue } from 'vs/base/common/async'; import { Disposable } from 'vs/base/common/lifecycle'; import { Schemas } from 'vs/base/common/network'; import { join } from 'vs/base/common/path'; import { Promises } from 'vs/base/node/pfs'; import { INativeEnvironmentService } from 'vs/platform/environment/common/environment'; import { IExtensionGalleryService, IExtensionIdentifier, IExtensionManagementService, ILocalExtension } from 'vs/platform/extensionManagement/common/extensionManagement'; import { areSameExtensions } from 'vs/platform/extensionManagement/common/extensionManagementUtil'; import { ILogService } from 'vs/platform/log/common/log'; import { ILocalizationContribution } from 'vs/platform/extensions/common/extensions'; import { ILanguagePackItem, LanguagePackBaseService } from 'vs/platform/languagePacks/common/languagePacks'; import { Language } from 'vs/base/common/platform'; import { URI } from 'vs/base/common/uri'; interface ILanguagePack { hash: string; label: string | undefined; extensions: { extensionIdentifier: IExtensionIdentifier; version: string; }[]; translations: { [id: string]: string }; } export class NativeLanguagePackService extends LanguagePackBaseService { private readonly cache: LanguagePacksCache; constructor( @IExtensionManagementService private readonly extensionManagementService: IExtensionManagementService, @INativeEnvironmentService environmentService: INativeEnvironmentService, @IExtensionGalleryService extensionGalleryService: IExtensionGalleryService, @ILogService private readonly logService: ILogService ) { super(extensionGalleryService); this.cache = this._register(new LanguagePacksCache(environmentService, logService)); this.extensionManagementService.registerParticipant({ postInstall: async (extension: ILocalExtension): Promise<void> => { return this.postInstallExtension(extension); }, postUninstall: async (extension: ILocalExtension): Promise<void> => { return this.postUninstallExtension(extension); } }); } async getBuiltInExtensionTranslationsUri(id: string): Promise<URI | undefined> { const packs = await this.cache.getLanguagePacks(); const pack = packs[Language.value()]; if (!pack) { this.logService.warn(`No language pack found for ${Language.value()}`); return undefined; } const translation = pack.translations[id]; return translation ? URI.file(translation) : undefined; } async getInstalledLanguages(): Promise<Array<ILanguagePackItem>> { const languagePacks = await this.cache.getLanguagePacks(); const languages = Object.keys(languagePacks).map(locale => { const languagePack = languagePacks[locale]; const baseQuickPick = this.createQuickPickItem(locale, languagePack.label); return { ...baseQuickPick, extensionId: languagePack.extensions[0].extensionIdentifier.id, }; }); languages.push({ ...this.createQuickPickItem('en', 'English'), extensionId: 'default', }); languages.sort((a, b) => a.label.localeCompare(b.label)); return languages; } private async postInstallExtension(extension: ILocalExtension): Promise<void> { if (extension && extension.manifest && extension.manifest.contributes && extension.manifest.contributes.localizations && extension.manifest.contributes.localizations.length) { this.logService.info('Adding language packs from the extension', extension.identifier.id); await this.update(); } } private async postUninstallExtension(extension: ILocalExtension): Promise<void> { const languagePacks = await this.cache.getLanguagePacks(); if (Object.keys(languagePacks).some(language => languagePacks[language] && languagePacks[language].extensions.some(e => areSameExtensions(e.extensionIdentifier, extension.identifier)))) { this.logService.info('Removing language packs from the extension', extension.identifier.id); await this.update(); } } async update(): Promise<boolean> { const [current, installed] = await Promise.all([this.cache.getLanguagePacks(), this.extensionManagementService.getInstalled()]); const updated = await this.cache.update(installed); return !equals(Object.keys(current), Object.keys(updated)); } } class LanguagePacksCache extends Disposable { private languagePacks: { [language: string]: ILanguagePack } = {}; private languagePacksFilePath: string; private languagePacksFileLimiter: Queue<any>; private initializedCache: boolean | undefined; constructor( @INativeEnvironmentService environmentService: INativeEnvironmentService, @ILogService private readonly logService: ILogService ) { super(); this.languagePacksFilePath = join(environmentService.userDataPath, 'languagepacks.json'); this.languagePacksFileLimiter = new Queue(); } getLanguagePacks(): Promise<{ [language: string]: ILanguagePack }> { // if queue is not empty, fetch from disk if (this.languagePacksFileLimiter.size || !this.initializedCache) { return this.withLanguagePacks() .then(() => this.languagePacks); } return Promise.resolve(this.languagePacks); } update(extensions: ILocalExtension[]): Promise<{ [language: string]: ILanguagePack }> { return this.withLanguagePacks(languagePacks => { Object.keys(languagePacks).forEach(language => delete languagePacks[language]); this.createLanguagePacksFromExtensions(languagePacks, ...extensions); }).then(() => this.languagePacks); } private createLanguagePacksFromExtensions(languagePacks: { [language: string]: ILanguagePack }, ...extensions: ILocalExtension[]): void { for (const extension of extensions) { if (extension && extension.manifest && extension.manifest.contributes && extension.manifest.contributes.localizations && extension.manifest.contributes.localizations.length) { this.createLanguagePacksFromExtension(languagePacks, extension); } } Object.keys(languagePacks).forEach(languageId => this.updateHash(languagePacks[languageId])); } private createLanguagePacksFromExtension(languagePacks: { [language: string]: ILanguagePack }, extension: ILocalExtension): void { const extensionIdentifier = extension.identifier; const localizations = extension.manifest.contributes && extension.manifest.contributes.localizations ? extension.manifest.contributes.localizations : []; for (const localizationContribution of localizations) { if (extension.location.scheme === Schemas.file && isValidLocalization(localizationContribution)) { let languagePack = languagePacks[localizationContribution.languageId]; if (!languagePack) { languagePack = { hash: '', extensions: [], translations: {}, label: localizationContribution.localizedLanguageName ?? localizationContribution.languageName }; languagePacks[localizationContribution.languageId] = languagePack; } const extensionInLanguagePack = languagePack.extensions.filter(e => areSameExtensions(e.extensionIdentifier, extensionIdentifier))[0]; if (extensionInLanguagePack) { extensionInLanguagePack.version = extension.manifest.version; } else { languagePack.extensions.push({ extensionIdentifier, version: extension.manifest.version }); } for (const translation of localizationContribution.translations) { languagePack.translations[translation.id] = join(extension.location.fsPath, translation.path); } } } } private updateHash(languagePack: ILanguagePack): void { if (languagePack) { const md5 = createHash('md5'); for (const extension of languagePack.extensions) { md5.update(extension.extensionIdentifier.uuid || extension.extensionIdentifier.id).update(extension.version); } languagePack.hash = md5.digest('hex'); } } private withLanguagePacks<T>(fn: (languagePacks: { [language: string]: ILanguagePack }) => T | null = () => null): Promise<T> { return this.languagePacksFileLimiter.queue(() => { let result: T | null = null; return Promises.readFile(this.languagePacksFilePath, 'utf8') .then(undefined, err => err.code === 'ENOENT' ? Promise.resolve('{}') : Promise.reject(err)) .then<{ [language: string]: ILanguagePack }>(raw => { try { return JSON.parse(raw); } catch (e) { return {}; } }) .then(languagePacks => { result = fn(languagePacks); return languagePacks; }) .then(languagePacks => { for (const language of Object.keys(languagePacks)) { if (!languagePacks[language]) { delete languagePacks[language]; } } this.languagePacks = languagePacks; this.initializedCache = true; const raw = JSON.stringify(this.languagePacks); this.logService.debug('Writing language packs', raw); return Promises.writeFile(this.languagePacksFilePath, raw); }) .then(() => result, error => this.logService.error(error)); }); } } function isValidLocalization(localization: ILocalizationContribution): boolean { if (typeof localization.languageId !== 'string') { return false; } if (!Array.isArray(localization.translations) || localization.translations.length === 0) { return false; } for (const translation of localization.translations) { if (typeof translation.id !== 'string') { return false; } if (typeof translation.path !== 'string') { return false; } } if (localization.languageName && typeof localization.languageName !== 'string') { return false; } if (localization.localizedLanguageName && typeof localization.localizedLanguageName !== 'string') { return false; } return true; }
src/vs/platform/languagePacks/node/languagePacks.ts
1
https://github.com/microsoft/vscode/commit/00e8fdec5dcd099ae21c1b9f9851179f6fb1ab2f
[ 0.011134957894682884, 0.0012106163194403052, 0.0001643163850530982, 0.00017179310088977218, 0.0025938001926988363 ]
{ "id": 6, "code_window": [ "\t\tqp.placeholder = localize('chooseLocale', \"Select Display Language\");\n", "\n", "\t\tif (installedLanguages?.length) {\n", "\t\t\tconst items: Array<ILanguagePackItem | IQuickPickSeparator> = [{ type: 'separator', label: localize('installed', \"Installed\") }];\n", "\t\t\tqp.items = items.concat(installedLanguages);\n", "\t\t}\n", "\n", "\t\tconst disposables = new DisposableStore();\n", "\t\tconst source = new CancellationTokenSource();\n" ], "labels": [ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep" ], "after_edit": [ "\t\t\tqp.items = items.concat(this.withMoreInfoButton(installedLanguages));\n" ], "file_path": "src/vs/workbench/contrib/localization/browser/localizationsActions.ts", "type": "replace", "edit_start_line_idx": 40 }
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import { isValidBasename } from 'vs/base/common/extpath'; import { Schemas } from 'vs/base/common/network'; import { IPath, win32, posix } from 'vs/base/common/path'; import { OperatingSystem, OS } from 'vs/base/common/platform'; import { basename } from 'vs/base/common/resources'; import { URI } from 'vs/base/common/uri'; import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; import { getVirtualWorkspaceScheme } from 'vs/platform/workspace/common/virtualWorkspace'; import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace'; import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService'; export const IPathService = createDecorator<IPathService>('pathService'); /** * Provides access to path related properties that will match the * environment. If the environment is connected to a remote, the * path properties will match that of the remotes operating system. */ export interface IPathService { readonly _serviceBrand: undefined; /** * The correct path library to use for the target environment. If * the environment is connected to a remote, this will be the * path library of the remote file system. Otherwise it will be * the local file system's path library depending on the OS. */ readonly path: Promise<IPath>; /** * Determines the best default URI scheme for the current workspace. * It uses information about whether we're running remote, in browser, * or native combined with information about the current workspace to * find the best default scheme. */ readonly defaultUriScheme: string; /** * Converts the given path to a file URI to use for the target * environment. If the environment is connected to a remote, it * will use the path separators according to the remote file * system. Otherwise it will use the local file system's path * separators. */ fileURI(path: string): Promise<URI>; /** * Resolves the user-home directory for the target environment. * If the envrionment is connected to a remote, this will be the * remote's user home directory, otherwise the local one unless * `preferLocal` is set to `true`. */ userHome(options: { preferLocal: true }): URI; userHome(options?: { preferLocal: boolean }): Promise<URI>; /** * Figures out if the provided resource has a valid file name * for the operating system the file is saved to. * * Note: this currently only supports `file` and `vscode-file` * protocols where we know the limits of the file systems behind * these OS. Other remotes are not supported and this method * will always return `true` for them. */ hasValidBasename(resource: URI, basename?: string): Promise<boolean>; hasValidBasename(resource: URI, os: OperatingSystem, basename?: string): boolean; /** * @deprecated use `userHome` instead. */ readonly resolvedUserHome: URI | undefined; } export abstract class AbstractPathService implements IPathService { declare readonly _serviceBrand: undefined; private resolveOS: Promise<OperatingSystem>; private resolveUserHome: Promise<URI>; private maybeUnresolvedUserHome: URI | undefined; constructor( private localUserHome: URI, @IRemoteAgentService private readonly remoteAgentService: IRemoteAgentService, @IWorkbenchEnvironmentService private readonly environmentService: IWorkbenchEnvironmentService, @IWorkspaceContextService private contextService: IWorkspaceContextService ) { // OS this.resolveOS = (async () => { const env = await this.remoteAgentService.getEnvironment(); return env?.os || OS; })(); // User Home this.resolveUserHome = (async () => { const env = await this.remoteAgentService.getEnvironment(); const userHome = this.maybeUnresolvedUserHome = env?.userHome ?? localUserHome; return userHome; })(); } hasValidBasename(resource: URI, basename?: string): Promise<boolean>; hasValidBasename(resource: URI, os: OperatingSystem, basename?: string): boolean; hasValidBasename(resource: URI, arg2?: string | OperatingSystem, basename?: string): boolean | Promise<boolean> { // async version if (typeof arg2 === 'string' || typeof arg2 === 'undefined') { return this.resolveOS.then(os => this.doHasValidBasename(resource, os, arg2)); } // sync version return this.doHasValidBasename(resource, arg2, basename); } private doHasValidBasename(resource: URI, os: OperatingSystem, name?: string): boolean { // Our `isValidBasename` method only works with our // standard schemes for files on disk, either locally // or remote. if (resource.scheme === Schemas.file || resource.scheme === Schemas.vscodeRemote) { return isValidBasename(name ?? basename(resource), os === OperatingSystem.Windows); } return true; } get defaultUriScheme(): string { return AbstractPathService.findDefaultUriScheme(this.environmentService, this.contextService); } static findDefaultUriScheme(environmentService: IWorkbenchEnvironmentService, contextService: IWorkspaceContextService): string { if (environmentService.remoteAuthority) { return Schemas.vscodeRemote; } const virtualWorkspace = getVirtualWorkspaceScheme(contextService.getWorkspace()); if (virtualWorkspace) { return virtualWorkspace; } const firstFolder = contextService.getWorkspace().folders[0]; if (firstFolder) { return firstFolder.uri.scheme; } const configuration = contextService.getWorkspace().configuration; if (configuration) { return configuration.scheme; } return Schemas.file; } userHome(options?: { preferLocal: boolean }): Promise<URI>; userHome(options: { preferLocal: true }): URI; userHome(options?: { preferLocal: boolean }): Promise<URI> | URI { return options?.preferLocal ? this.localUserHome : this.resolveUserHome; } get resolvedUserHome(): URI | undefined { return this.maybeUnresolvedUserHome; } get path(): Promise<IPath> { return this.resolveOS.then(os => { return os === OperatingSystem.Windows ? win32 : posix; }); } async fileURI(_path: string): Promise<URI> { let authority = ''; // normalize to fwd-slashes on windows, // on other systems bwd-slashes are valid // filename character, eg /f\oo/ba\r.txt const os = await this.resolveOS; if (os === OperatingSystem.Windows) { _path = _path.replace(/\\/g, '/'); } // check for authority as used in UNC shares // or use the path as given if (_path[0] === '/' && _path[1] === '/') { const idx = _path.indexOf('/', 2); if (idx === -1) { authority = _path.substring(2); _path = '/'; } else { authority = _path.substring(2, idx); _path = _path.substring(idx) || '/'; } } return URI.from({ scheme: Schemas.file, authority, path: _path, query: '', fragment: '' }); } }
src/vs/workbench/services/path/common/pathService.ts
0
https://github.com/microsoft/vscode/commit/00e8fdec5dcd099ae21c1b9f9851179f6fb1ab2f
[ 0.00017783668590709567, 0.0001721817534416914, 0.00016188040899578482, 0.000173941720277071, 0.000004776013611262897 ]
{ "id": 6, "code_window": [ "\t\tqp.placeholder = localize('chooseLocale', \"Select Display Language\");\n", "\n", "\t\tif (installedLanguages?.length) {\n", "\t\t\tconst items: Array<ILanguagePackItem | IQuickPickSeparator> = [{ type: 'separator', label: localize('installed', \"Installed\") }];\n", "\t\t\tqp.items = items.concat(installedLanguages);\n", "\t\t}\n", "\n", "\t\tconst disposables = new DisposableStore();\n", "\t\tconst source = new CancellationTokenSource();\n" ], "labels": [ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep" ], "after_edit": [ "\t\t\tqp.items = items.concat(this.withMoreInfoButton(installedLanguages));\n" ], "file_path": "src/vs/workbench/contrib/localization/browser/localizationsActions.ts", "type": "replace", "edit_start_line_idx": 40 }
{ "originalFileName": "./1.txt", "modifiedFileName": "./2.txt", "diffs": [ { "originalRange": "[1,5)", "modifiedRange": "[1,4)", "innerChanges": [ { "originalRange": "[1,15 -> 1,16]", "modifiedRange": "[1,15 -> 1,15]" }, { "originalRange": "[2,15 -> 3,16]", "modifiedRange": "[2,15 -> 2,15]" }, { "originalRange": "[4,15 -> 4,16]", "modifiedRange": "[3,15 -> 3,15]" } ] } ] }
src/vs/editor/test/node/diffing/fixtures/intra-block-align/experimental.expected.diff.json
0
https://github.com/microsoft/vscode/commit/00e8fdec5dcd099ae21c1b9f9851179f6fb1ab2f
[ 0.00017591238429304212, 0.00017433175526093692, 0.0001734900288283825, 0.00017359279445372522, 0.0000011184743016201537 ]
{ "id": 6, "code_window": [ "\t\tqp.placeholder = localize('chooseLocale', \"Select Display Language\");\n", "\n", "\t\tif (installedLanguages?.length) {\n", "\t\t\tconst items: Array<ILanguagePackItem | IQuickPickSeparator> = [{ type: 'separator', label: localize('installed', \"Installed\") }];\n", "\t\t\tqp.items = items.concat(installedLanguages);\n", "\t\t}\n", "\n", "\t\tconst disposables = new DisposableStore();\n", "\t\tconst source = new CancellationTokenSource();\n" ], "labels": [ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep" ], "after_edit": [ "\t\t\tqp.items = items.concat(this.withMoreInfoButton(installedLanguages));\n" ], "file_path": "src/vs/workbench/contrib/localization/browser/localizationsActions.ts", "type": "replace", "edit_start_line_idx": 40 }
[ { "c": "This is the summary line. It can't be too long.", "t": "text.git-commit meta.scope.message.git-commit meta.scope.subject.git-commit", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", "dark_vs": "default: #D4D4D4", "light_vs": "default: #000000", "hc_black": "default: #FFFFFF", "dark_plus_experimental": "default: #FFFFFFD3", "hc_light": "default: #292929", "light_plus_experimental": "default: #000000E4" } }, { "c": "After I can write a much more detailed description without quite the same restrictions on length.", "t": "text.git-commit meta.scope.message.git-commit", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", "dark_vs": "default: #D4D4D4", "light_vs": "default: #000000", "hc_black": "default: #FFFFFF", "dark_plus_experimental": "default: #FFFFFFD3", "hc_light": "default: #292929", "light_plus_experimental": "default: #000000E4" } }, { "c": "#", "t": "text.git-commit meta.scope.metadata.git-commit comment.line.number-sign.git-commit punctuation.definition.comment.git-commit", "r": { "dark_plus": "comment: #6A9955", "light_plus": "comment: #008000", "dark_vs": "comment: #6A9955", "light_vs": "comment: #008000", "hc_black": "comment: #7CA668", "dark_plus_experimental": "comment: #6A9955", "hc_light": "comment: #515151", "light_plus_experimental": "comment: #008000" } }, { "c": " Please enter the commit message for your changes. Lines starting", "t": "text.git-commit meta.scope.metadata.git-commit comment.line.number-sign.git-commit", "r": { "dark_plus": "comment: #6A9955", "light_plus": "comment: #008000", "dark_vs": "comment: #6A9955", "light_vs": "comment: #008000", "hc_black": "comment: #7CA668", "dark_plus_experimental": "comment: #6A9955", "hc_light": "comment: #515151", "light_plus_experimental": "comment: #008000" } }, { "c": "#", "t": "text.git-commit meta.scope.metadata.git-commit comment.line.number-sign.git-commit punctuation.definition.comment.git-commit", "r": { "dark_plus": "comment: #6A9955", "light_plus": "comment: #008000", "dark_vs": "comment: #6A9955", "light_vs": "comment: #008000", "hc_black": "comment: #7CA668", "dark_plus_experimental": "comment: #6A9955", "hc_light": "comment: #515151", "light_plus_experimental": "comment: #008000" } }, { "c": " with '#' will be ignored, and an empty message aborts the commit.", "t": "text.git-commit meta.scope.metadata.git-commit comment.line.number-sign.git-commit", "r": { "dark_plus": "comment: #6A9955", "light_plus": "comment: #008000", "dark_vs": "comment: #6A9955", "light_vs": "comment: #008000", "hc_black": "comment: #7CA668", "dark_plus_experimental": "comment: #6A9955", "hc_light": "comment: #515151", "light_plus_experimental": "comment: #008000" } }, { "c": "#", "t": "text.git-commit meta.scope.metadata.git-commit comment.line.number-sign.git-commit punctuation.definition.comment.git-commit", "r": { "dark_plus": "comment: #6A9955", "light_plus": "comment: #008000", "dark_vs": "comment: #6A9955", "light_vs": "comment: #008000", "hc_black": "comment: #7CA668", "dark_plus_experimental": "comment: #6A9955", "hc_light": "comment: #515151", "light_plus_experimental": "comment: #008000" } }, { "c": " On branch master", "t": "text.git-commit meta.scope.metadata.git-commit comment.line.number-sign.git-commit", "r": { "dark_plus": "comment: #6A9955", "light_plus": "comment: #008000", "dark_vs": "comment: #6A9955", "light_vs": "comment: #008000", "hc_black": "comment: #7CA668", "dark_plus_experimental": "comment: #6A9955", "hc_light": "comment: #515151", "light_plus_experimental": "comment: #008000" } }, { "c": "#", "t": "text.git-commit meta.scope.metadata.git-commit comment.line.number-sign.git-commit punctuation.definition.comment.git-commit", "r": { "dark_plus": "comment: #6A9955", "light_plus": "comment: #008000", "dark_vs": "comment: #6A9955", "light_vs": "comment: #008000", "hc_black": "comment: #7CA668", "dark_plus_experimental": "comment: #6A9955", "hc_light": "comment: #515151", "light_plus_experimental": "comment: #008000" } }, { "c": " Your branch is up-to-date with 'origin/master'.", "t": "text.git-commit meta.scope.metadata.git-commit comment.line.number-sign.git-commit", "r": { "dark_plus": "comment: #6A9955", "light_plus": "comment: #008000", "dark_vs": "comment: #6A9955", "light_vs": "comment: #008000", "hc_black": "comment: #7CA668", "dark_plus_experimental": "comment: #6A9955", "hc_light": "comment: #515151", "light_plus_experimental": "comment: #008000" } }, { "c": "#", "t": "text.git-commit meta.scope.metadata.git-commit comment.line.number-sign.git-commit punctuation.definition.comment.git-commit", "r": { "dark_plus": "comment: #6A9955", "light_plus": "comment: #008000", "dark_vs": "comment: #6A9955", "light_vs": "comment: #008000", "hc_black": "comment: #7CA668", "dark_plus_experimental": "comment: #6A9955", "hc_light": "comment: #515151", "light_plus_experimental": "comment: #008000" } }, { "c": "#", "t": "text.git-commit meta.scope.metadata.git-commit comment.line.number-sign.git-commit punctuation.definition.comment.git-commit", "r": { "dark_plus": "comment: #6A9955", "light_plus": "comment: #008000", "dark_vs": "comment: #6A9955", "light_vs": "comment: #008000", "hc_black": "comment: #7CA668", "dark_plus_experimental": "comment: #6A9955", "hc_light": "comment: #515151", "light_plus_experimental": "comment: #008000" } }, { "c": " Changes to be committed:", "t": "text.git-commit meta.scope.metadata.git-commit comment.line.number-sign.git-commit", "r": { "dark_plus": "comment: #6A9955", "light_plus": "comment: #008000", "dark_vs": "comment: #6A9955", "light_vs": "comment: #008000", "hc_black": "comment: #7CA668", "dark_plus_experimental": "comment: #6A9955", "hc_light": "comment: #515151", "light_plus_experimental": "comment: #008000" } }, { "c": "#", "t": "text.git-commit meta.scope.metadata.git-commit comment.line.number-sign.git-commit punctuation.definition.comment.git-commit", "r": { "dark_plus": "comment: #6A9955", "light_plus": "comment: #008000", "dark_vs": "comment: #6A9955", "light_vs": "comment: #008000", "hc_black": "comment: #7CA668", "dark_plus_experimental": "comment: #6A9955", "hc_light": "comment: #515151", "light_plus_experimental": "comment: #008000" } }, { "c": "\t", "t": "text.git-commit meta.scope.metadata.git-commit comment.line.number-sign.git-commit", "r": { "dark_plus": "comment: #6A9955", "light_plus": "comment: #008000", "dark_vs": "comment: #6A9955", "light_vs": "comment: #008000", "hc_black": "comment: #7CA668", "dark_plus_experimental": "comment: #6A9955", "hc_light": "comment: #515151", "light_plus_experimental": "comment: #008000" } }, { "c": "deleted: README.md", "t": "text.git-commit meta.scope.metadata.git-commit comment.line.number-sign.git-commit markup.deleted.git-commit", "r": { "dark_plus": "markup.deleted: #CE9178", "light_plus": "markup.deleted: #A31515", "dark_vs": "markup.deleted: #CE9178", "light_vs": "markup.deleted: #A31515", "hc_black": "markup.deleted: #CE9178", "dark_plus_experimental": "markup.deleted: #CE9178", "hc_light": "markup.deleted: #5A5A5A", "light_plus_experimental": "markup.deleted: #A31515" } }, { "c": "#", "t": "text.git-commit meta.scope.metadata.git-commit comment.line.number-sign.git-commit punctuation.definition.comment.git-commit", "r": { "dark_plus": "comment: #6A9955", "light_plus": "comment: #008000", "dark_vs": "comment: #6A9955", "light_vs": "comment: #008000", "hc_black": "comment: #7CA668", "dark_plus_experimental": "comment: #6A9955", "hc_light": "comment: #515151", "light_plus_experimental": "comment: #008000" } }, { "c": "\t", "t": "text.git-commit meta.scope.metadata.git-commit comment.line.number-sign.git-commit", "r": { "dark_plus": "comment: #6A9955", "light_plus": "comment: #008000", "dark_vs": "comment: #6A9955", "light_vs": "comment: #008000", "hc_black": "comment: #7CA668", "dark_plus_experimental": "comment: #6A9955", "hc_light": "comment: #515151", "light_plus_experimental": "comment: #008000" } }, { "c": "modified: index.less", "t": "text.git-commit meta.scope.metadata.git-commit comment.line.number-sign.git-commit markup.changed.git-commit", "r": { "dark_plus": "markup.changed: #569CD6", "light_plus": "markup.changed: #0451A5", "dark_vs": "markup.changed: #569CD6", "light_vs": "markup.changed: #0451A5", "hc_black": "markup.changed: #569CD6", "dark_plus_experimental": "markup.changed: #569CD6", "hc_light": "markup.changed: #0451A5", "light_plus_experimental": "markup.changed: #0451A5" } }, { "c": "#", "t": "text.git-commit meta.scope.metadata.git-commit comment.line.number-sign.git-commit punctuation.definition.comment.git-commit", "r": { "dark_plus": "comment: #6A9955", "light_plus": "comment: #008000", "dark_vs": "comment: #6A9955", "light_vs": "comment: #008000", "hc_black": "comment: #7CA668", "dark_plus_experimental": "comment: #6A9955", "hc_light": "comment: #515151", "light_plus_experimental": "comment: #008000" } }, { "c": "\t", "t": "text.git-commit meta.scope.metadata.git-commit comment.line.number-sign.git-commit", "r": { "dark_plus": "comment: #6A9955", "light_plus": "comment: #008000", "dark_vs": "comment: #6A9955", "light_vs": "comment: #008000", "hc_black": "comment: #7CA668", "dark_plus_experimental": "comment: #6A9955", "hc_light": "comment: #515151", "light_plus_experimental": "comment: #008000" } }, { "c": "new file: spec/COMMIT_EDITMSG", "t": "text.git-commit meta.scope.metadata.git-commit comment.line.number-sign.git-commit markup.inserted.git-commit", "r": { "dark_plus": "markup.inserted: #B5CEA8", "light_plus": "markup.inserted: #098658", "dark_vs": "markup.inserted: #B5CEA8", "light_vs": "markup.inserted: #098658", "hc_black": "markup.inserted: #B5CEA8", "dark_plus_experimental": "markup.inserted: #B5CEA8", "hc_light": "markup.inserted: #096D48", "light_plus_experimental": "markup.inserted: #098658" } }, { "c": "#", "t": "text.git-commit meta.scope.metadata.git-commit comment.line.number-sign.git-commit punctuation.definition.comment.git-commit", "r": { "dark_plus": "comment: #6A9955", "light_plus": "comment: #008000", "dark_vs": "comment: #6A9955", "light_vs": "comment: #008000", "hc_black": "comment: #7CA668", "dark_plus_experimental": "comment: #6A9955", "hc_light": "comment: #515151", "light_plus_experimental": "comment: #008000" } } ]
extensions/vscode-colorize-tests/test/colorize-results/COMMIT_EDITMSG.json
0
https://github.com/microsoft/vscode/commit/00e8fdec5dcd099ae21c1b9f9851179f6fb1ab2f
[ 0.0001763065083650872, 0.00017365846724715084, 0.00016981360386125743, 0.00017365519306622446, 0.0000015587614825562923 ]
{ "id": 7, "code_window": [ "\t\t\tconst newLanguages = availableLanguages.filter(l => l.id && !installedSet.has(l.id));\n", "\t\t\tif (newLanguages.length) {\n", "\t\t\t\tqp.items = [\n", "\t\t\t\t\t...qp.items,\n", "\t\t\t\t\t{ type: 'separator', label: localize('available', \"Available\") },\n", "\t\t\t\t\t...newLanguages\n", "\t\t\t\t];\n", "\t\t\t}\n", "\t\t\tqp.busy = false;\n", "\t\t});\n", "\n" ], "labels": [ "keep", "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ], "after_edit": [ "\t\t\t\t\t...this.withMoreInfoButton(newLanguages)\n" ], "file_path": "src/vs/workbench/contrib/localization/browser/localizationsActions.ts", "type": "replace", "edit_start_line_idx": 57 }
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import { localize } from 'vs/nls'; import { IQuickInputService, IQuickPickSeparator } from 'vs/platform/quickinput/common/quickInput'; import { CancellationTokenSource } from 'vs/base/common/cancellation'; import { DisposableStore } from 'vs/base/common/lifecycle'; import { Action2, MenuId } from 'vs/platform/actions/common/actions'; import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; import { ILanguagePackItem, ILanguagePackService } from 'vs/platform/languagePacks/common/languagePacks'; import { ILocaleService } from 'vs/workbench/contrib/localization/common/locale'; export class ConfigureDisplayLanguageAction extends Action2 { public static readonly ID = 'workbench.action.configureLocale'; public static readonly LABEL = localize('configureLocale', "Configure Display Language"); constructor() { super({ id: ConfigureDisplayLanguageAction.ID, title: { original: 'Configure Display Language', value: ConfigureDisplayLanguageAction.LABEL }, menu: { id: MenuId.CommandPalette } }); } public async run(accessor: ServicesAccessor): Promise<void> { const languagePackService: ILanguagePackService = accessor.get(ILanguagePackService); const quickInputService: IQuickInputService = accessor.get(IQuickInputService); const localeService: ILocaleService = accessor.get(ILocaleService); const installedLanguages = await languagePackService.getInstalledLanguages(); const qp = quickInputService.createQuickPick<ILanguagePackItem>(); qp.placeholder = localize('chooseLocale', "Select Display Language"); if (installedLanguages?.length) { const items: Array<ILanguagePackItem | IQuickPickSeparator> = [{ type: 'separator', label: localize('installed', "Installed") }]; qp.items = items.concat(installedLanguages); } const disposables = new DisposableStore(); const source = new CancellationTokenSource(); disposables.add(qp.onDispose(() => { source.cancel(); disposables.dispose(); })); const installedSet = new Set<string>(installedLanguages?.map(language => language.id!) ?? []); languagePackService.getAvailableLanguages().then(availableLanguages => { const newLanguages = availableLanguages.filter(l => l.id && !installedSet.has(l.id)); if (newLanguages.length) { qp.items = [ ...qp.items, { type: 'separator', label: localize('available', "Available") }, ...newLanguages ]; } qp.busy = false; }); disposables.add(qp.onDidAccept(async () => { const selectedLanguage = qp.activeItems[0]; qp.hide(); await localeService.setLocale(selectedLanguage); })); qp.show(); qp.busy = true; } } export class ClearDisplayLanguageAction extends Action2 { public static readonly ID = 'workbench.action.clearLocalePreference'; public static readonly LABEL = localize('clearDisplayLanguage', "Clear Display Language Preference"); constructor() { super({ id: ClearDisplayLanguageAction.ID, title: { original: 'Clear Display Language Preference', value: ClearDisplayLanguageAction.LABEL }, menu: { id: MenuId.CommandPalette } }); } public async run(accessor: ServicesAccessor): Promise<void> { const localeService: ILocaleService = accessor.get(ILocaleService); await localeService.clearLocalePreference(); } }
src/vs/workbench/contrib/localization/browser/localizationsActions.ts
1
https://github.com/microsoft/vscode/commit/00e8fdec5dcd099ae21c1b9f9851179f6fb1ab2f
[ 0.9981185793876648, 0.18366095423698425, 0.00016568911087233573, 0.00036498747067525983, 0.36820539832115173 ]
{ "id": 7, "code_window": [ "\t\t\tconst newLanguages = availableLanguages.filter(l => l.id && !installedSet.has(l.id));\n", "\t\t\tif (newLanguages.length) {\n", "\t\t\t\tqp.items = [\n", "\t\t\t\t\t...qp.items,\n", "\t\t\t\t\t{ type: 'separator', label: localize('available', \"Available\") },\n", "\t\t\t\t\t...newLanguages\n", "\t\t\t\t];\n", "\t\t\t}\n", "\t\t\tqp.busy = false;\n", "\t\t});\n", "\n" ], "labels": [ "keep", "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ], "after_edit": [ "\t\t\t\t\t...this.withMoreInfoButton(newLanguages)\n" ], "file_path": "src/vs/workbench/contrib/localization/browser/localizationsActions.ts", "type": "replace", "edit_start_line_idx": 57 }
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import { Emitter, Event } from 'vs/base/common/event'; import { Disposable } from 'vs/base/common/lifecycle'; import { ProgressBar } from 'vs/base/browser/ui/progressbar/progressbar'; import { IProgressRunner, IProgressIndicator, emptyProgressRunner } from 'vs/platform/progress/common/progress'; import { IEditorGroupView } from 'vs/workbench/browser/parts/editor/editor'; import { GroupModelChangeKind } from 'vs/workbench/common/editor'; export class EditorProgressIndicator extends Disposable implements IProgressIndicator { constructor( private readonly progressBar: ProgressBar, private readonly group: IEditorGroupView ) { super(); this.registerListeners(); } private registerListeners() { // Stop any running progress when the active editor changes or // the group becomes empty. // In contrast to the composite progress indicator, we do not // track active editor progress and replay it later (yet). this._register(this.group.onDidModelChange(e => { if ( e.kind === GroupModelChangeKind.EDITOR_ACTIVE || (e.kind === GroupModelChangeKind.EDITOR_CLOSE && this.group.isEmpty) ) { this.progressBar.stop().hide(); } })); } show(infinite: true, delay?: number): IProgressRunner; show(total: number, delay?: number): IProgressRunner; show(infiniteOrTotal: true | number, delay?: number): IProgressRunner { // No editor open: ignore any progress reporting if (this.group.isEmpty) { return emptyProgressRunner; } if (infiniteOrTotal === true) { return this.doShow(true, delay); } return this.doShow(infiniteOrTotal, delay); } private doShow(infinite: true, delay?: number): IProgressRunner; private doShow(total: number, delay?: number): IProgressRunner; private doShow(infiniteOrTotal: true | number, delay?: number): IProgressRunner { if (typeof infiniteOrTotal === 'boolean') { this.progressBar.infinite().show(delay); } else { this.progressBar.total(infiniteOrTotal).show(delay); } return { total: (total: number) => { this.progressBar.total(total); }, worked: (worked: number) => { if (this.progressBar.hasTotal()) { this.progressBar.worked(worked); } else { this.progressBar.infinite().show(); } }, done: () => { this.progressBar.stop().hide(); } }; } async showWhile(promise: Promise<unknown>, delay?: number): Promise<void> { // No editor open: ignore any progress reporting if (this.group.isEmpty) { try { await promise; } catch (error) { // ignore } } return this.doShowWhile(promise, delay); } private async doShowWhile(promise: Promise<unknown>, delay?: number): Promise<void> { try { this.progressBar.infinite().show(delay); await promise; } catch (error) { // ignore } finally { this.progressBar.stop().hide(); } } } namespace ProgressIndicatorState { export const enum Type { None, Done, Infinite, While, Work } export const None = { type: Type.None } as const; export const Done = { type: Type.Done } as const; export const Infinite = { type: Type.Infinite } as const; export class While { readonly type = Type.While; constructor( readonly whilePromise: Promise<unknown>, readonly whileStart: number, readonly whileDelay: number, ) { } } export class Work { readonly type = Type.Work; constructor( readonly total: number | undefined, readonly worked: number | undefined ) { } } export type State = typeof None | typeof Done | typeof Infinite | While | Work; } export interface IProgressScope { /** * Fired whenever `isActive` value changed. */ readonly onDidChangeActive: Event<void>; /** * Whether progress should be active or not. */ readonly isActive: boolean; } export class ScopedProgressIndicator extends Disposable implements IProgressIndicator { private progressState: ProgressIndicatorState.State = ProgressIndicatorState.None; constructor( private readonly progressBar: ProgressBar, private readonly scope: IProgressScope ) { super(); this.registerListeners(); } registerListeners() { this._register(this.scope.onDidChangeActive(() => { if (this.scope.isActive) { this.onDidScopeActivate(); } else { this.onDidScopeDeactivate(); } })); } private onDidScopeActivate(): void { // Return early if progress state indicates that progress is done if (this.progressState.type === ProgressIndicatorState.Done.type) { return; } // Replay Infinite Progress from Promise if (this.progressState.type === ProgressIndicatorState.Type.While) { let delay: number | undefined; if (this.progressState.whileDelay > 0) { const remainingDelay = this.progressState.whileDelay - (Date.now() - this.progressState.whileStart); if (remainingDelay > 0) { delay = remainingDelay; } } this.doShowWhile(delay); } // Replay Infinite Progress else if (this.progressState.type === ProgressIndicatorState.Type.Infinite) { this.progressBar.infinite().show(); } // Replay Finite Progress (Total & Worked) else if (this.progressState.type === ProgressIndicatorState.Type.Work) { if (this.progressState.total) { this.progressBar.total(this.progressState.total).show(); } if (this.progressState.worked) { this.progressBar.worked(this.progressState.worked).show(); } } } private onDidScopeDeactivate(): void { this.progressBar.stop().hide(); } show(infinite: true, delay?: number): IProgressRunner; show(total: number, delay?: number): IProgressRunner; show(infiniteOrTotal: true | number, delay?: number): IProgressRunner { // Sort out Arguments if (typeof infiniteOrTotal === 'boolean') { this.progressState = ProgressIndicatorState.Infinite; } else { this.progressState = new ProgressIndicatorState.Work(infiniteOrTotal, undefined); } // Active: Show Progress if (this.scope.isActive) { // Infinite: Start Progressbar and Show after Delay if (this.progressState.type === ProgressIndicatorState.Type.Infinite) { this.progressBar.infinite().show(delay); } // Finite: Start Progressbar and Show after Delay else if (this.progressState.type === ProgressIndicatorState.Type.Work && typeof this.progressState.total === 'number') { this.progressBar.total(this.progressState.total).show(delay); } } return { total: (total: number) => { this.progressState = new ProgressIndicatorState.Work( total, this.progressState.type === ProgressIndicatorState.Type.Work ? this.progressState.worked : undefined); if (this.scope.isActive) { this.progressBar.total(total); } }, worked: (worked: number) => { // Verify first that we are either not active or the progressbar has a total set if (!this.scope.isActive || this.progressBar.hasTotal()) { this.progressState = new ProgressIndicatorState.Work( this.progressState.type === ProgressIndicatorState.Type.Work ? this.progressState.total : undefined, this.progressState.type === ProgressIndicatorState.Type.Work && typeof this.progressState.worked === 'number' ? this.progressState.worked + worked : worked); if (this.scope.isActive) { this.progressBar.worked(worked); } } // Otherwise the progress bar does not support worked(), we fallback to infinite() progress else { this.progressState = ProgressIndicatorState.Infinite; this.progressBar.infinite().show(); } }, done: () => { this.progressState = ProgressIndicatorState.Done; if (this.scope.isActive) { this.progressBar.stop().hide(); } } }; } async showWhile(promise: Promise<unknown>, delay?: number): Promise<void> { // Join with existing running promise to ensure progress is accurate if (this.progressState.type === ProgressIndicatorState.Type.While) { promise = Promise.all([promise, this.progressState.whilePromise]); } // Keep Promise in State this.progressState = new ProgressIndicatorState.While(promise, delay || 0, Date.now()); try { this.doShowWhile(delay); await promise; } catch (error) { // ignore } finally { // If this is not the last promise in the list of joined promises, skip this if (this.progressState.type !== ProgressIndicatorState.Type.While || this.progressState.whilePromise === promise) { // The while promise is either null or equal the promise we last hooked on this.progressState = ProgressIndicatorState.None; if (this.scope.isActive) { this.progressBar.stop().hide(); } } } } private doShowWhile(delay?: number): void { // Show Progress when active if (this.scope.isActive) { this.progressBar.infinite().show(delay); } } } export abstract class AbstractProgressScope extends Disposable implements IProgressScope { private readonly _onDidChangeActive = this._register(new Emitter<void>()); readonly onDidChangeActive = this._onDidChangeActive.event; get isActive() { return this._isActive; } constructor( private scopeId: string, private _isActive: boolean ) { super(); } protected onScopeOpened(scopeId: string) { if (scopeId === this.scopeId) { if (!this._isActive) { this._isActive = true; this._onDidChangeActive.fire(); } } } protected onScopeClosed(scopeId: string) { if (scopeId === this.scopeId) { if (this._isActive) { this._isActive = false; this._onDidChangeActive.fire(); } } } }
src/vs/workbench/services/progress/browser/progressIndicator.ts
0
https://github.com/microsoft/vscode/commit/00e8fdec5dcd099ae21c1b9f9851179f6fb1ab2f
[ 0.0001776702411007136, 0.00017228834622073919, 0.00016455141303595155, 0.00017255262355320156, 0.0000027450398647488328 ]
{ "id": 7, "code_window": [ "\t\t\tconst newLanguages = availableLanguages.filter(l => l.id && !installedSet.has(l.id));\n", "\t\t\tif (newLanguages.length) {\n", "\t\t\t\tqp.items = [\n", "\t\t\t\t\t...qp.items,\n", "\t\t\t\t\t{ type: 'separator', label: localize('available', \"Available\") },\n", "\t\t\t\t\t...newLanguages\n", "\t\t\t\t];\n", "\t\t\t}\n", "\t\t\tqp.busy = false;\n", "\t\t});\n", "\n" ], "labels": [ "keep", "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ], "after_edit": [ "\t\t\t\t\t...this.withMoreInfoButton(newLanguages)\n" ], "file_path": "src/vs/workbench/contrib/localization/browser/localizationsActions.ts", "type": "replace", "edit_start_line_idx": 57 }
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import { notStrictEqual, strictEqual } from 'assert'; import { Schemas } from 'vs/base/common/network'; import { joinPath } from 'vs/base/common/resources'; import { URI } from 'vs/base/common/uri'; import { generateUuid } from 'vs/base/common/uuid'; import { OPTIONS, parseArgs } from 'vs/platform/environment/node/argv'; import { NativeEnvironmentService } from 'vs/platform/environment/node/environmentService'; import { FileService } from 'vs/platform/files/common/fileService'; import { ILifecycleMainService } from 'vs/platform/lifecycle/electron-main/lifecycleMainService'; import { NullLogService } from 'vs/platform/log/common/log'; import product from 'vs/platform/product/common/product'; import { IProductService } from 'vs/platform/product/common/productService'; import { StateMainService } from 'vs/platform/state/electron-main/stateMainService'; import { IS_NEW_KEY, StorageScope } from 'vs/platform/storage/common/storage'; import { IStorageChangeEvent, IStorageMain, IStorageMainOptions } from 'vs/platform/storage/electron-main/storageMain'; import { StorageMainService } from 'vs/platform/storage/electron-main/storageMainService'; import { currentSessionDateStorageKey, firstSessionDateStorageKey } from 'vs/platform/telemetry/common/telemetry'; import { UriIdentityService } from 'vs/platform/uriIdentity/common/uriIdentityService'; import { IUserDataProfile } from 'vs/platform/userDataProfile/common/userDataProfile'; import { UserDataProfilesMainService } from 'vs/platform/userDataProfile/electron-main/userDataProfile'; import { TestLifecycleMainService } from 'vs/platform/test/electron-main/workbenchTestServices'; suite('StorageMainService', function () { const productService: IProductService = { _serviceBrand: undefined, ...product }; const inMemoryProfileRoot = URI.file('/location').with({ scheme: Schemas.inMemory }); const inMemoryProfile: IUserDataProfile = { id: 'id', name: 'inMemory', shortName: 'inMemory', isDefault: false, location: inMemoryProfileRoot, globalStorageHome: joinPath(inMemoryProfileRoot, 'globalStorageHome'), settingsResource: joinPath(inMemoryProfileRoot, 'settingsResource'), keybindingsResource: joinPath(inMemoryProfileRoot, 'keybindingsResource'), tasksResource: joinPath(inMemoryProfileRoot, 'tasksResource'), snippetsHome: joinPath(inMemoryProfileRoot, 'snippetsHome'), extensionsResource: joinPath(inMemoryProfileRoot, 'extensionsResource') }; class TestStorageMainService extends StorageMainService { protected override getStorageOptions(): IStorageMainOptions { return { useInMemoryStorage: true }; } } async function testStorage(storage: IStorageMain, scope: StorageScope): Promise<void> { strictEqual(storage.isInMemory(), true); // Telemetry: added after init unless workspace/profile scoped if (scope === StorageScope.APPLICATION) { strictEqual(storage.items.size, 0); await storage.init(); strictEqual(typeof storage.get(firstSessionDateStorageKey), 'string'); strictEqual(typeof storage.get(currentSessionDateStorageKey), 'string'); } else { await storage.init(); } let storageChangeEvent: IStorageChangeEvent | undefined = undefined; const storageChangeListener = storage.onDidChangeStorage(e => { storageChangeEvent = e; }); let storageDidClose = false; const storageCloseListener = storage.onDidCloseStorage(() => storageDidClose = true); // Basic store/get/remove const size = storage.items.size; storage.set('bar', 'foo'); strictEqual(storageChangeEvent!.key, 'bar'); storage.set('barNumber', 55); storage.set('barBoolean', true); strictEqual(storage.get('bar'), 'foo'); strictEqual(storage.get('barNumber'), '55'); strictEqual(storage.get('barBoolean'), 'true'); strictEqual(storage.items.size, size + 3); storage.delete('bar'); strictEqual(storage.get('bar'), undefined); strictEqual(storage.items.size, size + 2); // IS_NEW strictEqual(storage.get(IS_NEW_KEY), 'true'); // Close await storage.close(); strictEqual(storageDidClose, true); storageChangeListener.dispose(); storageCloseListener.dispose(); } function createStorageService(lifecycleMainService: ILifecycleMainService = new TestLifecycleMainService()): TestStorageMainService { const environmentService = new NativeEnvironmentService(parseArgs(process.argv, OPTIONS), productService); const fileService = new FileService(new NullLogService()); return new TestStorageMainService(new NullLogService(), environmentService, new UserDataProfilesMainService(new StateMainService(environmentService, new NullLogService(), fileService), new UriIdentityService(fileService), environmentService, fileService, new NullLogService()), lifecycleMainService, fileService, new UriIdentityService(fileService)); } test('basics (application)', function () { const storageMainService = createStorageService(); return testStorage(storageMainService.applicationStorage, StorageScope.APPLICATION); }); test('basics (profile)', function () { const storageMainService = createStorageService(); const profile = inMemoryProfile; return testStorage(storageMainService.profileStorage(profile), StorageScope.PROFILE); }); test('basics (workspace)', function () { const workspace = { id: generateUuid() }; const storageMainService = createStorageService(); return testStorage(storageMainService.workspaceStorage(workspace), StorageScope.WORKSPACE); }); test('storage closed onWillShutdown', async function () { const lifecycleMainService = new TestLifecycleMainService(); const storageMainService = createStorageService(lifecycleMainService); const profile = inMemoryProfile; const workspace = { id: generateUuid() }; const workspaceStorage = storageMainService.workspaceStorage(workspace); let didCloseWorkspaceStorage = false; workspaceStorage.onDidCloseStorage(() => { didCloseWorkspaceStorage = true; }); const profileStorage = storageMainService.profileStorage(profile); let didCloseProfileStorage = false; profileStorage.onDidCloseStorage(() => { didCloseProfileStorage = true; }); const applicationStorage = storageMainService.applicationStorage; let didCloseApplicationStorage = false; applicationStorage.onDidCloseStorage(() => { didCloseApplicationStorage = true; }); strictEqual(applicationStorage, storageMainService.applicationStorage); // same instance as long as not closed strictEqual(profileStorage, storageMainService.profileStorage(profile)); // same instance as long as not closed strictEqual(workspaceStorage, storageMainService.workspaceStorage(workspace)); // same instance as long as not closed await applicationStorage.init(); await profileStorage.init(); await workspaceStorage.init(); await lifecycleMainService.fireOnWillShutdown(); strictEqual(didCloseApplicationStorage, true); strictEqual(didCloseProfileStorage, true); strictEqual(didCloseWorkspaceStorage, true); const profileStorage2 = storageMainService.profileStorage(profile); notStrictEqual(profileStorage, profileStorage2); const workspaceStorage2 = storageMainService.workspaceStorage(workspace); notStrictEqual(workspaceStorage, workspaceStorage2); return workspaceStorage2.close(); }); test('storage closed before init works', async function () { const storageMainService = createStorageService(); const profile = inMemoryProfile; const workspace = { id: generateUuid() }; const workspaceStorage = storageMainService.workspaceStorage(workspace); let didCloseWorkspaceStorage = false; workspaceStorage.onDidCloseStorage(() => { didCloseWorkspaceStorage = true; }); const profileStorage = storageMainService.profileStorage(profile); let didCloseProfileStorage = false; profileStorage.onDidCloseStorage(() => { didCloseProfileStorage = true; }); const applicationStorage = storageMainService.applicationStorage; let didCloseApplicationStorage = false; applicationStorage.onDidCloseStorage(() => { didCloseApplicationStorage = true; }); await applicationStorage.close(); await profileStorage.close(); await workspaceStorage.close(); strictEqual(didCloseApplicationStorage, true); strictEqual(didCloseProfileStorage, true); strictEqual(didCloseWorkspaceStorage, true); }); test('storage closed before init awaits works', async function () { const storageMainService = createStorageService(); const profile = inMemoryProfile; const workspace = { id: generateUuid() }; const workspaceStorage = storageMainService.workspaceStorage(workspace); let didCloseWorkspaceStorage = false; workspaceStorage.onDidCloseStorage(() => { didCloseWorkspaceStorage = true; }); const profileStorage = storageMainService.profileStorage(profile); let didCloseProfileStorage = false; profileStorage.onDidCloseStorage(() => { didCloseProfileStorage = true; }); const applicationtorage = storageMainService.applicationStorage; let didCloseApplicationStorage = false; applicationtorage.onDidCloseStorage(() => { didCloseApplicationStorage = true; }); applicationtorage.init(); profileStorage.init(); workspaceStorage.init(); await applicationtorage.close(); await profileStorage.close(); await workspaceStorage.close(); strictEqual(didCloseApplicationStorage, true); strictEqual(didCloseProfileStorage, true); strictEqual(didCloseWorkspaceStorage, true); }); });
src/vs/platform/storage/test/electron-main/storageMainService.test.ts
0
https://github.com/microsoft/vscode/commit/00e8fdec5dcd099ae21c1b9f9851179f6fb1ab2f
[ 0.0001750001247273758, 0.00017201049195136875, 0.00016675784718245268, 0.0001720986474538222, 0.000001741286496326211 ]
{ "id": 7, "code_window": [ "\t\t\tconst newLanguages = availableLanguages.filter(l => l.id && !installedSet.has(l.id));\n", "\t\t\tif (newLanguages.length) {\n", "\t\t\t\tqp.items = [\n", "\t\t\t\t\t...qp.items,\n", "\t\t\t\t\t{ type: 'separator', label: localize('available', \"Available\") },\n", "\t\t\t\t\t...newLanguages\n", "\t\t\t\t];\n", "\t\t\t}\n", "\t\t\tqp.busy = false;\n", "\t\t});\n", "\n" ], "labels": [ "keep", "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ], "after_edit": [ "\t\t\t\t\t...this.withMoreInfoButton(newLanguages)\n" ], "file_path": "src/vs/workbench/contrib/localization/browser/localizationsActions.ts", "type": "replace", "edit_start_line_idx": 57 }
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import { basename } from 'path'; import * as vscode from 'vscode'; import * as languageIds from './languageIds'; export const enum DiagnosticLanguage { JavaScript, TypeScript } export const allDiagnosticLanguages = [DiagnosticLanguage.JavaScript, DiagnosticLanguage.TypeScript]; export interface LanguageDescription { readonly id: string; readonly diagnosticOwner: string; readonly diagnosticSource: string; readonly diagnosticLanguage: DiagnosticLanguage; readonly languageIds: readonly string[]; readonly configFilePattern?: RegExp; readonly isExternal?: boolean; readonly standardFileExtensions: readonly string[]; } export const standardLanguageDescriptions: LanguageDescription[] = [ { id: 'typescript', diagnosticOwner: 'typescript', diagnosticSource: 'ts', diagnosticLanguage: DiagnosticLanguage.TypeScript, languageIds: [languageIds.typescript, languageIds.typescriptreact], configFilePattern: /^tsconfig(\..*)?\.json$/gi, standardFileExtensions: [ 'ts', 'tsx', 'cts', 'mts' ], }, { id: 'javascript', diagnosticOwner: 'typescript', diagnosticSource: 'ts', diagnosticLanguage: DiagnosticLanguage.JavaScript, languageIds: [languageIds.javascript, languageIds.javascriptreact], configFilePattern: /^jsconfig(\..*)?\.json$/gi, standardFileExtensions: [ 'js', 'jsx', 'cjs', 'mjs', 'es6', 'pac', ], } ]; export function isTsConfigFileName(fileName: string): boolean { return /^tsconfig\.(.+\.)?json$/i.test(basename(fileName)); } export function isJsConfigOrTsConfigFileName(fileName: string): boolean { return /^[jt]sconfig\.(.+\.)?json$/i.test(basename(fileName)); } export function doesResourceLookLikeATypeScriptFile(resource: vscode.Uri): boolean { return /\.(tsx?|mts|cts)$/i.test(resource.fsPath); } export function doesResourceLookLikeAJavaScriptFile(resource: vscode.Uri): boolean { return /\.(jsx?|mjs|cjs)$/i.test(resource.fsPath); }
extensions/typescript-language-features/src/utils/languageDescription.ts
0
https://github.com/microsoft/vscode/commit/00e8fdec5dcd099ae21c1b9f9851179f6fb1ab2f
[ 0.00019292747310828418, 0.0001751418167259544, 0.00016951690486166626, 0.00017238620785064995, 0.000006937656507943757 ]
{ "id": 8, "code_window": [ "\t\t\tconst selectedLanguage = qp.activeItems[0];\n", "\t\t\tqp.hide();\n", "\t\t\tawait localeService.setLocale(selectedLanguage);\n", "\t\t}));\n", "\n", "\t\tqp.show();\n", "\t\tqp.busy = true;\n", "\t}\n" ], "labels": [ "keep", "keep", "keep", "keep", "add", "keep", "keep", "keep" ], "after_edit": [ "\t\tdisposables.add(qp.onDidTriggerItemButton(async e => {\n", "\t\t\tqp.hide();\n", "\t\t\tif (e.item.extensionId) {\n", "\t\t\t\tawait extensionWorkbenchService.open(e.item.extensionId);\n", "\t\t\t}\n", "\t\t}));\n", "\n" ], "file_path": "src/vs/workbench/contrib/localization/browser/localizationsActions.ts", "type": "add", "edit_start_line_idx": 69 }
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import { localize } from 'vs/nls'; import { IQuickInputService, IQuickPickSeparator } from 'vs/platform/quickinput/common/quickInput'; import { CancellationTokenSource } from 'vs/base/common/cancellation'; import { DisposableStore } from 'vs/base/common/lifecycle'; import { Action2, MenuId } from 'vs/platform/actions/common/actions'; import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; import { ILanguagePackItem, ILanguagePackService } from 'vs/platform/languagePacks/common/languagePacks'; import { ILocaleService } from 'vs/workbench/contrib/localization/common/locale'; export class ConfigureDisplayLanguageAction extends Action2 { public static readonly ID = 'workbench.action.configureLocale'; public static readonly LABEL = localize('configureLocale', "Configure Display Language"); constructor() { super({ id: ConfigureDisplayLanguageAction.ID, title: { original: 'Configure Display Language', value: ConfigureDisplayLanguageAction.LABEL }, menu: { id: MenuId.CommandPalette } }); } public async run(accessor: ServicesAccessor): Promise<void> { const languagePackService: ILanguagePackService = accessor.get(ILanguagePackService); const quickInputService: IQuickInputService = accessor.get(IQuickInputService); const localeService: ILocaleService = accessor.get(ILocaleService); const installedLanguages = await languagePackService.getInstalledLanguages(); const qp = quickInputService.createQuickPick<ILanguagePackItem>(); qp.placeholder = localize('chooseLocale', "Select Display Language"); if (installedLanguages?.length) { const items: Array<ILanguagePackItem | IQuickPickSeparator> = [{ type: 'separator', label: localize('installed', "Installed") }]; qp.items = items.concat(installedLanguages); } const disposables = new DisposableStore(); const source = new CancellationTokenSource(); disposables.add(qp.onDispose(() => { source.cancel(); disposables.dispose(); })); const installedSet = new Set<string>(installedLanguages?.map(language => language.id!) ?? []); languagePackService.getAvailableLanguages().then(availableLanguages => { const newLanguages = availableLanguages.filter(l => l.id && !installedSet.has(l.id)); if (newLanguages.length) { qp.items = [ ...qp.items, { type: 'separator', label: localize('available', "Available") }, ...newLanguages ]; } qp.busy = false; }); disposables.add(qp.onDidAccept(async () => { const selectedLanguage = qp.activeItems[0]; qp.hide(); await localeService.setLocale(selectedLanguage); })); qp.show(); qp.busy = true; } } export class ClearDisplayLanguageAction extends Action2 { public static readonly ID = 'workbench.action.clearLocalePreference'; public static readonly LABEL = localize('clearDisplayLanguage', "Clear Display Language Preference"); constructor() { super({ id: ClearDisplayLanguageAction.ID, title: { original: 'Clear Display Language Preference', value: ClearDisplayLanguageAction.LABEL }, menu: { id: MenuId.CommandPalette } }); } public async run(accessor: ServicesAccessor): Promise<void> { const localeService: ILocaleService = accessor.get(ILocaleService); await localeService.clearLocalePreference(); } }
src/vs/workbench/contrib/localization/browser/localizationsActions.ts
1
https://github.com/microsoft/vscode/commit/00e8fdec5dcd099ae21c1b9f9851179f6fb1ab2f
[ 0.9985382556915283, 0.1017080545425415, 0.00017143106379080564, 0.0008727649692445993, 0.29896000027656555 ]
{ "id": 8, "code_window": [ "\t\t\tconst selectedLanguage = qp.activeItems[0];\n", "\t\t\tqp.hide();\n", "\t\t\tawait localeService.setLocale(selectedLanguage);\n", "\t\t}));\n", "\n", "\t\tqp.show();\n", "\t\tqp.busy = true;\n", "\t}\n" ], "labels": [ "keep", "keep", "keep", "keep", "add", "keep", "keep", "keep" ], "after_edit": [ "\t\tdisposables.add(qp.onDidTriggerItemButton(async e => {\n", "\t\t\tqp.hide();\n", "\t\t\tif (e.item.extensionId) {\n", "\t\t\t\tawait extensionWorkbenchService.open(e.item.extensionId);\n", "\t\t\t}\n", "\t\t}));\n", "\n" ], "file_path": "src/vs/workbench/contrib/localization/browser/localizationsActions.ts", "type": "add", "edit_start_line_idx": 69 }
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import { IConfigurationCache, ConfigurationKey } from 'vs/workbench/services/configuration/common/configuration'; import { URI } from 'vs/base/common/uri'; import { FileOperationError, FileOperationResult, IFileService } from 'vs/platform/files/common/files'; import { joinPath } from 'vs/base/common/resources'; import { VSBuffer } from 'vs/base/common/buffer'; import { Queue } from 'vs/base/common/async'; import { IEnvironmentService } from 'vs/platform/environment/common/environment'; export class ConfigurationCache implements IConfigurationCache { private readonly cacheHome: URI; private readonly cachedConfigurations: Map<string, CachedConfiguration> = new Map<string, CachedConfiguration>(); constructor( private readonly donotCacheResourcesWithSchemes: string[], environmentService: IEnvironmentService, private readonly fileService: IFileService ) { this.cacheHome = environmentService.cacheHome; } needsCaching(resource: URI): boolean { // Cache all non native resources return !this.donotCacheResourcesWithSchemes.includes(resource.scheme); } read(key: ConfigurationKey): Promise<string> { return this.getCachedConfiguration(key).read(); } write(key: ConfigurationKey, content: string): Promise<void> { return this.getCachedConfiguration(key).save(content); } remove(key: ConfigurationKey): Promise<void> { return this.getCachedConfiguration(key).remove(); } private getCachedConfiguration({ type, key }: ConfigurationKey): CachedConfiguration { const k = `${type}:${key}`; let cachedConfiguration = this.cachedConfigurations.get(k); if (!cachedConfiguration) { cachedConfiguration = new CachedConfiguration({ type, key }, this.cacheHome, this.fileService); this.cachedConfigurations.set(k, cachedConfiguration); } return cachedConfiguration; } } class CachedConfiguration { private queue: Queue<void>; private cachedConfigurationFolderResource: URI; private cachedConfigurationFileResource: URI; constructor( { type, key }: ConfigurationKey, cacheHome: URI, private readonly fileService: IFileService ) { this.cachedConfigurationFolderResource = joinPath(cacheHome, 'CachedConfigurations', type, key); this.cachedConfigurationFileResource = joinPath(this.cachedConfigurationFolderResource, type === 'workspaces' ? 'workspace.json' : 'configuration.json'); this.queue = new Queue<void>(); } async read(): Promise<string> { try { const content = await this.fileService.readFile(this.cachedConfigurationFileResource); return content.value.toString(); } catch (e) { return ''; } } async save(content: string): Promise<void> { const created = await this.createCachedFolder(); if (created) { await this.queue.queue(async () => { await this.fileService.writeFile(this.cachedConfigurationFileResource, VSBuffer.fromString(content)); }); } } async remove(): Promise<void> { try { await this.queue.queue(() => this.fileService.del(this.cachedConfigurationFolderResource, { recursive: true, useTrash: false })); } catch (error) { if ((<FileOperationError>error).fileOperationResult !== FileOperationResult.FILE_NOT_FOUND) { throw error; } } } private async createCachedFolder(): Promise<boolean> { if (await this.fileService.exists(this.cachedConfigurationFolderResource)) { return true; } try { await this.fileService.createFolder(this.cachedConfigurationFolderResource); return true; } catch (error) { return false; } } }
src/vs/workbench/services/configuration/common/configurationCache.ts
0
https://github.com/microsoft/vscode/commit/00e8fdec5dcd099ae21c1b9f9851179f6fb1ab2f
[ 0.0003817023243755102, 0.00019097566837444901, 0.00017015333287417889, 0.00017365068197250366, 0.00005754816083936021 ]
{ "id": 8, "code_window": [ "\t\t\tconst selectedLanguage = qp.activeItems[0];\n", "\t\t\tqp.hide();\n", "\t\t\tawait localeService.setLocale(selectedLanguage);\n", "\t\t}));\n", "\n", "\t\tqp.show();\n", "\t\tqp.busy = true;\n", "\t}\n" ], "labels": [ "keep", "keep", "keep", "keep", "add", "keep", "keep", "keep" ], "after_edit": [ "\t\tdisposables.add(qp.onDidTriggerItemButton(async e => {\n", "\t\t\tqp.hide();\n", "\t\t\tif (e.item.extensionId) {\n", "\t\t\t\tawait extensionWorkbenchService.open(e.item.extensionId);\n", "\t\t\t}\n", "\t\t}));\n", "\n" ], "file_path": "src/vs/workbench/contrib/localization/browser/localizationsActions.ts", "type": "add", "edit_start_line_idx": 69 }
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; import { SymbolItemDragAndDrop, SymbolItemEditorHighlights, SymbolItemNavigation, SymbolTreeInput } from '../references-view'; import { asResourceUrl, del, getThemeIcon, tail } from '../utils'; export class CallsTreeInput implements SymbolTreeInput<CallItem> { readonly title: string; readonly contextValue: string = 'callHierarchy'; constructor( readonly location: vscode.Location, readonly direction: CallsDirection, ) { this.title = direction === CallsDirection.Incoming ? vscode.l10n.t('Callers Of') : vscode.l10n.t('Calls From'); } async resolve() { const items = await Promise.resolve(vscode.commands.executeCommand<vscode.CallHierarchyItem[]>('vscode.prepareCallHierarchy', this.location.uri, this.location.range.start)); const model = new CallsModel(this.direction, items ?? []); const provider = new CallItemDataProvider(model); if (model.roots.length === 0) { return; } return { provider, get message() { return model.roots.length === 0 ? vscode.l10n.t('No results.') : undefined; }, navigation: model, highlights: model, dnd: model, dispose() { provider.dispose(); } }; } with(location: vscode.Location): CallsTreeInput { return new CallsTreeInput(location, this.direction); } } export const enum CallsDirection { Incoming, Outgoing } export class CallItem { children?: CallItem[]; constructor( readonly model: CallsModel, readonly item: vscode.CallHierarchyItem, readonly parent: CallItem | undefined, readonly locations: vscode.Location[] | undefined ) { } remove(): void { this.model.remove(this); } } class CallsModel implements SymbolItemNavigation<CallItem>, SymbolItemEditorHighlights<CallItem>, SymbolItemDragAndDrop<CallItem> { readonly roots: CallItem[] = []; private readonly _onDidChange = new vscode.EventEmitter<CallsModel>(); readonly onDidChange = this._onDidChange.event; constructor(readonly direction: CallsDirection, items: vscode.CallHierarchyItem[]) { this.roots = items.map(item => new CallItem(this, item, undefined, undefined)); } private async _resolveCalls(call: CallItem): Promise<CallItem[]> { if (this.direction === CallsDirection.Incoming) { const calls = await vscode.commands.executeCommand<vscode.CallHierarchyIncomingCall[]>('vscode.provideIncomingCalls', call.item); return calls ? calls.map(item => new CallItem(this, item.from, call, item.fromRanges.map(range => new vscode.Location(item.from.uri, range)))) : []; } else { const calls = await vscode.commands.executeCommand<vscode.CallHierarchyOutgoingCall[]>('vscode.provideOutgoingCalls', call.item); return calls ? calls.map(item => new CallItem(this, item.to, call, item.fromRanges.map(range => new vscode.Location(call.item.uri, range)))) : []; } } async getCallChildren(call: CallItem): Promise<CallItem[]> { if (!call.children) { call.children = await this._resolveCalls(call); } return call.children; } // -- navigation location(item: CallItem) { return new vscode.Location(item.item.uri, item.item.range); } nearest(uri: vscode.Uri, _position: vscode.Position): CallItem | undefined { return this.roots.find(item => item.item.uri.toString() === uri.toString()) ?? this.roots[0]; } next(from: CallItem): CallItem { return this._move(from, true) ?? from; } previous(from: CallItem): CallItem { return this._move(from, false) ?? from; } private _move(item: CallItem, fwd: boolean): CallItem | void { if (item.children?.length) { return fwd ? item.children[0] : tail(item.children); } const array = this.roots.includes(item) ? this.roots : item.parent?.children; if (array?.length) { const idx = array.indexOf(item); const delta = fwd ? 1 : -1; return array[idx + delta + array.length % array.length]; } } // --- dnd getDragUri(item: CallItem): vscode.Uri | undefined { return asResourceUrl(item.item.uri, item.item.range); } // --- highlights getEditorHighlights(item: CallItem, uri: vscode.Uri): vscode.Range[] | undefined { if (!item.locations) { return item.item.uri.toString() === uri.toString() ? [item.item.selectionRange] : undefined; } return item.locations .filter(loc => loc.uri.toString() === uri.toString()) .map(loc => loc.range); } remove(item: CallItem) { const isInRoot = this.roots.includes(item); const siblings = isInRoot ? this.roots : item.parent?.children; if (siblings) { del(siblings, item); this._onDidChange.fire(this); } } } class CallItemDataProvider implements vscode.TreeDataProvider<CallItem> { private readonly _emitter = new vscode.EventEmitter<CallItem | undefined>(); readonly onDidChangeTreeData = this._emitter.event; private readonly _modelListener: vscode.Disposable; constructor(private _model: CallsModel) { this._modelListener = _model.onDidChange(e => this._emitter.fire(e instanceof CallItem ? e : undefined)); } dispose(): void { this._emitter.dispose(); this._modelListener.dispose(); } getTreeItem(element: CallItem): vscode.TreeItem { const item = new vscode.TreeItem(element.item.name); item.description = element.item.detail; item.tooltip = item.label ? `${item.label} - ${element.item.detail}` : element.item.detail; item.contextValue = 'call-item'; item.iconPath = getThemeIcon(element.item.kind); type OpenArgs = [vscode.Uri, vscode.TextDocumentShowOptions]; let openArgs: OpenArgs; if (element.model.direction === CallsDirection.Outgoing) { openArgs = [element.item.uri, { selection: element.item.selectionRange.with({ end: element.item.selectionRange.start }) }]; } else { // incoming call -> reveal first call instead of caller let firstLoctionStart: vscode.Position | undefined; if (element.locations) { for (const loc of element.locations) { if (loc.uri.toString() === element.item.uri.toString()) { firstLoctionStart = firstLoctionStart?.isBefore(loc.range.start) ? firstLoctionStart : loc.range.start; } } } if (!firstLoctionStart) { firstLoctionStart = element.item.selectionRange.start; } openArgs = [element.item.uri, { selection: new vscode.Range(firstLoctionStart, firstLoctionStart) }]; } item.command = { command: 'vscode.open', title: vscode.l10n.t('Open Call'), arguments: openArgs }; item.collapsibleState = vscode.TreeItemCollapsibleState.Collapsed; return item; } getChildren(element?: CallItem | undefined) { return element ? this._model.getCallChildren(element) : this._model.roots; } getParent(element: CallItem) { return element.parent; } }
extensions/references-view/src/calls/model.ts
0
https://github.com/microsoft/vscode/commit/00e8fdec5dcd099ae21c1b9f9851179f6fb1ab2f
[ 0.00017770090198609978, 0.00017378405027557164, 0.00016790631343610585, 0.00017315470904577523, 0.000002528066261220374 ]
{ "id": 8, "code_window": [ "\t\t\tconst selectedLanguage = qp.activeItems[0];\n", "\t\t\tqp.hide();\n", "\t\t\tawait localeService.setLocale(selectedLanguage);\n", "\t\t}));\n", "\n", "\t\tqp.show();\n", "\t\tqp.busy = true;\n", "\t}\n" ], "labels": [ "keep", "keep", "keep", "keep", "add", "keep", "keep", "keep" ], "after_edit": [ "\t\tdisposables.add(qp.onDidTriggerItemButton(async e => {\n", "\t\t\tqp.hide();\n", "\t\t\tif (e.item.extensionId) {\n", "\t\t\t\tawait extensionWorkbenchService.open(e.item.extensionId);\n", "\t\t\t}\n", "\t\t}));\n", "\n" ], "file_path": "src/vs/workbench/contrib/localization/browser/localizationsActions.ts", "type": "add", "edit_start_line_idx": 69 }
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import * as assert from 'assert'; import * as vscode from 'vscode'; import { assertNoRpc, createRandomFile, disposeAll, withLogDisabled } from '../utils'; suite('vscode API - workspace events', () => { const disposables: vscode.Disposable[] = []; teardown(() => { assertNoRpc(); disposeAll(disposables); disposables.length = 0; }); test('onWillCreate/onDidCreate', withLogDisabled(async function () { const base = await createRandomFile(); const newUri = base.with({ path: base.path + '-foo' }); let onWillCreate: vscode.FileWillCreateEvent | undefined; let onDidCreate: vscode.FileCreateEvent | undefined; disposables.push(vscode.workspace.onWillCreateFiles(e => onWillCreate = e)); disposables.push(vscode.workspace.onDidCreateFiles(e => onDidCreate = e)); const edit = new vscode.WorkspaceEdit(); edit.createFile(newUri); const success = await vscode.workspace.applyEdit(edit); assert.ok(success); assert.ok(onWillCreate); assert.strictEqual(onWillCreate?.files.length, 1); assert.strictEqual(onWillCreate?.files[0].toString(), newUri.toString()); assert.ok(onDidCreate); assert.strictEqual(onDidCreate?.files.length, 1); assert.strictEqual(onDidCreate?.files[0].toString(), newUri.toString()); })); test('onWillCreate/onDidCreate, make changes, edit another file', withLogDisabled(async function () { const base = await createRandomFile(); const baseDoc = await vscode.workspace.openTextDocument(base); const newUri = base.with({ path: base.path + '-foo' }); disposables.push(vscode.workspace.onWillCreateFiles(e => { const ws = new vscode.WorkspaceEdit(); ws.insert(base, new vscode.Position(0, 0), 'HALLO_NEW'); e.waitUntil(Promise.resolve(ws)); })); const edit = new vscode.WorkspaceEdit(); edit.createFile(newUri); const success = await vscode.workspace.applyEdit(edit); assert.ok(success); assert.strictEqual(baseDoc.getText(), 'HALLO_NEW'); })); test('onWillCreate/onDidCreate, make changes, edit new file fails', withLogDisabled(async function () { const base = await createRandomFile(); const newUri = base.with({ path: base.path + '-foo' }); disposables.push(vscode.workspace.onWillCreateFiles(e => { const ws = new vscode.WorkspaceEdit(); ws.insert(e.files[0], new vscode.Position(0, 0), 'nope'); e.waitUntil(Promise.resolve(ws)); })); const edit = new vscode.WorkspaceEdit(); edit.createFile(newUri); const success = await vscode.workspace.applyEdit(edit); assert.ok(success); assert.strictEqual((await vscode.workspace.fs.readFile(newUri)).toString(), ''); assert.strictEqual((await vscode.workspace.openTextDocument(newUri)).getText(), ''); })); test('onWillDelete/onDidDelete', withLogDisabled(async function () { const base = await createRandomFile(); let onWilldelete: vscode.FileWillDeleteEvent | undefined; let onDiddelete: vscode.FileDeleteEvent | undefined; disposables.push(vscode.workspace.onWillDeleteFiles(e => onWilldelete = e)); disposables.push(vscode.workspace.onDidDeleteFiles(e => onDiddelete = e)); const edit = new vscode.WorkspaceEdit(); edit.deleteFile(base); const success = await vscode.workspace.applyEdit(edit); assert.ok(success); assert.ok(onWilldelete); assert.strictEqual(onWilldelete?.files.length, 1); assert.strictEqual(onWilldelete?.files[0].toString(), base.toString()); assert.ok(onDiddelete); assert.strictEqual(onDiddelete?.files.length, 1); assert.strictEqual(onDiddelete?.files[0].toString(), base.toString()); })); test('onWillDelete/onDidDelete, make changes', withLogDisabled(async function () { const base = await createRandomFile(); const newUri = base.with({ path: base.path + '-NEW' }); disposables.push(vscode.workspace.onWillDeleteFiles(e => { const edit = new vscode.WorkspaceEdit(); edit.createFile(newUri); edit.insert(newUri, new vscode.Position(0, 0), 'hahah'); e.waitUntil(Promise.resolve(edit)); })); const edit = new vscode.WorkspaceEdit(); edit.deleteFile(base); const success = await vscode.workspace.applyEdit(edit); assert.ok(success); })); test('onWillDelete/onDidDelete, make changes, del another file', withLogDisabled(async function () { const base = await createRandomFile(); const base2 = await createRandomFile(); disposables.push(vscode.workspace.onWillDeleteFiles(e => { if (e.files[0].toString() === base.toString()) { const edit = new vscode.WorkspaceEdit(); edit.deleteFile(base2); e.waitUntil(Promise.resolve(edit)); } })); const edit = new vscode.WorkspaceEdit(); edit.deleteFile(base); const success = await vscode.workspace.applyEdit(edit); assert.ok(success); })); test('onWillDelete/onDidDelete, make changes, double delete', withLogDisabled(async function () { const base = await createRandomFile(); let cnt = 0; disposables.push(vscode.workspace.onWillDeleteFiles(e => { if (++cnt === 0) { const edit = new vscode.WorkspaceEdit(); edit.deleteFile(e.files[0]); e.waitUntil(Promise.resolve(edit)); } })); const edit = new vscode.WorkspaceEdit(); edit.deleteFile(base); const success = await vscode.workspace.applyEdit(edit); assert.ok(success); })); test('onWillRename/onDidRename', withLogDisabled(async function () { const oldUri = await createRandomFile(); const newUri = oldUri.with({ path: oldUri.path + '-NEW' }); let onWillRename: vscode.FileWillRenameEvent | undefined; let onDidRename: vscode.FileRenameEvent | undefined; disposables.push(vscode.workspace.onWillRenameFiles(e => onWillRename = e)); disposables.push(vscode.workspace.onDidRenameFiles(e => onDidRename = e)); const edit = new vscode.WorkspaceEdit(); edit.renameFile(oldUri, newUri); const success = await vscode.workspace.applyEdit(edit); assert.ok(success); assert.ok(onWillRename); assert.strictEqual(onWillRename?.files.length, 1); assert.strictEqual(onWillRename?.files[0].oldUri.toString(), oldUri.toString()); assert.strictEqual(onWillRename?.files[0].newUri.toString(), newUri.toString()); assert.ok(onDidRename); assert.strictEqual(onDidRename?.files.length, 1); assert.strictEqual(onDidRename?.files[0].oldUri.toString(), oldUri.toString()); assert.strictEqual(onDidRename?.files[0].newUri.toString(), newUri.toString()); })); test('onWillRename - make changes (saved file)', withLogDisabled(function () { return testOnWillRename(false); })); test('onWillRename - make changes (dirty file)', withLogDisabled(function () { return testOnWillRename(true); })); async function testOnWillRename(withDirtyFile: boolean): Promise<void> { const oldUri = await createRandomFile('BAR'); if (withDirtyFile) { const edit = new vscode.WorkspaceEdit(); edit.insert(oldUri, new vscode.Position(0, 0), 'BAR'); const success = await vscode.workspace.applyEdit(edit); assert.ok(success); const oldDocument = await vscode.workspace.openTextDocument(oldUri); assert.ok(oldDocument.isDirty); } const newUri = oldUri.with({ path: oldUri.path + '-NEW' }); const anotherFile = await createRandomFile('BAR'); let onWillRename: vscode.FileWillRenameEvent | undefined; disposables.push(vscode.workspace.onWillRenameFiles(e => { onWillRename = e; const edit = new vscode.WorkspaceEdit(); edit.insert(e.files[0].oldUri, new vscode.Position(0, 0), 'FOO'); edit.replace(anotherFile, new vscode.Range(0, 0, 0, 3), 'FARBOO'); e.waitUntil(Promise.resolve(edit)); })); const edit = new vscode.WorkspaceEdit(); edit.renameFile(oldUri, newUri); const success = await vscode.workspace.applyEdit(edit); assert.ok(success); assert.ok(onWillRename); assert.strictEqual(onWillRename?.files.length, 1); assert.strictEqual(onWillRename?.files[0].oldUri.toString(), oldUri.toString()); assert.strictEqual(onWillRename?.files[0].newUri.toString(), newUri.toString()); const newDocument = await vscode.workspace.openTextDocument(newUri); const anotherDocument = await vscode.workspace.openTextDocument(anotherFile); assert.strictEqual(newDocument.getText(), withDirtyFile ? 'FOOBARBAR' : 'FOOBAR'); assert.strictEqual(anotherDocument.getText(), 'FARBOO'); assert.ok(newDocument.isDirty); assert.ok(anotherDocument.isDirty); } });
extensions/vscode-api-tests/src/singlefolder-tests/workspace.event.test.ts
0
https://github.com/microsoft/vscode/commit/00e8fdec5dcd099ae21c1b9f9851179f6fb1ab2f
[ 0.00017880498489830643, 0.0001766097848303616, 0.00017384157399646938, 0.00017673333059065044, 0.0000012264724773558555 ]
{ "id": 9, "code_window": [ "\t\tqp.show();\n", "\t\tqp.busy = true;\n", "\t}\n", "}\n", "\n", "export class ClearDisplayLanguageAction extends Action2 {\n", "\tpublic static readonly ID = 'workbench.action.clearLocalePreference';\n", "\tpublic static readonly LABEL = localize('clearDisplayLanguage', \"Clear Display Language Preference\");\n" ], "labels": [ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ], "after_edit": [ "\n", "\tprivate withMoreInfoButton(items: ILanguagePackItem[]): ILanguagePackItem[] {\n", "\t\tfor (const item of items) {\n", "\t\t\tif (item.extensionId) {\n", "\t\t\t\titem.buttons = [{\n", "\t\t\t\t\ttooltip: localize('moreInfo', \"More Info\"),\n", "\t\t\t\t\ticonClass: 'codicon-info'\n", "\t\t\t\t}];\n", "\t\t\t}\n", "\t\t}\n", "\t\treturn items;\n", "\t}\n" ], "file_path": "src/vs/workbench/contrib/localization/browser/localizationsActions.ts", "type": "add", "edit_start_line_idx": 72 }
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import { localize } from 'vs/nls'; import { IQuickInputService, IQuickPickSeparator } from 'vs/platform/quickinput/common/quickInput'; import { CancellationTokenSource } from 'vs/base/common/cancellation'; import { DisposableStore } from 'vs/base/common/lifecycle'; import { Action2, MenuId } from 'vs/platform/actions/common/actions'; import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; import { ILanguagePackItem, ILanguagePackService } from 'vs/platform/languagePacks/common/languagePacks'; import { ILocaleService } from 'vs/workbench/contrib/localization/common/locale'; export class ConfigureDisplayLanguageAction extends Action2 { public static readonly ID = 'workbench.action.configureLocale'; public static readonly LABEL = localize('configureLocale', "Configure Display Language"); constructor() { super({ id: ConfigureDisplayLanguageAction.ID, title: { original: 'Configure Display Language', value: ConfigureDisplayLanguageAction.LABEL }, menu: { id: MenuId.CommandPalette } }); } public async run(accessor: ServicesAccessor): Promise<void> { const languagePackService: ILanguagePackService = accessor.get(ILanguagePackService); const quickInputService: IQuickInputService = accessor.get(IQuickInputService); const localeService: ILocaleService = accessor.get(ILocaleService); const installedLanguages = await languagePackService.getInstalledLanguages(); const qp = quickInputService.createQuickPick<ILanguagePackItem>(); qp.placeholder = localize('chooseLocale', "Select Display Language"); if (installedLanguages?.length) { const items: Array<ILanguagePackItem | IQuickPickSeparator> = [{ type: 'separator', label: localize('installed', "Installed") }]; qp.items = items.concat(installedLanguages); } const disposables = new DisposableStore(); const source = new CancellationTokenSource(); disposables.add(qp.onDispose(() => { source.cancel(); disposables.dispose(); })); const installedSet = new Set<string>(installedLanguages?.map(language => language.id!) ?? []); languagePackService.getAvailableLanguages().then(availableLanguages => { const newLanguages = availableLanguages.filter(l => l.id && !installedSet.has(l.id)); if (newLanguages.length) { qp.items = [ ...qp.items, { type: 'separator', label: localize('available', "Available") }, ...newLanguages ]; } qp.busy = false; }); disposables.add(qp.onDidAccept(async () => { const selectedLanguage = qp.activeItems[0]; qp.hide(); await localeService.setLocale(selectedLanguage); })); qp.show(); qp.busy = true; } } export class ClearDisplayLanguageAction extends Action2 { public static readonly ID = 'workbench.action.clearLocalePreference'; public static readonly LABEL = localize('clearDisplayLanguage', "Clear Display Language Preference"); constructor() { super({ id: ClearDisplayLanguageAction.ID, title: { original: 'Clear Display Language Preference', value: ClearDisplayLanguageAction.LABEL }, menu: { id: MenuId.CommandPalette } }); } public async run(accessor: ServicesAccessor): Promise<void> { const localeService: ILocaleService = accessor.get(ILocaleService); await localeService.clearLocalePreference(); } }
src/vs/workbench/contrib/localization/browser/localizationsActions.ts
1
https://github.com/microsoft/vscode/commit/00e8fdec5dcd099ae21c1b9f9851179f6fb1ab2f
[ 0.9991663694381714, 0.20121872425079346, 0.00016517186304554343, 0.0014105727896094322, 0.3986320495605469 ]
{ "id": 9, "code_window": [ "\t\tqp.show();\n", "\t\tqp.busy = true;\n", "\t}\n", "}\n", "\n", "export class ClearDisplayLanguageAction extends Action2 {\n", "\tpublic static readonly ID = 'workbench.action.clearLocalePreference';\n", "\tpublic static readonly LABEL = localize('clearDisplayLanguage', \"Clear Display Language Preference\");\n" ], "labels": [ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ], "after_edit": [ "\n", "\tprivate withMoreInfoButton(items: ILanguagePackItem[]): ILanguagePackItem[] {\n", "\t\tfor (const item of items) {\n", "\t\t\tif (item.extensionId) {\n", "\t\t\t\titem.buttons = [{\n", "\t\t\t\t\ttooltip: localize('moreInfo', \"More Info\"),\n", "\t\t\t\t\ticonClass: 'codicon-info'\n", "\t\t\t\t}];\n", "\t\t\t}\n", "\t\t}\n", "\t\treturn items;\n", "\t}\n" ], "file_path": "src/vs/workbench/contrib/localization/browser/localizationsActions.ts", "type": "add", "edit_start_line_idx": 72 }
{ "emmet.excludeLanguages": [] }
extensions/emmet/.vscode/settings.json
0
https://github.com/microsoft/vscode/commit/00e8fdec5dcd099ae21c1b9f9851179f6fb1ab2f
[ 0.0001732050732243806, 0.0001732050732243806, 0.0001732050732243806, 0.0001732050732243806, 0 ]
{ "id": 9, "code_window": [ "\t\tqp.show();\n", "\t\tqp.busy = true;\n", "\t}\n", "}\n", "\n", "export class ClearDisplayLanguageAction extends Action2 {\n", "\tpublic static readonly ID = 'workbench.action.clearLocalePreference';\n", "\tpublic static readonly LABEL = localize('clearDisplayLanguage', \"Clear Display Language Preference\");\n" ], "labels": [ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ], "after_edit": [ "\n", "\tprivate withMoreInfoButton(items: ILanguagePackItem[]): ILanguagePackItem[] {\n", "\t\tfor (const item of items) {\n", "\t\t\tif (item.extensionId) {\n", "\t\t\t\titem.buttons = [{\n", "\t\t\t\t\ttooltip: localize('moreInfo', \"More Info\"),\n", "\t\t\t\t\ticonClass: 'codicon-info'\n", "\t\t\t\t}];\n", "\t\t\t}\n", "\t\t}\n", "\t\treturn items;\n", "\t}\n" ], "file_path": "src/vs/workbench/contrib/localization/browser/localizationsActions.ts", "type": "add", "edit_start_line_idx": 72 }
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. # yarn lockfile v1 "@types/mkdirp@^1.0.1": version "1.0.1" resolved "https://registry.yarnpkg.com/@types/mkdirp/-/mkdirp-1.0.1.tgz#0930b948914a78587de35458b86c907b6e98bbf6" integrity sha512-HkGSK7CGAXncr8Qn/0VqNtExEE+PHMWb+qlR1faHMao7ng6P3tAaoWWBMdva0gL5h4zprjIO89GJOLXsMcDm1Q== dependencies: "@types/node" "*" "@types/[email protected]": version "2.0.1" resolved "https://registry.yarnpkg.com/@types/ncp/-/ncp-2.0.1.tgz#749432511f6ad747d04e98837b18cca9045567fb" integrity sha512-TeiJ7uvv/92ugSqZ0v9l0eNXzutlki0aK+R1K5bfA5SYUil46ITlxLW4iNTCf55P4L5weCmaOdtxGeGWvudwPg== dependencies: "@types/node" "*" "@types/node@*": version "12.7.1" resolved "https://registry.yarnpkg.com/@types/node/-/node-12.7.1.tgz#3b5c3a26393c19b400844ac422bd0f631a94d69d" integrity sha512-aK9jxMypeSrhiYofWWBf/T7O+KwaiAHzM4sveCdWPn71lzUSMimRnKzhXDKfKwV1kWoBo2P1aGgaIYGLf9/ljw== "@types/[email protected]": version "16.18.3" resolved "https://registry.yarnpkg.com/@types/node/-/node-16.18.3.tgz#d7f7ba828ad9e540270f01ce00d391c54e6e0abc" integrity sha512-jh6m0QUhIRcZpNv7Z/rpN+ZWXOicUUQbSoWks7Htkbb9IjFQj4kzcX/xFCkjstCj5flMsN8FiSvt+q+Tcs4Llg== "@types/[email protected]": version "0.2.2" resolved "https://registry.yarnpkg.com/@types/tmp/-/tmp-0.2.2.tgz#424537a3b91828cb26aaf697f21ae3cd1b69f7e7" integrity sha512-MhSa0yylXtVMsyT8qFpHA1DLHj4DvQGH5ntxrhHSh8PxUVNi35Wk+P5hVgqbO2qZqOotqr9jaoPRL+iRjWYm/A== ansi-styles@^3.2.1: version "3.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA== dependencies: color-convert "^1.9.0" at-least-node@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/at-least-node/-/at-least-node-1.0.0.tgz#602cd4b46e844ad4effc92a8011a3c46e0238dc2" integrity sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg== balanced-match@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c= brace-expansion@^1.1.7: version "1.1.11" resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== dependencies: balanced-match "^1.0.0" concat-map "0.0.1" call-bind@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.0.tgz#24127054bb3f9bdcb4b1fb82418186072f77b8ce" integrity sha512-AEXsYIyyDY3MCzbwdhzG3Jx1R0J2wetQyUynn6dYHAO+bg8l1k7jwZtRv4ryryFs7EP+NDlikJlVe59jr0cM2w== dependencies: function-bind "^1.1.1" get-intrinsic "^1.0.0" chalk@^2.4.1: version "2.4.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== dependencies: ansi-styles "^3.2.1" escape-string-regexp "^1.0.5" supports-color "^5.3.0" co@^4.6.0: version "4.6.0" resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" integrity sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ= color-convert@^1.9.0: version "1.9.3" resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg== dependencies: color-name "1.1.3" [email protected]: version "1.1.3" resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU= [email protected]: version "0.0.1" resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= [email protected]: version "3.0.0" resolved "https://registry.yarnpkg.com/cpx2/-/cpx2-3.0.0.tgz#d02d2526f0d6fd967405ab20b687668aca1f55ea" integrity sha512-WVI69l0qqlDboGngiggQitRyto20og3YNNZp6ySva9dRMYpy9OQd5ep7mQvkvuBeUkIluOKR6jBOek7FRS7X0w== dependencies: co "^4.6.0" debounce "^1.2.0" debug "^4.1.1" duplexer "^0.1.1" fs-extra "^9.0.1" glob "^7.1.4" glob2base "0.0.12" minimatch "^3.0.4" resolve "^1.12.0" safe-buffer "^5.2.0" shell-quote "^1.7.1" subarg "^1.0.0" cross-spawn@^6.0.5: version "6.0.5" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4" integrity sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ== dependencies: nice-try "^1.0.4" path-key "^2.0.1" semver "^5.5.0" shebang-command "^1.2.0" which "^1.2.9" debounce@^1.2.0: version "1.2.1" resolved "https://registry.yarnpkg.com/debounce/-/debounce-1.2.1.tgz#38881d8f4166a5c5848020c11827b834bcb3e0a5" integrity sha512-XRRe6Glud4rd/ZGQfiV1ruXSfbvfJedlV9Y6zOlP+2K04vBYiJEte6stfFkCP03aMnY5tsipamumUjL14fofug== debug@^4.1.1: version "4.3.2" resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.2.tgz#f0a49c18ac8779e31d4a0c6029dfb76873c7428b" integrity sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw== dependencies: ms "2.1.2" define-properties@^1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.3.tgz#cf88da6cbee26fe6db7094f61d870cbd84cee9f1" integrity sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ== dependencies: object-keys "^1.0.12" duplexer@^0.1.1: version "0.1.2" resolved "https://registry.yarnpkg.com/duplexer/-/duplexer-0.1.2.tgz#3abe43aef3835f8ae077d136ddce0f276b0400e6" integrity sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg== error-ex@^1.3.1: version "1.3.2" resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf" integrity sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g== dependencies: is-arrayish "^0.2.1" es-abstract@^1.18.0-next.1: version "1.18.0-next.1" resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.18.0-next.1.tgz#6e3a0a4bda717e5023ab3b8e90bec36108d22c68" integrity sha512-I4UGspA0wpZXWENrdA0uHbnhte683t3qT/1VFH9aX2dA5PPSf6QW5HHXf5HImaqPmjXaVeVk4RGWnaylmV7uAA== dependencies: es-to-primitive "^1.2.1" function-bind "^1.1.1" has "^1.0.3" has-symbols "^1.0.1" is-callable "^1.2.2" is-negative-zero "^2.0.0" is-regex "^1.1.1" object-inspect "^1.8.0" object-keys "^1.1.1" object.assign "^4.1.1" string.prototype.trimend "^1.0.1" string.prototype.trimstart "^1.0.1" es-to-primitive@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.2.1.tgz#e55cd4c9cdc188bcefb03b366c736323fc5c898a" integrity sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA== dependencies: is-callable "^1.1.4" is-date-object "^1.0.1" is-symbol "^1.0.2" escape-string-regexp@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= exec-sh@^0.2.0: version "0.2.2" resolved "https://registry.yarnpkg.com/exec-sh/-/exec-sh-0.2.2.tgz#2a5e7ffcbd7d0ba2755bdecb16e5a427dfbdec36" integrity sha512-FIUCJz1RbuS0FKTdaAafAByGS0CPvU3R0MeHxgtl+djzCc//F8HakL8GzmVNZanasTbTAY/3DRFA0KpVqj/eAw== dependencies: merge "^1.2.0" find-index@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/find-index/-/find-index-0.1.1.tgz#675d358b2ca3892d795a1ab47232f8b6e2e0dde4" integrity sha1-Z101iyyjiS15Whq0cjL4tuLg3eQ= fs-extra@^9.0.1: version "9.1.0" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-9.1.0.tgz#5954460c764a8da2094ba3554bf839e6b9a7c86d" integrity sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ== dependencies: at-least-node "^1.0.0" graceful-fs "^4.2.0" jsonfile "^6.0.1" universalify "^2.0.0" fs.realpath@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= function-bind@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== get-intrinsic@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.0.1.tgz#94a9768fcbdd0595a1c9273aacf4c89d075631be" integrity sha512-ZnWP+AmS1VUaLgTRy47+zKtjTxz+0xMpx3I52i+aalBK1QP19ggLF3Db89KJX7kjfOfP2eoa01qc++GwPgufPg== dependencies: function-bind "^1.1.1" has "^1.0.3" has-symbols "^1.0.1" [email protected]: version "0.0.12" resolved "https://registry.yarnpkg.com/glob2base/-/glob2base-0.0.12.tgz#9d419b3e28f12e83a362164a277055922c9c0d56" integrity sha1-nUGbPijxLoOjYhZKJ3BVkiycDVY= dependencies: find-index "^0.1.1" glob@^7.1.3: version "7.1.4" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.4.tgz#aa608a2f6c577ad357e1ae5a5c26d9a8d1969255" integrity sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A== dependencies: fs.realpath "^1.0.0" inflight "^1.0.4" inherits "2" minimatch "^3.0.4" once "^1.3.0" path-is-absolute "^1.0.0" glob@^7.1.4: version "7.2.0" resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.0.tgz#d15535af7732e02e948f4c41628bd910293f6023" integrity sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q== dependencies: fs.realpath "^1.0.0" inflight "^1.0.4" inherits "2" minimatch "^3.0.4" once "^1.3.0" path-is-absolute "^1.0.0" graceful-fs@^4.1.2: version "4.2.4" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.4.tgz#2256bde14d3632958c465ebc96dc467ca07a29fb" integrity sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw== graceful-fs@^4.1.6, graceful-fs@^4.2.0: version "4.2.8" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.8.tgz#e412b8d33f5e006593cbd3cee6df9f2cebbe802a" integrity sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg== has-flag@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" integrity sha1-tdRU3CGZriJWmfNGfloH87lVuv0= has-symbols@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.1.tgz#9f5214758a44196c406d9bd76cebf81ec2dd31e8" integrity sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg== has@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/has/-/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796" integrity sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw== dependencies: function-bind "^1.1.1" hosted-git-info@^2.1.4: version "2.8.8" resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.8.8.tgz#7539bd4bc1e0e0a895815a2e0262420b12858488" integrity sha512-f/wzC2QaWBs7t9IYqB4T3sR1xviIViXJRJTWBlx2Gf3g0Xi5vI7Yy4koXQ1c9OYDGHN9sBy1DQ2AB8fqZBWhUg== inflight@^1.0.4: version "1.0.6" resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" integrity sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk= dependencies: once "^1.3.0" wrappy "1" inherits@2: version "2.0.4" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== is-arrayish@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" integrity sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0= is-callable@^1.1.4, is-callable@^1.2.2: version "1.2.2" resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.2.2.tgz#c7c6715cd22d4ddb48d3e19970223aceabb080d9" integrity sha512-dnMqspv5nU3LoewK2N/y7KLtxtakvTuaCsU9FU50/QDmdbHNy/4/JuRtMHqRU22o3q+W89YQndQEeCVwK+3qrA== is-core-module@^2.1.0: version "2.2.0" resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.2.0.tgz#97037ef3d52224d85163f5597b2b63d9afed981a" integrity sha512-XRAfAdyyY5F5cOXn7hYQDqh2Xmii+DEfIcQGxK/uNwMHhIkPWO0g8msXcbzLe+MpGoR951MlqM/2iIlU4vKDdQ== dependencies: has "^1.0.3" is-core-module@^2.2.0: version "2.8.0" resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.8.0.tgz#0321336c3d0925e497fd97f5d95cb114a5ccd548" integrity sha512-vd15qHsaqrRL7dtH6QNuy0ndJmRDrS9HAM1CAiSifNUFv4x1a0CCVsj18hJ1mShxIG6T2i1sO78MkP56r0nYRw== dependencies: has "^1.0.3" is-date-object@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.2.tgz#bda736f2cd8fd06d32844e7743bfa7494c3bfd7e" integrity sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g== is-negative-zero@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/is-negative-zero/-/is-negative-zero-2.0.1.tgz#3de746c18dda2319241a53675908d8f766f11c24" integrity sha512-2z6JzQvZRa9A2Y7xC6dQQm4FSTSTNWjKIYYTt4246eMTJmIo0Q+ZyOsU66X8lxK1AbB92dFeglPLrhwpeRKO6w== is-regex@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.1.1.tgz#c6f98aacc546f6cec5468a07b7b153ab564a57b9" integrity sha512-1+QkEcxiLlB7VEyFtyBg94e08OAsvq7FUBgApTq/w2ymCLyKJgDPsybBENVtA7XCQEgEXxKPonG+mvYRxh/LIg== dependencies: has-symbols "^1.0.1" is-symbol@^1.0.2: version "1.0.3" resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.3.tgz#38e1014b9e6329be0de9d24a414fd7441ec61937" integrity sha512-OwijhaRSgqvhm/0ZdAcXNZt9lYdKFpcRDT5ULUuYXPoT794UNOdU+gpT6Rzo7b4V2HUl/op6GqY894AZwv9faQ== dependencies: has-symbols "^1.0.1" isexe@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" integrity sha1-6PvzdNxVb/iUehDcsFctYz8s+hA= json-parse-better-errors@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz#bb867cfb3450e69107c131d1c514bab3dc8bcaa9" integrity sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw== jsonfile@^6.0.1: version "6.1.0" resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-6.1.0.tgz#bc55b2634793c679ec6403094eb13698a6ec0aae" integrity sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ== dependencies: universalify "^2.0.0" optionalDependencies: graceful-fs "^4.1.6" load-json-file@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-4.0.0.tgz#2f5f45ab91e33216234fd53adab668eb4ec0993b" integrity sha1-L19Fq5HjMhYjT9U62rZo607AmTs= dependencies: graceful-fs "^4.1.2" parse-json "^4.0.0" pify "^3.0.0" strip-bom "^3.0.0" memorystream@^0.3.1: version "0.3.1" resolved "https://registry.yarnpkg.com/memorystream/-/memorystream-0.3.1.tgz#86d7090b30ce455d63fbae12dda51a47ddcaf9b2" integrity sha1-htcJCzDORV1j+64S3aUaR93K+bI= merge@^1.2.0: version "1.2.1" resolved "https://registry.yarnpkg.com/merge/-/merge-1.2.1.tgz#38bebf80c3220a8a487b6fcfb3941bb11720c145" integrity sha512-VjFo4P5Whtj4vsLzsYBu5ayHhoHJ0UqNm7ibvShmbmoz7tGi0vXaoJbGdB+GmDMLUdg8DpQXEIeVDAe8MaABvQ== minimatch@^3.0.4: version "3.1.2" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== dependencies: brace-expansion "^1.1.7" minimist@^1.1.0, minimist@^1.2.0: version "1.2.6" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.6.tgz#8637a5b759ea0d6e98702cfb3a9283323c93af44" integrity sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q== mkdirp@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e" integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw== [email protected]: version "2.1.2" resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== ncp@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/ncp/-/ncp-2.0.0.tgz#195a21d6c46e361d2fb1281ba38b91e9df7bdbb3" integrity sha1-GVoh1sRuNh0vsSgbo4uR6d9727M= nice-try@^1.0.4: version "1.0.5" resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366" integrity sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ== normalize-package-data@^2.3.2: version "2.5.0" resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.5.0.tgz#e66db1838b200c1dfc233225d12cb36520e234a8" integrity sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA== dependencies: hosted-git-info "^2.1.4" resolve "^1.10.0" semver "2 || 3 || 4 || 5" validate-npm-package-license "^3.0.1" npm-run-all@^4.1.5: version "4.1.5" resolved "https://registry.yarnpkg.com/npm-run-all/-/npm-run-all-4.1.5.tgz#04476202a15ee0e2e214080861bff12a51d98fba" integrity sha512-Oo82gJDAVcaMdi3nuoKFavkIHBRVqQ1qvMb+9LHk/cF4P6B2m8aP04hGf7oL6wZ9BuGwX1onlLhpuoofSyoQDQ== dependencies: ansi-styles "^3.2.1" chalk "^2.4.1" cross-spawn "^6.0.5" memorystream "^0.3.1" minimatch "^3.0.4" pidtree "^0.3.0" read-pkg "^3.0.0" shell-quote "^1.6.1" string.prototype.padend "^3.0.0" object-inspect@^1.8.0: version "1.9.0" resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.9.0.tgz#c90521d74e1127b67266ded3394ad6116986533a" integrity sha512-i3Bp9iTqwhaLZBxGkRfo5ZbE07BQRT7MGu8+nNgwW9ItGp1TzCTw2DLEoWwjClxBjOFI/hWljTAmYGCEwmtnOw== object-keys@^1.0.12, object-keys@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e" integrity sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA== object.assign@^4.1.1: version "4.1.2" resolved "https://registry.yarnpkg.com/object.assign/-/object.assign-4.1.2.tgz#0ed54a342eceb37b38ff76eb831a0e788cb63940" integrity sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ== dependencies: call-bind "^1.0.0" define-properties "^1.1.3" has-symbols "^1.0.1" object-keys "^1.1.1" once@^1.3.0: version "1.4.0" resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E= dependencies: wrappy "1" parse-json@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-4.0.0.tgz#be35f5425be1f7f6c747184f98a788cb99477ee0" integrity sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA= dependencies: error-ex "^1.3.1" json-parse-better-errors "^1.0.1" path-is-absolute@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= path-key@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" integrity sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A= path-parse@^1.0.6: version "1.0.6" resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c" integrity sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw== path-type@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/path-type/-/path-type-3.0.0.tgz#cef31dc8e0a1a3bb0d105c0cd97cf3bf47f4e36f" integrity sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg== dependencies: pify "^3.0.0" pidtree@^0.3.0: version "0.3.1" resolved "https://registry.yarnpkg.com/pidtree/-/pidtree-0.3.1.tgz#ef09ac2cc0533df1f3250ccf2c4d366b0d12114a" integrity sha512-qQbW94hLHEqCg7nhby4yRC7G2+jYHY4Rguc2bjw7Uug4GIJuu1tvf2uHaZv5Q8zdt+WKJ6qK1FOI6amaWUo5FA== pify@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/pify/-/pify-3.0.0.tgz#e5a4acd2c101fdf3d9a4d07f0dbc4db49dd28176" integrity sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY= read-pkg@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-3.0.0.tgz#9cbc686978fee65d16c00e2b19c237fcf6e38389" integrity sha1-nLxoaXj+5l0WwA4rGcI3/Pbjg4k= dependencies: load-json-file "^4.0.0" normalize-package-data "^2.3.2" path-type "^3.0.0" resolve@^1.10.0: version "1.19.0" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.19.0.tgz#1af5bf630409734a067cae29318aac7fa29a267c" integrity sha512-rArEXAgsBG4UgRGcynxWIWKFvh/XZCcS8UJdHhwy91zwAvCZIbcs+vAbflgBnNjYMs/i/i+/Ux6IZhML1yPvxg== dependencies: is-core-module "^2.1.0" path-parse "^1.0.6" resolve@^1.12.0: version "1.20.0" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.20.0.tgz#629a013fb3f70755d6f0b7935cc1c2c5378b1975" integrity sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A== dependencies: is-core-module "^2.2.0" path-parse "^1.0.6" rimraf@^3.0.0: version "3.0.2" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a" integrity sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA== dependencies: glob "^7.1.3" safe-buffer@^5.2.0: version "5.2.1" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== "semver@2 || 3 || 4 || 5", semver@^5.5.0: version "5.7.1" resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== shebang-command@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea" integrity sha1-RKrGW2lbAzmJaMOfNj/uXer98eo= dependencies: shebang-regex "^1.0.0" shebang-regex@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" integrity sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM= shell-quote@^1.6.1: version "1.7.1" resolved "https://registry.yarnpkg.com/shell-quote/-/shell-quote-1.7.1.tgz#3161d969886fb14f9140c65245a5dd19b6f0b06b" integrity sha512-2kUqeAGnMAu6YrTPX4E3LfxacH9gKljzVjlkUeSqY0soGwK4KLl7TURXCem712tkhBCeeaFP9QK4dKn88s3Icg== shell-quote@^1.7.1: version "1.7.3" resolved "https://registry.yarnpkg.com/shell-quote/-/shell-quote-1.7.3.tgz#aa40edac170445b9a431e17bb62c0b881b9c4123" integrity sha512-Vpfqwm4EnqGdlsBFNmHhxhElJYrdfcxPThu+ryKS5J8L/fhAwLazFZtq+S+TWZ9ANj2piSQLGj6NQg+lKPmxrw== spdx-correct@^3.0.0: version "3.1.1" resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-3.1.1.tgz#dece81ac9c1e6713e5f7d1b6f17d468fa53d89a9" integrity sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w== dependencies: spdx-expression-parse "^3.0.0" spdx-license-ids "^3.0.0" spdx-exceptions@^2.1.0: version "2.3.0" resolved "https://registry.yarnpkg.com/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz#3f28ce1a77a00372683eade4a433183527a2163d" integrity sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A== spdx-expression-parse@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz#cf70f50482eefdc98e3ce0a6833e4a53ceeba679" integrity sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q== dependencies: spdx-exceptions "^2.1.0" spdx-license-ids "^3.0.0" spdx-license-ids@^3.0.0: version "3.0.7" resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-3.0.7.tgz#e9c18a410e5ed7e12442a549fbd8afa767038d65" integrity sha512-U+MTEOO0AiDzxwFvoa4JVnMV6mZlJKk2sBLt90s7G0Gd0Mlknc7kxEn3nuDPNZRta7O2uy8oLcZLVT+4sqNZHQ== string.prototype.padend@^3.0.0: version "3.1.1" resolved "https://registry.yarnpkg.com/string.prototype.padend/-/string.prototype.padend-3.1.1.tgz#824c84265dbac46cade2b957b38b6a5d8d1683c5" integrity sha512-eCzTASPnoCr5Ht+Vn1YXgm8SB015hHKgEIMu9Nr9bQmLhRBxKRfmzSj/IQsxDFc8JInJDDFA0qXwK+xxI7wDkg== dependencies: call-bind "^1.0.0" define-properties "^1.1.3" es-abstract "^1.18.0-next.1" string.prototype.trimend@^1.0.1: version "1.0.3" resolved "https://registry.yarnpkg.com/string.prototype.trimend/-/string.prototype.trimend-1.0.3.tgz#a22bd53cca5c7cf44d7c9d5c732118873d6cd18b" integrity sha512-ayH0pB+uf0U28CtjlLvL7NaohvR1amUvVZk+y3DYb0Ey2PUV5zPkkKy9+U1ndVEIXO8hNg18eIv9Jntbii+dKw== dependencies: call-bind "^1.0.0" define-properties "^1.1.3" string.prototype.trimstart@^1.0.1: version "1.0.3" resolved "https://registry.yarnpkg.com/string.prototype.trimstart/-/string.prototype.trimstart-1.0.3.tgz#9b4cb590e123bb36564401d59824298de50fd5aa" integrity sha512-oBIBUy5lea5tt0ovtOFiEQaBkoBBkyJhZXzJYrSmDo5IUUqbOPvVezuRs/agBIdZ2p2Eo1FD6bD9USyBLfl3xg== dependencies: call-bind "^1.0.0" define-properties "^1.1.3" strip-bom@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3" integrity sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM= subarg@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/subarg/-/subarg-1.0.0.tgz#f62cf17581e996b48fc965699f54c06ae268b8d2" integrity sha1-9izxdYHplrSPyWVpn1TAauJouNI= dependencies: minimist "^1.1.0" supports-color@^5.3.0: version "5.5.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== dependencies: has-flag "^3.0.0" [email protected]: version "0.2.1" resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.2.1.tgz#8457fc3037dcf4719c251367a1af6500ee1ccf14" integrity sha512-76SUhtfqR2Ijn+xllcI5P1oyannHNHByD80W1q447gU3mp9G9PSpGdWmjUOHRDPiHYacIk66W7ubDTuPF3BEtQ== dependencies: rimraf "^3.0.0" [email protected]: version "1.2.2" resolved "https://registry.yarnpkg.com/tree-kill/-/tree-kill-1.2.2.tgz#4ca09a9092c88b73a7cdc5e8a01b507b0790a0cc" integrity sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A== universalify@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/universalify/-/universalify-2.0.0.tgz#75a4984efedc4b08975c5aeb73f530d02df25717" integrity sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ== validate-npm-package-license@^3.0.1: version "3.0.4" resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz#fc91f6b9c7ba15c857f4cb2c5defeec39d4f410a" integrity sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew== dependencies: spdx-correct "^3.0.0" spdx-expression-parse "^3.0.0" [email protected]: version "3.0.2" resolved "https://registry.yarnpkg.com/vscode-uri/-/vscode-uri-3.0.2.tgz#ecfd1d066cb8ef4c3a208decdbab9a8c23d055d0" integrity sha512-jkjy6pjU1fxUvI51P+gCsxg1u2n8LSt0W6KrCNQceaziKzff74GoWmjVG46KieVzybO1sttPQmYfrwSHey7GUA== watch@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/watch/-/watch-1.0.2.tgz#340a717bde765726fa0aa07d721e0147a551df0c" integrity sha1-NApxe952Vyb6CqB9ch4BR6VR3ww= dependencies: exec-sh "^0.2.0" minimist "^1.2.0" which@^1.2.9: version "1.3.1" resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a" integrity sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ== dependencies: isexe "^2.0.0" wrappy@1: version "1.0.2" resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=
test/automation/yarn.lock
0
https://github.com/microsoft/vscode/commit/00e8fdec5dcd099ae21c1b9f9851179f6fb1ab2f
[ 0.00017300090985372663, 0.00016702582070138305, 0.00016244122525677085, 0.00016679854888934642, 0.0000024625032892799936 ]
{ "id": 9, "code_window": [ "\t\tqp.show();\n", "\t\tqp.busy = true;\n", "\t}\n", "}\n", "\n", "export class ClearDisplayLanguageAction extends Action2 {\n", "\tpublic static readonly ID = 'workbench.action.clearLocalePreference';\n", "\tpublic static readonly LABEL = localize('clearDisplayLanguage', \"Clear Display Language Preference\");\n" ], "labels": [ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ], "after_edit": [ "\n", "\tprivate withMoreInfoButton(items: ILanguagePackItem[]): ILanguagePackItem[] {\n", "\t\tfor (const item of items) {\n", "\t\t\tif (item.extensionId) {\n", "\t\t\t\titem.buttons = [{\n", "\t\t\t\t\ttooltip: localize('moreInfo', \"More Info\"),\n", "\t\t\t\t\ticonClass: 'codicon-info'\n", "\t\t\t\t}];\n", "\t\t\t}\n", "\t\t}\n", "\t\treturn items;\n", "\t}\n" ], "file_path": "src/vs/workbench/contrib/localization/browser/localizationsActions.ts", "type": "add", "edit_start_line_idx": 72 }
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ export class IdGenerator { private _prefix: string; private _lastId: number; constructor(prefix: string) { this._prefix = prefix; this._lastId = 0; } public nextId(): string { return this._prefix + (++this._lastId); } } export const defaultGenerator = new IdGenerator('id#');
src/vs/base/common/idGenerator.ts
0
https://github.com/microsoft/vscode/commit/00e8fdec5dcd099ae21c1b9f9851179f6fb1ab2f
[ 0.00017424968245904893, 0.0001691332581685856, 0.0001660212001297623, 0.00016712889191694558, 0.0000036460110095504206 ]
{ "id": 0, "code_window": [ "\t\t}\n", "\n", "\t\t// Check all the selectors to make sure it's worth going to the extension host.\n", "\t\tconst appropriateHandles = Array.from(this.portsAttributesProviders.entries()).filter(entry => {\n", "\t\t\tconst selector = entry[1];\n", "\t\t\tconst portRange = selector.portRange;\n", "\t\t\tconst portInRange = portRange ? ports.some(port => portRange[0] <= port && port < portRange[1]) : true;\n", "\t\t\tconst commandMatches = !selector.commandPattern || (commandLine && (commandLine.match(selector.commandPattern)));\n", "\t\t\treturn portInRange && commandMatches;\n", "\t\t}).map(entry => entry[0]);\n", "\n" ], "labels": [ "keep", "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ], "after_edit": [ "\t\t\tconst portRange = (typeof selector.portRange === 'number') ? [selector.portRange, selector.portRange + 1] : selector.portRange;\n" ], "file_path": "src/vs/workbench/api/browser/mainThreadTunnelService.ts", "type": "replace", "edit_start_line_idx": 85 }
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import * as nls from 'vs/nls'; import { MainThreadTunnelServiceShape, MainContext, ExtHostContext, ExtHostTunnelServiceShape, CandidatePortSource, PortAttributesSelector, TunnelDto } from 'vs/workbench/api/common/extHost.protocol'; import { TunnelDtoConverter } from 'vs/workbench/api/common/extHostTunnelService'; import { extHostNamedCustomer, IExtHostContext } from 'vs/workbench/services/extensions/common/extHostCustomers'; import { CandidatePort, IRemoteExplorerService, makeAddress, PORT_AUTO_FORWARD_SETTING, PORT_AUTO_SOURCE_SETTING, PORT_AUTO_SOURCE_SETTING_OUTPUT, TunnelCloseReason, TunnelSource } from 'vs/workbench/services/remote/common/remoteExplorerService'; import { ITunnelProvider, ITunnelService, TunnelCreationOptions, TunnelProviderFeatures, TunnelOptions, RemoteTunnel, ProvidedPortAttributes, PortAttributesProvider, TunnelProtocol } from 'vs/platform/tunnel/common/tunnel'; import { Disposable } from 'vs/base/common/lifecycle'; import type { TunnelDescription } from 'vs/platform/remote/common/remoteAuthorityResolver'; import { INotificationService, Severity } from 'vs/platform/notification/common/notification'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { ILogService } from 'vs/platform/log/common/log'; import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService'; import { CancellationToken } from 'vs/base/common/cancellation'; import { Registry } from 'vs/platform/registry/common/platform'; import { IConfigurationRegistry, Extensions as ConfigurationExtensions } from 'vs/platform/configuration/common/configurationRegistry'; @extHostNamedCustomer(MainContext.MainThreadTunnelService) export class MainThreadTunnelService extends Disposable implements MainThreadTunnelServiceShape, PortAttributesProvider { private readonly _proxy: ExtHostTunnelServiceShape; private elevateionRetry: boolean = false; private portsAttributesProviders: Map<number, PortAttributesSelector> = new Map(); constructor( extHostContext: IExtHostContext, @IRemoteExplorerService private readonly remoteExplorerService: IRemoteExplorerService, @ITunnelService private readonly tunnelService: ITunnelService, @INotificationService private readonly notificationService: INotificationService, @IConfigurationService private readonly configurationService: IConfigurationService, @ILogService private readonly logService: ILogService, @IRemoteAgentService private readonly remoteAgentService: IRemoteAgentService ) { super(); this._proxy = extHostContext.getProxy(ExtHostContext.ExtHostTunnelService); this._register(tunnelService.onTunnelOpened(() => this._proxy.$onDidTunnelsChange())); this._register(tunnelService.onTunnelClosed(() => this._proxy.$onDidTunnelsChange())); } private processFindingEnabled(): boolean { return (!!this.configurationService.getValue(PORT_AUTO_FORWARD_SETTING) || this.tunnelService.hasTunnelProvider) && (this.configurationService.getValue(PORT_AUTO_SOURCE_SETTING) !== PORT_AUTO_SOURCE_SETTING_OUTPUT); } async $setRemoteTunnelService(processId: number): Promise<void> { this.remoteExplorerService.namedProcesses.set(processId, 'Code Extension Host'); if (this.remoteExplorerService.portsFeaturesEnabled) { this._proxy.$registerCandidateFinder(this.processFindingEnabled()); } else { this._register(this.remoteExplorerService.onEnabledPortsFeatures(() => this._proxy.$registerCandidateFinder(this.configurationService.getValue(PORT_AUTO_FORWARD_SETTING)))); } this._register(this.configurationService.onDidChangeConfiguration(async (e) => { if (e.affectsConfiguration(PORT_AUTO_FORWARD_SETTING) || e.affectsConfiguration(PORT_AUTO_SOURCE_SETTING)) { return this._proxy.$registerCandidateFinder(this.processFindingEnabled()); } })); this._register(this.tunnelService.onAddedTunnelProvider(() => { return this._proxy.$registerCandidateFinder(this.processFindingEnabled()); })); } private _alreadyRegistered: boolean = false; async $registerPortsAttributesProvider(selector: PortAttributesSelector, providerHandle: number): Promise<void> { this.portsAttributesProviders.set(providerHandle, selector); if (!this._alreadyRegistered) { this.remoteExplorerService.tunnelModel.addAttributesProvider(this); this._alreadyRegistered = true; } } async $unregisterPortsAttributesProvider(providerHandle: number): Promise<void> { this.portsAttributesProviders.delete(providerHandle); } async providePortAttributes(ports: number[], pid: number | undefined, commandLine: string | undefined, token: CancellationToken): Promise<ProvidedPortAttributes[]> { if (this.portsAttributesProviders.size === 0) { return []; } // Check all the selectors to make sure it's worth going to the extension host. const appropriateHandles = Array.from(this.portsAttributesProviders.entries()).filter(entry => { const selector = entry[1]; const portRange = selector.portRange; const portInRange = portRange ? ports.some(port => portRange[0] <= port && port < portRange[1]) : true; const commandMatches = !selector.commandPattern || (commandLine && (commandLine.match(selector.commandPattern))); return portInRange && commandMatches; }).map(entry => entry[0]); if (appropriateHandles.length === 0) { return []; } return this._proxy.$providePortAttributes(appropriateHandles, ports, pid, commandLine, token); } async $openTunnel(tunnelOptions: TunnelOptions, source: string): Promise<TunnelDto | undefined> { const tunnel = await this.remoteExplorerService.forward({ remote: tunnelOptions.remoteAddress, local: tunnelOptions.localAddressPort, name: tunnelOptions.label, source: { source: TunnelSource.Extension, description: source }, elevateIfNeeded: false }); if (tunnel) { if (!this.elevateionRetry && (tunnelOptions.localAddressPort !== undefined) && (tunnel.tunnelLocalPort !== undefined) && this.tunnelService.isPortPrivileged(tunnelOptions.localAddressPort) && (tunnel.tunnelLocalPort !== tunnelOptions.localAddressPort) && this.tunnelService.canElevate) { this.elevationPrompt(tunnelOptions, tunnel, source); } return TunnelDtoConverter.fromServiceTunnel(tunnel); } return undefined; } private async elevationPrompt(tunnelOptions: TunnelOptions, tunnel: RemoteTunnel, source: string) { return this.notificationService.prompt(Severity.Info, nls.localize('remote.tunnel.openTunnel', "The extension {0} has forwarded port {1}. You'll need to run as superuser to use port {2} locally.", source, tunnelOptions.remoteAddress.port, tunnelOptions.localAddressPort), [{ label: nls.localize('remote.tunnelsView.elevationButton', "Use Port {0} as Sudo...", tunnel.tunnelRemotePort), run: async () => { this.elevateionRetry = true; await this.remoteExplorerService.close({ host: tunnel.tunnelRemoteHost, port: tunnel.tunnelRemotePort }, TunnelCloseReason.Other); await this.remoteExplorerService.forward({ remote: tunnelOptions.remoteAddress, local: tunnelOptions.localAddressPort, name: tunnelOptions.label, source: { source: TunnelSource.Extension, description: source }, elevateIfNeeded: true }); this.elevateionRetry = false; } }]); } async $closeTunnel(remote: { host: string; port: number }): Promise<void> { return this.remoteExplorerService.close(remote, TunnelCloseReason.Other); } async $getTunnels(): Promise<TunnelDescription[]> { return (await this.tunnelService.tunnels).map(tunnel => { return { remoteAddress: { port: tunnel.tunnelRemotePort, host: tunnel.tunnelRemoteHost }, localAddress: tunnel.localAddress, privacy: tunnel.privacy, protocol: tunnel.protocol }; }); } async $onFoundNewCandidates(candidates: CandidatePort[]): Promise<void> { this.remoteExplorerService.onFoundNewCandidates(candidates); } async $setTunnelProvider(features?: TunnelProviderFeatures): Promise<void> { const tunnelProvider: ITunnelProvider = { forwardPort: (tunnelOptions: TunnelOptions, tunnelCreationOptions: TunnelCreationOptions) => { const forward = this._proxy.$forwardPort(tunnelOptions, tunnelCreationOptions); return forward.then(tunnel => { this.logService.trace(`ForwardedPorts: (MainThreadTunnelService) New tunnel established by tunnel provider: ${tunnel?.remoteAddress.host}:${tunnel?.remoteAddress.port}`); if (!tunnel) { return undefined; } return { tunnelRemotePort: tunnel.remoteAddress.port, tunnelRemoteHost: tunnel.remoteAddress.host, localAddress: typeof tunnel.localAddress === 'string' ? tunnel.localAddress : makeAddress(tunnel.localAddress.host, tunnel.localAddress.port), tunnelLocalPort: typeof tunnel.localAddress !== 'string' ? tunnel.localAddress.port : undefined, public: tunnel.public, privacy: tunnel.privacy, protocol: tunnel.protocol ?? TunnelProtocol.Http, dispose: async (silent?: boolean) => { this.logService.trace(`ForwardedPorts: (MainThreadTunnelService) Closing tunnel from tunnel provider: ${tunnel?.remoteAddress.host}:${tunnel?.remoteAddress.port}`); return this._proxy.$closeTunnel({ host: tunnel.remoteAddress.host, port: tunnel.remoteAddress.port }, silent); } }; }); } }; this.tunnelService.setTunnelProvider(tunnelProvider); if (features) { this.tunnelService.setTunnelFeatures(features); } } async $setCandidateFilter(): Promise<void> { this.remoteExplorerService.setCandidateFilter((candidates: CandidatePort[]): Promise<CandidatePort[]> => { return this._proxy.$applyCandidateFilter(candidates); }); } async $setCandidatePortSource(source: CandidatePortSource): Promise<void> { // Must wait for the remote environment before trying to set settings there. this.remoteAgentService.getEnvironment().then(() => { switch (source) { case CandidatePortSource.None: { Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration) .registerDefaultConfigurations([{ overrides: { 'remote.autoForwardPorts': false } }]); break; } case CandidatePortSource.Output: { Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration) .registerDefaultConfigurations([{ overrides: { 'remote.autoForwardPortsSource': PORT_AUTO_SOURCE_SETTING_OUTPUT } }]); break; } default: // Do nothing, the defaults for these settings should be used. } }).catch(() => { // The remote failed to get setup. Errors from that area will already be surfaced to the user. }); } }
src/vs/workbench/api/browser/mainThreadTunnelService.ts
1
https://github.com/microsoft/vscode/commit/15d8d39815dd6fc14bb2cf9aeb17200bd5710bd5
[ 0.9986951947212219, 0.08695518225431442, 0.00016719121776986867, 0.0001735226105665788, 0.2795654535293579 ]
{ "id": 0, "code_window": [ "\t\t}\n", "\n", "\t\t// Check all the selectors to make sure it's worth going to the extension host.\n", "\t\tconst appropriateHandles = Array.from(this.portsAttributesProviders.entries()).filter(entry => {\n", "\t\t\tconst selector = entry[1];\n", "\t\t\tconst portRange = selector.portRange;\n", "\t\t\tconst portInRange = portRange ? ports.some(port => portRange[0] <= port && port < portRange[1]) : true;\n", "\t\t\tconst commandMatches = !selector.commandPattern || (commandLine && (commandLine.match(selector.commandPattern)));\n", "\t\t\treturn portInRange && commandMatches;\n", "\t\t}).map(entry => entry[0]);\n", "\n" ], "labels": [ "keep", "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ], "after_edit": [ "\t\t\tconst portRange = (typeof selector.portRange === 'number') ? [selector.portRange, selector.portRange + 1] : selector.portRange;\n" ], "file_path": "src/vs/workbench/api/browser/mainThreadTunnelService.ts", "type": "replace", "edit_start_line_idx": 85 }
#!/usr/bin/env bash yarn $*
scripts/npm.sh
0
https://github.com/microsoft/vscode/commit/15d8d39815dd6fc14bb2cf9aeb17200bd5710bd5
[ 0.00016887852689251304, 0.00016887852689251304, 0.00016887852689251304, 0.00016887852689251304, 0 ]
{ "id": 0, "code_window": [ "\t\t}\n", "\n", "\t\t// Check all the selectors to make sure it's worth going to the extension host.\n", "\t\tconst appropriateHandles = Array.from(this.portsAttributesProviders.entries()).filter(entry => {\n", "\t\t\tconst selector = entry[1];\n", "\t\t\tconst portRange = selector.portRange;\n", "\t\t\tconst portInRange = portRange ? ports.some(port => portRange[0] <= port && port < portRange[1]) : true;\n", "\t\t\tconst commandMatches = !selector.commandPattern || (commandLine && (commandLine.match(selector.commandPattern)));\n", "\t\t\treturn portInRange && commandMatches;\n", "\t\t}).map(entry => entry[0]);\n", "\n" ], "labels": [ "keep", "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ], "after_edit": [ "\t\t\tconst portRange = (typeof selector.portRange === 'number') ? [selector.portRange, selector.portRange + 1] : selector.portRange;\n" ], "file_path": "src/vs/workbench/api/browser/mainThreadTunnelService.ts", "type": "replace", "edit_start_line_idx": 85 }
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; import { TelemetryReporter } from '../logging/telemetry'; import { isImplicitProjectConfigFile, openOrCreateConfig, ProjectType } from '../tsconfig'; import { ITypeScriptServiceClient } from '../typescriptService'; interface Hint { message: string; } class ExcludeHintItem { public configFileName?: string; private readonly _item: vscode.StatusBarItem; private _currentHint?: Hint; constructor( private readonly telemetryReporter: TelemetryReporter ) { this._item = vscode.window.createStatusBarItem('status.typescript.exclude', vscode.StatusBarAlignment.Right, 98 /* to the right of typescript version status (99) */); this._item.name = vscode.l10n.t("TypeScript: Configure Excludes"); this._item.command = 'js.projectStatus.command'; } public getCurrentHint(): Hint { return this._currentHint!; } public hide() { this._item.hide(); } public show(largeRoots?: string) { this._currentHint = { message: largeRoots ? vscode.l10n.t("To enable project-wide JavaScript/TypeScript language features, exclude folders with many files, like: {0}", largeRoots) : vscode.l10n.t("To enable project-wide JavaScript/TypeScript language features, exclude large folders with source files that you do not work on.") }; this._item.tooltip = this._currentHint.message; this._item.text = vscode.l10n.t("Configure Excludes"); this._item.tooltip = vscode.l10n.t("To enable project-wide JavaScript/TypeScript language features, exclude large folders with source files that you do not work on."); this._item.color = '#A5DF3B'; this._item.show(); /* __GDPR__ "js.hintProjectExcludes" : { "owner": "mjbvz", "${include}": [ "${TypeScriptCommonProperties}" ] } */ this.telemetryReporter.logTelemetry('js.hintProjectExcludes'); } } function createLargeProjectMonitorFromTypeScript(item: ExcludeHintItem, client: ITypeScriptServiceClient): vscode.Disposable { interface LargeProjectMessageItem extends vscode.MessageItem { index: number; } return client.onProjectLanguageServiceStateChanged(body => { if (body.languageServiceEnabled) { item.hide(); } else { item.show(); const configFileName = body.projectName; if (configFileName) { item.configFileName = configFileName; vscode.window.showWarningMessage<LargeProjectMessageItem>(item.getCurrentHint().message, { title: vscode.l10n.t("Configure Excludes"), index: 0 }).then(selected => { if (selected && selected.index === 0) { onConfigureExcludesSelected(client, configFileName); } }); } } }); } function onConfigureExcludesSelected( client: ITypeScriptServiceClient, configFileName: string ) { if (!isImplicitProjectConfigFile(configFileName)) { vscode.workspace.openTextDocument(configFileName) .then(vscode.window.showTextDocument); } else { const root = client.getWorkspaceRootForResource(vscode.Uri.file(configFileName)); if (root) { openOrCreateConfig( /tsconfig\.?.*\.json/.test(configFileName) ? ProjectType.TypeScript : ProjectType.JavaScript, root, client.configuration); } } } export function create( client: ITypeScriptServiceClient, ): vscode.Disposable { const toDispose: vscode.Disposable[] = []; const item = new ExcludeHintItem(client.telemetryReporter); toDispose.push(vscode.commands.registerCommand('js.projectStatus.command', () => { if (item.configFileName) { onConfigureExcludesSelected(client, item.configFileName); } const { message } = item.getCurrentHint(); return vscode.window.showInformationMessage(message); })); toDispose.push(createLargeProjectMonitorFromTypeScript(item, client)); return vscode.Disposable.from(...toDispose); }
extensions/typescript-language-features/src/ui/largeProjectStatus.ts
0
https://github.com/microsoft/vscode/commit/15d8d39815dd6fc14bb2cf9aeb17200bd5710bd5
[ 0.00017722304619383067, 0.00017507924349047244, 0.0001721590233501047, 0.00017574055527802557, 0.0000018193013602285646 ]
{ "id": 0, "code_window": [ "\t\t}\n", "\n", "\t\t// Check all the selectors to make sure it's worth going to the extension host.\n", "\t\tconst appropriateHandles = Array.from(this.portsAttributesProviders.entries()).filter(entry => {\n", "\t\t\tconst selector = entry[1];\n", "\t\t\tconst portRange = selector.portRange;\n", "\t\t\tconst portInRange = portRange ? ports.some(port => portRange[0] <= port && port < portRange[1]) : true;\n", "\t\t\tconst commandMatches = !selector.commandPattern || (commandLine && (commandLine.match(selector.commandPattern)));\n", "\t\t\treturn portInRange && commandMatches;\n", "\t\t}).map(entry => entry[0]);\n", "\n" ], "labels": [ "keep", "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ], "after_edit": [ "\t\t\tconst portRange = (typeof selector.portRange === 'number') ? [selector.portRange, selector.portRange + 1] : selector.portRange;\n" ], "file_path": "src/vs/workbench/api/browser/mainThreadTunnelService.ts", "type": "replace", "edit_start_line_idx": 85 }
declare module "event-stream" { import { Stream } from 'stream'; import { ThroughStream as _ThroughStream } from 'through'; import * as File from 'vinyl'; export interface ThroughStream extends _ThroughStream { queue(data: File | null): any; push(data: File | null): any; paused: boolean; } function merge(streams: Stream[]): ThroughStream; function merge(...streams: Stream[]): ThroughStream; function concat(...stream: Stream[]): ThroughStream; function duplex(istream: Stream, ostream: Stream): ThroughStream; function through(write?: (this: ThroughStream, data: any) => void, end?: (this: ThroughStream) => void, opts?: { autoDestroy: boolean; }): ThroughStream; function readArray<T>(array: T[]): ThroughStream; function writeArray<T>(cb: (err: Error, array: T[]) => void): ThroughStream; function mapSync<I, O>(cb: (data: I) => O): ThroughStream; function map<I, O>(cb: (data: I, cb: (err?: Error, data?: O) => void) => O): ThroughStream; function readable(asyncFunction: (this: ThroughStream, ...args: any[]) => any): any; }
build/lib/typings/event-stream.d.ts
0
https://github.com/microsoft/vscode/commit/15d8d39815dd6fc14bb2cf9aeb17200bd5710bd5
[ 0.00017895986093208194, 0.00017589807976037264, 0.0001740265142871067, 0.00017470784951001406, 0.0000021828045646543615 ]
{ "id": 1, "code_window": [ "}\n", "\n", "export interface PortAttributesSelector {\n", "\tportRange?: [number, number];\n", "\tcommandPattern?: RegExp;\n", "}\n", "\n", "export interface MainThreadTunnelServiceShape extends IDisposable {\n", "\t$openTunnel(tunnelOptions: TunnelOptions, source: string | undefined): Promise<TunnelDto | undefined>;\n" ], "labels": [ "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ], "after_edit": [ "\tportRange?: [number, number] | number;\n" ], "file_path": "src/vs/workbench/api/common/extHost.protocol.ts", "type": "replace", "edit_start_line_idx": 1000 }
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import * as nls from 'vs/nls'; import { MainThreadTunnelServiceShape, MainContext, ExtHostContext, ExtHostTunnelServiceShape, CandidatePortSource, PortAttributesSelector, TunnelDto } from 'vs/workbench/api/common/extHost.protocol'; import { TunnelDtoConverter } from 'vs/workbench/api/common/extHostTunnelService'; import { extHostNamedCustomer, IExtHostContext } from 'vs/workbench/services/extensions/common/extHostCustomers'; import { CandidatePort, IRemoteExplorerService, makeAddress, PORT_AUTO_FORWARD_SETTING, PORT_AUTO_SOURCE_SETTING, PORT_AUTO_SOURCE_SETTING_OUTPUT, TunnelCloseReason, TunnelSource } from 'vs/workbench/services/remote/common/remoteExplorerService'; import { ITunnelProvider, ITunnelService, TunnelCreationOptions, TunnelProviderFeatures, TunnelOptions, RemoteTunnel, ProvidedPortAttributes, PortAttributesProvider, TunnelProtocol } from 'vs/platform/tunnel/common/tunnel'; import { Disposable } from 'vs/base/common/lifecycle'; import type { TunnelDescription } from 'vs/platform/remote/common/remoteAuthorityResolver'; import { INotificationService, Severity } from 'vs/platform/notification/common/notification'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { ILogService } from 'vs/platform/log/common/log'; import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService'; import { CancellationToken } from 'vs/base/common/cancellation'; import { Registry } from 'vs/platform/registry/common/platform'; import { IConfigurationRegistry, Extensions as ConfigurationExtensions } from 'vs/platform/configuration/common/configurationRegistry'; @extHostNamedCustomer(MainContext.MainThreadTunnelService) export class MainThreadTunnelService extends Disposable implements MainThreadTunnelServiceShape, PortAttributesProvider { private readonly _proxy: ExtHostTunnelServiceShape; private elevateionRetry: boolean = false; private portsAttributesProviders: Map<number, PortAttributesSelector> = new Map(); constructor( extHostContext: IExtHostContext, @IRemoteExplorerService private readonly remoteExplorerService: IRemoteExplorerService, @ITunnelService private readonly tunnelService: ITunnelService, @INotificationService private readonly notificationService: INotificationService, @IConfigurationService private readonly configurationService: IConfigurationService, @ILogService private readonly logService: ILogService, @IRemoteAgentService private readonly remoteAgentService: IRemoteAgentService ) { super(); this._proxy = extHostContext.getProxy(ExtHostContext.ExtHostTunnelService); this._register(tunnelService.onTunnelOpened(() => this._proxy.$onDidTunnelsChange())); this._register(tunnelService.onTunnelClosed(() => this._proxy.$onDidTunnelsChange())); } private processFindingEnabled(): boolean { return (!!this.configurationService.getValue(PORT_AUTO_FORWARD_SETTING) || this.tunnelService.hasTunnelProvider) && (this.configurationService.getValue(PORT_AUTO_SOURCE_SETTING) !== PORT_AUTO_SOURCE_SETTING_OUTPUT); } async $setRemoteTunnelService(processId: number): Promise<void> { this.remoteExplorerService.namedProcesses.set(processId, 'Code Extension Host'); if (this.remoteExplorerService.portsFeaturesEnabled) { this._proxy.$registerCandidateFinder(this.processFindingEnabled()); } else { this._register(this.remoteExplorerService.onEnabledPortsFeatures(() => this._proxy.$registerCandidateFinder(this.configurationService.getValue(PORT_AUTO_FORWARD_SETTING)))); } this._register(this.configurationService.onDidChangeConfiguration(async (e) => { if (e.affectsConfiguration(PORT_AUTO_FORWARD_SETTING) || e.affectsConfiguration(PORT_AUTO_SOURCE_SETTING)) { return this._proxy.$registerCandidateFinder(this.processFindingEnabled()); } })); this._register(this.tunnelService.onAddedTunnelProvider(() => { return this._proxy.$registerCandidateFinder(this.processFindingEnabled()); })); } private _alreadyRegistered: boolean = false; async $registerPortsAttributesProvider(selector: PortAttributesSelector, providerHandle: number): Promise<void> { this.portsAttributesProviders.set(providerHandle, selector); if (!this._alreadyRegistered) { this.remoteExplorerService.tunnelModel.addAttributesProvider(this); this._alreadyRegistered = true; } } async $unregisterPortsAttributesProvider(providerHandle: number): Promise<void> { this.portsAttributesProviders.delete(providerHandle); } async providePortAttributes(ports: number[], pid: number | undefined, commandLine: string | undefined, token: CancellationToken): Promise<ProvidedPortAttributes[]> { if (this.portsAttributesProviders.size === 0) { return []; } // Check all the selectors to make sure it's worth going to the extension host. const appropriateHandles = Array.from(this.portsAttributesProviders.entries()).filter(entry => { const selector = entry[1]; const portRange = selector.portRange; const portInRange = portRange ? ports.some(port => portRange[0] <= port && port < portRange[1]) : true; const commandMatches = !selector.commandPattern || (commandLine && (commandLine.match(selector.commandPattern))); return portInRange && commandMatches; }).map(entry => entry[0]); if (appropriateHandles.length === 0) { return []; } return this._proxy.$providePortAttributes(appropriateHandles, ports, pid, commandLine, token); } async $openTunnel(tunnelOptions: TunnelOptions, source: string): Promise<TunnelDto | undefined> { const tunnel = await this.remoteExplorerService.forward({ remote: tunnelOptions.remoteAddress, local: tunnelOptions.localAddressPort, name: tunnelOptions.label, source: { source: TunnelSource.Extension, description: source }, elevateIfNeeded: false }); if (tunnel) { if (!this.elevateionRetry && (tunnelOptions.localAddressPort !== undefined) && (tunnel.tunnelLocalPort !== undefined) && this.tunnelService.isPortPrivileged(tunnelOptions.localAddressPort) && (tunnel.tunnelLocalPort !== tunnelOptions.localAddressPort) && this.tunnelService.canElevate) { this.elevationPrompt(tunnelOptions, tunnel, source); } return TunnelDtoConverter.fromServiceTunnel(tunnel); } return undefined; } private async elevationPrompt(tunnelOptions: TunnelOptions, tunnel: RemoteTunnel, source: string) { return this.notificationService.prompt(Severity.Info, nls.localize('remote.tunnel.openTunnel', "The extension {0} has forwarded port {1}. You'll need to run as superuser to use port {2} locally.", source, tunnelOptions.remoteAddress.port, tunnelOptions.localAddressPort), [{ label: nls.localize('remote.tunnelsView.elevationButton', "Use Port {0} as Sudo...", tunnel.tunnelRemotePort), run: async () => { this.elevateionRetry = true; await this.remoteExplorerService.close({ host: tunnel.tunnelRemoteHost, port: tunnel.tunnelRemotePort }, TunnelCloseReason.Other); await this.remoteExplorerService.forward({ remote: tunnelOptions.remoteAddress, local: tunnelOptions.localAddressPort, name: tunnelOptions.label, source: { source: TunnelSource.Extension, description: source }, elevateIfNeeded: true }); this.elevateionRetry = false; } }]); } async $closeTunnel(remote: { host: string; port: number }): Promise<void> { return this.remoteExplorerService.close(remote, TunnelCloseReason.Other); } async $getTunnels(): Promise<TunnelDescription[]> { return (await this.tunnelService.tunnels).map(tunnel => { return { remoteAddress: { port: tunnel.tunnelRemotePort, host: tunnel.tunnelRemoteHost }, localAddress: tunnel.localAddress, privacy: tunnel.privacy, protocol: tunnel.protocol }; }); } async $onFoundNewCandidates(candidates: CandidatePort[]): Promise<void> { this.remoteExplorerService.onFoundNewCandidates(candidates); } async $setTunnelProvider(features?: TunnelProviderFeatures): Promise<void> { const tunnelProvider: ITunnelProvider = { forwardPort: (tunnelOptions: TunnelOptions, tunnelCreationOptions: TunnelCreationOptions) => { const forward = this._proxy.$forwardPort(tunnelOptions, tunnelCreationOptions); return forward.then(tunnel => { this.logService.trace(`ForwardedPorts: (MainThreadTunnelService) New tunnel established by tunnel provider: ${tunnel?.remoteAddress.host}:${tunnel?.remoteAddress.port}`); if (!tunnel) { return undefined; } return { tunnelRemotePort: tunnel.remoteAddress.port, tunnelRemoteHost: tunnel.remoteAddress.host, localAddress: typeof tunnel.localAddress === 'string' ? tunnel.localAddress : makeAddress(tunnel.localAddress.host, tunnel.localAddress.port), tunnelLocalPort: typeof tunnel.localAddress !== 'string' ? tunnel.localAddress.port : undefined, public: tunnel.public, privacy: tunnel.privacy, protocol: tunnel.protocol ?? TunnelProtocol.Http, dispose: async (silent?: boolean) => { this.logService.trace(`ForwardedPorts: (MainThreadTunnelService) Closing tunnel from tunnel provider: ${tunnel?.remoteAddress.host}:${tunnel?.remoteAddress.port}`); return this._proxy.$closeTunnel({ host: tunnel.remoteAddress.host, port: tunnel.remoteAddress.port }, silent); } }; }); } }; this.tunnelService.setTunnelProvider(tunnelProvider); if (features) { this.tunnelService.setTunnelFeatures(features); } } async $setCandidateFilter(): Promise<void> { this.remoteExplorerService.setCandidateFilter((candidates: CandidatePort[]): Promise<CandidatePort[]> => { return this._proxy.$applyCandidateFilter(candidates); }); } async $setCandidatePortSource(source: CandidatePortSource): Promise<void> { // Must wait for the remote environment before trying to set settings there. this.remoteAgentService.getEnvironment().then(() => { switch (source) { case CandidatePortSource.None: { Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration) .registerDefaultConfigurations([{ overrides: { 'remote.autoForwardPorts': false } }]); break; } case CandidatePortSource.Output: { Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration) .registerDefaultConfigurations([{ overrides: { 'remote.autoForwardPortsSource': PORT_AUTO_SOURCE_SETTING_OUTPUT } }]); break; } default: // Do nothing, the defaults for these settings should be used. } }).catch(() => { // The remote failed to get setup. Errors from that area will already be surfaced to the user. }); } }
src/vs/workbench/api/browser/mainThreadTunnelService.ts
1
https://github.com/microsoft/vscode/commit/15d8d39815dd6fc14bb2cf9aeb17200bd5710bd5
[ 0.9992852807044983, 0.20261813700199127, 0.00016388420772273093, 0.001491639413870871, 0.3827762305736542 ]
{ "id": 1, "code_window": [ "}\n", "\n", "export interface PortAttributesSelector {\n", "\tportRange?: [number, number];\n", "\tcommandPattern?: RegExp;\n", "}\n", "\n", "export interface MainThreadTunnelServiceShape extends IDisposable {\n", "\t$openTunnel(tunnelOptions: TunnelOptions, source: string | undefined): Promise<TunnelDto | undefined>;\n" ], "labels": [ "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ], "after_edit": [ "\tportRange?: [number, number] | number;\n" ], "file_path": "src/vs/workbench/api/common/extHost.protocol.ts", "type": "replace", "edit_start_line_idx": 1000 }
"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.retry = void 0; async function retry(fn) { let lastError; for (let run = 1; run <= 10; run++) { try { return await fn(); } catch (err) { if (!/ECONNRESET|CredentialUnavailableError|Audience validation failed/i.test(err.message)) { throw err; } lastError = err; const millis = (Math.random() * 200) + (50 * Math.pow(1.5, run)); console.log(`Request failed, retrying in ${millis}ms...`); // maximum delay is 10th retry: ~3 seconds await new Promise(c => setTimeout(c, millis)); } } console.log(`Too many retries, aborting.`); throw lastError; } exports.retry = retry; //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmV0cnkuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJyZXRyeS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUE7OztnR0FHZ0c7OztBQUV6RixLQUFLLFVBQVUsS0FBSyxDQUFJLEVBQW9CO0lBQ2xELElBQUksU0FBNEIsQ0FBQztJQUVqQyxLQUFLLElBQUksR0FBRyxHQUFHLENBQUMsRUFBRSxHQUFHLElBQUksRUFBRSxFQUFFLEdBQUcsRUFBRSxFQUFFO1FBQ25DLElBQUk7WUFDSCxPQUFPLE1BQU0sRUFBRSxFQUFFLENBQUM7U0FDbEI7UUFBQyxPQUFPLEdBQUcsRUFBRTtZQUNiLElBQUksQ0FBQyxtRUFBbUUsQ0FBQyxJQUFJLENBQUMsR0FBRyxDQUFDLE9BQU8sQ0FBQyxFQUFFO2dCQUMzRixNQUFNLEdBQUcsQ0FBQzthQUNWO1lBRUQsU0FBUyxHQUFHLEdBQUcsQ0FBQztZQUNoQixNQUFNLE1BQU0sR0FBRyxDQUFDLElBQUksQ0FBQyxNQUFNLEVBQUUsR0FBRyxHQUFHLENBQUMsR0FBRyxDQUFDLEVBQUUsR0FBRyxJQUFJLENBQUMsR0FBRyxDQUFDLEdBQUcsRUFBRSxHQUFHLENBQUMsQ0FBQyxDQUFDO1lBQ2pFLE9BQU8sQ0FBQyxHQUFHLENBQUMsK0JBQStCLE1BQU0sT0FBTyxDQUFDLENBQUM7WUFFMUQsMENBQTBDO1lBQzFDLE1BQU0sSUFBSSxPQUFPLENBQUMsQ0FBQyxDQUFDLEVBQUUsQ0FBQyxVQUFVLENBQUMsQ0FBQyxFQUFFLE1BQU0sQ0FBQyxDQUFDLENBQUM7U0FDOUM7S0FDRDtJQUVELE9BQU8sQ0FBQyxHQUFHLENBQUMsNkJBQTZCLENBQUMsQ0FBQztJQUMzQyxNQUFNLFNBQVMsQ0FBQztBQUNqQixDQUFDO0FBdEJELHNCQXNCQyJ9
build/azure-pipelines/common/retry.js
0
https://github.com/microsoft/vscode/commit/15d8d39815dd6fc14bb2cf9aeb17200bd5710bd5
[ 0.0019435586873441935, 0.0007640460971742868, 0.0001722789165796712, 0.00017630061483941972, 0.0008340429631061852 ]
{ "id": 1, "code_window": [ "}\n", "\n", "export interface PortAttributesSelector {\n", "\tportRange?: [number, number];\n", "\tcommandPattern?: RegExp;\n", "}\n", "\n", "export interface MainThreadTunnelServiceShape extends IDisposable {\n", "\t$openTunnel(tunnelOptions: TunnelOptions, source: string | undefined): Promise<TunnelDto | undefined>;\n" ], "labels": [ "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ], "after_edit": [ "\tportRange?: [number, number] | number;\n" ], "file_path": "src/vs/workbench/api/common/extHost.protocol.ts", "type": "replace", "edit_start_line_idx": 1000 }
"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 }); const child_process_1 = require("child_process"); const fs_1 = require("fs"); const path = require("path"); const byline = require("byline"); const ripgrep_1 = require("@vscode/ripgrep"); const Parser = require("tree-sitter"); const node_fetch_1 = require("node-fetch"); const { typescript } = require('tree-sitter-typescript'); const product = require('../../product.json'); const packageJson = require('../../package.json'); function isNlsString(value) { return value ? typeof value !== 'string' : false; } function isStringArray(value) { return !value.some(s => isNlsString(s)); } function isNlsStringArray(value) { return value.every(s => isNlsString(s)); } var PolicyType; (function (PolicyType) { PolicyType[PolicyType["StringEnum"] = 0] = "StringEnum"; })(PolicyType || (PolicyType = {})); function renderADMLString(prefix, moduleName, nlsString, translations) { let value; if (translations) { const moduleTranslations = translations[moduleName]; if (moduleTranslations) { value = moduleTranslations[nlsString.nlsKey]; } } if (!value) { value = nlsString.value; } return `<string id="${prefix}_${nlsString.nlsKey}">${value}</string>`; } class BasePolicy { policyType; name; category; minimumVersion; description; moduleName; constructor(policyType, name, category, minimumVersion, description, moduleName) { this.policyType = policyType; this.name = name; this.category = category; this.minimumVersion = minimumVersion; this.description = description; this.moduleName = moduleName; } renderADMLString(nlsString, translations) { return renderADMLString(this.name, this.moduleName, nlsString, translations); } renderADMX(regKey) { return [ `<policy name="${this.name}" class="Both" displayName="$(string.${this.name})" explainText="$(string.${this.name}_${this.description.nlsKey})" key="Software\\Policies\\Microsoft\\${regKey}" presentation="$(presentation.${this.name})">`, ` <parentCategory ref="${this.category.name.nlsKey}" />`, ` <supportedOn ref="Supported_${this.minimumVersion.replace(/\./g, '_')}" />`, ` <elements>`, ...this.renderADMXElements(), ` </elements>`, `</policy>` ]; } renderADMLStrings(translations) { return [ `<string id="${this.name}">${this.name}</string>`, this.renderADMLString(this.description, translations) ]; } renderADMLPresentation() { return `<presentation id="${this.name}">${this.renderADMLPresentationContents()}</presentation>`; } } class BooleanPolicy extends BasePolicy { static from(name, category, minimumVersion, description, moduleName, settingNode) { const type = getStringProperty(settingNode, 'type'); if (type !== 'boolean') { return undefined; } return new BooleanPolicy(name, category, minimumVersion, description, moduleName); } constructor(name, category, minimumVersion, description, moduleName) { super(PolicyType.StringEnum, name, category, minimumVersion, description, moduleName); } renderADMXElements() { return [ `<boolean id="${this.name}" valueName="${this.name}">`, ` <trueValue><decimal value="1" /></trueValue><falseValue><decimal value="0" /></falseValue>`, `</boolean>` ]; } renderADMLPresentationContents() { return `<checkBox refId="${this.name}">${this.name}</checkBox>`; } } class IntPolicy extends BasePolicy { defaultValue; static from(name, category, minimumVersion, description, moduleName, settingNode) { const type = getStringProperty(settingNode, 'type'); if (type !== 'number') { return undefined; } const defaultValue = getIntProperty(settingNode, 'default'); if (typeof defaultValue === 'undefined') { throw new Error(`Missing required 'default' property.`); } return new IntPolicy(name, category, minimumVersion, description, moduleName, defaultValue); } constructor(name, category, minimumVersion, description, moduleName, defaultValue) { super(PolicyType.StringEnum, name, category, minimumVersion, description, moduleName); this.defaultValue = defaultValue; } renderADMXElements() { return [ `<decimal id="${this.name}" valueName="${this.name}" />` // `<decimal id="Quarantine_PurgeItemsAfterDelay" valueName="PurgeItemsAfterDelay" minValue="0" maxValue="10000000" />` ]; } renderADMLPresentationContents() { return `<decimalTextBox refId="${this.name}" defaultValue="${this.defaultValue}">${this.name}</decimalTextBox>`; } } class StringPolicy extends BasePolicy { static from(name, category, minimumVersion, description, moduleName, settingNode) { const type = getStringProperty(settingNode, 'type'); if (type !== 'string') { return undefined; } return new StringPolicy(name, category, minimumVersion, description, moduleName); } constructor(name, category, minimumVersion, description, moduleName) { super(PolicyType.StringEnum, name, category, minimumVersion, description, moduleName); } renderADMXElements() { return [`<text id="${this.name}" valueName="${this.name}" required="true" />`]; } renderADMLPresentationContents() { return `<textBox refId="${this.name}"><label>${this.name}:</label></textBox>`; } } class StringEnumPolicy extends BasePolicy { enum_; enumDescriptions; static from(name, category, minimumVersion, description, moduleName, settingNode) { const type = getStringProperty(settingNode, 'type'); if (type !== 'string') { return undefined; } const enum_ = getStringArrayProperty(settingNode, 'enum'); if (!enum_) { return undefined; } if (!isStringArray(enum_)) { throw new Error(`Property 'enum' should not be localized.`); } const enumDescriptions = getStringArrayProperty(settingNode, 'enumDescriptions'); if (!enumDescriptions) { throw new Error(`Missing required 'enumDescriptions' property.`); } else if (!isNlsStringArray(enumDescriptions)) { throw new Error(`Property 'enumDescriptions' should be localized.`); } return new StringEnumPolicy(name, category, minimumVersion, description, moduleName, enum_, enumDescriptions); } constructor(name, category, minimumVersion, description, moduleName, enum_, enumDescriptions) { super(PolicyType.StringEnum, name, category, minimumVersion, description, moduleName); this.enum_ = enum_; this.enumDescriptions = enumDescriptions; } renderADMXElements() { return [ `<enum id="${this.name}" valueName="${this.name}">`, ...this.enum_.map((value, index) => ` <item displayName="$(string.${this.name}_${this.enumDescriptions[index].nlsKey})"><value><string>${value}</string></value></item>`), `</enum>` ]; } renderADMLStrings(translations) { return [ ...super.renderADMLStrings(translations), ...this.enumDescriptions.map(e => this.renderADMLString(e, translations)) ]; } renderADMLPresentationContents() { return `<dropdownList refId="${this.name}" />`; } } const IntQ = { Q: `(number) @value`, value(matches) { const match = matches[0]; if (!match) { return undefined; } const value = match.captures.filter(c => c.name === 'value')[0]?.node.text; if (!value) { throw new Error(`Missing required 'value' property.`); } return parseInt(value); } }; const StringQ = { Q: `[ (string (string_fragment) @value) (call_expression function: (identifier) @localizeFn arguments: (arguments (string (string_fragment) @nlsKey) (string (string_fragment) @value)) (#eq? @localizeFn localize)) ]`, value(matches) { const match = matches[0]; if (!match) { return undefined; } const value = match.captures.filter(c => c.name === 'value')[0]?.node.text; if (!value) { throw new Error(`Missing required 'value' property.`); } const nlsKey = match.captures.filter(c => c.name === 'nlsKey')[0]?.node.text; if (nlsKey) { return { value, nlsKey }; } else { return value; } } }; const StringArrayQ = { Q: `(array ${StringQ.Q})`, value(matches) { if (matches.length === 0) { return undefined; } return matches.map(match => { return StringQ.value([match]); }); } }; function getProperty(qtype, node, key) { const query = new Parser.Query(typescript, `( (pair key: [(property_identifier)(string)] @key value: ${qtype.Q} ) (#eq? @key ${key}) )`); return qtype.value(query.matches(node)); } function getIntProperty(node, key) { return getProperty(IntQ, node, key); } function getStringProperty(node, key) { return getProperty(StringQ, node, key); } function getStringArrayProperty(node, key) { return getProperty(StringArrayQ, node, key); } // TODO: add more policy types const PolicyTypes = [ BooleanPolicy, IntPolicy, StringEnumPolicy, StringPolicy, ]; function getPolicy(moduleName, configurationNode, settingNode, policyNode, categories) { const name = getStringProperty(policyNode, 'name'); if (!name) { throw new Error(`Missing required 'name' property.`); } else if (isNlsString(name)) { throw new Error(`Property 'name' should be a literal string.`); } const categoryName = getStringProperty(configurationNode, 'title'); if (!categoryName) { throw new Error(`Missing required 'title' property.`); } else if (!isNlsString(categoryName)) { throw new Error(`Property 'title' should be localized.`); } const categoryKey = `${categoryName.nlsKey}:${categoryName.value}`; let category = categories.get(categoryKey); if (!category) { category = { moduleName, name: categoryName }; categories.set(categoryKey, category); } const minimumVersion = getStringProperty(policyNode, 'minimumVersion'); if (!minimumVersion) { throw new Error(`Missing required 'minimumVersion' property.`); } else if (isNlsString(minimumVersion)) { throw new Error(`Property 'minimumVersion' should be a literal string.`); } const description = getStringProperty(settingNode, 'description'); if (!description) { throw new Error(`Missing required 'description' property.`); } if (!isNlsString(description)) { throw new Error(`Property 'description' should be localized.`); } let result; for (const policyType of PolicyTypes) { if (result = policyType.from(name, category, minimumVersion, description, moduleName, settingNode)) { break; } } if (!result) { throw new Error(`Failed to parse policy '${name}'.`); } return result; } function getPolicies(moduleName, node) { const query = new Parser.Query(typescript, ` ( (call_expression function: (member_expression property: (property_identifier) @registerConfigurationFn) (#eq? @registerConfigurationFn registerConfiguration) arguments: (arguments (object (pair key: [(property_identifier)(string)] @propertiesKey (#eq? @propertiesKey properties) value: (object (pair key: [(property_identifier)(string)] value: (object (pair key: [(property_identifier)(string)] @policyKey (#eq? @policyKey policy) value: (object) @policy )) @setting )) )) @configuration) ) ) `); const categories = new Map(); return query.matches(node).map(m => { const configurationNode = m.captures.filter(c => c.name === 'configuration')[0].node; const settingNode = m.captures.filter(c => c.name === 'setting')[0].node; const policyNode = m.captures.filter(c => c.name === 'policy')[0].node; return getPolicy(moduleName, configurationNode, settingNode, policyNode, categories); }); } async function getFiles(root) { return new Promise((c, e) => { const result = []; const rg = (0, child_process_1.spawn)(ripgrep_1.rgPath, ['-l', 'registerConfiguration\\(', '-g', 'src/**/*.ts', '-g', '!src/**/test/**', root]); const stream = byline(rg.stdout.setEncoding('utf8')); stream.on('data', path => result.push(path)); stream.on('error', err => e(err)); stream.on('end', () => c(result)); }); } function renderADMX(regKey, versions, categories, policies) { versions = versions.map(v => v.replace(/\./g, '_')); return `<?xml version="1.0" encoding="utf-8"?> <policyDefinitions revision="1.1" schemaVersion="1.0"> <policyNamespaces> <target prefix="${regKey}" namespace="Microsoft.Policies.${regKey}" /> </policyNamespaces> <resources minRequiredRevision="1.0" /> <supportedOn> <definitions> ${versions.map(v => `<definition name="Supported_${v}" displayName="$(string.Supported_${v})" />`).join(`\n `)} </definitions> </supportedOn> <categories> <category displayName="$(string.Application)" name="Application" /> ${categories.map(c => `<category displayName="$(string.Category_${c.name.nlsKey})" name="${c.name.nlsKey}"><parentCategory ref="Application" /></category>`).join(`\n `)} </categories> <policies> ${policies.map(p => p.renderADMX(regKey)).flat().join(`\n `)} </policies> </policyDefinitions> `; } function renderADML(appName, versions, categories, policies, translations) { return `<?xml version="1.0" encoding="utf-8"?> <policyDefinitionResources revision="1.0" schemaVersion="1.0"> <displayName /> <description /> <resources> <stringTable> <string id="Application">${appName}</string> ${versions.map(v => `<string id="Supported_${v.replace(/\./g, '_')}">${appName} &gt;= ${v}</string>`)} ${categories.map(c => renderADMLString('Category', c.moduleName, c.name, translations))} ${policies.map(p => p.renderADMLStrings(translations)).flat().join(`\n `)} </stringTable> <presentationTable> ${policies.map(p => p.renderADMLPresentation()).join(`\n `)} </presentationTable> </resources> </policyDefinitionResources> `; } function renderGP(policies, translations) { const appName = product.nameLong; const regKey = product.win32RegValueName; const versions = [...new Set(policies.map(p => p.minimumVersion)).values()].sort(); const categories = [...new Set(policies.map(p => p.category))]; return { admx: renderADMX(regKey, versions, categories, policies), adml: [ { languageId: 'en-us', contents: renderADML(appName, versions, categories, policies) }, ...translations.map(({ languageId, languageTranslations }) => ({ languageId, contents: renderADML(appName, versions, categories, policies, languageTranslations) })) ] }; } const Languages = { 'fr': 'fr-fr', 'it': 'it-it', 'de': 'de-de', 'es': 'es-es', 'ru': 'ru-ru', 'zh-hans': 'zh-cn', 'zh-hant': 'zh-tw', 'ja': 'ja-jp', 'ko': 'ko-kr', 'cs': 'cs-cz', 'pt-br': 'pt-br', 'tr': 'tr-tr', 'pl': 'pl-pl', }; async function getSpecificNLS(resourceUrlTemplate, languageId, version) { const resource = { publisher: 'ms-ceintl', name: `vscode-language-pack-${languageId}`, version: `${version[0]}.${version[1]}.${version[2]}`, path: 'extension/translations/main.i18n.json' }; const url = resourceUrlTemplate.replace(/\{([^}]+)\}/g, (_, key) => resource[key]); const res = await (0, node_fetch_1.default)(url); if (res.status !== 200) { throw new Error(`[${res.status}] Error downloading language pack ${languageId}@${version}`); } const { contents: result } = await res.json(); return result; } function parseVersion(version) { const [, major, minor, patch] = /^(\d+)\.(\d+)\.(\d+)/.exec(version); return [parseInt(major), parseInt(minor), parseInt(patch)]; } function compareVersions(a, b) { if (a[0] !== b[0]) { return a[0] - b[0]; } if (a[1] !== b[1]) { return a[1] - b[1]; } return a[2] - b[2]; } async function queryVersions(serviceUrl, languageId) { const res = await (0, node_fetch_1.default)(`${serviceUrl}/extensionquery`, { method: 'POST', headers: { 'Accept': 'application/json;api-version=3.0-preview.1', 'Content-Type': 'application/json', 'User-Agent': 'VS Code Build', }, body: JSON.stringify({ filters: [{ criteria: [{ filterType: 7, value: `ms-ceintl.vscode-language-pack-${languageId}` }] }], flags: 0x1 }) }); if (res.status !== 200) { throw new Error(`[${res.status}] Error querying for extension: ${languageId}`); } const result = await res.json(); return result.results[0].extensions[0].versions.map(v => parseVersion(v.version)).sort(compareVersions); } async function getNLS(extensionGalleryServiceUrl, resourceUrlTemplate, languageId, version) { const versions = await queryVersions(extensionGalleryServiceUrl, languageId); const nextMinor = [version[0], version[1] + 1, 0]; const compatibleVersions = versions.filter(v => compareVersions(v, nextMinor) < 0); const latestCompatibleVersion = compatibleVersions.at(-1); // order is newest to oldest if (!latestCompatibleVersion) { throw new Error(`No compatible language pack found for ${languageId} for version ${version}`); } return await getSpecificNLS(resourceUrlTemplate, languageId, latestCompatibleVersion); } async function parsePolicies() { const parser = new Parser(); parser.setLanguage(typescript); const files = await getFiles(process.cwd()); const base = path.join(process.cwd(), 'src'); const policies = []; for (const file of files) { const moduleName = path.relative(base, file).replace(/\.ts$/i, '').replace(/\\/g, '/'); const contents = await fs_1.promises.readFile(file, { encoding: 'utf8' }); const tree = parser.parse(contents); policies.push(...getPolicies(moduleName, tree.rootNode)); } return policies; } async function getTranslations() { const extensionGalleryServiceUrl = product.extensionsGallery?.serviceUrl; if (!extensionGalleryServiceUrl) { console.warn(`Skipping policy localization: No 'extensionGallery.serviceUrl' found in 'product.json'.`); return []; } const resourceUrlTemplate = product.extensionsGallery?.resourceUrlTemplate; if (!resourceUrlTemplate) { console.warn(`Skipping policy localization: No 'resourceUrlTemplate' found in 'product.json'.`); return []; } const version = parseVersion(packageJson.version); const languageIds = Object.keys(Languages); return await Promise.all(languageIds.map(languageId => getNLS(extensionGalleryServiceUrl, resourceUrlTemplate, languageId, version) .then(languageTranslations => ({ languageId, languageTranslations })))); } async function main() { const [policies, translations] = await Promise.all([parsePolicies(), getTranslations()]); const { admx, adml } = await renderGP(policies, translations); const root = '.build/policies/win32'; await fs_1.promises.rm(root, { recursive: true, force: true }); await fs_1.promises.mkdir(root, { recursive: true }); await fs_1.promises.writeFile(path.join(root, `${product.win32RegValueName}.admx`), admx.replace(/\r?\n/g, '\n')); for (const { languageId, contents } of adml) { const languagePath = path.join(root, languageId === 'en-us' ? 'en-us' : Languages[languageId]); await fs_1.promises.mkdir(languagePath, { recursive: true }); await fs_1.promises.writeFile(path.join(languagePath, `${product.win32RegValueName}.adml`), contents.replace(/\r?\n/g, '\n')); } } if (require.main === module) { main().catch(err => { console.error(err); process.exit(1); }); } //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicG9saWNpZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJwb2xpY2llcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUE7OztnR0FHZ0c7O0FBRWhHLGlEQUFzQztBQUN0QywyQkFBb0M7QUFDcEMsNkJBQTZCO0FBQzdCLGlDQUFpQztBQUNqQyw2Q0FBeUM7QUFDekMsc0NBQXNDO0FBQ3RDLDJDQUErQjtBQUMvQixNQUFNLEVBQUUsVUFBVSxFQUFFLEdBQUcsT0FBTyxDQUFDLHdCQUF3QixDQUFDLENBQUM7QUFDekQsTUFBTSxPQUFPLEdBQUcsT0FBTyxDQUFDLG9CQUFvQixDQUFDLENBQUM7QUFDOUMsTUFBTSxXQUFXLEdBQUcsT0FBTyxDQUFDLG9CQUFvQixDQUFDLENBQUM7QUFJbEQsU0FBUyxXQUFXLENBQUMsS0FBcUM7SUFDekQsT0FBTyxLQUFLLENBQUMsQ0FBQyxDQUFDLE9BQU8sS0FBSyxLQUFLLFFBQVEsQ0FBQyxDQUFDLENBQUMsS0FBSyxDQUFDO0FBQ2xELENBQUM7QUFFRCxTQUFTLGFBQWEsQ0FBQyxLQUE2QjtJQUNuRCxPQUFPLENBQUMsS0FBSyxDQUFDLElBQUksQ0FBQyxDQUFDLENBQUMsRUFBRSxDQUFDLFdBQVcsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDO0FBQ3pDLENBQUM7QUFFRCxTQUFTLGdCQUFnQixDQUFDLEtBQTZCO0lBQ3RELE9BQU8sS0FBSyxDQUFDLEtBQUssQ0FBQyxDQUFDLENBQUMsRUFBRSxDQUFDLFdBQVcsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDO0FBQ3pDLENBQUM7QUFPRCxJQUFLLFVBRUo7QUFGRCxXQUFLLFVBQVU7SUFDZCx1REFBVSxDQUFBO0FBQ1gsQ0FBQyxFQUZJLFVBQVUsS0FBVixVQUFVLFFBRWQ7QUFVRCxTQUFTLGdCQUFnQixDQUFDLE1BQWMsRUFBRSxVQUFrQixFQUFFLFNBQW9CLEVBQUUsWUFBbUM7SUFDdEgsSUFBSSxLQUF5QixDQUFDO0lBRTlCLElBQUksWUFBWSxFQUFFO1FBQ2pCLE1BQU0sa0JBQWtCLEdBQUcsWUFBWSxDQUFDLFVBQVUsQ0FBQyxDQUFDO1FBRXBELElBQUksa0JBQWtCLEVBQUU7WUFDdkIsS0FBSyxHQUFHLGtCQUFrQixDQUFDLFNBQVMsQ0FBQyxNQUFNLENBQUMsQ0FBQztTQUM3QztLQUNEO0lBRUQsSUFBSSxDQUFDLEtBQUssRUFBRTtRQUNYLEtBQUssR0FBRyxTQUFTLENBQUMsS0FBSyxDQUFDO0tBQ3hCO0lBRUQsT0FBTyxlQUFlLE1BQU0sSUFBSSxTQUFTLENBQUMsTUFBTSxLQUFLLEtBQUssV0FBVyxDQUFDO0FBQ3ZFLENBQUM7QUFFRCxNQUFlLFVBQVU7SUFFYjtJQUNBO0lBQ0Q7SUFDQTtJQUNDO0lBQ0E7SUFOWCxZQUNXLFVBQXNCLEVBQ3RCLElBQVksRUFDYixRQUFrQixFQUNsQixjQUFzQixFQUNyQixXQUFzQixFQUN0QixVQUFrQjtRQUxsQixlQUFVLEdBQVYsVUFBVSxDQUFZO1FBQ3RCLFNBQUksR0FBSixJQUFJLENBQVE7UUFDYixhQUFRLEdBQVIsUUFBUSxDQUFVO1FBQ2xCLG1CQUFjLEdBQWQsY0FBYyxDQUFRO1FBQ3JCLGdCQUFXLEdBQVgsV0FBVyxDQUFXO1FBQ3RCLGVBQVUsR0FBVixVQUFVLENBQVE7SUFDekIsQ0FBQztJQUVLLGdCQUFnQixDQUFDLFNBQW9CLEVBQUUsWUFBbUM7UUFDbkYsT0FBTyxnQkFBZ0IsQ0FBQyxJQUFJLENBQUMsSUFBSSxFQUFFLElBQUksQ0FBQyxVQUFVLEVBQUUsU0FBUyxFQUFFLFlBQVksQ0FBQyxDQUFDO0lBQzlFLENBQUM7SUFFRCxVQUFVLENBQUMsTUFBYztRQUN4QixPQUFPO1lBQ04saUJBQWlCLElBQUksQ0FBQyxJQUFJLHdDQUF3QyxJQUFJLENBQUMsSUFBSSw0QkFBNEIsSUFBSSxDQUFDLElBQUksSUFBSSxJQUFJLENBQUMsV0FBVyxDQUFDLE1BQU0sMENBQTBDLE1BQU0sa0NBQWtDLElBQUksQ0FBQyxJQUFJLEtBQUs7WUFDM08seUJBQXlCLElBQUksQ0FBQyxRQUFRLENBQUMsSUFBSSxDQUFDLE1BQU0sTUFBTTtZQUN4RCxnQ0FBZ0MsSUFBSSxDQUFDLGNBQWMsQ0FBQyxPQUFPLENBQUMsS0FBSyxFQUFFLEdBQUcsQ0FBQyxNQUFNO1lBQzdFLGFBQWE7WUFDYixHQUFHLElBQUksQ0FBQyxrQkFBa0IsRUFBRTtZQUM1QixjQUFjO1lBQ2QsV0FBVztTQUNYLENBQUM7SUFDSCxDQUFDO0lBSUQsaUJBQWlCLENBQUMsWUFBbUM7UUFDcEQsT0FBTztZQUNOLGVBQWUsSUFBSSxDQUFDLElBQUksS0FBSyxJQUFJLENBQUMsSUFBSSxXQUFXO1lBQ2pELElBQUksQ0FBQyxnQkFBZ0IsQ0FBQyxJQUFJLENBQUMsV0FBVyxFQUFFLFlBQVksQ0FBQztTQUNyRCxDQUFDO0lBQ0gsQ0FBQztJQUVELHNCQUFzQjtRQUNyQixPQUFPLHFCQUFxQixJQUFJLENBQUMsSUFBSSxLQUFLLElBQUksQ0FBQyw4QkFBOEIsRUFBRSxpQkFBaUIsQ0FBQztJQUNsRyxDQUFDO0NBR0Q7QUFFRCxNQUFNLGFBQWMsU0FBUSxVQUFVO0lBRXJDLE1BQU0sQ0FBQyxJQUFJLENBQ1YsSUFBWSxFQUNaLFFBQWtCLEVBQ2xCLGNBQXNCLEVBQ3RCLFdBQXNCLEVBQ3RCLFVBQWtCLEVBQ2xCLFdBQThCO1FBRTlCLE1BQU0sSUFBSSxHQUFHLGlCQUFpQixDQUFDLFdBQVcsRUFBRSxNQUFNLENBQUMsQ0FBQztRQUVwRCxJQUFJLElBQUksS0FBSyxTQUFTLEVBQUU7WUFDdkIsT0FBTyxTQUFTLENBQUM7U0FDakI7UUFFRCxPQUFPLElBQUksYUFBYSxDQUFDLElBQUksRUFBRSxRQUFRLEVBQUUsY0FBYyxFQUFFLFdBQVcsRUFBRSxVQUFVLENBQUMsQ0FBQztJQUNuRixDQUFDO0lBRUQsWUFDQyxJQUFZLEVBQ1osUUFBa0IsRUFDbEIsY0FBc0IsRUFDdEIsV0FBc0IsRUFDdEIsVUFBa0I7UUFFbEIsS0FBSyxDQUFDLFVBQVUsQ0FBQyxVQUFVLEVBQUUsSUFBSSxFQUFFLFFBQVEsRUFBRSxjQUFjLEVBQUUsV0FBVyxFQUFFLFVBQVUsQ0FBQyxDQUFDO0lBQ3ZGLENBQUM7SUFFUyxrQkFBa0I7UUFDM0IsT0FBTztZQUNOLGdCQUFnQixJQUFJLENBQUMsSUFBSSxnQkFBZ0IsSUFBSSxDQUFDLElBQUksSUFBSTtZQUN0RCw2RkFBNkY7WUFDN0YsWUFBWTtTQUNaLENBQUM7SUFDSCxDQUFDO0lBRUQsOEJBQThCO1FBQzdCLE9BQU8sb0JBQW9CLElBQUksQ0FBQyxJQUFJLEtBQUssSUFBSSxDQUFDLElBQUksYUFBYSxDQUFDO0lBQ2pFLENBQUM7Q0FDRDtBQUVELE1BQU0sU0FBVSxTQUFRLFVBQVU7SUErQmI7SUE3QnBCLE1BQU0sQ0FBQyxJQUFJLENBQ1YsSUFBWSxFQUNaLFFBQWtCLEVBQ2xCLGNBQXNCLEVBQ3RCLFdBQXNCLEVBQ3RCLFVBQWtCLEVBQ2xCLFdBQThCO1FBRTlCLE1BQU0sSUFBSSxHQUFHLGlCQUFpQixDQUFDLFdBQVcsRUFBRSxNQUFNLENBQUMsQ0FBQztRQUVwRCxJQUFJLElBQUksS0FBSyxRQUFRLEVBQUU7WUFDdEIsT0FBTyxTQUFTLENBQUM7U0FDakI7UUFFRCxNQUFNLFlBQVksR0FBRyxjQUFjLENBQUMsV0FBVyxFQUFFLFNBQVMsQ0FBQyxDQUFDO1FBRTVELElBQUksT0FBTyxZQUFZLEtBQUssV0FBVyxFQUFFO1lBQ3hDLE1BQU0sSUFBSSxLQUFLLENBQUMsc0NBQXNDLENBQUMsQ0FBQztTQUN4RDtRQUVELE9BQU8sSUFBSSxTQUFTLENBQUMsSUFBSSxFQUFFLFFBQVEsRUFBRSxjQUFjLEVBQUUsV0FBVyxFQUFFLFVBQVUsRUFBRSxZQUFZLENBQUMsQ0FBQztJQUM3RixDQUFDO0lBRUQsWUFDQyxJQUFZLEVBQ1osUUFBa0IsRUFDbEIsY0FBc0IsRUFDdEIsV0FBc0IsRUFDdEIsVUFBa0IsRUFDQyxZQUFvQjtRQUV2QyxLQUFLLENBQUMsVUFBVSxDQUFDLFVBQVUsRUFBRSxJQUFJLEVBQUUsUUFBUSxFQUFFLGNBQWMsRUFBRSxXQUFXLEVBQUUsVUFBVSxDQUFDLENBQUM7UUFGbkUsaUJBQVksR0FBWixZQUFZLENBQVE7SUFHeEMsQ0FBQztJQUVTLGtCQUFrQjtRQUMzQixPQUFPO1lBQ04sZ0JBQWdCLElBQUksQ0FBQyxJQUFJLGdCQUFnQixJQUFJLENBQUMsSUFBSSxNQUFNO1lBQ3hELHVIQUF1SDtTQUN2SCxDQUFDO0lBQ0gsQ0FBQztJQUVELDhCQUE4QjtRQUM3QixPQUFPLDBCQUEwQixJQUFJLENBQUMsSUFBSSxtQkFBbUIsSUFBSSxDQUFDLFlBQVksS0FBSyxJQUFJLENBQUMsSUFBSSxtQkFBbUIsQ0FBQztJQUNqSCxDQUFDO0NBQ0Q7QUFFRCxNQUFNLFlBQWEsU0FBUSxVQUFVO0lBRXBDLE1BQU0sQ0FBQyxJQUFJLENBQ1YsSUFBWSxFQUNaLFFBQWtCLEVBQ2xCLGNBQXNCLEVBQ3RCLFdBQXNCLEVBQ3RCLFVBQWtCLEVBQ2xCLFdBQThCO1FBRTlCLE1BQU0sSUFBSSxHQUFHLGlCQUFpQixDQUFDLFdBQVcsRUFBRSxNQUFNLENBQUMsQ0FBQztRQUVwRCxJQUFJLElBQUksS0FBSyxRQUFRLEVBQUU7WUFDdEIsT0FBTyxTQUFTLENBQUM7U0FDakI7UUFFRCxPQUFPLElBQUksWUFBWSxDQUFDLElBQUksRUFBRSxRQUFRLEVBQUUsY0FBYyxFQUFFLFdBQVcsRUFBRSxVQUFVLENBQUMsQ0FBQztJQUNsRixDQUFDO0lBRUQsWUFDQyxJQUFZLEVBQ1osUUFBa0IsRUFDbEIsY0FBc0IsRUFDdEIsV0FBc0IsRUFDdEIsVUFBa0I7UUFFbEIsS0FBSyxDQUFDLFVBQVUsQ0FBQyxVQUFVLEVBQUUsSUFBSSxFQUFFLFFBQVEsRUFBRSxjQUFjLEVBQUUsV0FBVyxFQUFFLFVBQVUsQ0FBQyxDQUFDO0lBQ3ZGLENBQUM7SUFFUyxrQkFBa0I7UUFDM0IsT0FBTyxDQUFDLGFBQWEsSUFBSSxDQUFDLElBQUksZ0JBQWdCLElBQUksQ0FBQyxJQUFJLHNCQUFzQixDQUFDLENBQUM7SUFDaEYsQ0FBQztJQUVELDhCQUE4QjtRQUM3QixPQUFPLG1CQUFtQixJQUFJLENBQUMsSUFBSSxZQUFZLElBQUksQ0FBQyxJQUFJLHFCQUFxQixDQUFDO0lBQy9FLENBQUM7Q0FDRDtBQUVELE1BQU0sZ0JBQWlCLFNBQVEsVUFBVTtJQTJDN0I7SUFDQTtJQTFDWCxNQUFNLENBQUMsSUFBSSxDQUNWLElBQVksRUFDWixRQUFrQixFQUNsQixjQUFzQixFQUN0QixXQUFzQixFQUN0QixVQUFrQixFQUNsQixXQUE4QjtRQUU5QixNQUFNLElBQUksR0FBRyxpQkFBaUIsQ0FBQyxXQUFXLEVBQUUsTUFBTSxDQUFDLENBQUM7UUFFcEQsSUFBSSxJQUFJLEtBQUssUUFBUSxFQUFFO1lBQ3RCLE9BQU8sU0FBUyxDQUFDO1NBQ2pCO1FBRUQsTUFBTSxLQUFLLEdBQUcsc0JBQXNCLENBQUMsV0FBVyxFQUFFLE1BQU0sQ0FBQyxDQUFDO1FBRTFELElBQUksQ0FBQyxLQUFLLEVBQUU7WUFDWCxPQUFPLFNBQVMsQ0FBQztTQUNqQjtRQUVELElBQUksQ0FBQyxhQUFhLENBQUMsS0FBSyxDQUFDLEVBQUU7WUFDMUIsTUFBTSxJQUFJLEtBQUssQ0FBQywwQ0FBMEMsQ0FBQyxDQUFDO1NBQzVEO1FBRUQsTUFBTSxnQkFBZ0IsR0FBRyxzQkFBc0IsQ0FBQyxXQUFXLEVBQUUsa0JBQWtCLENBQUMsQ0FBQztRQUVqRixJQUFJLENBQUMsZ0JBQWdCLEVBQUU7WUFDdEIsTUFBTSxJQUFJLEtBQUssQ0FBQywrQ0FBK0MsQ0FBQyxDQUFDO1NBQ2pFO2FBQU0sSUFBSSxDQUFDLGdCQUFnQixDQUFDLGdCQUFnQixDQUFDLEVBQUU7WUFDL0MsTUFBTSxJQUFJLEtBQUssQ0FBQyxrREFBa0QsQ0FBQyxDQUFDO1NBQ3BFO1FBRUQsT0FBTyxJQUFJLGdCQUFnQixDQUFDLElBQUksRUFBRSxRQUFRLEVBQUUsY0FBYyxFQUFFLFdBQVcsRUFBRSxVQUFVLEVBQUUsS0FBSyxFQUFFLGdCQUFnQixDQUFDLENBQUM7SUFDL0csQ0FBQztJQUVELFlBQ0MsSUFBWSxFQUNaLFFBQWtCLEVBQ2xCLGNBQXNCLEVBQ3RCLFdBQXNCLEVBQ3RCLFVBQWtCLEVBQ1IsS0FBZSxFQUNmLGdCQUE2QjtRQUV2QyxLQUFLLENBQUMsVUFBVSxDQUFDLFVBQVUsRUFBRSxJQUFJLEVBQUUsUUFBUSxFQUFFLGNBQWMsRUFBRSxXQUFXLEVBQUUsVUFBVSxDQUFDLENBQUM7UUFINUUsVUFBSyxHQUFMLEtBQUssQ0FBVTtRQUNmLHFCQUFnQixHQUFoQixnQkFBZ0IsQ0FBYTtJQUd4QyxDQUFDO0lBRVMsa0JBQWtCO1FBQzNCLE9BQU87WUFDTixhQUFhLElBQUksQ0FBQyxJQUFJLGdCQUFnQixJQUFJLENBQUMsSUFBSSxJQUFJO1lBQ25ELEdBQUcsSUFBSSxDQUFDLEtBQUssQ0FBQyxHQUFHLENBQUMsQ0FBQyxLQUFLLEVBQUUsS0FBSyxFQUFFLEVBQUUsQ0FBQyxnQ0FBZ0MsSUFBSSxDQUFDLElBQUksSUFBSSxJQUFJLENBQUMsZ0JBQWdCLENBQUMsS0FBSyxDQUFDLENBQUMsTUFBTSxxQkFBcUIsS0FBSywwQkFBMEIsQ0FBQztZQUN6SyxTQUFTO1NBQ1QsQ0FBQztJQUNILENBQUM7SUFFRCxpQkFBaUIsQ0FBQyxZQUFtQztRQUNwRCxPQUFPO1lBQ04sR0FBRyxLQUFLLENBQUMsaUJBQWlCLENBQUMsWUFBWSxDQUFDO1lBQ3hDLEdBQUcsSUFBSSxDQUFDLGdCQUFnQixDQUFDLEdBQUcsQ0FBQyxDQUFDLENBQUMsRUFBRSxDQUFDLElBQUksQ0FBQyxnQkFBZ0IsQ0FBQyxDQUFDLEVBQUUsWUFBWSxDQUFDLENBQUM7U0FDekUsQ0FBQztJQUNILENBQUM7SUFFRCw4QkFBOEI7UUFDN0IsT0FBTyx3QkFBd0IsSUFBSSxDQUFDLElBQUksTUFBTSxDQUFDO0lBQ2hELENBQUM7Q0FDRDtBQU9ELE1BQU0sSUFBSSxHQUFrQjtJQUMzQixDQUFDLEVBQUUsaUJBQWlCO0lBRXBCLEtBQUssQ0FBQyxPQUE0QjtRQUNqQyxNQUFNLEtBQUssR0FBRyxPQUFPLENBQUMsQ0FBQyxDQUFDLENBQUM7UUFFekIsSUFBSSxDQUFDLEtBQUssRUFBRTtZQUNYLE9BQU8sU0FBUyxDQUFDO1NBQ2pCO1FBRUQsTUFBTSxLQUFLLEdBQUcsS0FBSyxDQUFDLFFBQVEsQ0FBQyxNQUFNLENBQUMsQ0FBQyxDQUFDLEVBQUUsQ0FBQyxDQUFDLENBQUMsSUFBSSxLQUFLLE9BQU8sQ0FBQyxDQUFDLENBQUMsQ0FBQyxFQUFFLElBQUksQ0FBQyxJQUFJLENBQUM7UUFFM0UsSUFBSSxDQUFDLEtBQUssRUFBRTtZQUNYLE1BQU0sSUFBSSxLQUFLLENBQUMsb0NBQW9DLENBQUMsQ0FBQztTQUN0RDtRQUVELE9BQU8sUUFBUSxDQUFDLEtBQUssQ0FBQyxDQUFDO0lBQ3hCLENBQUM7Q0FDRCxDQUFDO0FBRUYsTUFBTSxPQUFPLEdBQThCO0lBQzFDLENBQUMsRUFBRTs7O0dBR0Q7SUFFRixLQUFLLENBQUMsT0FBNEI7UUFDakMsTUFBTSxLQUFLLEdBQUcsT0FBTyxDQUFDLENBQUMsQ0FBQyxDQUFDO1FBRXpCLElBQUksQ0FBQyxLQUFLLEVBQUU7WUFDWCxPQUFPLFNBQVMsQ0FBQztTQUNqQjtRQUVELE1BQU0sS0FBSyxHQUFHLEtBQUssQ0FBQyxRQUFRLENBQUMsTUFBTSxDQUFDLENBQUMsQ0FBQyxFQUFFLENBQUMsQ0FBQyxDQUFDLElBQUksS0FBSyxPQUFPLENBQUMsQ0FBQyxDQUFDLENBQUMsRUFBRSxJQUFJLENBQUMsSUFBSSxDQUFDO1FBRTNFLElBQUksQ0FBQyxLQUFLLEVBQUU7WUFDWCxNQUFNLElBQUksS0FBSyxDQUFDLG9DQUFvQyxDQUFDLENBQUM7U0FDdEQ7UUFFRCxNQUFNLE1BQU0sR0FBRyxLQUFLLENBQUMsUUFBUSxDQUFDLE1BQU0sQ0FBQyxDQUFDLENBQUMsRUFBRSxDQUFDLENBQUMsQ0FBQyxJQUFJLEtBQUssUUFBUSxDQUFDLENBQUMsQ0FBQyxDQUFDLEVBQUUsSUFBSSxDQUFDLElBQUksQ0FBQztRQUU3RSxJQUFJLE1BQU0sRUFBRTtZQUNYLE9BQU8sRUFBRSxLQUFLLEVBQUUsTUFBTSxFQUFFLENBQUM7U0FDekI7YUFBTTtZQUNOLE9BQU8sS0FBSyxDQUFDO1NBQ2I7SUFDRixDQUFDO0NBQ0QsQ0FBQztBQUVGLE1BQU0sWUFBWSxHQUFrQztJQUNuRCxDQUFDLEVBQUUsVUFBVSxPQUFPLENBQUMsQ0FBQyxHQUFHO0lBRXpCLEtBQUssQ0FBQyxPQUE0QjtRQUNqQyxJQUFJLE9BQU8sQ0FBQyxNQUFNLEtBQUssQ0FBQyxFQUFFO1lBQ3pCLE9BQU8sU0FBUyxDQUFDO1NBQ2pCO1FBRUQsT0FBTyxPQUFPLENBQUMsR0FBRyxDQUFDLEtBQUssQ0FBQyxFQUFFO1lBQzFCLE9BQU8sT0FBTyxDQUFDLEtBQUssQ0FBQyxDQUFDLEtBQUssQ0FBQyxDQUF1QixDQUFDO1FBQ3JELENBQUMsQ0FBQyxDQUFDO0lBQ0osQ0FBQztDQUNELENBQUM7QUFFRixTQUFTLFdBQVcsQ0FBSSxLQUFlLEVBQUUsSUFBdUIsRUFBRSxHQUFXO0lBQzVFLE1BQU0sS0FBSyxHQUFHLElBQUksTUFBTSxDQUFDLEtBQUssQ0FDN0IsVUFBVSxFQUNWOzs7YUFHVyxLQUFLLENBQUMsQ0FBQzs7Z0JBRUosR0FBRztJQUNmLENBQ0YsQ0FBQztJQUVGLE9BQU8sS0FBSyxDQUFDLEtBQUssQ0FBQyxLQUFLLENBQUMsT0FBTyxDQUFDLElBQUksQ0FBQyxDQUFDLENBQUM7QUFDekMsQ0FBQztBQUVELFNBQVMsY0FBYyxDQUFDLElBQXVCLEVBQUUsR0FBVztJQUMzRCxPQUFPLFdBQVcsQ0FBQyxJQUFJLEVBQUUsSUFBSSxFQUFFLEdBQUcsQ0FBQyxDQUFDO0FBQ3JDLENBQUM7QUFFRCxTQUFTLGlCQUFpQixDQUFDLElBQXVCLEVBQUUsR0FBVztJQUM5RCxPQUFPLFdBQVcsQ0FBQyxPQUFPLEVBQUUsSUFBSSxFQUFFLEdBQUcsQ0FBQyxDQUFDO0FBQ3hDLENBQUM7QUFFRCxTQUFTLHNCQUFzQixDQUFDLElBQXVCLEVBQUUsR0FBVztJQUNuRSxPQUFPLFdBQVcsQ0FBQyxZQUFZLEVBQUUsSUFBSSxFQUFFLEdBQUcsQ0FBQyxDQUFDO0FBQzdDLENBQUM7QUFFRCw4QkFBOEI7QUFDOUIsTUFBTSxXQUFXLEdBQUc7SUFDbkIsYUFBYTtJQUNiLFNBQVM7SUFDVCxnQkFBZ0I7SUFDaEIsWUFBWTtDQUNaLENBQUM7QUFFRixTQUFTLFNBQVMsQ0FDakIsVUFBa0IsRUFDbEIsaUJBQW9DLEVBQ3BDLFdBQThCLEVBQzlCLFVBQTZCLEVBQzdCLFVBQWlDO0lBRWpDLE1BQU0sSUFBSSxHQUFHLGlCQUFpQixDQUFDLFVBQVUsRUFBRSxNQUFNLENBQUMsQ0FBQztJQUVuRCxJQUFJLENBQUMsSUFBSSxFQUFFO1FBQ1YsTUFBTSxJQUFJLEtBQUssQ0FBQyxtQ0FBbUMsQ0FBQyxDQUFDO0tBQ3JEO1NBQU0sSUFBSSxXQUFXLENBQUMsSUFBSSxDQUFDLEVBQUU7UUFDN0IsTUFBTSxJQUFJLEtBQUssQ0FBQyw2Q0FBNkMsQ0FBQyxDQUFDO0tBQy9EO0lBRUQsTUFBTSxZQUFZLEdBQUcsaUJBQWlCLENBQUMsaUJBQWlCLEVBQUUsT0FBTyxDQUFDLENBQUM7SUFFbkUsSUFBSSxDQUFDLFlBQVksRUFBRTtRQUNsQixNQUFNLElBQUksS0FBSyxDQUFDLG9DQUFvQyxDQUFDLENBQUM7S0FDdEQ7U0FBTSxJQUFJLENBQUMsV0FBVyxDQUFDLFlBQVksQ0FBQyxFQUFFO1FBQ3RDLE1BQU0sSUFBSSxLQUFLLENBQUMsdUNBQXVDLENBQUMsQ0FBQztLQUN6RDtJQUVELE1BQU0sV0FBVyxHQUFHLEdBQUcsWUFBWSxDQUFDLE1BQU0sSUFBSSxZQUFZLENBQUMsS0FBSyxFQUFFLENBQUM7SUFDbkUsSUFBSSxRQUFRLEdBQUcsVUFBVSxDQUFDLEdBQUcsQ0FBQyxXQUFXLENBQUMsQ0FBQztJQUUzQyxJQUFJLENBQUMsUUFBUSxFQUFFO1FBQ2QsUUFBUSxHQUFHLEVBQUUsVUFBVSxFQUFFLElBQUksRUFBRSxZQUFZLEVBQUUsQ0FBQztRQUM5QyxVQUFVLENBQUMsR0FBRyxDQUFDLFdBQVcsRUFBRSxRQUFRLENBQUMsQ0FBQztLQUN0QztJQUVELE1BQU0sY0FBYyxHQUFHLGlCQUFpQixDQUFDLFVBQVUsRUFBRSxnQkFBZ0IsQ0FBQyxDQUFDO0lBRXZFLElBQUksQ0FBQyxjQUFjLEVBQUU7UUFDcEIsTUFBTSxJQUFJLEtBQUssQ0FBQyw2Q0FBNkMsQ0FBQyxDQUFDO0tBQy9EO1NBQU0sSUFBSSxXQUFXLENBQUMsY0FBYyxDQUFDLEVBQUU7UUFDdkMsTUFBTSxJQUFJLEtBQUssQ0FBQyx1REFBdUQsQ0FBQyxDQUFDO0tBQ3pFO0lBRUQsTUFBTSxXQUFXLEdBQUcsaUJBQWlCLENBQUMsV0FBVyxFQUFFLGFBQWEsQ0FBQyxDQUFDO0lBRWxFLElBQUksQ0FBQyxXQUFXLEVBQUU7UUFDakIsTUFBTSxJQUFJLEtBQUssQ0FBQywwQ0FBMEMsQ0FBQyxDQUFDO0tBQzVEO0lBQUMsSUFBSSxDQUFDLFdBQVcsQ0FBQyxXQUFXLENBQUMsRUFBRTtRQUNoQyxNQUFNLElBQUksS0FBSyxDQUFDLDZDQUE2QyxDQUFDLENBQUM7S0FDL0Q7SUFFRCxJQUFJLE1BQTBCLENBQUM7SUFFL0IsS0FBSyxNQUFNLFVBQVUsSUFBSSxXQUFXLEVBQUU7UUFDckMsSUFBSSxNQUFNLEdBQUcsVUFBVSxDQUFDLElBQUksQ0FBQyxJQUFJLEVBQUUsUUFBUSxFQUFFLGNBQWMsRUFBRSxXQUFXLEVBQUUsVUFBVSxFQUFFLFdBQVcsQ0FBQyxFQUFFO1lBQ25HLE1BQU07U0FDTjtLQUNEO0lBRUQsSUFBSSxDQUFDLE1BQU0sRUFBRTtRQUNaLE1BQU0sSUFBSSxLQUFLLENBQUMsMkJBQTJCLElBQUksSUFBSSxDQUFDLENBQUM7S0FDckQ7SUFFRCxPQUFPLE1BQU0sQ0FBQztBQUNmLENBQUM7QUFFRCxTQUFTLFdBQVcsQ0FBQyxVQUFrQixFQUFFLElBQXVCO0lBQy9ELE1BQU0sS0FBSyxHQUFHLElBQUksTUFBTSxDQUFDLEtBQUssQ0FBQyxVQUFVLEVBQUU7Ozs7Ozs7Ozs7Ozs7Ozs7RUFnQjFDLENBQUMsQ0FBQztJQUVILE1BQU0sVUFBVSxHQUFHLElBQUksR0FBRyxFQUFvQixDQUFDO0lBRS9DLE9BQU8sS0FBSyxDQUFDLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FBQyxHQUFHLENBQUMsQ0FBQyxDQUFDLEVBQUU7UUFDbEMsTUFBTSxpQkFBaUIsR0FBRyxDQUFDLENBQUMsUUFBUSxDQUFDLE1BQU0sQ0FBQyxDQUFDLENBQUMsRUFBRSxDQUFDLENBQUMsQ0FBQyxJQUFJLEtBQUssZUFBZSxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUMsSUFBSSxDQUFDO1FBQ3JGLE1BQU0sV0FBVyxHQUFHLENBQUMsQ0FBQyxRQUFRLENBQUMsTUFBTSxDQUFDLENBQUMsQ0FBQyxFQUFFLENBQUMsQ0FBQyxDQUFDLElBQUksS0FBSyxTQUFTLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxJQUFJLENBQUM7UUFDekUsTUFBTSxVQUFVLEdBQUcsQ0FBQyxDQUFDLFFBQVEsQ0FBQyxNQUFNLENBQUMsQ0FBQyxDQUFDLEVBQUUsQ0FBQyxDQUFDLENBQUMsSUFBSSxLQUFLLFFBQVEsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDLElBQUksQ0FBQztRQUN2RSxPQUFPLFNBQVMsQ0FBQyxVQUFVLEVBQUUsaUJBQWlCLEVBQUUsV0FBVyxFQUFFLFVBQVUsRUFBRSxVQUFVLENBQUMsQ0FBQztJQUN0RixDQUFDLENBQUMsQ0FBQztBQUNKLENBQUM7QUFFRCxLQUFLLFVBQVUsUUFBUSxDQUFDLElBQVk7SUFDbkMsT0FBTyxJQUFJLE9BQU8sQ0FBQyxDQUFDLENBQUMsRUFBRSxDQUFDLEVBQUUsRUFBRTtRQUMzQixNQUFNLE1BQU0sR0FBYSxFQUFFLENBQUM7UUFDNUIsTUFBTSxFQUFFLEdBQUcsSUFBQSxxQkFBSyxFQUFDLGdCQUFNLEVBQUUsQ0FBQyxJQUFJLEVBQUUsMEJBQTBCLEVBQUUsSUFBSSxFQUFFLGFBQWEsRUFBRSxJQUFJLEVBQUUsaUJBQWlCLEVBQUUsSUFBSSxDQUFDLENBQUMsQ0FBQztRQUNqSCxNQUFNLE1BQU0sR0FBRyxNQUFNLENBQUMsRUFBRSxDQUFDLE1BQU0sQ0FBQyxXQUFXLENBQUMsTUFBTSxDQUFDLENBQUMsQ0FBQztRQUNyRCxNQUFNLENBQUMsRUFBRSxDQUFDLE1BQU0sRUFBRSxJQUFJLENBQUMsRUFBRSxDQUFDLE1BQU0sQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUFDLENBQUMsQ0FBQztRQUM3QyxNQUFNLENBQUMsRUFBRSxDQUFDLE9BQU8sRUFBRSxHQUFHLENBQUMsRUFBRSxDQUFDLENBQUMsQ0FBQyxHQUFHLENBQUMsQ0FBQyxDQUFDO1FBQ2xDLE1BQU0sQ0FBQyxFQUFFLENBQUMsS0FBSyxFQUFFLEdBQUcsRUFBRSxDQUFDLENBQUMsQ0FBQyxNQUFNLENBQUMsQ0FBQyxDQUFDO0lBQ25DLENBQUMsQ0FBQyxDQUFDO0FBQ0osQ0FBQztBQUVELFNBQVMsVUFBVSxDQUFDLE1BQWMsRUFBRSxRQUFrQixFQUFFLFVBQXNCLEVBQUUsUUFBa0I7SUFDakcsUUFBUSxHQUFHLFFBQVEsQ0FBQyxHQUFHLENBQUMsQ0FBQyxDQUFDLEVBQUUsQ0FBQyxDQUFDLENBQUMsT0FBTyxDQUFDLEtBQUssRUFBRSxHQUFHLENBQUMsQ0FBQyxDQUFDO0lBRXBELE9BQU87OztvQkFHWSxNQUFNLG1DQUFtQyxNQUFNOzs7OztLQUs5RCxRQUFRLENBQUMsR0FBRyxDQUFDLENBQUMsQ0FBQyxFQUFFLENBQUMsK0JBQStCLENBQUMscUNBQXFDLENBQUMsT0FBTyxDQUFDLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQzs7Ozs7SUFLL0csVUFBVSxDQUFDLEdBQUcsQ0FBQyxDQUFDLENBQUMsRUFBRSxDQUFDLDRDQUE0QyxDQUFDLENBQUMsSUFBSSxDQUFDLE1BQU0sWUFBWSxDQUFDLENBQUMsSUFBSSxDQUFDLE1BQU0sbURBQW1ELENBQUMsQ0FBQyxJQUFJLENBQUMsTUFBTSxDQUFDOzs7SUFHdkssUUFBUSxDQUFDLEdBQUcsQ0FBQyxDQUFDLENBQUMsRUFBRSxDQUFDLENBQUMsQ0FBQyxVQUFVLENBQUMsTUFBTSxDQUFDLENBQUMsQ0FBQyxJQUFJLEVBQUUsQ0FBQyxJQUFJLENBQUMsTUFBTSxDQUFDOzs7Q0FHOUQsQ0FBQztBQUNGLENBQUM7QUFFRCxTQUFTLFVBQVUsQ0FBQyxPQUFlLEVBQUUsUUFBa0IsRUFBRSxVQUFzQixFQUFFLFFBQWtCLEVBQUUsWUFBbUM7SUFDdkksT0FBTzs7Ozs7OzhCQU1zQixPQUFPO0tBQ2hDLFFBQVEsQ0FBQyxHQUFHLENBQUMsQ0FBQyxDQUFDLEVBQUUsQ0FBQyx5QkFBeUIsQ0FBQyxDQUFDLE9BQU8sQ0FBQyxLQUFLLEVBQUUsR0FBRyxDQUFDLEtBQUssT0FBTyxVQUFVLENBQUMsV0FBVyxDQUFDO0tBQ25HLFVBQVUsQ0FBQyxHQUFHLENBQUMsQ0FBQyxDQUFDLEVBQUUsQ0FBQyxnQkFBZ0IsQ0FBQyxVQUFVLEVBQUUsQ0FBQyxDQUFDLFVBQVUsRUFBRSxDQUFDLENBQUMsSUFBSSxFQUFFLFlBQVksQ0FBQyxDQUFDO0tBQ3JGLFFBQVEsQ0FBQyxHQUFHLENBQUMsQ0FBQyxDQUFDLEVBQUUsQ0FBQyxDQUFDLENBQUMsaUJBQWlCLENBQUMsWUFBWSxDQUFDLENBQUMsQ0FBQyxJQUFJLEVBQUUsQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFDOzs7S0FHekUsUUFBUSxDQUFDLEdBQUcsQ0FBQyxDQUFDLENBQUMsRUFBRSxDQUFDLENBQUMsQ0FBQyxzQkFBc0IsRUFBRSxDQUFDLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQzs7OztDQUkvRCxDQUFDO0FBQ0YsQ0FBQztBQUVELFNBQVMsUUFBUSxDQUFDLFFBQWtCLEVBQUUsWUFBMEI7SUFDL0QsTUFBTSxPQUFPLEdBQUcsT0FBTyxDQUFDLFFBQVEsQ0FBQztJQUNqQyxNQUFNLE1BQU0sR0FBRyxPQUFPLENBQUMsaUJBQWlCLENBQUM7SUFFekMsTUFBTSxRQUFRLEdBQUcsQ0FBQyxHQUFHLElBQUksR0FBRyxDQUFDLFFBQVEsQ0FBQyxHQUFHLENBQUMsQ0FBQyxDQUFDLEVBQUUsQ0FBQyxDQUFDLENBQUMsY0FBYyxDQUFDLENBQUMsQ0FBQyxNQUFNLEVBQUUsQ0FBQyxDQUFDLElBQUksRUFBRSxDQUFDO0lBQ25GLE1BQU0sVUFBVSxHQUFHLENBQUMsR0FBRyxJQUFJLEdBQUcsQ0FBQyxRQUFRLENBQUMsR0FBRyxDQUFDLENBQUMsQ0FBQyxFQUFFLENBQUMsQ0FBQyxDQUFDLFFBQVEsQ0FBQyxDQUFDLENBQUMsQ0FBQztJQUUvRCxPQUFPO1FBQ04sSUFBSSxFQUFFLFVBQVUsQ0FBQyxNQUFNLEVBQUUsUUFBUSxFQUFFLFVBQVUsRUFBRSxRQUFRLENBQUM7UUFDeEQsSUFBSSxFQUFFO1lBQ0wsRUFBRSxVQUFVLEVBQUUsT0FBTyxFQUFFLFFBQVEsRUFBRSxVQUFVLENBQUMsT0FBTyxFQUFFLFFBQVEsRUFBRSxVQUFVLEVBQUUsUUFBUSxDQUFDLEVBQUU7WUFDdEYsR0FBRyxZQUFZLENBQUMsR0FBRyxDQUFDLENBQUMsRUFBRSxVQUFVLEVBQUUsb0JBQW9CLEVBQUUsRUFBRSxFQUFFLENBQzVELENBQUMsRUFBRSxVQUFVLEVBQUUsUUFBUSxFQUFFLFVBQVUsQ0FBQyxPQUFPLEVBQUUsUUFBUSxFQUFFLFVBQVUsRUFBRSxRQUFRLEVBQUUsb0JBQW9CLENBQUMsRUFBRSxDQUFDLENBQUM7U0FDdkc7S0FDRCxDQUFDO0FBQ0gsQ0FBQztBQUVELE1BQU0sU0FBUyxHQUFHO0lBQ2pCLElBQUksRUFBRSxPQUFPO0lBQ2IsSUFBSSxFQUFFLE9BQU87SUFDYixJQUFJLEVBQUUsT0FBTztJQUNiLElBQUksRUFBRSxPQUFPO0lBQ2IsSUFBSSxFQUFFLE9BQU87SUFDYixTQUFTLEVBQUUsT0FBTztJQUNsQixTQUFTLEVBQUUsT0FBTztJQUNsQixJQUFJLEVBQUUsT0FBTztJQUNiLElBQUksRUFBRSxPQUFPO0lBQ2IsSUFBSSxFQUFFLE9BQU87SUFDYixPQUFPLEVBQUUsT0FBTztJQUNoQixJQUFJLEVBQUUsT0FBTztJQUNiLElBQUksRUFBRSxPQUFPO0NBQ2IsQ0FBQztBQU9GLEtBQUssVUFBVSxjQUFjLENBQUMsbUJBQTJCLEVBQUUsVUFBa0IsRUFBRSxPQUFnQjtJQUM5RixNQUFNLFFBQVEsR0FBRztRQUNoQixTQUFTLEVBQUUsV0FBVztRQUN0QixJQUFJLEVBQUUsd0JBQXdCLFVBQVUsRUFBRTtRQUMxQyxPQUFPLEVBQUUsR0FBRyxPQUFPLENBQUMsQ0FBQyxDQUFDLElBQUksT0FBTyxDQUFDLENBQUMsQ0FBQyxJQUFJLE9BQU8sQ0FBQyxDQUFDLENBQUMsRUFBRTtRQUNwRCxJQUFJLEVBQUUsdUNBQXVDO0tBQzdDLENBQUM7SUFFRixNQUFNLEdBQUcsR0FBRyxtQkFBbUIsQ0FBQyxPQUFPLENBQUMsY0FBYyxFQUFFLENBQUMsQ0FBQyxFQUFFLEdBQUcsRUFBRSxFQUFFLENBQUMsUUFBUSxDQUFDLEdBQTRCLENBQUMsQ0FBQyxDQUFDO0lBQzVHLE1BQU0sR0FBRyxHQUFHLE1BQU0sSUFBQSxvQkFBSyxFQUFDLEdBQUcsQ0FBQyxDQUFDO0lBRTdCLElBQUksR0FBRyxDQUFDLE1BQU0sS0FBSyxHQUFHLEVBQUU7UUFDdkIsTUFBTSxJQUFJLEtBQUssQ0FBQyxJQUFJLEdBQUcsQ0FBQyxNQUFNLHFDQUFxQyxVQUFVLElBQUksT0FBTyxFQUFFLENBQUMsQ0FBQztLQUM1RjtJQUVELE1BQU0sRUFBRSxRQUFRLEVBQUUsTUFBTSxFQUFFLEdBQUcsTUFBTSxHQUFHLENBQUMsSUFBSSxFQUF3QyxDQUFDO0lBQ3BGLE9BQU8sTUFBTSxDQUFDO0FBQ2YsQ0FBQztBQUVELFNBQVMsWUFBWSxDQUFDLE9BQWU7SUFDcEMsTUFBTSxDQUFDLEVBQUUsS0FBSyxFQUFFLEtBQUssRUFBRSxLQUFLLENBQUMsR0FBRyxzQkFBc0IsQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFFLENBQUM7SUFDdEUsT0FBTyxDQUFDLFFBQVEsQ0FBQyxLQUFLLENBQUMsRUFBRSxRQUFRLENBQUMsS0FBSyxDQUFDLEVBQUUsUUFBUSxDQUFDLEtBQUssQ0FBQyxDQUFDLENBQUM7QUFDNUQsQ0FBQztBQUVELFNBQVMsZUFBZSxDQUFDLENBQVUsRUFBRSxDQUFVO0lBQzlDLElBQUksQ0FBQyxDQUFDLENBQUMsQ0FBQyxLQUFLLENBQUMsQ0FBQyxDQUFDLENBQUMsRUFBRTtRQUFFLE9BQU8sQ0FBQyxDQUFDLENBQUMsQ0FBQyxHQUFHLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQztLQUFFO0lBQzFDLElBQUksQ0FBQyxDQUFDLENBQUMsQ0FBQyxLQUFLLENBQUMsQ0FBQyxDQUFDLENBQUMsRUFBRTtRQUFFLE9BQU8sQ0FBQyxDQUFDLENBQUMsQ0FBQyxHQUFHLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQztLQUFFO0lBQzFDLE9BQU8sQ0FBQyxDQUFDLENBQUMsQ0FBQyxHQUFHLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQztBQUNwQixDQUFDO0FBRUQsS0FBSyxVQUFVLGFBQWEsQ0FBQyxVQUFrQixFQUFFLFVBQWtCO0lBQ2xFLE1BQU0sR0FBRyxHQUFHLE1BQU0sSUFBQSxvQkFBSyxFQUFDLEdBQUcsVUFBVSxpQkFBaUIsRUFBRTtRQUN2RCxNQUFNLEVBQUUsTUFBTTtRQUNkLE9BQU8sRUFBRTtZQUNSLFFBQVEsRUFBRSw0Q0FBNEM7WUFDdEQsY0FBYyxFQUFFLGtCQUFrQjtZQUNsQyxZQUFZLEVBQUUsZUFBZTtTQUM3QjtRQUNELElBQUksRUFBRSxJQUFJLENBQUMsU0FBUyxDQUFDO1lBQ3BCLE9BQU8sRUFBRSxDQUFDLEVBQUUsUUFBUSxFQUFFLENBQUMsRUFBRSxVQUFVLEVBQUUsQ0FBQyxFQUFFLEtBQUssRUFBRSxrQ0FBa0MsVUFBVSxFQUFFLEVBQUUsQ0FBQyxFQUFFLENBQUM7WUFDbkcsS0FBSyxFQUFFLEdBQUc7U0FDVixDQUFDO0tBQ0YsQ0FBQyxDQUFDO0lBRUgsSUFBSSxHQUFHLENBQUMsTUFBTSxLQUFLLEdBQUcsRUFBRTtRQUN2QixNQUFNLElBQUksS0FBSyxDQUFDLElBQUksR0FBRyxDQUFDLE1BQU0sbUNBQW1DLFVBQVUsRUFBRSxDQUFDLENBQUM7S0FDL0U7SUFFRCxNQUFNLE1BQU0sR0FBRyxNQUFNLEdBQUcsQ0FBQyxJQUFJLEVBQTBFLENBQUM7SUFDeEcsT0FBTyxNQUFNLENBQUMsT0FBTyxDQUFDLENBQUMsQ0FBQyxDQUFDLFVBQVUsQ0FBQyxDQUFDLENBQUMsQ0FBQyxRQUFRLENBQUMsR0FBRyxDQUFDLENBQUMsQ0FBQyxFQUFFLENBQUMsWUFBWSxDQUFDLENBQUMsQ0FBQyxPQUFPLENBQUMsQ0FBQyxDQUFDLElBQUksQ0FBQyxlQUFlLENBQUMsQ0FBQztBQUN6RyxDQUFDO0FBRUQsS0FBSyxVQUFVLE1BQU0sQ0FBQywwQkFBa0MsRUFBRSxtQkFBMkIsRUFBRSxVQUFrQixFQUFFLE9BQWdCO0lBQzFILE1BQU0sUUFBUSxHQUFHLE1BQU0sYUFBYSxDQUFDLDBCQUEwQixFQUFFLFVBQVUsQ0FBQyxDQUFDO0lBQzdFLE1BQU0sU0FBUyxHQUFZLENBQUMsT0FBTyxDQUFDLENBQUMsQ0FBQyxFQUFFLE9BQU8sQ0FBQyxDQUFDLENBQUMsR0FBRyxDQUFDLEVBQUUsQ0FBQyxDQUFDLENBQUM7SUFDM0QsTUFBTSxrQkFBa0IsR0FBRyxRQUFRLENBQUMsTUFBTSxDQUFDLENBQUMsQ0FBQyxFQUFFLENBQUMsZUFBZSxDQUFDLENBQUMsRUFBRSxTQUFTLENBQUMsR0FBRyxDQUFDLENBQUMsQ0FBQztJQUNuRixNQUFNLHVCQUF1QixHQUFHLGtCQUFrQixDQUFDLEVBQUUsQ0FBQyxDQUFDLENBQUMsQ0FBRSxDQUFDLENBQUMsNEJBQTRCO0lBRXhGLElBQUksQ0FBQyx1QkFBdUIsRUFBRTtRQUM3QixNQUFNLElBQUksS0FBSyxDQUFDLHlDQUF5QyxVQUFVLGdCQUFnQixPQUFPLEVBQUUsQ0FBQyxDQUFDO0tBQzlGO0lBRUQsT0FBTyxNQUFNLGNBQWMsQ0FBQyxtQkFBbUIsRUFBRSxVQUFVLEVBQUUsdUJBQXVCLENBQUMsQ0FBQztBQUN2RixDQUFDO0FBRUQsS0FBSyxVQUFVLGFBQWE7SUFDM0IsTUFBTSxNQUFNLEdBQUcsSUFBSSxNQUFNLEVBQUUsQ0FBQztJQUM1QixNQUFNLENBQUMsV0FBVyxDQUFDLFVBQVUsQ0FBQyxDQUFDO0lBRS9CLE1BQU0sS0FBSyxHQUFHLE1BQU0sUUFBUSxDQUFDLE9BQU8sQ0FBQyxHQUFHLEVBQUUsQ0FBQyxDQUFDO0lBQzVDLE1BQU0sSUFBSSxHQUFHLElBQUksQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFDLEdBQUcsRUFBRSxFQUFFLEtBQUssQ0FBQyxDQUFDO0lBQzdDLE1BQU0sUUFBUSxHQUFHLEVBQUUsQ0FBQztJQUVwQixLQUFLLE1BQU0sSUFBSSxJQUFJLEtBQUssRUFBRTtRQUN6QixNQUFNLFVBQVUsR0FBRyxJQUFJLENBQUMsUUFBUSxDQUFDLElBQUksRUFBRSxJQUFJLENBQUMsQ0FBQyxPQUFPLENBQUMsUUFBUSxFQUFFLEVBQUUsQ0FBQyxDQUFDLE9BQU8sQ0FBQyxLQUFLLEVBQUUsR0FBRyxDQUFDLENBQUM7UUFDdkYsTUFBTSxRQUFRLEdBQUcsTUFBTSxhQUFFLENBQUMsUUFBUSxDQUFDLElBQUksRUFBRSxFQUFFLFFBQVEsRUFBRSxNQUFNLEVBQUUsQ0FBQyxDQUFDO1FBQy9ELE1BQU0sSUFBSSxHQUFHLE1BQU0sQ0FBQyxLQUFLLENBQUMsUUFBUSxDQUFDLENBQUM7UUFDcEMsUUFBUSxDQUFDLElBQUksQ0FBQyxHQUFHLFdBQVcsQ0FBQyxVQUFVLEVBQUUsSUFBSSxDQUFDLFFBQVEsQ0FBQyxDQUFDLENBQUM7S0FDekQ7SUFFRCxPQUFPLFFBQVEsQ0FBQztBQUNqQixDQUFDO0FBRUQsS0FBSyxVQUFVLGVBQWU7SUFDN0IsTUFBTSwwQkFBMEIsR0FBRyxPQUFPLENBQUMsaUJBQWlCLEVBQUUsVUFBVSxDQUFDO0lBRXpFLElBQUksQ0FBQywwQkFBMEIsRUFBRTtRQUNoQyxPQUFPLENBQUMsSUFBSSxDQUFDLHlGQUF5RixDQUFDLENBQUM7UUFDeEcsT0FBTyxFQUFFLENBQUM7S0FDVjtJQUVELE1BQU0sbUJBQW1CLEdBQUcsT0FBTyxDQUFDLGlCQUFpQixFQUFFLG1CQUFtQixDQUFDO0lBRTNFLElBQUksQ0FBQyxtQkFBbUIsRUFBRTtRQUN6QixPQUFPLENBQUMsSUFBSSxDQUFDLGlGQUFpRixDQUFDLENBQUM7UUFDaEcsT0FBTyxFQUFFLENBQUM7S0FDVjtJQUVELE1BQU0sT0FBTyxHQUFHLFlBQVksQ0FBQyxXQUFXLENBQUMsT0FBTyxDQUFDLENBQUM7SUFDbEQsTUFBTSxXQUFXLEdBQUcsTUFBTSxDQUFDLElBQUksQ0FBQyxTQUFTLENBQUMsQ0FBQztJQUUzQyxPQUFPLE1BQU0sT0FBTyxDQUFDLEdBQUcsQ0FBQyxXQUFXLENBQUMsR0FBRyxDQUN2QyxVQUFVLENBQUMsRUFBRSxDQUFDLE1BQU0sQ0FBQywwQkFBMEIsRUFBRSxtQkFBbUIsRUFBRSxVQUFVLEVBQUUsT0FBTyxDQUFDO1NBQ3hGLElBQUksQ0FBQyxvQkFBb0IsQ0FBQyxFQUFFLENBQUMsQ0FBQyxFQUFFLFVBQVUsRUFBRSxvQkFBb0IsRUFBRSxDQUFDLENBQUMsQ0FDdEUsQ0FBQyxDQUFDO0FBQ0osQ0FBQztBQUVELEtBQUssVUFBVSxJQUFJO0lBQ2xCLE1BQU0sQ0FBQyxRQUFRLEVBQUUsWUFBWSxDQUFDLEdBQUcsTUFBTSxPQUFPLENBQUMsR0FBRyxDQUFDLENBQUMsYUFBYSxFQUFFLEVBQUUsZUFBZSxFQUFFLENBQUMsQ0FBQyxDQUFDO0lBQ3pGLE1BQU0sRUFBRSxJQUFJLEVBQUUsSUFBSSxFQUFFLEdBQUcsTUFBTSxRQUFRLENBQUMsUUFBUSxFQUFFLFlBQVksQ0FBQyxDQUFDO0lBRTlELE1BQU0sSUFBSSxHQUFHLHVCQUF1QixDQUFDO0lBQ3JDLE1BQU0sYUFBRSxDQUFDLEVBQUUsQ0FBQyxJQUFJLEVBQUUsRUFBRSxTQUFTLEVBQUUsSUFBSSxFQUFFLEtBQUssRUFBRSxJQUFJLEVBQUUsQ0FBQyxDQUFDO0lBQ3BELE1BQU0sYUFBRSxDQUFDLEtBQUssQ0FBQyxJQUFJLEVBQUUsRUFBRSxTQUFTLEVBQUUsSUFBSSxFQUFFLENBQUMsQ0FBQztJQUUxQyxNQUFNLGFBQUUsQ0FBQyxTQUFTLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxJQUFJLEVBQUUsR0FBRyxPQUFPLENBQUMsaUJBQWlCLE9BQU8sQ0FBQyxFQUFFLElBQUksQ0FBQyxPQUFPLENBQUMsUUFBUSxFQUFFLElBQUksQ0FBQyxDQUFDLENBQUM7SUFFdkcsS0FBSyxNQUFNLEVBQUUsVUFBVSxFQUFFLFFBQVEsRUFBRSxJQUFJLElBQUksRUFBRTtRQUM1QyxNQUFNLFlBQVksR0FBRyxJQUFJLENBQUMsSUFBSSxDQUFDLElBQUksRUFBRSxVQUFVLEtBQUssT0FBTyxDQUFDLENBQUMsQ0FBQyxPQUFPLENBQUMsQ0FBQyxDQUFDLFNBQVMsQ0FBQyxVQUFvQyxDQUFDLENBQUMsQ0FBQztRQUN6SCxNQUFNLGFBQUUsQ0FBQyxLQUFLLENBQUMsWUFBWSxFQUFFLEVBQUUsU0FBUyxFQUFFLElBQUksRUFBRSxDQUFDLENBQUM7UUFDbEQsTUFBTSxhQUFFLENBQUMsU0FBUyxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsWUFBWSxFQUFFLEdBQUcsT0FBTyxDQUFDLGlCQUFpQixPQUFPLENBQUMsRUFBRSxRQUFRLENBQUMsT0FBTyxDQUFDLFFBQVEsRUFBRSxJQUFJLENBQUMsQ0FBQyxDQUFDO0tBQ25IO0FBQ0YsQ0FBQztBQUVELElBQUksT0FBTyxDQUFDLElBQUksS0FBSyxNQUFNLEVBQUU7SUFDNUIsSUFBSSxFQUFFLENBQUMsS0FBSyxDQUFDLEdBQUcsQ0FBQyxFQUFFO1FBQ2xCLE9BQU8sQ0FBQyxLQUFLLENBQUMsR0FBRyxDQUFDLENBQUM7UUFDbkIsT0FBTyxDQUFDLElBQUksQ0FBQyxDQUFDLENBQUMsQ0FBQztJQUNqQixDQUFDLENBQUMsQ0FBQztDQUNIIn0=
build/lib/policies.js
0
https://github.com/microsoft/vscode/commit/15d8d39815dd6fc14bb2cf9aeb17200bd5710bd5
[ 0.0006819050177000463, 0.00018392954370938241, 0.00016634049825370312, 0.00017470933380536735, 0.00006911040691193193 ]
{ "id": 1, "code_window": [ "}\n", "\n", "export interface PortAttributesSelector {\n", "\tportRange?: [number, number];\n", "\tcommandPattern?: RegExp;\n", "}\n", "\n", "export interface MainThreadTunnelServiceShape extends IDisposable {\n", "\t$openTunnel(tunnelOptions: TunnelOptions, source: string | undefined): Promise<TunnelDto | undefined>;\n" ], "labels": [ "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ], "after_edit": [ "\tportRange?: [number, number] | number;\n" ], "file_path": "src/vs/workbench/api/common/extHost.protocol.ts", "type": "replace", "edit_start_line_idx": 1000 }
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import 'vs/css!./media/sidebysideeditor'; import { localize } from 'vs/nls'; import { Dimension, $, clearNode, multibyteAwareBtoa } from 'vs/base/browser/dom'; import { Registry } from 'vs/platform/registry/common/platform'; import { IEditorControl, IEditorPane, IEditorOpenContext, EditorExtensions, SIDE_BY_SIDE_EDITOR_ID, SideBySideEditor as Side, IEditorPaneSelection, IEditorPaneWithSelection, IEditorPaneSelectionChangeEvent, isEditorPaneWithSelection, EditorPaneSelectionCompareResult } from 'vs/workbench/common/editor'; import { SideBySideEditorInput } from 'vs/workbench/common/editor/sideBySideEditorInput'; import { EditorInput } from 'vs/workbench/common/editor/editorInput'; import { EditorPane } from 'vs/workbench/browser/parts/editor/editorPane'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { IThemeService } from 'vs/platform/theme/common/themeService'; import { IEditorPaneRegistry } from 'vs/workbench/browser/editor'; import { CancellationToken } from 'vs/base/common/cancellation'; import { IEditorGroup, IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService'; import { SplitView, Sizing, Orientation } from 'vs/base/browser/ui/splitview/splitview'; import { Event, Relay, Emitter } from 'vs/base/common/event'; import { IStorageService } from 'vs/platform/storage/common/storage'; import { assertIsDefined } from 'vs/base/common/types'; import { IEditorOptions } from 'vs/platform/editor/common/editor'; import { IConfigurationChangeEvent, IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { DEFAULT_EDITOR_MIN_DIMENSIONS } from 'vs/workbench/browser/parts/editor/editor'; import { DisposableStore } from 'vs/base/common/lifecycle'; import { SIDE_BY_SIDE_EDITOR_HORIZONTAL_BORDER, SIDE_BY_SIDE_EDITOR_VERTICAL_BORDER } from 'vs/workbench/common/theme'; import { AbstractEditorWithViewState } from 'vs/workbench/browser/parts/editor/editorWithViewState'; import { ITextResourceConfigurationService } from 'vs/editor/common/services/textResourceConfiguration'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; import { isEqual } from 'vs/base/common/resources'; import { URI } from 'vs/base/common/uri'; import { IBoundarySashes } from 'vs/base/browser/ui/sash/sash'; interface ISideBySideEditorViewState { primary: object; secondary: object; focus: Side.PRIMARY | Side.SECONDARY | undefined; ratio: number | undefined; } function isSideBySideEditorViewState(thing: unknown): thing is ISideBySideEditorViewState { const candidate = thing as ISideBySideEditorViewState | undefined; return typeof candidate?.primary === 'object' && typeof candidate.secondary === 'object'; } interface ISideBySideEditorOptions extends IEditorOptions { /** * Whether the editor options should apply to * the primary or secondary side. * * If a target side is provided, that side will * also receive keyboard focus unless focus is * to be preserved. */ target?: Side.PRIMARY | Side.SECONDARY; } export class SideBySideEditor extends AbstractEditorWithViewState<ISideBySideEditorViewState> implements IEditorPaneWithSelection { static readonly ID: string = SIDE_BY_SIDE_EDITOR_ID; static SIDE_BY_SIDE_LAYOUT_SETTING = 'workbench.editor.splitInGroupLayout'; private static readonly VIEW_STATE_PREFERENCE_KEY = 'sideBySideEditorViewState'; //#region Layout Constraints private get minimumPrimaryWidth() { return this.primaryEditorPane ? this.primaryEditorPane.minimumWidth : 0; } private get maximumPrimaryWidth() { return this.primaryEditorPane ? this.primaryEditorPane.maximumWidth : Number.POSITIVE_INFINITY; } private get minimumPrimaryHeight() { return this.primaryEditorPane ? this.primaryEditorPane.minimumHeight : 0; } private get maximumPrimaryHeight() { return this.primaryEditorPane ? this.primaryEditorPane.maximumHeight : Number.POSITIVE_INFINITY; } private get minimumSecondaryWidth() { return this.secondaryEditorPane ? this.secondaryEditorPane.minimumWidth : 0; } private get maximumSecondaryWidth() { return this.secondaryEditorPane ? this.secondaryEditorPane.maximumWidth : Number.POSITIVE_INFINITY; } private get minimumSecondaryHeight() { return this.secondaryEditorPane ? this.secondaryEditorPane.minimumHeight : 0; } private get maximumSecondaryHeight() { return this.secondaryEditorPane ? this.secondaryEditorPane.maximumHeight : Number.POSITIVE_INFINITY; } override set minimumWidth(value: number) { /* noop */ } override set maximumWidth(value: number) { /* noop */ } override set minimumHeight(value: number) { /* noop */ } override set maximumHeight(value: number) { /* noop */ } override get minimumWidth() { return this.minimumPrimaryWidth + this.minimumSecondaryWidth; } override get maximumWidth() { return this.maximumPrimaryWidth + this.maximumSecondaryWidth; } override get minimumHeight() { return this.minimumPrimaryHeight + this.minimumSecondaryHeight; } override get maximumHeight() { return this.maximumPrimaryHeight + this.maximumSecondaryHeight; } private _boundarySashes: IBoundarySashes | undefined; //#endregion //#region Events private onDidCreateEditors = this._register(new Emitter<{ width: number; height: number } | undefined>()); private _onDidChangeSizeConstraints = this._register(new Relay<{ width: number; height: number } | undefined>()); override readonly onDidChangeSizeConstraints = Event.any(this.onDidCreateEditors.event, this._onDidChangeSizeConstraints.event); private readonly _onDidChangeSelection = this._register(new Emitter<IEditorPaneSelectionChangeEvent>()); readonly onDidChangeSelection = this._onDidChangeSelection.event; //#endregion private primaryEditorPane: EditorPane | undefined = undefined; private secondaryEditorPane: EditorPane | undefined = undefined; private primaryEditorContainer: HTMLElement | undefined; private secondaryEditorContainer: HTMLElement | undefined; private splitview: SplitView | undefined; private readonly splitviewDisposables = this._register(new DisposableStore()); private readonly editorDisposables = this._register(new DisposableStore()); private orientation = this.configurationService.getValue<'vertical' | 'horizontal'>(SideBySideEditor.SIDE_BY_SIDE_LAYOUT_SETTING) === 'vertical' ? Orientation.VERTICAL : Orientation.HORIZONTAL; private dimension = new Dimension(0, 0); private lastFocusedSide: Side.PRIMARY | Side.SECONDARY | undefined = undefined; constructor( @ITelemetryService telemetryService: ITelemetryService, @IInstantiationService instantiationService: IInstantiationService, @IThemeService themeService: IThemeService, @IStorageService storageService: IStorageService, @IConfigurationService private readonly configurationService: IConfigurationService, @ITextResourceConfigurationService textResourceConfigurationService: ITextResourceConfigurationService, @IEditorService editorService: IEditorService, @IEditorGroupsService editorGroupService: IEditorGroupsService ) { super(SideBySideEditor.ID, SideBySideEditor.VIEW_STATE_PREFERENCE_KEY, telemetryService, instantiationService, storageService, textResourceConfigurationService, themeService, editorService, editorGroupService); this.registerListeners(); } private registerListeners(): void { this._register(this.configurationService.onDidChangeConfiguration(e => this.onConfigurationUpdated(e))); } private onConfigurationUpdated(event: IConfigurationChangeEvent): void { if (event.affectsConfiguration(SideBySideEditor.SIDE_BY_SIDE_LAYOUT_SETTING)) { this.orientation = this.configurationService.getValue<'vertical' | 'horizontal'>(SideBySideEditor.SIDE_BY_SIDE_LAYOUT_SETTING) === 'vertical' ? Orientation.VERTICAL : Orientation.HORIZONTAL; // If config updated from event, re-create the split // editor using the new layout orientation if it was // already created. if (this.splitview) { this.recreateSplitview(); } } } private recreateSplitview(): void { const container = assertIsDefined(this.getContainer()); // Clear old (if any) but remember ratio const ratio = this.getSplitViewRatio(); if (this.splitview) { container.removeChild(this.splitview.el); this.splitviewDisposables.clear(); } // Create new this.createSplitView(container, ratio); this.layout(this.dimension); } private getSplitViewRatio(): number | undefined { let ratio: number | undefined = undefined; if (this.splitview) { const leftViewSize = this.splitview.getViewSize(0); const rightViewSize = this.splitview.getViewSize(1); // Only return a ratio when the view size is significantly // enough different for left and right view sizes if (Math.abs(leftViewSize - rightViewSize) > 1) { const totalSize = this.splitview.orientation === Orientation.HORIZONTAL ? this.dimension.width : this.dimension.height; ratio = leftViewSize / totalSize; } } return ratio; } protected createEditor(parent: HTMLElement): void { parent.classList.add('side-by-side-editor'); // Editor pane containers this.secondaryEditorContainer = $('.side-by-side-editor-container.editor-instance'); this.primaryEditorContainer = $('.side-by-side-editor-container.editor-instance'); // Split view this.createSplitView(parent); } private createSplitView(parent: HTMLElement, ratio?: number): void { // Splitview widget this.splitview = this.splitviewDisposables.add(new SplitView(parent, { orientation: this.orientation })); this.splitviewDisposables.add(this.splitview.onDidSashReset(() => this.splitview?.distributeViewSizes())); if (this.orientation === Orientation.HORIZONTAL) { this.splitview.orthogonalEndSash = this._boundarySashes?.bottom; } else { this.splitview.orthogonalStartSash = this._boundarySashes?.left; this.splitview.orthogonalEndSash = this._boundarySashes?.right; } // Figure out sizing let leftSizing: number | Sizing = Sizing.Distribute; let rightSizing: number | Sizing = Sizing.Distribute; if (ratio) { const totalSize = this.splitview.orientation === Orientation.HORIZONTAL ? this.dimension.width : this.dimension.height; leftSizing = Math.round(totalSize * ratio); rightSizing = totalSize - leftSizing; // We need to call `layout` for the `ratio` to have any effect this.splitview.layout(this.orientation === Orientation.HORIZONTAL ? this.dimension.width : this.dimension.height); } // Secondary (left) const secondaryEditorContainer = assertIsDefined(this.secondaryEditorContainer); this.splitview.addView({ element: secondaryEditorContainer, layout: size => this.layoutPane(this.secondaryEditorPane, size), minimumSize: this.orientation === Orientation.HORIZONTAL ? DEFAULT_EDITOR_MIN_DIMENSIONS.width : DEFAULT_EDITOR_MIN_DIMENSIONS.height, maximumSize: Number.POSITIVE_INFINITY, onDidChange: Event.None }, leftSizing); // Primary (right) const primaryEditorContainer = assertIsDefined(this.primaryEditorContainer); this.splitview.addView({ element: primaryEditorContainer, layout: size => this.layoutPane(this.primaryEditorPane, size), minimumSize: this.orientation === Orientation.HORIZONTAL ? DEFAULT_EDITOR_MIN_DIMENSIONS.width : DEFAULT_EDITOR_MIN_DIMENSIONS.height, maximumSize: Number.POSITIVE_INFINITY, onDidChange: Event.None }, rightSizing); this.updateStyles(); } override getTitle(): string { if (this.input) { return this.input.getName(); } return localize('sideBySideEditor', "Side by Side Editor"); } override async setInput(input: SideBySideEditorInput, options: ISideBySideEditorOptions | undefined, context: IEditorOpenContext, token: CancellationToken): Promise<void> { const oldInput = this.input; await super.setInput(input, options, context, token); // Create new side by side editors if either we have not // been created before or the input no longer matches. if (!oldInput || !input.matches(oldInput)) { if (oldInput) { this.disposeEditors(); } this.createEditors(input); } // Restore any previous view state const { primary, secondary, viewState } = this.loadViewState(input, options, context); this.lastFocusedSide = viewState?.focus; if (typeof viewState?.ratio === 'number' && this.splitview) { const totalSize = this.splitview.orientation === Orientation.HORIZONTAL ? this.dimension.width : this.dimension.height; this.splitview.resizeView(0, Math.round(totalSize * viewState.ratio)); } else { this.splitview?.distributeViewSizes(); } // Set input to both sides await Promise.all([ this.secondaryEditorPane?.setInput(input.secondary, secondary, context, token), this.primaryEditorPane?.setInput(input.primary, primary, context, token) ]); // Update focus if target is provided if (typeof options?.target === 'number') { this.lastFocusedSide = options.target; } } private loadViewState(input: SideBySideEditorInput, options: ISideBySideEditorOptions | undefined, context: IEditorOpenContext): { primary: IEditorOptions | undefined; secondary: IEditorOptions | undefined; viewState: ISideBySideEditorViewState | undefined } { const viewState = isSideBySideEditorViewState(options?.viewState) ? options?.viewState : this.loadEditorViewState(input, context); let primaryOptions: IEditorOptions = Object.create(null); let secondaryOptions: IEditorOptions | undefined = undefined; // Depending on the optional `target` property, we apply // the provided options to either the primary or secondary // side if (options?.target === Side.SECONDARY) { secondaryOptions = { ...options }; } else { primaryOptions = { ...options }; } primaryOptions.viewState = viewState?.primary; if (viewState?.secondary) { if (!secondaryOptions) { secondaryOptions = { viewState: viewState.secondary }; } else { secondaryOptions.viewState = viewState?.secondary; } } return { primary: primaryOptions, secondary: secondaryOptions, viewState }; } private createEditors(newInput: SideBySideEditorInput): void { // Create editors this.secondaryEditorPane = this.doCreateEditor(newInput.secondary, assertIsDefined(this.secondaryEditorContainer)); this.primaryEditorPane = this.doCreateEditor(newInput.primary, assertIsDefined(this.primaryEditorContainer)); // Layout this.layout(this.dimension); // Eventing this._onDidChangeSizeConstraints.input = Event.any( Event.map(this.secondaryEditorPane.onDidChangeSizeConstraints, () => undefined), Event.map(this.primaryEditorPane.onDidChangeSizeConstraints, () => undefined) ); this.onDidCreateEditors.fire(undefined); // Track focus and signal active control change via event this.editorDisposables.add(this.primaryEditorPane.onDidFocus(() => this.onDidFocusChange(Side.PRIMARY))); this.editorDisposables.add(this.secondaryEditorPane.onDidFocus(() => this.onDidFocusChange(Side.SECONDARY))); } private doCreateEditor(editorInput: EditorInput, container: HTMLElement): EditorPane { const editorPaneDescriptor = Registry.as<IEditorPaneRegistry>(EditorExtensions.EditorPane).getEditorPane(editorInput); if (!editorPaneDescriptor) { throw new Error('No editor pane descriptor for editor found'); } // Create editor pane and make visible const editorPane = editorPaneDescriptor.instantiate(this.instantiationService); editorPane.create(container); editorPane.setVisible(this.isVisible(), this.group); // Track selections if supported if (isEditorPaneWithSelection(editorPane)) { this.editorDisposables.add(editorPane.onDidChangeSelection(e => this._onDidChangeSelection.fire(e))); } // Track for disposal this.editorDisposables.add(editorPane); return editorPane; } private onDidFocusChange(side: Side.PRIMARY | Side.SECONDARY): void { this.lastFocusedSide = side; // Signal to outside that our active control changed this._onDidChangeControl.fire(); } getSelection(): IEditorPaneSelection | undefined { const lastFocusedEditorPane = this.getLastFocusedEditorPane(); if (isEditorPaneWithSelection(lastFocusedEditorPane)) { const selection = lastFocusedEditorPane.getSelection(); if (selection) { return new SideBySideAwareEditorPaneSelection(selection, lastFocusedEditorPane === this.primaryEditorPane ? Side.PRIMARY : Side.SECONDARY); } } return undefined; } override setOptions(options: ISideBySideEditorOptions | undefined): void { super.setOptions(options); // Update focus if target is provided if (typeof options?.target === 'number') { this.lastFocusedSide = options.target; } // Apply to focused side this.getLastFocusedEditorPane()?.setOptions(options); } protected override setEditorVisible(visible: boolean, group: IEditorGroup | undefined): void { // Forward to both sides this.primaryEditorPane?.setVisible(visible, group); this.secondaryEditorPane?.setVisible(visible, group); super.setEditorVisible(visible, group); } override clearInput(): void { super.clearInput(); // Forward to both sides this.primaryEditorPane?.clearInput(); this.secondaryEditorPane?.clearInput(); // Since we do not keep side editors alive // we dispose any editor created for recreation this.disposeEditors(); } override focus(): void { this.getLastFocusedEditorPane()?.focus(); } private getLastFocusedEditorPane(): EditorPane | undefined { if (this.lastFocusedSide === Side.SECONDARY) { return this.secondaryEditorPane; } return this.primaryEditorPane; } layout(dimension: Dimension): void { this.dimension = dimension; const splitview = assertIsDefined(this.splitview); splitview.layout(this.orientation === Orientation.HORIZONTAL ? dimension.width : dimension.height); } override setBoundarySashes(sashes: IBoundarySashes) { this._boundarySashes = sashes; if (this.splitview) { this.splitview.orthogonalEndSash = sashes.bottom; } } private layoutPane(pane: EditorPane | undefined, size: number): void { pane?.layout(this.orientation === Orientation.HORIZONTAL ? new Dimension(size, this.dimension.height) : new Dimension(this.dimension.width, size)); } override getControl(): IEditorControl | undefined { return this.getLastFocusedEditorPane()?.getControl(); } getPrimaryEditorPane(): IEditorPane | undefined { return this.primaryEditorPane; } getSecondaryEditorPane(): IEditorPane | undefined { return this.secondaryEditorPane; } protected tracksEditorViewState(input: EditorInput): boolean { return input instanceof SideBySideEditorInput; } protected computeEditorViewState(resource: URI): ISideBySideEditorViewState | undefined { if (!this.input || !isEqual(resource, this.toEditorViewStateResource(this.input))) { return; // unexpected state } const primarViewState = this.primaryEditorPane?.getViewState(); const secondaryViewState = this.secondaryEditorPane?.getViewState(); if (!primarViewState || !secondaryViewState) { return; // we actually need view states } return { primary: primarViewState, secondary: secondaryViewState, focus: this.lastFocusedSide, ratio: this.getSplitViewRatio() }; } protected toEditorViewStateResource(input: EditorInput): URI | undefined { let primary: URI | undefined; let secondary: URI | undefined; if (input instanceof SideBySideEditorInput) { primary = input.primary.resource; secondary = input.secondary.resource; } if (!secondary || !primary) { return undefined; } // create a URI that is the Base64 concatenation of original + modified resource return URI.from({ scheme: 'sideBySide', path: `${multibyteAwareBtoa(secondary.toString())}${multibyteAwareBtoa(primary.toString())}` }); } override updateStyles(): void { super.updateStyles(); if (this.primaryEditorContainer) { if (this.orientation === Orientation.HORIZONTAL) { this.primaryEditorContainer.style.borderLeftWidth = '1px'; this.primaryEditorContainer.style.borderLeftStyle = 'solid'; this.primaryEditorContainer.style.borderLeftColor = this.getColor(SIDE_BY_SIDE_EDITOR_VERTICAL_BORDER) ?? ''; this.primaryEditorContainer.style.borderTopWidth = '0'; } else { this.primaryEditorContainer.style.borderTopWidth = '1px'; this.primaryEditorContainer.style.borderTopStyle = 'solid'; this.primaryEditorContainer.style.borderTopColor = this.getColor(SIDE_BY_SIDE_EDITOR_HORIZONTAL_BORDER) ?? ''; this.primaryEditorContainer.style.borderLeftWidth = '0'; } } } override dispose(): void { this.disposeEditors(); super.dispose(); } private disposeEditors(): void { this.editorDisposables.clear(); this.secondaryEditorPane = undefined; this.primaryEditorPane = undefined; this.lastFocusedSide = undefined; if (this.secondaryEditorContainer) { clearNode(this.secondaryEditorContainer); } if (this.primaryEditorContainer) { clearNode(this.primaryEditorContainer); } } } class SideBySideAwareEditorPaneSelection implements IEditorPaneSelection { constructor( private readonly selection: IEditorPaneSelection, private readonly side: Side.PRIMARY | Side.SECONDARY ) { } compare(other: IEditorPaneSelection): EditorPaneSelectionCompareResult { if (!(other instanceof SideBySideAwareEditorPaneSelection)) { return EditorPaneSelectionCompareResult.DIFFERENT; } if (this.side !== other.side) { return EditorPaneSelectionCompareResult.DIFFERENT; } return this.selection.compare(other.selection); } restore(options: IEditorOptions): ISideBySideEditorOptions { const sideBySideEditorOptions: ISideBySideEditorOptions = { ...options, target: this.side }; return this.selection.restore(sideBySideEditorOptions); } }
src/vs/workbench/browser/parts/editor/sideBySideEditor.ts
0
https://github.com/microsoft/vscode/commit/15d8d39815dd6fc14bb2cf9aeb17200bd5710bd5
[ 0.00017711105465423316, 0.0001720833097351715, 0.0001646217133384198, 0.00017253178521059453, 0.000003050885197808384 ]
{ "id": 2, "code_window": [ "\texport interface PortAttributesSelector {\n", "\t\t/**\n", "\t\t * Specifying a port range will cause your provider to only be called for ports within the range.\n", "\t\t */\n" ], "labels": [ "keep", "keep", "add", "keep" ], "after_edit": [ "\t\t * The start is inclusive and the end is exclusive.\n" ], "file_path": "src/vscode-dts/vscode.proposed.portsAttributes.d.ts", "type": "add", "edit_start_line_idx": 74 }
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ declare module 'vscode' { // https://github.com/microsoft/vscode/issues/115616 @alexr00 /** * The action that should be taken when a port is discovered through automatic port forwarding discovery. */ export enum PortAutoForwardAction { /** * Notify the user that the port is being forwarded. This is the default action. */ Notify = 1, /** * Once the port is forwarded, open the browser to the forwarded port. */ OpenBrowser = 2, /** * Once the port is forwarded, open the preview browser to the forwarded port. */ OpenPreview = 3, /** * Forward the port silently. */ Silent = 4, /** * Do not forward the port. */ Ignore = 5, /** * Once the port is forwarded, open the browser to the forwarded port. Only open the browser the first time the port is forwarded in a session. */ OpenBrowserOnce = 6 } /** * The attributes that a forwarded port can have. */ export class PortAttributes { /** * The action to be taken when this port is detected for auto forwarding. */ autoForwardAction: PortAutoForwardAction; /** * Creates a new PortAttributes object * @param port the port number * @param autoForwardAction the action to take when this port is detected */ constructor(autoForwardAction: PortAutoForwardAction); } /** * A provider of port attributes. Port attributes are used to determine what action should be taken when a port is discovered. */ export interface PortAttributesProvider { /** * Provides attributes for the given port. For ports that your extension doesn't know about, simply * return undefined. For example, if `providePortAttributes` is called with ports 3000 but your * extension doesn't know anything about 3000 you should return undefined. */ providePortAttributes(port: number, pid: number | undefined, commandLine: string | undefined, token: CancellationToken): ProviderResult<PortAttributes>; } /** * A selector that will be used to filter which {@link PortAttributesProvider} should be called for each port. */ export interface PortAttributesSelector { /** * Specifying a port range will cause your provider to only be called for ports within the range. */ portRange?: [number, number]; /** * Specifying a command pattern will cause your provider to only be called for processes whose command line matches the pattern. */ commandPattern?: RegExp; } export namespace workspace { /** * If your extension listens on ports, consider registering a PortAttributesProvider to provide information * about the ports. For example, a debug extension may know about debug ports in it's debuggee. By providing * this information with a PortAttributesProvider the extension can tell the editor that these ports should be * ignored, since they don't need to be user facing. * * The results of the PortAttributesProvider are merged with the user setting `remote.portsAttributes`. If the values conflict, the user setting takes precedence. * * @param portSelector It is best practice to specify a port selector to avoid unnecessary calls to your provider. * If you don't specify a port selector your provider will be called for every port, which will result in slower port forwarding for the user. * @param provider The {@link PortAttributesProvider PortAttributesProvider}. */ export function registerPortAttributesProvider(portSelector: PortAttributesSelector, provider: PortAttributesProvider): Disposable; } }
src/vscode-dts/vscode.proposed.portsAttributes.d.ts
1
https://github.com/microsoft/vscode/commit/15d8d39815dd6fc14bb2cf9aeb17200bd5710bd5
[ 0.9908536672592163, 0.14118292927742004, 0.0001726462651276961, 0.0008442060789093375, 0.30827173590660095 ]
{ "id": 2, "code_window": [ "\texport interface PortAttributesSelector {\n", "\t\t/**\n", "\t\t * Specifying a port range will cause your provider to only be called for ports within the range.\n", "\t\t */\n" ], "labels": [ "keep", "keep", "add", "keep" ], "after_edit": [ "\t\t * The start is inclusive and the end is exclusive.\n" ], "file_path": "src/vscode-dts/vscode.proposed.portsAttributes.d.ts", "type": "add", "edit_start_line_idx": 74 }
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import { Codicon } from 'vs/base/common/codicons'; import { KeyCode, KeyMod } from 'vs/base/common/keyCodes'; import { DisposableStore } from 'vs/base/common/lifecycle'; import { URI } from 'vs/base/common/uri'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { EditorAction, EditorCommand, EditorContributionInstantiation, IActionOptions, registerEditorAction, registerEditorCommand, registerEditorContribution, ServicesAccessor } from 'vs/editor/browser/editorExtensions'; import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService'; import { Position } from 'vs/editor/common/core/position'; import { Range } from 'vs/editor/common/core/range'; import { IEditorContribution } from 'vs/editor/common/editorCommon'; import { EditorContextKeys } from 'vs/editor/common/editorContextKeys'; import { IMarkerNavigationService, MarkerList } from 'vs/editor/contrib/gotoError/browser/markerNavigationService'; import * as nls from 'vs/nls'; import { MenuId } from 'vs/platform/actions/common/actions'; import { IContextKey, IContextKeyService, RawContextKey } from 'vs/platform/contextkey/common/contextkey'; import { TextEditorSelectionRevealType } from 'vs/platform/editor/common/editor'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { IMarker } from 'vs/platform/markers/common/markers'; import { registerIcon } from 'vs/platform/theme/common/iconRegistry'; import { MarkerNavigationWidget } from './gotoErrorWidget'; export class MarkerController implements IEditorContribution { static readonly ID = 'editor.contrib.markerController'; static get(editor: ICodeEditor): MarkerController | null { return editor.getContribution<MarkerController>(MarkerController.ID); } private readonly _editor: ICodeEditor; private readonly _widgetVisible: IContextKey<boolean>; private readonly _sessionDispoables = new DisposableStore(); private _model?: MarkerList; private _widget?: MarkerNavigationWidget; constructor( editor: ICodeEditor, @IMarkerNavigationService private readonly _markerNavigationService: IMarkerNavigationService, @IContextKeyService private readonly _contextKeyService: IContextKeyService, @ICodeEditorService private readonly _editorService: ICodeEditorService, @IInstantiationService private readonly _instantiationService: IInstantiationService, ) { this._editor = editor; this._widgetVisible = CONTEXT_MARKERS_NAVIGATION_VISIBLE.bindTo(this._contextKeyService); } dispose(): void { this._cleanUp(); this._sessionDispoables.dispose(); } private _cleanUp(): void { this._widgetVisible.reset(); this._sessionDispoables.clear(); this._widget = undefined; this._model = undefined; } private _getOrCreateModel(uri: URI | undefined): MarkerList { if (this._model && this._model.matches(uri)) { return this._model; } let reusePosition = false; if (this._model) { reusePosition = true; this._cleanUp(); } this._model = this._markerNavigationService.getMarkerList(uri); if (reusePosition) { this._model.move(true, this._editor.getModel()!, this._editor.getPosition()!); } this._widget = this._instantiationService.createInstance(MarkerNavigationWidget, this._editor); this._widget.onDidClose(() => this.close(), this, this._sessionDispoables); this._widgetVisible.set(true); this._sessionDispoables.add(this._model); this._sessionDispoables.add(this._widget); // follow cursor this._sessionDispoables.add(this._editor.onDidChangeCursorPosition(e => { if (!this._model?.selected || !Range.containsPosition(this._model?.selected.marker, e.position)) { this._model?.resetIndex(); } })); // update markers this._sessionDispoables.add(this._model.onDidChange(() => { if (!this._widget || !this._widget.position || !this._model) { return; } const info = this._model.find(this._editor.getModel()!.uri, this._widget!.position!); if (info) { this._widget.updateMarker(info.marker); } else { this._widget.showStale(); } })); // open related this._sessionDispoables.add(this._widget.onDidSelectRelatedInformation(related => { this._editorService.openCodeEditor({ resource: related.resource, options: { pinned: true, revealIfOpened: true, selection: Range.lift(related).collapseToStart() } }, this._editor); this.close(false); })); this._sessionDispoables.add(this._editor.onDidChangeModel(() => this._cleanUp())); return this._model; } close(focusEditor: boolean = true): void { this._cleanUp(); if (focusEditor) { this._editor.focus(); } } showAtMarker(marker: IMarker): void { if (this._editor.hasModel()) { const model = this._getOrCreateModel(this._editor.getModel().uri); model.resetIndex(); model.move(true, this._editor.getModel(), new Position(marker.startLineNumber, marker.startColumn)); if (model.selected) { this._widget!.showAtMarker(model.selected.marker, model.selected.index, model.selected.total); } } } async nagivate(next: boolean, multiFile: boolean) { if (this._editor.hasModel()) { const model = this._getOrCreateModel(multiFile ? undefined : this._editor.getModel().uri); model.move(next, this._editor.getModel(), this._editor.getPosition()); if (!model.selected) { return; } if (model.selected.marker.resource.toString() !== this._editor.getModel().uri.toString()) { // show in different editor this._cleanUp(); const otherEditor = await this._editorService.openCodeEditor({ resource: model.selected.marker.resource, options: { pinned: false, revealIfOpened: true, selectionRevealType: TextEditorSelectionRevealType.NearTop, selection: model.selected.marker } }, this._editor); if (otherEditor) { MarkerController.get(otherEditor)?.close(); MarkerController.get(otherEditor)?.nagivate(next, multiFile); } } else { // show in this editor this._widget!.showAtMarker(model.selected.marker, model.selected.index, model.selected.total); } } } } class MarkerNavigationAction extends EditorAction { constructor( private readonly _next: boolean, private readonly _multiFile: boolean, opts: IActionOptions ) { super(opts); } async run(_accessor: ServicesAccessor, editor: ICodeEditor): Promise<void> { if (editor.hasModel()) { MarkerController.get(editor)?.nagivate(this._next, this._multiFile); } } } export class NextMarkerAction extends MarkerNavigationAction { static ID: string = 'editor.action.marker.next'; static LABEL: string = nls.localize('markerAction.next.label', "Go to Next Problem (Error, Warning, Info)"); constructor() { super(true, false, { id: NextMarkerAction.ID, label: NextMarkerAction.LABEL, alias: 'Go to Next Problem (Error, Warning, Info)', precondition: undefined, kbOpts: { kbExpr: EditorContextKeys.focus, primary: KeyMod.Alt | KeyCode.F8, weight: KeybindingWeight.EditorContrib }, menuOpts: { menuId: MarkerNavigationWidget.TitleMenu, title: NextMarkerAction.LABEL, icon: registerIcon('marker-navigation-next', Codicon.arrowDown, nls.localize('nextMarkerIcon', 'Icon for goto next marker.')), group: 'navigation', order: 1 } }); } } class PrevMarkerAction extends MarkerNavigationAction { static ID: string = 'editor.action.marker.prev'; static LABEL: string = nls.localize('markerAction.previous.label', "Go to Previous Problem (Error, Warning, Info)"); constructor() { super(false, false, { id: PrevMarkerAction.ID, label: PrevMarkerAction.LABEL, alias: 'Go to Previous Problem (Error, Warning, Info)', precondition: undefined, kbOpts: { kbExpr: EditorContextKeys.focus, primary: KeyMod.Shift | KeyMod.Alt | KeyCode.F8, weight: KeybindingWeight.EditorContrib }, menuOpts: { menuId: MarkerNavigationWidget.TitleMenu, title: PrevMarkerAction.LABEL, icon: registerIcon('marker-navigation-previous', Codicon.arrowUp, nls.localize('previousMarkerIcon', 'Icon for goto previous marker.')), group: 'navigation', order: 2 } }); } } class NextMarkerInFilesAction extends MarkerNavigationAction { constructor() { super(true, true, { id: 'editor.action.marker.nextInFiles', label: nls.localize('markerAction.nextInFiles.label', "Go to Next Problem in Files (Error, Warning, Info)"), alias: 'Go to Next Problem in Files (Error, Warning, Info)', precondition: undefined, kbOpts: { kbExpr: EditorContextKeys.focus, primary: KeyCode.F8, weight: KeybindingWeight.EditorContrib }, menuOpts: { menuId: MenuId.MenubarGoMenu, title: nls.localize({ key: 'miGotoNextProblem', comment: ['&& denotes a mnemonic'] }, "Next &&Problem"), group: '6_problem_nav', order: 1 } }); } } class PrevMarkerInFilesAction extends MarkerNavigationAction { constructor() { super(false, true, { id: 'editor.action.marker.prevInFiles', label: nls.localize('markerAction.previousInFiles.label', "Go to Previous Problem in Files (Error, Warning, Info)"), alias: 'Go to Previous Problem in Files (Error, Warning, Info)', precondition: undefined, kbOpts: { kbExpr: EditorContextKeys.focus, primary: KeyMod.Shift | KeyCode.F8, weight: KeybindingWeight.EditorContrib }, menuOpts: { menuId: MenuId.MenubarGoMenu, title: nls.localize({ key: 'miGotoPreviousProblem', comment: ['&& denotes a mnemonic'] }, "Previous &&Problem"), group: '6_problem_nav', order: 2 } }); } } registerEditorContribution(MarkerController.ID, MarkerController, EditorContributionInstantiation.Lazy); registerEditorAction(NextMarkerAction); registerEditorAction(PrevMarkerAction); registerEditorAction(NextMarkerInFilesAction); registerEditorAction(PrevMarkerInFilesAction); const CONTEXT_MARKERS_NAVIGATION_VISIBLE = new RawContextKey<boolean>('markersNavigationVisible', false); const MarkerCommand = EditorCommand.bindToContribution<MarkerController>(MarkerController.get); registerEditorCommand(new MarkerCommand({ id: 'closeMarkersNavigation', precondition: CONTEXT_MARKERS_NAVIGATION_VISIBLE, handler: x => x.close(), kbOpts: { weight: KeybindingWeight.EditorContrib + 50, kbExpr: EditorContextKeys.focus, primary: KeyCode.Escape, secondary: [KeyMod.Shift | KeyCode.Escape] } }));
src/vs/editor/contrib/gotoError/browser/gotoError.ts
0
https://github.com/microsoft/vscode/commit/15d8d39815dd6fc14bb2cf9aeb17200bd5710bd5
[ 0.00022446687216870487, 0.00017253693658858538, 0.00016538557247258723, 0.00016952920123003423, 0.000011487026313261595 ]
{ "id": 2, "code_window": [ "\texport interface PortAttributesSelector {\n", "\t\t/**\n", "\t\t * Specifying a port range will cause your provider to only be called for ports within the range.\n", "\t\t */\n" ], "labels": [ "keep", "keep", "add", "keep" ], "after_edit": [ "\t\t * The start is inclusive and the end is exclusive.\n" ], "file_path": "src/vscode-dts/vscode.proposed.portsAttributes.d.ts", "type": "add", "edit_start_line_idx": 74 }
# Steps to publish a new version of monaco-editor-core ## Generate monaco.d.ts * The `monaco.d.ts` is now automatically generated when running `gulp watch` ## Bump version * increase version in `build/monaco/package.json` ## Generate npm contents for monaco-editor-core * Be sure to have all changes committed **and pushed to the remote** * (the generated files contain the HEAD sha and that should be available on the remote) * run gulp editor-distro ## Publish * `cd out-monaco-editor-core` * `npm publish`
build/monaco/README.md
0
https://github.com/microsoft/vscode/commit/15d8d39815dd6fc14bb2cf9aeb17200bd5710bd5
[ 0.00017582770669832826, 0.00017115015361923724, 0.00016844109632074833, 0.0001691816869424656, 0.0000033213127608178183 ]
{ "id": 2, "code_window": [ "\texport interface PortAttributesSelector {\n", "\t\t/**\n", "\t\t * Specifying a port range will cause your provider to only be called for ports within the range.\n", "\t\t */\n" ], "labels": [ "keep", "keep", "add", "keep" ], "after_edit": [ "\t\t * The start is inclusive and the end is exclusive.\n" ], "file_path": "src/vscode-dts/vscode.proposed.portsAttributes.d.ts", "type": "add", "edit_start_line_idx": 74 }
{ "displayName": "Markdown Math", "description": "Adds math support to Markdown in notebooks.", "config.markdown.math.enabled": "Enable/disable rendering math in the built-in Markdown preview." }
extensions/markdown-math/package.nls.json
0
https://github.com/microsoft/vscode/commit/15d8d39815dd6fc14bb2cf9aeb17200bd5710bd5
[ 0.00016916458844207227, 0.00016916458844207227, 0.00016916458844207227, 0.00016916458844207227, 0 ]
{ "id": 3, "code_window": [ "\t\t */\n", "\t\tportRange?: [number, number];\n", "\n", "\t\t/**\n", "\t\t * Specifying a command pattern will cause your provider to only be called for processes whose command line matches the pattern.\n", "\t\t */\n", "\t\tcommandPattern?: RegExp;\n" ], "labels": [ "keep", "replace", "keep", "keep", "keep", "keep", "keep" ], "after_edit": [ "\t\tportRange?: [number, number] | number;\n" ], "file_path": "src/vscode-dts/vscode.proposed.portsAttributes.d.ts", "type": "replace", "edit_start_line_idx": 75 }
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ declare module 'vscode' { // https://github.com/microsoft/vscode/issues/115616 @alexr00 /** * The action that should be taken when a port is discovered through automatic port forwarding discovery. */ export enum PortAutoForwardAction { /** * Notify the user that the port is being forwarded. This is the default action. */ Notify = 1, /** * Once the port is forwarded, open the browser to the forwarded port. */ OpenBrowser = 2, /** * Once the port is forwarded, open the preview browser to the forwarded port. */ OpenPreview = 3, /** * Forward the port silently. */ Silent = 4, /** * Do not forward the port. */ Ignore = 5, /** * Once the port is forwarded, open the browser to the forwarded port. Only open the browser the first time the port is forwarded in a session. */ OpenBrowserOnce = 6 } /** * The attributes that a forwarded port can have. */ export class PortAttributes { /** * The action to be taken when this port is detected for auto forwarding. */ autoForwardAction: PortAutoForwardAction; /** * Creates a new PortAttributes object * @param port the port number * @param autoForwardAction the action to take when this port is detected */ constructor(autoForwardAction: PortAutoForwardAction); } /** * A provider of port attributes. Port attributes are used to determine what action should be taken when a port is discovered. */ export interface PortAttributesProvider { /** * Provides attributes for the given port. For ports that your extension doesn't know about, simply * return undefined. For example, if `providePortAttributes` is called with ports 3000 but your * extension doesn't know anything about 3000 you should return undefined. */ providePortAttributes(port: number, pid: number | undefined, commandLine: string | undefined, token: CancellationToken): ProviderResult<PortAttributes>; } /** * A selector that will be used to filter which {@link PortAttributesProvider} should be called for each port. */ export interface PortAttributesSelector { /** * Specifying a port range will cause your provider to only be called for ports within the range. */ portRange?: [number, number]; /** * Specifying a command pattern will cause your provider to only be called for processes whose command line matches the pattern. */ commandPattern?: RegExp; } export namespace workspace { /** * If your extension listens on ports, consider registering a PortAttributesProvider to provide information * about the ports. For example, a debug extension may know about debug ports in it's debuggee. By providing * this information with a PortAttributesProvider the extension can tell the editor that these ports should be * ignored, since they don't need to be user facing. * * The results of the PortAttributesProvider are merged with the user setting `remote.portsAttributes`. If the values conflict, the user setting takes precedence. * * @param portSelector It is best practice to specify a port selector to avoid unnecessary calls to your provider. * If you don't specify a port selector your provider will be called for every port, which will result in slower port forwarding for the user. * @param provider The {@link PortAttributesProvider PortAttributesProvider}. */ export function registerPortAttributesProvider(portSelector: PortAttributesSelector, provider: PortAttributesProvider): Disposable; } }
src/vscode-dts/vscode.proposed.portsAttributes.d.ts
1
https://github.com/microsoft/vscode/commit/15d8d39815dd6fc14bb2cf9aeb17200bd5710bd5
[ 0.9645275473594666, 0.12205394357442856, 0.0001671451609581709, 0.0001937577035278082, 0.2907261848449707 ]
{ "id": 3, "code_window": [ "\t\t */\n", "\t\tportRange?: [number, number];\n", "\n", "\t\t/**\n", "\t\t * Specifying a command pattern will cause your provider to only be called for processes whose command line matches the pattern.\n", "\t\t */\n", "\t\tcommandPattern?: RegExp;\n" ], "labels": [ "keep", "replace", "keep", "keep", "keep", "keep", "keep" ], "after_edit": [ "\t\tportRange?: [number, number] | number;\n" ], "file_path": "src/vscode-dts/vscode.proposed.portsAttributes.d.ts", "type": "replace", "edit_start_line_idx": 75 }
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; export interface Command { readonly id: string; execute(...args: any[]): void; } export class CommandManager { private readonly _commands = new Map<string, vscode.Disposable>(); public dispose() { for (const registration of this._commands.values()) { registration.dispose(); } this._commands.clear(); } public register<T extends Command>(command: T): vscode.Disposable { this._registerCommand(command.id, command.execute, command); return new vscode.Disposable(() => { this._commands.delete(command.id); }); } private _registerCommand(id: string, impl: (...args: any[]) => void, thisArg?: any) { if (this._commands.has(id)) { return; } this._commands.set(id, vscode.commands.registerCommand(id, impl, thisArg)); } }
extensions/markdown-language-features/src/commandManager.ts
0
https://github.com/microsoft/vscode/commit/15d8d39815dd6fc14bb2cf9aeb17200bd5710bd5
[ 0.00018550392996985465, 0.00017822548397816718, 0.00016908056568354368, 0.0001791587274055928, 0.000005891002729185857 ]
{ "id": 3, "code_window": [ "\t\t */\n", "\t\tportRange?: [number, number];\n", "\n", "\t\t/**\n", "\t\t * Specifying a command pattern will cause your provider to only be called for processes whose command line matches the pattern.\n", "\t\t */\n", "\t\tcommandPattern?: RegExp;\n" ], "labels": [ "keep", "replace", "keep", "keep", "keep", "keep", "keep" ], "after_edit": [ "\t\tportRange?: [number, number] | number;\n" ], "file_path": "src/vscode-dts/vscode.proposed.portsAttributes.d.ts", "type": "replace", "edit_start_line_idx": 75 }
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import * as dom from 'vs/base/browser/dom'; import { DomEmitter } from 'vs/base/browser/event'; import { IContentActionHandler } from 'vs/base/browser/formattedTextRenderer'; import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent'; import { renderMarkdown } from 'vs/base/browser/markdownRenderer'; import { AnchorPosition, IContextViewProvider } from 'vs/base/browser/ui/contextview/contextview'; import { IListEvent, IListRenderer, IListVirtualDelegate } from 'vs/base/browser/ui/list/list'; import { List } from 'vs/base/browser/ui/list/listWidget'; import { ISelectBoxDelegate, ISelectBoxOptions, ISelectBoxStyles, ISelectData, ISelectOptionItem } from 'vs/base/browser/ui/selectBox/selectBox'; import * as arrays from 'vs/base/common/arrays'; import { Emitter, Event } from 'vs/base/common/event'; import { KeyCode, KeyCodeUtils } from 'vs/base/common/keyCodes'; import { Disposable, IDisposable } from 'vs/base/common/lifecycle'; import { isMacintosh } from 'vs/base/common/platform'; import { ScrollbarVisibility } from 'vs/base/common/scrollable'; import 'vs/css!./selectBoxCustom'; import { localize } from 'vs/nls'; const $ = dom.$; const SELECT_OPTION_ENTRY_TEMPLATE_ID = 'selectOption.entry.template'; interface ISelectListTemplateData { root: HTMLElement; text: HTMLElement; detail: HTMLElement; decoratorRight: HTMLElement; } class SelectListRenderer implements IListRenderer<ISelectOptionItem, ISelectListTemplateData> { get templateId(): string { return SELECT_OPTION_ENTRY_TEMPLATE_ID; } renderTemplate(container: HTMLElement): ISelectListTemplateData { const data: ISelectListTemplateData = Object.create(null); data.root = container; data.text = dom.append(container, $('.option-text')); data.detail = dom.append(container, $('.option-detail')); data.decoratorRight = dom.append(container, $('.option-decorator-right')); return data; } renderElement(element: ISelectOptionItem, index: number, templateData: ISelectListTemplateData): void { const data: ISelectListTemplateData = templateData; const text = element.text; const detail = element.detail; const decoratorRight = element.decoratorRight; const isDisabled = element.isDisabled; data.text.textContent = text; data.detail.textContent = !!detail ? detail : ''; data.decoratorRight.innerText = !!decoratorRight ? decoratorRight : ''; // pseudo-select disabled option if (isDisabled) { data.root.classList.add('option-disabled'); } else { // Make sure we do class removal from prior template rendering data.root.classList.remove('option-disabled'); } } disposeTemplate(_templateData: ISelectListTemplateData): void { // noop } } export class SelectBoxList extends Disposable implements ISelectBoxDelegate, IListVirtualDelegate<ISelectOptionItem> { private static readonly DEFAULT_DROPDOWN_MINIMUM_BOTTOM_MARGIN = 32; private static readonly DEFAULT_DROPDOWN_MINIMUM_TOP_MARGIN = 2; private static readonly DEFAULT_MINIMUM_VISIBLE_OPTIONS = 3; private _isVisible: boolean; private selectBoxOptions: ISelectBoxOptions; private selectElement: HTMLSelectElement; private container?: HTMLElement; private options: ISelectOptionItem[] = []; private selected: number; private readonly _onDidSelect: Emitter<ISelectData>; private readonly styles: ISelectBoxStyles; private listRenderer!: SelectListRenderer; private contextViewProvider!: IContextViewProvider; private selectDropDownContainer!: HTMLElement; private styleElement!: HTMLStyleElement; private selectList!: List<ISelectOptionItem>; private selectDropDownListContainer!: HTMLElement; private widthControlElement!: HTMLElement; private _currentSelection = 0; private _dropDownPosition!: AnchorPosition; private _hasDetails: boolean = false; private selectionDetailsPane!: HTMLElement; private _skipLayout: boolean = false; private _cachedMaxDetailsHeight?: number; private _sticky: boolean = false; // for dev purposes only constructor(options: ISelectOptionItem[], selected: number, contextViewProvider: IContextViewProvider, styles: ISelectBoxStyles, selectBoxOptions?: ISelectBoxOptions) { super(); this._isVisible = false; this.styles = styles; this.selectBoxOptions = selectBoxOptions || Object.create(null); if (typeof this.selectBoxOptions.minBottomMargin !== 'number') { this.selectBoxOptions.minBottomMargin = SelectBoxList.DEFAULT_DROPDOWN_MINIMUM_BOTTOM_MARGIN; } else if (this.selectBoxOptions.minBottomMargin < 0) { this.selectBoxOptions.minBottomMargin = 0; } this.selectElement = document.createElement('select'); // Use custom CSS vars for padding calculation this.selectElement.className = 'monaco-select-box monaco-select-box-dropdown-padding'; if (typeof this.selectBoxOptions.ariaLabel === 'string') { this.selectElement.setAttribute('aria-label', this.selectBoxOptions.ariaLabel); } if (typeof this.selectBoxOptions.ariaDescription === 'string') { this.selectElement.setAttribute('aria-description', this.selectBoxOptions.ariaDescription); } this._onDidSelect = new Emitter<ISelectData>(); this._register(this._onDidSelect); this.registerListeners(); this.constructSelectDropDown(contextViewProvider); this.selected = selected || 0; if (options) { this.setOptions(options, selected); } this.initStyleSheet(); } // IDelegate - List renderer getHeight(): number { return 22; } getTemplateId(): string { return SELECT_OPTION_ENTRY_TEMPLATE_ID; } private constructSelectDropDown(contextViewProvider: IContextViewProvider) { // SetUp ContextView container to hold select Dropdown this.contextViewProvider = contextViewProvider; this.selectDropDownContainer = dom.$('.monaco-select-box-dropdown-container'); // Use custom CSS vars for padding calculation (shared with parent select) this.selectDropDownContainer.classList.add('monaco-select-box-dropdown-padding'); // Setup container for select option details this.selectionDetailsPane = dom.append(this.selectDropDownContainer, $('.select-box-details-pane')); // Create span flex box item/div we can measure and control const widthControlOuterDiv = dom.append(this.selectDropDownContainer, $('.select-box-dropdown-container-width-control')); const widthControlInnerDiv = dom.append(widthControlOuterDiv, $('.width-control-div')); this.widthControlElement = document.createElement('span'); this.widthControlElement.className = 'option-text-width-control'; dom.append(widthControlInnerDiv, this.widthControlElement); // Always default to below position this._dropDownPosition = AnchorPosition.BELOW; // Inline stylesheet for themes this.styleElement = dom.createStyleSheet(this.selectDropDownContainer); // Prevent dragging of dropdown #114329 this.selectDropDownContainer.setAttribute('draggable', 'true'); this._register(dom.addDisposableListener(this.selectDropDownContainer, dom.EventType.DRAG_START, (e) => { dom.EventHelper.stop(e, true); })); } private registerListeners() { // Parent native select keyboard listeners this._register(dom.addStandardDisposableListener(this.selectElement, 'change', (e) => { this.selected = e.target.selectedIndex; this._onDidSelect.fire({ index: e.target.selectedIndex, selected: e.target.value }); if (!!this.options[this.selected] && !!this.options[this.selected].text) { this.selectElement.title = this.options[this.selected].text; } })); // Have to implement both keyboard and mouse controllers to handle disabled options // Intercept mouse events to override normal select actions on parents this._register(dom.addDisposableListener(this.selectElement, dom.EventType.CLICK, (e) => { dom.EventHelper.stop(e); if (this._isVisible) { this.hideSelectDropDown(true); } else { this.showSelectDropDown(); } })); this._register(dom.addDisposableListener(this.selectElement, dom.EventType.MOUSE_DOWN, (e) => { dom.EventHelper.stop(e); })); // Intercept touch events // The following implementation is slightly different from the mouse event handlers above. // Use the following helper variable, otherwise the list flickers. let listIsVisibleOnTouchStart: boolean; this._register(dom.addDisposableListener(this.selectElement, 'touchstart', (e) => { listIsVisibleOnTouchStart = this._isVisible; })); this._register(dom.addDisposableListener(this.selectElement, 'touchend', (e) => { dom.EventHelper.stop(e); if (listIsVisibleOnTouchStart) { this.hideSelectDropDown(true); } else { this.showSelectDropDown(); } })); // Intercept keyboard handling this._register(dom.addDisposableListener(this.selectElement, dom.EventType.KEY_DOWN, (e: KeyboardEvent) => { const event = new StandardKeyboardEvent(e); let showDropDown = false; // Create and drop down select list on keyboard select if (isMacintosh) { if (event.keyCode === KeyCode.DownArrow || event.keyCode === KeyCode.UpArrow || event.keyCode === KeyCode.Space || event.keyCode === KeyCode.Enter) { showDropDown = true; } } else { if (event.keyCode === KeyCode.DownArrow && event.altKey || event.keyCode === KeyCode.UpArrow && event.altKey || event.keyCode === KeyCode.Space || event.keyCode === KeyCode.Enter) { showDropDown = true; } } if (showDropDown) { this.showSelectDropDown(); dom.EventHelper.stop(e, true); } })); } public get onDidSelect(): Event<ISelectData> { return this._onDidSelect.event; } public setOptions(options: ISelectOptionItem[], selected?: number): void { if (!arrays.equals(this.options, options)) { this.options = options; this.selectElement.options.length = 0; this._hasDetails = false; this._cachedMaxDetailsHeight = undefined; this.options.forEach((option, index) => { this.selectElement.add(this.createOption(option.text, index, option.isDisabled)); if (typeof option.description === 'string') { this._hasDetails = true; } }); } if (selected !== undefined) { this.select(selected); // Set current = selected since this is not necessarily a user exit this._currentSelection = this.selected; } } private setOptionsList() { // Mirror options in drop-down // Populate select list for non-native select mode this.selectList?.splice(0, this.selectList.length, this.options); } public select(index: number): void { if (index >= 0 && index < this.options.length) { this.selected = index; } else if (index > this.options.length - 1) { // Adjust index to end of list // This could make client out of sync with the select this.select(this.options.length - 1); } else if (this.selected < 0) { this.selected = 0; } this.selectElement.selectedIndex = this.selected; if (!!this.options[this.selected] && !!this.options[this.selected].text) { this.selectElement.title = this.options[this.selected].text; } } public setAriaLabel(label: string): void { this.selectBoxOptions.ariaLabel = label; this.selectElement.setAttribute('aria-label', this.selectBoxOptions.ariaLabel); } public focus(): void { if (this.selectElement) { this.selectElement.tabIndex = 0; this.selectElement.focus(); } } public blur(): void { if (this.selectElement) { this.selectElement.tabIndex = -1; this.selectElement.blur(); } } public setFocusable(focusable: boolean): void { this.selectElement.tabIndex = focusable ? 0 : -1; } public render(container: HTMLElement): void { this.container = container; container.classList.add('select-container'); container.appendChild(this.selectElement); this.styleSelectElement(); } private initStyleSheet(): void { const content: string[] = []; // Style non-native select mode if (this.styles.listFocusBackground) { content.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row.focused { background-color: ${this.styles.listFocusBackground} !important; }`); } if (this.styles.listFocusForeground) { content.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row.focused { color: ${this.styles.listFocusForeground} !important; }`); } if (this.styles.decoratorRightForeground) { content.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row:not(.focused) .option-decorator-right { color: ${this.styles.decoratorRightForeground}; }`); } if (this.styles.selectBackground && this.styles.selectBorder && this.styles.selectBorder !== this.styles.selectBackground) { content.push(`.monaco-select-box-dropdown-container { border: 1px solid ${this.styles.selectBorder} } `); content.push(`.monaco-select-box-dropdown-container > .select-box-details-pane.border-top { border-top: 1px solid ${this.styles.selectBorder} } `); content.push(`.monaco-select-box-dropdown-container > .select-box-details-pane.border-bottom { border-bottom: 1px solid ${this.styles.selectBorder} } `); } else if (this.styles.selectListBorder) { content.push(`.monaco-select-box-dropdown-container > .select-box-details-pane.border-top { border-top: 1px solid ${this.styles.selectListBorder} } `); content.push(`.monaco-select-box-dropdown-container > .select-box-details-pane.border-bottom { border-bottom: 1px solid ${this.styles.selectListBorder} } `); } // Hover foreground - ignore for disabled options if (this.styles.listHoverForeground) { content.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row:not(.option-disabled):not(.focused):hover { color: ${this.styles.listHoverForeground} !important; }`); } // Hover background - ignore for disabled options if (this.styles.listHoverBackground) { content.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row:not(.option-disabled):not(.focused):hover { background-color: ${this.styles.listHoverBackground} !important; }`); } // Match quick input outline styles - ignore for disabled options if (this.styles.listFocusOutline) { content.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row.focused { outline: 1.6px dotted ${this.styles.listFocusOutline} !important; outline-offset: -1.6px !important; }`); } if (this.styles.listHoverOutline) { content.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row:not(.option-disabled):not(.focused):hover { outline: 1.6px dashed ${this.styles.listHoverOutline} !important; outline-offset: -1.6px !important; }`); } // Clear list styles on focus and on hover for disabled options content.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row.option-disabled.focused { background-color: transparent !important; color: inherit !important; outline: none !important; }`); content.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row.option-disabled:hover { background-color: transparent !important; color: inherit !important; outline: none !important; }`); this.styleElement.textContent = content.join('\n'); } private styleSelectElement(): void { const background = this.styles.selectBackground ?? ''; const foreground = this.styles.selectForeground ?? ''; const border = this.styles.selectBorder ?? ''; this.selectElement.style.backgroundColor = background; this.selectElement.style.color = foreground; this.selectElement.style.borderColor = border; } private styleList() { const background = this.styles.selectBackground ?? ''; const listBackground = dom.asCssValueWithDefault(this.styles.selectListBackground, background); this.selectDropDownListContainer.style.backgroundColor = listBackground; this.selectionDetailsPane.style.backgroundColor = listBackground; const optionsBorder = this.styles.focusBorder ?? ''; this.selectDropDownContainer.style.outlineColor = optionsBorder; this.selectDropDownContainer.style.outlineOffset = '-1px'; this.selectList.style(this.styles); } private createOption(value: string, index: number, disabled?: boolean): HTMLOptionElement { const option = document.createElement('option'); option.value = value; option.text = value; option.disabled = !!disabled; return option; } // ContextView dropdown methods private showSelectDropDown() { this.selectionDetailsPane.innerText = ''; if (!this.contextViewProvider || this._isVisible) { return; } // Lazily create and populate list only at open, moved from constructor this.createSelectList(this.selectDropDownContainer); this.setOptionsList(); // This allows us to flip the position based on measurement // Set drop-down position above/below from required height and margins // If pre-layout cannot fit at least one option do not show drop-down this.contextViewProvider.showContextView({ getAnchor: () => this.selectElement, render: (container: HTMLElement) => this.renderSelectDropDown(container, true), layout: () => { this.layoutSelectDropDown(); }, onHide: () => { this.selectDropDownContainer.classList.remove('visible'); this.selectElement.classList.remove('synthetic-focus'); }, anchorPosition: this._dropDownPosition }, this.selectBoxOptions.optionsAsChildren ? this.container : undefined); // Hide so we can relay out this._isVisible = true; this.hideSelectDropDown(false); this.contextViewProvider.showContextView({ getAnchor: () => this.selectElement, render: (container: HTMLElement) => this.renderSelectDropDown(container), layout: () => this.layoutSelectDropDown(), onHide: () => { this.selectDropDownContainer.classList.remove('visible'); this.selectElement.classList.remove('synthetic-focus'); }, anchorPosition: this._dropDownPosition }, this.selectBoxOptions.optionsAsChildren ? this.container : undefined); // Track initial selection the case user escape, blur this._currentSelection = this.selected; this._isVisible = true; this.selectElement.setAttribute('aria-expanded', 'true'); } private hideSelectDropDown(focusSelect: boolean) { if (!this.contextViewProvider || !this._isVisible) { return; } this._isVisible = false; this.selectElement.setAttribute('aria-expanded', 'false'); if (focusSelect) { this.selectElement.focus(); } this.contextViewProvider.hideContextView(); } private renderSelectDropDown(container: HTMLElement, preLayoutPosition?: boolean): IDisposable { container.appendChild(this.selectDropDownContainer); // Pre-Layout allows us to change position this.layoutSelectDropDown(preLayoutPosition); return { dispose: () => { // contextView will dispose itself if moving from one View to another try { container.removeChild(this.selectDropDownContainer); // remove to take out the CSS rules we add } catch (error) { // Ignore, removed already by change of focus } } }; } // Iterate over detailed descriptions, find max height private measureMaxDetailsHeight(): number { let maxDetailsPaneHeight = 0; this.options.forEach((_option, index) => { this.updateDetail(index); if (this.selectionDetailsPane.offsetHeight > maxDetailsPaneHeight) { maxDetailsPaneHeight = this.selectionDetailsPane.offsetHeight; } }); return maxDetailsPaneHeight; } private layoutSelectDropDown(preLayoutPosition?: boolean): boolean { // Avoid recursion from layout called in onListFocus if (this._skipLayout) { return false; } // Layout ContextView drop down select list and container // Have to manage our vertical overflow, sizing, position below or above // Position has to be determined and set prior to contextView instantiation if (this.selectList) { // Make visible to enable measurements this.selectDropDownContainer.classList.add('visible'); const selectPosition = dom.getDomNodePagePosition(this.selectElement); const styles = getComputedStyle(this.selectElement); const verticalPadding = parseFloat(styles.getPropertyValue('--dropdown-padding-top')) + parseFloat(styles.getPropertyValue('--dropdown-padding-bottom')); const maxSelectDropDownHeightBelow = (window.innerHeight - selectPosition.top - selectPosition.height - (this.selectBoxOptions.minBottomMargin || 0)); const maxSelectDropDownHeightAbove = (selectPosition.top - SelectBoxList.DEFAULT_DROPDOWN_MINIMUM_TOP_MARGIN); // Determine optimal width - min(longest option), opt(parent select, excluding margins), max(ContextView controlled) const selectWidth = this.selectElement.offsetWidth; const selectMinWidth = this.setWidthControlElement(this.widthControlElement); const selectOptimalWidth = Math.max(selectMinWidth, Math.round(selectWidth)).toString() + 'px'; this.selectDropDownContainer.style.width = selectOptimalWidth; // Get initial list height and determine space above and below this.selectList.getHTMLElement().style.height = ''; this.selectList.layout(); let listHeight = this.selectList.contentHeight; if (this._hasDetails && this._cachedMaxDetailsHeight === undefined) { this._cachedMaxDetailsHeight = this.measureMaxDetailsHeight(); } const maxDetailsPaneHeight = this._hasDetails ? this._cachedMaxDetailsHeight! : 0; const minRequiredDropDownHeight = listHeight + verticalPadding + maxDetailsPaneHeight; const maxVisibleOptionsBelow = ((Math.floor((maxSelectDropDownHeightBelow - verticalPadding - maxDetailsPaneHeight) / this.getHeight()))); const maxVisibleOptionsAbove = ((Math.floor((maxSelectDropDownHeightAbove - verticalPadding - maxDetailsPaneHeight) / this.getHeight()))); // If we are only doing pre-layout check/adjust position only // Calculate vertical space available, flip up if insufficient // Use reflected padding on parent select, ContextView style // properties not available before DOM attachment if (preLayoutPosition) { // Check if select moved out of viewport , do not open // If at least one option cannot be shown, don't open the drop-down or hide/remove if open if ((selectPosition.top + selectPosition.height) > (window.innerHeight - 22) || selectPosition.top < SelectBoxList.DEFAULT_DROPDOWN_MINIMUM_TOP_MARGIN || ((maxVisibleOptionsBelow < 1) && (maxVisibleOptionsAbove < 1))) { // Indicate we cannot open return false; } // Determine if we have to flip up // Always show complete list items - never more than Max available vertical height if (maxVisibleOptionsBelow < SelectBoxList.DEFAULT_MINIMUM_VISIBLE_OPTIONS && maxVisibleOptionsAbove > maxVisibleOptionsBelow && this.options.length > maxVisibleOptionsBelow ) { this._dropDownPosition = AnchorPosition.ABOVE; this.selectDropDownContainer.removeChild(this.selectDropDownListContainer); this.selectDropDownContainer.removeChild(this.selectionDetailsPane); this.selectDropDownContainer.appendChild(this.selectionDetailsPane); this.selectDropDownContainer.appendChild(this.selectDropDownListContainer); this.selectionDetailsPane.classList.remove('border-top'); this.selectionDetailsPane.classList.add('border-bottom'); } else { this._dropDownPosition = AnchorPosition.BELOW; this.selectDropDownContainer.removeChild(this.selectDropDownListContainer); this.selectDropDownContainer.removeChild(this.selectionDetailsPane); this.selectDropDownContainer.appendChild(this.selectDropDownListContainer); this.selectDropDownContainer.appendChild(this.selectionDetailsPane); this.selectionDetailsPane.classList.remove('border-bottom'); this.selectionDetailsPane.classList.add('border-top'); } // Do full layout on showSelectDropDown only return true; } // Check if select out of viewport or cutting into status bar if ((selectPosition.top + selectPosition.height) > (window.innerHeight - 22) || selectPosition.top < SelectBoxList.DEFAULT_DROPDOWN_MINIMUM_TOP_MARGIN || (this._dropDownPosition === AnchorPosition.BELOW && maxVisibleOptionsBelow < 1) || (this._dropDownPosition === AnchorPosition.ABOVE && maxVisibleOptionsAbove < 1)) { // Cannot properly layout, close and hide this.hideSelectDropDown(true); return false; } // SetUp list dimensions and layout - account for container padding // Use position to check above or below available space if (this._dropDownPosition === AnchorPosition.BELOW) { if (this._isVisible && maxVisibleOptionsBelow + maxVisibleOptionsAbove < 1) { // If drop-down is visible, must be doing a DOM re-layout, hide since we don't fit // Hide drop-down, hide contextview, focus on parent select this.hideSelectDropDown(true); return false; } // Adjust list height to max from select bottom to margin (default/minBottomMargin) if (minRequiredDropDownHeight > maxSelectDropDownHeightBelow) { listHeight = (maxVisibleOptionsBelow * this.getHeight()); } } else { if (minRequiredDropDownHeight > maxSelectDropDownHeightAbove) { listHeight = (maxVisibleOptionsAbove * this.getHeight()); } } // Set adjusted list height and relayout this.selectList.layout(listHeight); this.selectList.domFocus(); // Finally set focus on selected item if (this.selectList.length > 0) { this.selectList.setFocus([this.selected || 0]); this.selectList.reveal(this.selectList.getFocus()[0] || 0); } if (this._hasDetails) { // Leave the selectDropDownContainer to size itself according to children (list + details) - #57447 this.selectList.getHTMLElement().style.height = (listHeight + verticalPadding) + 'px'; this.selectDropDownContainer.style.height = ''; } else { this.selectDropDownContainer.style.height = (listHeight + verticalPadding) + 'px'; } this.updateDetail(this.selected); this.selectDropDownContainer.style.width = selectOptimalWidth; // Maintain focus outline on parent select as well as list container - tabindex for focus this.selectDropDownListContainer.setAttribute('tabindex', '0'); this.selectElement.classList.add('synthetic-focus'); this.selectDropDownContainer.classList.add('synthetic-focus'); return true; } else { return false; } } private setWidthControlElement(container: HTMLElement): number { let elementWidth = 0; if (container) { let longest = 0; let longestLength = 0; this.options.forEach((option, index) => { const detailLength = !!option.detail ? option.detail.length : 0; const rightDecoratorLength = !!option.decoratorRight ? option.decoratorRight.length : 0; const len = option.text.length + detailLength + rightDecoratorLength; if (len > longestLength) { longest = index; longestLength = len; } }); container.textContent = this.options[longest].text + (!!this.options[longest].decoratorRight ? (this.options[longest].decoratorRight + ' ') : ''); elementWidth = dom.getTotalWidth(container); } return elementWidth; } private createSelectList(parent: HTMLElement): void { // If we have already constructive list on open, skip if (this.selectList) { return; } // SetUp container for list this.selectDropDownListContainer = dom.append(parent, $('.select-box-dropdown-list-container')); this.listRenderer = new SelectListRenderer(); this.selectList = new List('SelectBoxCustom', this.selectDropDownListContainer, this, [this.listRenderer], { useShadows: false, verticalScrollMode: ScrollbarVisibility.Visible, keyboardSupport: false, mouseSupport: false, accessibilityProvider: { getAriaLabel: element => { let label = element.text; if (element.detail) { label += `. ${element.detail}`; } if (element.decoratorRight) { label += `. ${element.decoratorRight}`; } if (element.description) { label += `. ${element.description}`; } return label; }, getWidgetAriaLabel: () => localize({ key: 'selectBox', comment: ['Behave like native select dropdown element.'] }, "Select Box"), getRole: () => isMacintosh ? '' : 'option', getWidgetRole: () => 'listbox' } }); if (this.selectBoxOptions.ariaLabel) { this.selectList.ariaLabel = this.selectBoxOptions.ariaLabel; } // SetUp list keyboard controller - control navigation, disabled items, focus const onKeyDown = this._register(new DomEmitter(this.selectDropDownListContainer, 'keydown')); const onSelectDropDownKeyDown = Event.chain(onKeyDown.event) .filter(() => this.selectList.length > 0) .map(e => new StandardKeyboardEvent(e)); this._register(onSelectDropDownKeyDown.filter(e => e.keyCode === KeyCode.Enter).on(e => this.onEnter(e), this)); this._register(onSelectDropDownKeyDown.filter(e => e.keyCode === KeyCode.Tab).on(e => this.onEnter(e), this)); // Tab should behave the same as enter, #79339 this._register(onSelectDropDownKeyDown.filter(e => e.keyCode === KeyCode.Escape).on(e => this.onEscape(e), this)); this._register(onSelectDropDownKeyDown.filter(e => e.keyCode === KeyCode.UpArrow).on(e => this.onUpArrow(e), this)); this._register(onSelectDropDownKeyDown.filter(e => e.keyCode === KeyCode.DownArrow).on(e => this.onDownArrow(e), this)); this._register(onSelectDropDownKeyDown.filter(e => e.keyCode === KeyCode.PageDown).on(this.onPageDown, this)); this._register(onSelectDropDownKeyDown.filter(e => e.keyCode === KeyCode.PageUp).on(this.onPageUp, this)); this._register(onSelectDropDownKeyDown.filter(e => e.keyCode === KeyCode.Home).on(this.onHome, this)); this._register(onSelectDropDownKeyDown.filter(e => e.keyCode === KeyCode.End).on(this.onEnd, this)); this._register(onSelectDropDownKeyDown.filter(e => (e.keyCode >= KeyCode.Digit0 && e.keyCode <= KeyCode.KeyZ) || (e.keyCode >= KeyCode.Semicolon && e.keyCode <= KeyCode.NumpadDivide)).on(this.onCharacter, this)); // SetUp list mouse controller - control navigation, disabled items, focus this._register(dom.addDisposableListener(this.selectList.getHTMLElement(), dom.EventType.POINTER_UP, e => this.onPointerUp(e))); this._register(this.selectList.onMouseOver(e => typeof e.index !== 'undefined' && this.selectList.setFocus([e.index]))); this._register(this.selectList.onDidChangeFocus(e => this.onListFocus(e))); this._register(dom.addDisposableListener(this.selectDropDownContainer, dom.EventType.FOCUS_OUT, e => { if (!this._isVisible || dom.isAncestor(e.relatedTarget as HTMLElement, this.selectDropDownContainer)) { return; } this.onListBlur(); })); this.selectList.getHTMLElement().setAttribute('aria-label', this.selectBoxOptions.ariaLabel || ''); this.selectList.getHTMLElement().setAttribute('aria-expanded', 'true'); this.styleList(); } // List methods // List mouse controller - active exit, select option, fire onDidSelect if change, return focus to parent select // Also takes in touchend events private onPointerUp(e: PointerEvent): void { if (!this.selectList.length) { return; } dom.EventHelper.stop(e); const target = <Element>e.target; if (!target) { return; } // Check our mouse event is on an option (not scrollbar) if (target.classList.contains('slider')) { return; } const listRowElement = target.closest('.monaco-list-row'); if (!listRowElement) { return; } const index = Number(listRowElement.getAttribute('data-index')); const disabled = listRowElement.classList.contains('option-disabled'); // Ignore mouse selection of disabled options if (index >= 0 && index < this.options.length && !disabled) { this.selected = index; this.select(this.selected); this.selectList.setFocus([this.selected]); this.selectList.reveal(this.selectList.getFocus()[0]); // Only fire if selection change if (this.selected !== this._currentSelection) { // Set current = selected this._currentSelection = this.selected; this._onDidSelect.fire({ index: this.selectElement.selectedIndex, selected: this.options[this.selected].text }); if (!!this.options[this.selected] && !!this.options[this.selected].text) { this.selectElement.title = this.options[this.selected].text; } } this.hideSelectDropDown(true); } } // List Exit - passive - implicit no selection change, hide drop-down private onListBlur(): void { if (this._sticky) { return; } if (this.selected !== this._currentSelection) { // Reset selected to current if no change this.select(this._currentSelection); } this.hideSelectDropDown(false); } private renderDescriptionMarkdown(text: string, actionHandler?: IContentActionHandler): HTMLElement { const cleanRenderedMarkdown = (element: Node) => { for (let i = 0; i < element.childNodes.length; i++) { const child = <Element>element.childNodes.item(i); const tagName = child.tagName && child.tagName.toLowerCase(); if (tagName === 'img') { element.removeChild(child); } else { cleanRenderedMarkdown(child); } } }; const rendered = renderMarkdown({ value: text, supportThemeIcons: true }, { actionHandler }); rendered.element.classList.add('select-box-description-markdown'); cleanRenderedMarkdown(rendered.element); return rendered.element; } // List Focus Change - passive - update details pane with newly focused element's data private onListFocus(e: IListEvent<ISelectOptionItem>) { // Skip during initial layout if (!this._isVisible || !this._hasDetails) { return; } this.updateDetail(e.indexes[0]); } private updateDetail(selectedIndex: number): void { this.selectionDetailsPane.innerText = ''; const option = this.options[selectedIndex]; const description = option?.description ?? ''; const descriptionIsMarkdown = option?.descriptionIsMarkdown ?? false; if (description) { if (descriptionIsMarkdown) { const actionHandler = option.descriptionMarkdownActionHandler; this.selectionDetailsPane.appendChild(this.renderDescriptionMarkdown(description, actionHandler)); } else { this.selectionDetailsPane.innerText = description; } this.selectionDetailsPane.style.display = 'block'; } else { this.selectionDetailsPane.style.display = 'none'; } // Avoid recursion this._skipLayout = true; this.contextViewProvider.layout(); this._skipLayout = false; } // List keyboard controller // List exit - active - hide ContextView dropdown, reset selection, return focus to parent select private onEscape(e: StandardKeyboardEvent): void { dom.EventHelper.stop(e); // Reset selection to value when opened this.select(this._currentSelection); this.hideSelectDropDown(true); } // List exit - active - hide ContextView dropdown, return focus to parent select, fire onDidSelect if change private onEnter(e: StandardKeyboardEvent): void { dom.EventHelper.stop(e); // Only fire if selection change if (this.selected !== this._currentSelection) { this._currentSelection = this.selected; this._onDidSelect.fire({ index: this.selectElement.selectedIndex, selected: this.options[this.selected].text }); if (!!this.options[this.selected] && !!this.options[this.selected].text) { this.selectElement.title = this.options[this.selected].text; } } this.hideSelectDropDown(true); } // List navigation - have to handle a disabled option (jump over) private onDownArrow(e: StandardKeyboardEvent): void { if (this.selected < this.options.length - 1) { dom.EventHelper.stop(e, true); // Skip disabled options const nextOptionDisabled = this.options[this.selected + 1].isDisabled; if (nextOptionDisabled && this.options.length > this.selected + 2) { this.selected += 2; } else if (nextOptionDisabled) { return; } else { this.selected++; } // Set focus/selection - only fire event when closing drop-down or on blur this.select(this.selected); this.selectList.setFocus([this.selected]); this.selectList.reveal(this.selectList.getFocus()[0]); } } private onUpArrow(e: StandardKeyboardEvent): void { if (this.selected > 0) { dom.EventHelper.stop(e, true); // Skip disabled options const previousOptionDisabled = this.options[this.selected - 1].isDisabled; if (previousOptionDisabled && this.selected > 1) { this.selected -= 2; } else { this.selected--; } // Set focus/selection - only fire event when closing drop-down or on blur this.select(this.selected); this.selectList.setFocus([this.selected]); this.selectList.reveal(this.selectList.getFocus()[0]); } } private onPageUp(e: StandardKeyboardEvent): void { dom.EventHelper.stop(e); this.selectList.focusPreviousPage(); // Allow scrolling to settle setTimeout(() => { this.selected = this.selectList.getFocus()[0]; // Shift selection down if we land on a disabled option if (this.options[this.selected].isDisabled && this.selected < this.options.length - 1) { this.selected++; this.selectList.setFocus([this.selected]); } this.selectList.reveal(this.selected); this.select(this.selected); }, 1); } private onPageDown(e: StandardKeyboardEvent): void { dom.EventHelper.stop(e); this.selectList.focusNextPage(); // Allow scrolling to settle setTimeout(() => { this.selected = this.selectList.getFocus()[0]; // Shift selection up if we land on a disabled option if (this.options[this.selected].isDisabled && this.selected > 0) { this.selected--; this.selectList.setFocus([this.selected]); } this.selectList.reveal(this.selected); this.select(this.selected); }, 1); } private onHome(e: StandardKeyboardEvent): void { dom.EventHelper.stop(e); if (this.options.length < 2) { return; } this.selected = 0; if (this.options[this.selected].isDisabled && this.selected > 1) { this.selected++; } this.selectList.setFocus([this.selected]); this.selectList.reveal(this.selected); this.select(this.selected); } private onEnd(e: StandardKeyboardEvent): void { dom.EventHelper.stop(e); if (this.options.length < 2) { return; } this.selected = this.options.length - 1; if (this.options[this.selected].isDisabled && this.selected > 1) { this.selected--; } this.selectList.setFocus([this.selected]); this.selectList.reveal(this.selected); this.select(this.selected); } // Mimic option first character navigation of native select private onCharacter(e: StandardKeyboardEvent): void { const ch = KeyCodeUtils.toString(e.keyCode); let optionIndex = -1; for (let i = 0; i < this.options.length - 1; i++) { optionIndex = (i + this.selected + 1) % this.options.length; if (this.options[optionIndex].text.charAt(0).toUpperCase() === ch && !this.options[optionIndex].isDisabled) { this.select(optionIndex); this.selectList.setFocus([optionIndex]); this.selectList.reveal(this.selectList.getFocus()[0]); dom.EventHelper.stop(e); break; } } } public override dispose(): void { this.hideSelectDropDown(false); super.dispose(); } }
src/vs/base/browser/ui/selectBox/selectBoxCustom.ts
0
https://github.com/microsoft/vscode/commit/15d8d39815dd6fc14bb2cf9aeb17200bd5710bd5
[ 0.0014618997229263186, 0.00019713481015060097, 0.00016634826897643507, 0.00017209896759595722, 0.0001619395916350186 ]
{ "id": 3, "code_window": [ "\t\t */\n", "\t\tportRange?: [number, number];\n", "\n", "\t\t/**\n", "\t\t * Specifying a command pattern will cause your provider to only be called for processes whose command line matches the pattern.\n", "\t\t */\n", "\t\tcommandPattern?: RegExp;\n" ], "labels": [ "keep", "replace", "keep", "keep", "keep", "keep", "keep" ], "after_edit": [ "\t\tportRange?: [number, number] | number;\n" ], "file_path": "src/vscode-dts/vscode.proposed.portsAttributes.d.ts", "type": "replace", "edit_start_line_idx": 75 }
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import { IHistoryNavigationWidget } from 'vs/base/browser/history'; import { IContextViewProvider } from 'vs/base/browser/ui/contextview/contextview'; import { FindInput, IFindInputOptions } from 'vs/base/browser/ui/findinput/findInput'; import { IReplaceInputOptions, ReplaceInput } from 'vs/base/browser/ui/findinput/replaceInput'; import { HistoryInputBox, IHistoryInputOptions } from 'vs/base/browser/ui/inputbox/inputBox'; import { KeyCode, KeyMod } from 'vs/base/common/keyCodes'; import { ContextKeyExpr, IContextKey, IContextKeyService, RawContextKey } from 'vs/platform/contextkey/common/contextkey'; import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { localize } from 'vs/nls'; import { DisposableStore, IDisposable, toDisposable } from 'vs/base/common/lifecycle'; export const historyNavigationVisible = new RawContextKey<boolean>('suggestWidgetVisible', false, localize('suggestWidgetVisible', "Whether suggestion are visible")); const HistoryNavigationWidgetFocusContext = 'historyNavigationWidgetFocus'; const HistoryNavigationForwardsEnablementContext = 'historyNavigationForwardsEnabled'; const HistoryNavigationBackwardsEnablementContext = 'historyNavigationBackwardsEnabled'; export interface IHistoryNavigationContext extends IDisposable { historyNavigationForwardsEnablement: IContextKey<boolean>; historyNavigationBackwardsEnablement: IContextKey<boolean>; } let lastFocusedWidget: IHistoryNavigationWidget | undefined = undefined; const widgets: IHistoryNavigationWidget[] = []; export function registerAndCreateHistoryNavigationContext(scopedContextKeyService: IContextKeyService, widget: IHistoryNavigationWidget): IHistoryNavigationContext { if (widgets.includes(widget)) { throw new Error('Cannot register the same widget multiple times'); } widgets.push(widget); const disposableStore = new DisposableStore(); const historyNavigationWidgetFocus = new RawContextKey<boolean>(HistoryNavigationWidgetFocusContext, false).bindTo(scopedContextKeyService); const historyNavigationForwardsEnablement = new RawContextKey<boolean>(HistoryNavigationForwardsEnablementContext, true).bindTo(scopedContextKeyService); const historyNavigationBackwardsEnablement = new RawContextKey<boolean>(HistoryNavigationBackwardsEnablementContext, true).bindTo(scopedContextKeyService); const onDidFocus = () => { historyNavigationWidgetFocus.set(true); lastFocusedWidget = widget; }; const onDidBlur = () => { historyNavigationWidgetFocus.set(false); if (lastFocusedWidget === widget) { lastFocusedWidget = undefined; } }; // Check for currently being focused if (widget.element === document.activeElement) { onDidFocus(); } disposableStore.add(widget.onDidFocus(() => onDidFocus())); disposableStore.add(widget.onDidBlur(() => onDidBlur())); disposableStore.add(toDisposable(() => { widgets.splice(widgets.indexOf(widget), 1); onDidBlur(); })); return { historyNavigationForwardsEnablement, historyNavigationBackwardsEnablement, dispose() { disposableStore.dispose(); } }; } export class ContextScopedHistoryInputBox extends HistoryInputBox { constructor(container: HTMLElement, contextViewProvider: IContextViewProvider | undefined, options: IHistoryInputOptions, @IContextKeyService contextKeyService: IContextKeyService ) { super(container, contextViewProvider, options); const scopedContextKeyService = this._register(contextKeyService.createScoped(this.element)); this._register(registerAndCreateHistoryNavigationContext(scopedContextKeyService, this)); } } export class ContextScopedFindInput extends FindInput { constructor(container: HTMLElement | null, contextViewProvider: IContextViewProvider, options: IFindInputOptions, @IContextKeyService contextKeyService: IContextKeyService ) { super(container, contextViewProvider, options); const scopedContextKeyService = this._register(contextKeyService.createScoped(this.inputBox.element)); this._register(registerAndCreateHistoryNavigationContext(scopedContextKeyService, this.inputBox)); } } export class ContextScopedReplaceInput extends ReplaceInput { constructor(container: HTMLElement | null, contextViewProvider: IContextViewProvider | undefined, options: IReplaceInputOptions, @IContextKeyService contextKeyService: IContextKeyService, showReplaceOptions: boolean = false ) { super(container, contextViewProvider, showReplaceOptions, options); const scopedContextKeyService = this._register(contextKeyService.createScoped(this.inputBox.element)); this._register(registerAndCreateHistoryNavigationContext(scopedContextKeyService, this.inputBox)); } } KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'history.showPrevious', weight: KeybindingWeight.WorkbenchContrib, when: ContextKeyExpr.and( ContextKeyExpr.has(HistoryNavigationWidgetFocusContext), ContextKeyExpr.equals(HistoryNavigationBackwardsEnablementContext, true), historyNavigationVisible.isEqualTo(false), ), primary: KeyCode.UpArrow, secondary: [KeyMod.Alt | KeyCode.UpArrow], handler: (accessor) => { lastFocusedWidget?.showPreviousValue(); } }); KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'history.showNext', weight: KeybindingWeight.WorkbenchContrib, when: ContextKeyExpr.and( ContextKeyExpr.has(HistoryNavigationWidgetFocusContext), ContextKeyExpr.equals(HistoryNavigationForwardsEnablementContext, true), historyNavigationVisible.isEqualTo(false), ), primary: KeyCode.DownArrow, secondary: [KeyMod.Alt | KeyCode.DownArrow], handler: (accessor) => { lastFocusedWidget?.showNextValue(); } });
src/vs/platform/history/browser/contextScopedHistoryWidget.ts
0
https://github.com/microsoft/vscode/commit/15d8d39815dd6fc14bb2cf9aeb17200bd5710bd5
[ 0.0001750398223521188, 0.00017150909116026014, 0.0001667277974775061, 0.00017194761312566698, 0.0000024649916667840444 ]
{ "id": 0, "code_window": [ " <AlertDialog open={showDeleteDialog} onOpenChange={setShowDeleteDialog}>\n", " <AlertDialogContent>\n", " <AlertDialogHeader>\n", " <AlertDialogTitle>Are you sure absolutely sure?</AlertDialogTitle>\n", " <AlertDialogDescription>\n", " This action cannot be undone. This preset will no longer be\n", " accessible by you or others you&apos;ve shared it with.\n", " </AlertDialogDescription>\n", " </AlertDialogHeader>\n" ], "labels": [ "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ], "after_edit": [ " <AlertDialogTitle>Are you absolutely sure?</AlertDialogTitle>\n" ], "file_path": "apps/www/app/examples/playground/components/preset-actions.tsx", "type": "replace", "edit_start_line_idx": 97 }
--- title: Drawer description: A drawer component for React. component: true links: doc: https://github.com/emilkowalski/vaul --- <ComponentPreview name="drawer-demo" /> ## About Drawer is built on top of [Vaul](https://github.com/emilkowalski/vaul) by [emilkowalski\_](https://twitter.com/emilkowalski_). ## Installation <Tabs defaultValue="cli"> <TabsList> <TabsTrigger value="cli">CLI</TabsTrigger> <TabsTrigger value="manual">Manual</TabsTrigger> </TabsList> <TabsContent value="cli"> ```bash npx shadcn-ui@latest add drawer ``` </TabsContent> <TabsContent value="manual"> <Steps> <Step>Install the following dependencies:</Step> ```bash npm install vaul ``` <Step>Copy and paste the following code into your project.</Step> <ComponentSource name="drawer" /> <Step>Update the import paths to match your project setup.</Step> </Steps> </TabsContent> </Tabs> ## Usage ```tsx showLineNumbers import { Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerTitle, DrawerTrigger, } from "@/components/ui/drawer" ``` ```tsx showLineNumbers <Drawer> <DrawerTrigger>Open</DrawerTrigger> <DrawerContent> <DrawerHeader> <DrawerTitle>Are you sure absolutely sure?</DrawerTitle> <DrawerDescription>This action cannot be undone.</DrawerDescription> </DrawerHeader> <DrawerFooter> <Button>Submit</Button> <DrawerClose> <Button variant="outline">Cancel</Button> </DrawerClose> </DrawerFooter> </DrawerContent> </Drawer> ``` ## Examples ### Responsive Dialog You can combine the `Dialog` and `Drawer` components to create a responsive dialog. This renders a `Dialog` component on desktop and a `Drawer` on mobile. <ComponentPreview name="drawer-dialog" />
apps/www/content/docs/components/drawer.mdx
1
https://github.com/shadcn-ui/ui/commit/4b200ebf5973602ec017294bbdaaee59cd632d0f
[ 0.03132364898920059, 0.003286262508481741, 0.00016374862752854824, 0.00016753788804635406, 0.009345801547169685 ]
{ "id": 0, "code_window": [ " <AlertDialog open={showDeleteDialog} onOpenChange={setShowDeleteDialog}>\n", " <AlertDialogContent>\n", " <AlertDialogHeader>\n", " <AlertDialogTitle>Are you sure absolutely sure?</AlertDialogTitle>\n", " <AlertDialogDescription>\n", " This action cannot be undone. This preset will no longer be\n", " accessible by you or others you&apos;ve shared it with.\n", " </AlertDialogDescription>\n", " </AlertDialogHeader>\n" ], "labels": [ "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ], "after_edit": [ " <AlertDialogTitle>Are you absolutely sure?</AlertDialogTitle>\n" ], "file_path": "apps/www/app/examples/playground/components/preset-actions.tsx", "type": "replace", "edit_start_line_idx": 97 }
{ "inlineColors": { "light": { "background": "white", "foreground": "zinc-950", "card": "white", "card-foreground": "zinc-950", "popover": "white", "popover-foreground": "zinc-950", "primary": "zinc-900", "primary-foreground": "zinc-50", "secondary": "zinc-100", "secondary-foreground": "zinc-900", "muted": "zinc-100", "muted-foreground": "zinc-500", "accent": "zinc-100", "accent-foreground": "zinc-900", "destructive": "red-500", "destructive-foreground": "zinc-50", "border": "zinc-200", "input": "zinc-200", "ring": "zinc-950" }, "dark": { "background": "zinc-950", "foreground": "zinc-50", "card": "zinc-950", "card-foreground": "zinc-50", "popover": "zinc-950", "popover-foreground": "zinc-50", "primary": "zinc-50", "primary-foreground": "zinc-900", "secondary": "zinc-800", "secondary-foreground": "zinc-50", "muted": "zinc-800", "muted-foreground": "zinc-400", "accent": "zinc-800", "accent-foreground": "zinc-50", "destructive": "red-900", "destructive-foreground": "zinc-50", "border": "zinc-800", "input": "zinc-800", "ring": "zinc-300" } }, "cssVars": { "light": { "background": "0 0% 100%", "foreground": "240 10% 3.9%", "card": "0 0% 100%", "card-foreground": "240 10% 3.9%", "popover": "0 0% 100%", "popover-foreground": "240 10% 3.9%", "primary": "240 5.9% 10%", "primary-foreground": "0 0% 98%", "secondary": "240 4.8% 95.9%", "secondary-foreground": "240 5.9% 10%", "muted": "240 4.8% 95.9%", "muted-foreground": "240 3.8% 46.1%", "accent": "240 4.8% 95.9%", "accent-foreground": "240 5.9% 10%", "destructive": "0 84.2% 60.2%", "destructive-foreground": "0 0% 98%", "border": "240 5.9% 90%", "input": "240 5.9% 90%", "ring": "240 10% 3.9%" }, "dark": { "background": "240 10% 3.9%", "foreground": "0 0% 98%", "card": "240 10% 3.9%", "card-foreground": "0 0% 98%", "popover": "240 10% 3.9%", "popover-foreground": "0 0% 98%", "primary": "0 0% 98%", "primary-foreground": "240 5.9% 10%", "secondary": "240 3.7% 15.9%", "secondary-foreground": "0 0% 98%", "muted": "240 3.7% 15.9%", "muted-foreground": "240 5% 64.9%", "accent": "240 3.7% 15.9%", "accent-foreground": "0 0% 98%", "destructive": "0 62.8% 30.6%", "destructive-foreground": "0 0% 98%", "border": "240 3.7% 15.9%", "input": "240 3.7% 15.9%", "ring": "240 4.9% 83.9%" } }, "inlineColorsTemplate": "@tailwind base;\n@tailwind components;\n@tailwind utilities;\n", "cssVarsTemplate": "@tailwind base;\n@tailwind components;\n@tailwind utilities;\n \n@layer base {\n :root {\n --background: 0 0% 100%;\n --foreground: 240 10% 3.9%;\n\n --card: 0 0% 100%;\n --card-foreground: 240 10% 3.9%;\n \n --popover: 0 0% 100%;\n --popover-foreground: 240 10% 3.9%;\n \n --primary: 240 5.9% 10%;\n --primary-foreground: 0 0% 98%;\n \n --secondary: 240 4.8% 95.9%;\n --secondary-foreground: 240 5.9% 10%;\n \n --muted: 240 4.8% 95.9%;\n --muted-foreground: 240 3.8% 46.1%;\n \n --accent: 240 4.8% 95.9%;\n --accent-foreground: 240 5.9% 10%;\n \n --destructive: 0 84.2% 60.2%;\n --destructive-foreground: 0 0% 98%;\n\n --border: 240 5.9% 90%;\n --input: 240 5.9% 90%;\n --ring: 240 10% 3.9%;\n \n --radius: 0.5rem;\n }\n \n .dark {\n --background: 240 10% 3.9%;\n --foreground: 0 0% 98%;\n \n --card: 240 10% 3.9%;\n --card-foreground: 0 0% 98%;\n \n --popover: 240 10% 3.9%;\n --popover-foreground: 0 0% 98%;\n \n --primary: 0 0% 98%;\n --primary-foreground: 240 5.9% 10%;\n \n --secondary: 240 3.7% 15.9%;\n --secondary-foreground: 0 0% 98%;\n \n --muted: 240 3.7% 15.9%;\n --muted-foreground: 240 5% 64.9%;\n \n --accent: 240 3.7% 15.9%;\n --accent-foreground: 0 0% 98%;\n \n --destructive: 0 62.8% 30.6%;\n --destructive-foreground: 0 0% 98%;\n \n --border: 240 3.7% 15.9%;\n --input: 240 3.7% 15.9%;\n --ring: 240 4.9% 83.9%;\n }\n}\n \n@layer base {\n * {\n @apply border-border;\n }\n body {\n @apply bg-background text-foreground;\n }\n}" }
apps/www/public/registry/colors/zinc.json
0
https://github.com/shadcn-ui/ui/commit/4b200ebf5973602ec017294bbdaaee59cd632d0f
[ 0.00017591741925571114, 0.0001725816837279126, 0.00017013483738992363, 0.00017229889635927975, 0.0000016004808003344806 ]
{ "id": 0, "code_window": [ " <AlertDialog open={showDeleteDialog} onOpenChange={setShowDeleteDialog}>\n", " <AlertDialogContent>\n", " <AlertDialogHeader>\n", " <AlertDialogTitle>Are you sure absolutely sure?</AlertDialogTitle>\n", " <AlertDialogDescription>\n", " This action cannot be undone. This preset will no longer be\n", " accessible by you or others you&apos;ve shared it with.\n", " </AlertDialogDescription>\n", " </AlertDialogHeader>\n" ], "labels": [ "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ], "after_edit": [ " <AlertDialogTitle>Are you absolutely sure?</AlertDialogTitle>\n" ], "file_path": "apps/www/app/examples/playground/components/preset-actions.tsx", "type": "replace", "edit_start_line_idx": 97 }
"use client" import { zodResolver } from "@hookform/resolvers/zod" import { useForm } from "react-hook-form" import * as z from "zod" import { Button } from "@/registry/new-york/ui/button" import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage, } from "@/registry/new-york/ui/form" import { RadioGroup, RadioGroupItem } from "@/registry/new-york/ui/radio-group" import { toast } from "@/registry/new-york/ui/use-toast" const FormSchema = z.object({ type: z.enum(["all", "mentions", "none"], { required_error: "You need to select a notification type.", }), }) export default function RadioGroupForm() { const form = useForm<z.infer<typeof FormSchema>>({ resolver: zodResolver(FormSchema), }) function onSubmit(data: z.infer<typeof FormSchema>) { toast({ title: "You submitted the following values:", description: ( <pre className="mt-2 w-[340px] rounded-md bg-slate-950 p-4"> <code className="text-white">{JSON.stringify(data, null, 2)}</code> </pre> ), }) } return ( <Form {...form}> <form onSubmit={form.handleSubmit(onSubmit)} className="w-2/3 space-y-6"> <FormField control={form.control} name="type" render={({ field }) => ( <FormItem className="space-y-3"> <FormLabel>Notify me about...</FormLabel> <FormControl> <RadioGroup onValueChange={field.onChange} defaultValue={field.value} className="flex flex-col space-y-1" > <FormItem className="flex items-center space-x-3 space-y-0"> <FormControl> <RadioGroupItem value="all" /> </FormControl> <FormLabel className="font-normal"> All new messages </FormLabel> </FormItem> <FormItem className="flex items-center space-x-3 space-y-0"> <FormControl> <RadioGroupItem value="mentions" /> </FormControl> <FormLabel className="font-normal"> Direct messages and mentions </FormLabel> </FormItem> <FormItem className="flex items-center space-x-3 space-y-0"> <FormControl> <RadioGroupItem value="none" /> </FormControl> <FormLabel className="font-normal">Nothing</FormLabel> </FormItem> </RadioGroup> </FormControl> <FormMessage /> </FormItem> )} /> <Button type="submit">Submit</Button> </form> </Form> ) }
apps/www/registry/new-york/example/radio-group-form.tsx
0
https://github.com/shadcn-ui/ui/commit/4b200ebf5973602ec017294bbdaaee59cd632d0f
[ 0.00017459361697547138, 0.00017058364755939692, 0.00016472363495267928, 0.00017108928295783699, 0.0000025312058369308943 ]
{ "id": 0, "code_window": [ " <AlertDialog open={showDeleteDialog} onOpenChange={setShowDeleteDialog}>\n", " <AlertDialogContent>\n", " <AlertDialogHeader>\n", " <AlertDialogTitle>Are you sure absolutely sure?</AlertDialogTitle>\n", " <AlertDialogDescription>\n", " This action cannot be undone. This preset will no longer be\n", " accessible by you or others you&apos;ve shared it with.\n", " </AlertDialogDescription>\n", " </AlertDialogHeader>\n" ], "labels": [ "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ], "after_edit": [ " <AlertDialogTitle>Are you absolutely sure?</AlertDialogTitle>\n" ], "file_path": "apps/www/app/examples/playground/components/preset-actions.tsx", "type": "replace", "edit_start_line_idx": 97 }
"use client" import * as React from "react" import { ThemeProvider as NextThemesProvider } from "next-themes" import { ThemeProviderProps } from "next-themes/dist/types" import { TooltipProvider } from "@/registry/new-york/ui/tooltip" export function ThemeProvider({ children, ...props }: ThemeProviderProps) { return ( <NextThemesProvider {...props}> <TooltipProvider>{children}</TooltipProvider> </NextThemesProvider> ) }
apps/www/components/providers.tsx
0
https://github.com/shadcn-ui/ui/commit/4b200ebf5973602ec017294bbdaaee59cd632d0f
[ 0.0001721736480249092, 0.00017167298938147724, 0.0001711723452899605, 0.00017167298938147724, 5.006513674743474e-7 ]
{ "id": 1, "code_window": [ "<Dialog>\n", " <DialogTrigger>Open</DialogTrigger>\n", " <DialogContent>\n", " <DialogHeader>\n", " <DialogTitle>Are you sure absolutely sure?</DialogTitle>\n", " <DialogDescription>\n", " This action cannot be undone. This will permanently delete your account\n", " and remove your data from our servers.\n", " </DialogDescription>\n", " </DialogHeader>\n" ], "labels": [ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ], "after_edit": [ " <DialogTitle>Are you absolutely sure?</DialogTitle>\n" ], "file_path": "apps/www/content/docs/components/dialog.mdx", "type": "replace", "edit_start_line_idx": 68 }
"use client" import * as React from "react" import { Dialog } from "@radix-ui/react-dialog" import { DotsHorizontalIcon } from "@radix-ui/react-icons" import { AlertDialog, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, } from "@/registry/new-york/ui/alert-dialog" import { Button } from "@/registry/new-york/ui/button" import { DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, } from "@/registry/new-york/ui/dialog" import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger, } from "@/registry/new-york/ui/dropdown-menu" import { Label } from "@/registry/new-york/ui/label" import { Switch } from "@/registry/new-york/ui/switch" import { toast } from "@/registry/new-york/ui/use-toast" export function PresetActions() { const [open, setIsOpen] = React.useState(false) const [showDeleteDialog, setShowDeleteDialog] = React.useState(false) return ( <> <DropdownMenu> <DropdownMenuTrigger asChild> <Button variant="secondary"> <span className="sr-only">Actions</span> <DotsHorizontalIcon className="h-4 w-4" /> </Button> </DropdownMenuTrigger> <DropdownMenuContent align="end"> <DropdownMenuItem onSelect={() => setIsOpen(true)}> Content filter preferences </DropdownMenuItem> <DropdownMenuSeparator /> <DropdownMenuItem onSelect={() => setShowDeleteDialog(true)} className="text-red-600" > Delete preset </DropdownMenuItem> </DropdownMenuContent> </DropdownMenu> <Dialog open={open} onOpenChange={setIsOpen}> <DialogContent> <DialogHeader> <DialogTitle>Content filter preferences</DialogTitle> <DialogDescription> The content filter flags text that may violate our content policy. It&apos;s powered by our moderation endpoint which is free to use to moderate your OpenAI API traffic. Learn more. </DialogDescription> </DialogHeader> <div className="py-6"> <h4 className="text-sm text-muted-foreground"> Playground Warnings </h4> <div className="flex items-start justify-between space-x-4 pt-3"> <Switch name="show" id="show" defaultChecked={true} /> <Label className="grid gap-1 font-normal" htmlFor="show"> <span className="font-semibold"> Show a warning when content is flagged </span> <span className="text-sm text-muted-foreground"> A warning will be shown when sexual, hateful, violent or self-harm content is detected. </span> </Label> </div> </div> <DialogFooter> <Button variant="secondary" onClick={() => setIsOpen(false)}> Close </Button> </DialogFooter> </DialogContent> </Dialog> <AlertDialog open={showDeleteDialog} onOpenChange={setShowDeleteDialog}> <AlertDialogContent> <AlertDialogHeader> <AlertDialogTitle>Are you sure absolutely sure?</AlertDialogTitle> <AlertDialogDescription> This action cannot be undone. This preset will no longer be accessible by you or others you&apos;ve shared it with. </AlertDialogDescription> </AlertDialogHeader> <AlertDialogFooter> <AlertDialogCancel>Cancel</AlertDialogCancel> <Button variant="destructive" onClick={() => { setShowDeleteDialog(false) toast({ description: "This preset has been deleted.", }) }} > Delete </Button> </AlertDialogFooter> </AlertDialogContent> </AlertDialog> </> ) }
apps/www/app/examples/playground/components/preset-actions.tsx
1
https://github.com/shadcn-ui/ui/commit/4b200ebf5973602ec017294bbdaaee59cd632d0f
[ 0.02520333230495453, 0.002572688739746809, 0.0001653221988817677, 0.00020754463912453502, 0.006620339117944241 ]
{ "id": 1, "code_window": [ "<Dialog>\n", " <DialogTrigger>Open</DialogTrigger>\n", " <DialogContent>\n", " <DialogHeader>\n", " <DialogTitle>Are you sure absolutely sure?</DialogTitle>\n", " <DialogDescription>\n", " This action cannot be undone. This will permanently delete your account\n", " and remove your data from our servers.\n", " </DialogDescription>\n", " </DialogHeader>\n" ], "labels": [ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ], "after_edit": [ " <DialogTitle>Are you absolutely sure?</DialogTitle>\n" ], "file_path": "apps/www/content/docs/components/dialog.mdx", "type": "replace", "edit_start_line_idx": 68 }
"use client" import * as React from "react" import * as ProgressPrimitive from "@radix-ui/react-progress" import { cn } from "@/lib/utils" const Progress = React.forwardRef< React.ElementRef<typeof ProgressPrimitive.Root>, React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Root> >(({ className, value, ...props }, ref) => ( <ProgressPrimitive.Root ref={ref} className={cn( "relative h-2 w-full overflow-hidden rounded-full bg-primary/20", className )} {...props} > <ProgressPrimitive.Indicator className="h-full w-full flex-1 bg-primary transition-all" style={{ transform: `translateX(-${100 - (value || 0)}%)` }} /> </ProgressPrimitive.Root> )) Progress.displayName = ProgressPrimitive.Root.displayName export { Progress }
apps/www/registry/new-york/ui/progress.tsx
0
https://github.com/shadcn-ui/ui/commit/4b200ebf5973602ec017294bbdaaee59cd632d0f
[ 0.00017614955140743405, 0.0001751273957779631, 0.00017341328202746809, 0.0001758193102432415, 0.0000012195263252579025 ]
{ "id": 1, "code_window": [ "<Dialog>\n", " <DialogTrigger>Open</DialogTrigger>\n", " <DialogContent>\n", " <DialogHeader>\n", " <DialogTitle>Are you sure absolutely sure?</DialogTitle>\n", " <DialogDescription>\n", " This action cannot be undone. This will permanently delete your account\n", " and remove your data from our servers.\n", " </DialogDescription>\n", " </DialogHeader>\n" ], "labels": [ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ], "after_edit": [ " <DialogTitle>Are you absolutely sure?</DialogTitle>\n" ], "file_path": "apps/www/content/docs/components/dialog.mdx", "type": "replace", "edit_start_line_idx": 68 }
{ "name": "gray", "label": "Gray", "cssVars": { "light": { "background": "0 0% 100%", "foreground": "224 71.4% 4.1%", "card": "0 0% 100%", "card-foreground": "224 71.4% 4.1%", "popover": "0 0% 100%", "popover-foreground": "224 71.4% 4.1%", "primary": "220.9 39.3% 11%", "primary-foreground": "210 20% 98%", "secondary": "220 14.3% 95.9%", "secondary-foreground": "220.9 39.3% 11%", "muted": "220 14.3% 95.9%", "muted-foreground": "220 8.9% 46.1%", "accent": "220 14.3% 95.9%", "accent-foreground": "220.9 39.3% 11%", "destructive": "0 84.2% 60.2%", "destructive-foreground": "210 20% 98%", "border": "220 13% 91%", "input": "220 13% 91%", "ring": "224 71.4% 4.1%" }, "dark": { "background": "224 71.4% 4.1%", "foreground": "210 20% 98%", "card": "224 71.4% 4.1%", "card-foreground": "210 20% 98%", "popover": "224 71.4% 4.1%", "popover-foreground": "210 20% 98%", "primary": "210 20% 98%", "primary-foreground": "220.9 39.3% 11%", "secondary": "215 27.9% 16.9%", "secondary-foreground": "210 20% 98%", "muted": "215 27.9% 16.9%", "muted-foreground": "217.9 10.6% 64.9%", "accent": "215 27.9% 16.9%", "accent-foreground": "210 20% 98%", "destructive": "0 62.8% 30.6%", "destructive-foreground": "210 20% 98%", "border": "215 27.9% 16.9%", "input": "215 27.9% 16.9%", "ring": "216 12.2% 83.9%" } } }
apps/www/public/registry/themes/gray.json
0
https://github.com/shadcn-ui/ui/commit/4b200ebf5973602ec017294bbdaaee59cd632d0f
[ 0.00017495690553914756, 0.0001738374849082902, 0.0001722416200209409, 0.0001745463378028944, 0.000001114472865992866 ]
{ "id": 1, "code_window": [ "<Dialog>\n", " <DialogTrigger>Open</DialogTrigger>\n", " <DialogContent>\n", " <DialogHeader>\n", " <DialogTitle>Are you sure absolutely sure?</DialogTitle>\n", " <DialogDescription>\n", " This action cannot be undone. This will permanently delete your account\n", " and remove your data from our servers.\n", " </DialogDescription>\n", " </DialogHeader>\n" ], "labels": [ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ], "after_edit": [ " <DialogTitle>Are you absolutely sure?</DialogTitle>\n" ], "file_path": "apps/www/content/docs/components/dialog.mdx", "type": "replace", "edit_start_line_idx": 68 }
{ "name": "button", "dependencies": [ "@radix-ui/react-slot" ], "files": [ { "name": "button.tsx", "content": "import * as React from \"react\"\nimport { Slot } from \"@radix-ui/react-slot\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst buttonVariants = cva(\n \"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50\",\n {\n variants: {\n variant: {\n default:\n \"bg-primary text-primary-foreground shadow hover:bg-primary/90\",\n destructive:\n \"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90\",\n outline:\n \"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground\",\n secondary:\n \"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80\",\n ghost: \"hover:bg-accent hover:text-accent-foreground\",\n link: \"text-primary underline-offset-4 hover:underline\",\n },\n size: {\n default: \"h-9 px-4 py-2\",\n sm: \"h-8 rounded-md px-3 text-xs\",\n lg: \"h-10 rounded-md px-8\",\n icon: \"h-9 w-9\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n },\n }\n)\n\nexport interface ButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement>,\n VariantProps<typeof buttonVariants> {\n asChild?: boolean\n}\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n ({ className, variant, size, asChild = false, ...props }, ref) => {\n const Comp = asChild ? Slot : \"button\"\n return (\n <Comp\n className={cn(buttonVariants({ variant, size, className }))}\n ref={ref}\n {...props}\n />\n )\n }\n)\nButton.displayName = \"Button\"\n\nexport { Button, buttonVariants }\n" } ], "type": "components:ui" }
apps/www/public/registry/styles/new-york/button.json
0
https://github.com/shadcn-ui/ui/commit/4b200ebf5973602ec017294bbdaaee59cd632d0f
[ 0.0001739714207360521, 0.0001696743129286915, 0.00016537721967324615, 0.0001696743129286915, 0.000004297100531402975 ]
{ "id": 2, "code_window": [ " </DialogTrigger>\n", " </ContextMenuContent>\n", " </ContextMenu>\n", " <DialogContent>\n", " <DialogHeader>\n", " <DialogTitle>Are you sure absolutely sure?</DialogTitle>\n", " <DialogDescription>\n", " This action cannot be undone. Are you sure you want to permanently\n", " delete this file from our servers?\n", " </DialogDescription>\n", " </DialogHeader>\n" ], "labels": [ "keep", "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ], "after_edit": [ " <DialogTitle>Are you absolutely sure?</DialogTitle>\n" ], "file_path": "apps/www/content/docs/components/dialog.mdx", "type": "replace", "edit_start_line_idx": 105 }
--- title: Sheet description: Extends the Dialog component to display content that complements the main content of the screen. component: true links: doc: https://www.radix-ui.com/docs/primitives/components/dialog api: https://www.radix-ui.com/docs/primitives/components/dialog#api-reference --- <ComponentPreview name="sheet-demo" /> ## Installation <Tabs defaultValue="cli"> <TabsList> <TabsTrigger value="cli">CLI</TabsTrigger> <TabsTrigger value="manual">Manual</TabsTrigger> </TabsList> <TabsContent value="cli"> ```bash npx shadcn-ui@latest add sheet ``` </TabsContent> <TabsContent value="manual"> <Steps> <Step>Install the following dependencies:</Step> ```bash npm install @radix-ui/react-dialog ``` <Step>Copy and paste the following code into your project.</Step> <ComponentSource name="sheet" /> <Step>Update the import paths to match your project setup.</Step> </Steps> </TabsContent> </Tabs> ### Usage ```tsx import { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle, SheetTrigger, } from "@/components/ui/sheet" ``` ```tsx <Sheet> <SheetTrigger>Open</SheetTrigger> <SheetContent> <SheetHeader> <SheetTitle>Are you sure absolutely sure?</SheetTitle> <SheetDescription> This action cannot be undone. This will permanently delete your account and remove your data from our servers. </SheetDescription> </SheetHeader> </SheetContent> </Sheet> ``` ## Examples ### Side Use the `side` property to `<SheetContent />` to indicate the edge of the screen where the component will appear. The values can be `top`, `right`, `bottom` or `left`. <ComponentPreview name="sheet-side" /> ### Size You can adjust the size of the sheet using CSS classes: ```tsx {3} <Sheet> <SheetTrigger>Open</SheetTrigger> <SheetContent className="w-[400px] sm:w-[540px]"> <SheetHeader> <SheetTitle>Are you sure absolutely sure?</SheetTitle> <SheetDescription> This action cannot be undone. This will permanently delete your account and remove your data from our servers. </SheetDescription> </SheetHeader> </SheetContent> </Sheet> ```
apps/www/content/docs/components/sheet.mdx
1
https://github.com/shadcn-ui/ui/commit/4b200ebf5973602ec017294bbdaaee59cd632d0f
[ 0.012616807594895363, 0.0020767617970705032, 0.00016363499162252992, 0.00016821222379803658, 0.00407131714746356 ]
{ "id": 2, "code_window": [ " </DialogTrigger>\n", " </ContextMenuContent>\n", " </ContextMenu>\n", " <DialogContent>\n", " <DialogHeader>\n", " <DialogTitle>Are you sure absolutely sure?</DialogTitle>\n", " <DialogDescription>\n", " This action cannot be undone. Are you sure you want to permanently\n", " delete this file from our servers?\n", " </DialogDescription>\n", " </DialogHeader>\n" ], "labels": [ "keep", "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ], "after_edit": [ " <DialogTitle>Are you absolutely sure?</DialogTitle>\n" ], "file_path": "apps/www/content/docs/components/dialog.mdx", "type": "replace", "edit_start_line_idx": 105 }
import { BellRing, Check } from "lucide-react" import { cn } from "@/lib/utils" import { Button } from "@/registry/default/ui/button" import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, } from "@/registry/default/ui/card" import { Switch } from "@/registry/default/ui/switch" const notifications = [ { title: "Your call has been confirmed.", description: "1 hour ago", }, { title: "You have a new message!", description: "1 hour ago", }, { title: "Your subscription is expiring soon!", description: "2 hours ago", }, ] type CardProps = React.ComponentProps<typeof Card> export default function CardDemo({ className, ...props }: CardProps) { return ( <Card className={cn("w-[380px]", className)} {...props}> <CardHeader> <CardTitle>Notifications</CardTitle> <CardDescription>You have 3 unread messages.</CardDescription> </CardHeader> <CardContent className="grid gap-4"> <div className=" flex items-center space-x-4 rounded-md border p-4"> <BellRing /> <div className="flex-1 space-y-1"> <p className="text-sm font-medium leading-none"> Push Notifications </p> <p className="text-sm text-muted-foreground"> Send notifications to device. </p> </div> <Switch /> </div> <div> {notifications.map((notification, index) => ( <div key={index} className="mb-4 grid grid-cols-[25px_1fr] items-start pb-4 last:mb-0 last:pb-0" > <span className="flex h-2 w-2 translate-y-1 rounded-full bg-sky-500" /> <div className="space-y-1"> <p className="text-sm font-medium leading-none"> {notification.title} </p> <p className="text-sm text-muted-foreground"> {notification.description} </p> </div> </div> ))} </div> </CardContent> <CardFooter> <Button className="w-full"> <Check className="mr-2 h-4 w-4" /> Mark all as read </Button> </CardFooter> </Card> ) }
apps/www/registry/default/example/card-demo.tsx
0
https://github.com/shadcn-ui/ui/commit/4b200ebf5973602ec017294bbdaaee59cd632d0f
[ 0.00017411945736967027, 0.0001703414018265903, 0.00016448380483780056, 0.00017086739535443485, 0.000003055889010283863 ]
{ "id": 2, "code_window": [ " </DialogTrigger>\n", " </ContextMenuContent>\n", " </ContextMenu>\n", " <DialogContent>\n", " <DialogHeader>\n", " <DialogTitle>Are you sure absolutely sure?</DialogTitle>\n", " <DialogDescription>\n", " This action cannot be undone. Are you sure you want to permanently\n", " delete this file from our servers?\n", " </DialogDescription>\n", " </DialogHeader>\n" ], "labels": [ "keep", "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ], "after_edit": [ " <DialogTitle>Are you absolutely sure?</DialogTitle>\n" ], "file_path": "apps/www/content/docs/components/dialog.mdx", "type": "replace", "edit_start_line_idx": 105 }
import { Registry } from "@/registry/schema" const ui: Registry = [ { name: "accordion", type: "components:ui", dependencies: ["@radix-ui/react-accordion"], files: ["ui/accordion.tsx"], }, { name: "alert", type: "components:ui", files: ["ui/alert.tsx"], }, { name: "alert-dialog", type: "components:ui", dependencies: ["@radix-ui/react-alert-dialog"], registryDependencies: ["button"], files: ["ui/alert-dialog.tsx"], }, { name: "aspect-ratio", type: "components:ui", dependencies: ["@radix-ui/react-aspect-ratio"], files: ["ui/aspect-ratio.tsx"], }, { name: "avatar", type: "components:ui", dependencies: ["@radix-ui/react-avatar"], files: ["ui/avatar.tsx"], }, { name: "badge", type: "components:ui", files: ["ui/badge.tsx"], }, { name: "button", type: "components:ui", dependencies: ["@radix-ui/react-slot"], files: ["ui/button.tsx"], }, { name: "calendar", type: "components:ui", dependencies: ["react-day-picker", "date-fns"], registryDependencies: ["button"], files: ["ui/calendar.tsx"], }, { name: "card", type: "components:ui", files: ["ui/card.tsx"], }, { name: "carousel", type: "components:ui", files: ["ui/carousel.tsx"], registryDependencies: ["button"], dependencies: ["embla-carousel-react"], }, { name: "checkbox", type: "components:ui", dependencies: ["@radix-ui/react-checkbox"], files: ["ui/checkbox.tsx"], }, { name: "collapsible", type: "components:ui", dependencies: ["@radix-ui/react-collapsible"], files: ["ui/collapsible.tsx"], }, { name: "command", type: "components:ui", dependencies: ["cmdk"], registryDependencies: ["dialog"], files: ["ui/command.tsx"], }, { name: "context-menu", type: "components:ui", dependencies: ["@radix-ui/react-context-menu"], files: ["ui/context-menu.tsx"], }, { name: "dialog", type: "components:ui", dependencies: ["@radix-ui/react-dialog"], files: ["ui/dialog.tsx"], }, { name: "drawer", type: "components:ui", dependencies: ["vaul", "@radix-ui/react-dialog"], files: ["ui/drawer.tsx"], }, { name: "dropdown-menu", type: "components:ui", dependencies: ["@radix-ui/react-dropdown-menu"], files: ["ui/dropdown-menu.tsx"], }, { name: "form", type: "components:ui", dependencies: [ "@radix-ui/react-label", "@radix-ui/react-slot", "@hookform/resolvers", "zod", "react-hook-form", ], registryDependencies: ["button", "label"], files: ["ui/form.tsx"], }, { name: "hover-card", type: "components:ui", dependencies: ["@radix-ui/react-hover-card"], files: ["ui/hover-card.tsx"], }, { name: "input", type: "components:ui", files: ["ui/input.tsx"], }, { name: "label", type: "components:ui", dependencies: ["@radix-ui/react-label"], files: ["ui/label.tsx"], }, { name: "menubar", type: "components:ui", dependencies: ["@radix-ui/react-menubar"], files: ["ui/menubar.tsx"], }, { name: "navigation-menu", type: "components:ui", dependencies: ["@radix-ui/react-navigation-menu"], files: ["ui/navigation-menu.tsx"], }, { name: "pagination", type: "components:ui", registryDependencies: ["button"], files: ["ui/pagination.tsx"], }, { name: "popover", type: "components:ui", dependencies: ["@radix-ui/react-popover"], files: ["ui/popover.tsx"], }, { name: "progress", type: "components:ui", dependencies: ["@radix-ui/react-progress"], files: ["ui/progress.tsx"], }, { name: "radio-group", type: "components:ui", dependencies: ["@radix-ui/react-radio-group"], files: ["ui/radio-group.tsx"], }, { name: "resizable", type: "components:ui", dependencies: ["react-resizable-panels"], files: ["ui/resizable.tsx"], }, { name: "scroll-area", type: "components:ui", dependencies: ["@radix-ui/react-scroll-area"], files: ["ui/scroll-area.tsx"], }, { name: "select", type: "components:ui", dependencies: ["@radix-ui/react-select"], files: ["ui/select.tsx"], }, { name: "separator", type: "components:ui", dependencies: ["@radix-ui/react-separator"], files: ["ui/separator.tsx"], }, { name: "sheet", type: "components:ui", dependencies: ["@radix-ui/react-dialog"], files: ["ui/sheet.tsx"], }, { name: "skeleton", type: "components:ui", files: ["ui/skeleton.tsx"], }, { name: "slider", type: "components:ui", dependencies: ["@radix-ui/react-slider"], files: ["ui/slider.tsx"], }, { name: "sonner", type: "components:ui", dependencies: ["sonner", "next-themes"], files: ["ui/sonner.tsx"], }, { name: "switch", type: "components:ui", dependencies: ["@radix-ui/react-switch"], files: ["ui/switch.tsx"], }, { name: "table", type: "components:ui", files: ["ui/table.tsx"], }, { name: "tabs", type: "components:ui", dependencies: ["@radix-ui/react-tabs"], files: ["ui/tabs.tsx"], }, { name: "textarea", type: "components:ui", files: ["ui/textarea.tsx"], }, { name: "toast", type: "components:ui", dependencies: ["@radix-ui/react-toast"], files: ["ui/toast.tsx", "ui/use-toast.ts", "ui/toaster.tsx"], }, { name: "toggle", type: "components:ui", dependencies: ["@radix-ui/react-toggle"], files: ["ui/toggle.tsx"], }, { name: "toggle-group", type: "components:ui", dependencies: ["@radix-ui/react-toggle-group"], registryDependencies: ["toggle"], files: ["ui/toggle-group.tsx"], }, { name: "tooltip", type: "components:ui", dependencies: ["@radix-ui/react-tooltip"], files: ["ui/tooltip.tsx"], }, ] const example: Registry = [ { name: "accordion-demo", type: "components:example", registryDependencies: ["accordion"], files: ["example/accordion-demo.tsx"], }, { name: "alert-demo", type: "components:example", registryDependencies: ["alert"], files: ["example/alert-demo.tsx"], }, { name: "alert-destructive", type: "components:example", registryDependencies: ["alert"], files: ["example/alert-destructive.tsx"], }, { name: "alert-dialog-demo", type: "components:example", registryDependencies: ["alert-dialog", "button"], files: ["example/alert-dialog-demo.tsx"], }, { name: "aspect-ratio-demo", type: "components:example", registryDependencies: ["aspect-ratio"], files: ["example/aspect-ratio-demo.tsx"], }, { name: "avatar-demo", type: "components:example", registryDependencies: ["avatar"], files: ["example/avatar-demo.tsx"], }, { name: "badge-demo", type: "components:example", registryDependencies: ["badge"], files: ["example/badge-demo.tsx"], }, { name: "badge-destructive", type: "components:example", registryDependencies: ["badge"], files: ["example/badge-destructive.tsx"], }, { name: "badge-outline", type: "components:example", registryDependencies: ["badge"], files: ["example/badge-outline.tsx"], }, { name: "badge-secondary", type: "components:example", registryDependencies: ["badge"], files: ["example/badge-secondary.tsx"], }, { name: "button-demo", type: "components:example", registryDependencies: ["button"], files: ["example/button-demo.tsx"], }, { name: "button-secondary", type: "components:example", registryDependencies: ["button"], files: ["example/button-secondary.tsx"], }, { name: "button-destructive", type: "components:example", registryDependencies: ["button"], files: ["example/button-destructive.tsx"], }, { name: "button-outline", type: "components:example", registryDependencies: ["button"], files: ["example/button-outline.tsx"], }, { name: "button-ghost", type: "components:example", registryDependencies: ["button"], files: ["example/button-ghost.tsx"], }, { name: "button-link", type: "components:example", registryDependencies: ["button"], files: ["example/button-link.tsx"], }, { name: "button-with-icon", type: "components:example", registryDependencies: ["button"], files: ["example/button-with-icon.tsx"], }, { name: "button-loading", type: "components:example", registryDependencies: ["button"], files: ["example/button-loading.tsx"], }, { name: "button-icon", type: "components:example", registryDependencies: ["button"], files: ["example/button-icon.tsx"], }, { name: "button-as-child", type: "components:example", registryDependencies: ["button"], files: ["example/button-as-child.tsx"], }, { name: "calendar-demo", type: "components:example", registryDependencies: ["calendar"], files: ["example/calendar-demo.tsx"], }, { name: "calendar-form", type: "components:example", registryDependencies: ["calendar", "form", "popover"], files: ["example/calendar-form.tsx"], }, { name: "card-demo", type: "components:example", registryDependencies: ["card", "button", "switch"], files: ["example/card-demo.tsx"], }, { name: "card-with-form", type: "components:example", registryDependencies: ["button", "card", "input", "label", "select"], files: ["example/card-with-form.tsx"], }, { name: "carousel-demo", type: "components:example", registryDependencies: ["carousel"], files: ["example/carousel-demo.tsx"], }, { name: "carousel-size", type: "components:example", registryDependencies: ["carousel"], files: ["example/carousel-size.tsx"], }, { name: "carousel-spacing", type: "components:example", registryDependencies: ["carousel"], files: ["example/carousel-spacing.tsx"], }, { name: "carousel-orientation", type: "components:example", registryDependencies: ["carousel"], files: ["example/carousel-orientation.tsx"], }, { name: "carousel-api", type: "components:example", registryDependencies: ["carousel"], files: ["example/carousel-api.tsx"], }, { name: "carousel-plugin", type: "components:example", registryDependencies: ["carousel"], files: ["example/carousel-plugin.tsx"], }, { name: "checkbox-demo", type: "components:example", registryDependencies: ["checkbox"], files: ["example/checkbox-demo.tsx"], }, { name: "checkbox-disabled", type: "components:example", registryDependencies: ["checkbox"], files: ["example/checkbox-disabled.tsx"], }, { name: "checkbox-form-multiple", type: "components:example", registryDependencies: ["checkbox", "form"], files: ["example/checkbox-form-multiple.tsx"], }, { name: "checkbox-form-single", type: "components:example", registryDependencies: ["checkbox", "form"], files: ["example/checkbox-form-single.tsx"], }, { name: "checkbox-with-text", type: "components:example", registryDependencies: ["checkbox"], files: ["example/checkbox-with-text.tsx"], }, { name: "collapsible-demo", type: "components:example", registryDependencies: ["collapsible"], files: ["example/collapsible-demo.tsx"], }, { name: "combobox-demo", type: "components:example", registryDependencies: ["command"], files: ["example/combobox-demo.tsx"], }, { name: "combobox-dropdown-menu", type: "components:example", registryDependencies: ["command", "dropdown-menu", "button"], files: ["example/combobox-dropdown-menu.tsx"], }, { name: "combobox-form", type: "components:example", registryDependencies: ["command", "form"], files: ["example/combobox-form.tsx"], }, { name: "combobox-popover", type: "components:example", registryDependencies: ["combobox", "popover"], files: ["example/combobox-popover.tsx"], }, { name: "combobox-responsive", type: "components:example", registryDependencies: ["combobox", "popover", "drawer"], files: ["example/combobox-responsive.tsx"], }, { name: "command-demo", type: "components:example", registryDependencies: ["command"], files: ["example/command-demo.tsx"], }, { name: "command-dialog", type: "components:example", registryDependencies: ["command", "dialog"], files: ["example/command-dialog.tsx"], }, { name: "context-menu-demo", type: "components:example", registryDependencies: ["context-menu"], files: ["example/context-menu-demo.tsx"], }, { name: "data-table-demo", type: "components:example", registryDependencies: ["data-table"], files: ["example/data-table-demo.tsx"], }, { name: "date-picker-demo", type: "components:example", registryDependencies: ["button", "calendar", "popover"], files: ["example/date-picker-demo.tsx"], dependencies: ["date-fns"], }, { name: "date-picker-form", type: "components:example", registryDependencies: ["button", "calendar", "form", "popover"], files: ["example/date-picker-form.tsx"], dependencies: ["date-fns"], }, { name: "date-picker-with-presets", type: "components:example", registryDependencies: ["button", "calendar", "popover", "select"], files: ["example/date-picker-with-presets.tsx"], dependencies: ["date-fns"], }, { name: "date-picker-with-range", type: "components:example", registryDependencies: ["button", "calendar", "popover"], files: ["example/date-picker-with-range.tsx"], dependencies: ["date-fns"], }, { name: "dialog-demo", type: "components:example", registryDependencies: ["dialog"], files: ["example/dialog-demo.tsx"], }, { name: "dialog-close-button", type: "components:example", registryDependencies: ["dialog", "button"], files: ["example/dialog-close-button.tsx"], }, { name: "drawer-demo", type: "components:example", registryDependencies: ["drawer"], files: ["example/drawer-demo.tsx"], }, { name: "drawer-dialog", type: "components:example", registryDependencies: ["drawer", "dialog"], files: ["example/drawer-dialog.tsx"], }, { name: "dropdown-menu-demo", type: "components:example", registryDependencies: ["dropdown-menu"], files: ["example/dropdown-menu-demo.tsx"], }, { name: "dropdown-menu-checkboxes", type: "components:example", registryDependencies: ["dropdown-menu", "checkbox"], files: ["example/dropdown-menu-checkboxes.tsx"], }, { name: "dropdown-menu-radio-group", type: "components:example", registryDependencies: ["dropdown-menu", "radio-group"], files: ["example/dropdown-menu-radio-group.tsx"], }, { name: "hover-card-demo", type: "components:example", registryDependencies: ["hover-card"], files: ["example/hover-card-demo.tsx"], }, { name: "input-demo", type: "components:example", registryDependencies: ["input"], files: ["example/input-demo.tsx"], }, { name: "input-disabled", type: "components:example", registryDependencies: ["input"], files: ["example/input-disabled.tsx"], }, { name: "input-file", type: "components:example", registryDependencies: ["input"], files: ["example/input-file.tsx"], }, { name: "input-form", type: "components:example", registryDependencies: ["input", "button", "form"], files: ["example/input-form.tsx"], }, { name: "input-with-button", type: "components:example", registryDependencies: ["input", "button"], files: ["example/input-with-button.tsx"], }, { name: "input-with-label", type: "components:example", registryDependencies: ["input", "button", "label"], files: ["example/input-with-label.tsx"], }, { name: "input-with-text", type: "components:example", registryDependencies: ["input", "button", "label"], files: ["example/input-with-text.tsx"], }, { name: "label-demo", type: "components:example", registryDependencies: ["label"], files: ["example/label-demo.tsx"], }, { name: "menubar-demo", type: "components:example", registryDependencies: ["menubar"], files: ["example/menubar-demo.tsx"], }, { name: "navigation-menu-demo", type: "components:example", registryDependencies: ["navigation-menu"], files: ["example/navigation-menu-demo.tsx"], }, { name: "pagination-demo", type: "components:example", registryDependencies: ["pagination"], files: ["example/pagination-demo.tsx"], }, { name: "popover-demo", type: "components:example", registryDependencies: ["popover"], files: ["example/popover-demo.tsx"], }, { name: "progress-demo", type: "components:example", registryDependencies: ["progress"], files: ["example/progress-demo.tsx"], }, { name: "radio-group-demo", type: "components:example", registryDependencies: ["radio-group"], files: ["example/radio-group-demo.tsx"], }, { name: "radio-group-form", type: "components:example", registryDependencies: ["radio-group", "form"], files: ["example/radio-group-form.tsx"], }, { name: "resizable-demo", type: "components:example", registryDependencies: ["resizable"], files: ["example/resizable-demo.tsx"], }, { name: "resizable-demo-with-handle", type: "components:example", registryDependencies: ["resizable"], files: ["example/resizable-demo-with-handle.tsx"], }, { name: "resizable-vertical", type: "components:example", registryDependencies: ["resizable"], files: ["example/resizable-vertical.tsx"], }, { name: "resizable-handle", type: "components:example", registryDependencies: ["resizable"], files: ["example/resizable-handle.tsx"], }, { name: "scroll-area-demo", type: "components:example", registryDependencies: ["scroll-area"], files: ["example/scroll-area-demo.tsx"], }, { name: "scroll-area-horizontal-demo", type: "components:example", registryDependencies: ["scroll-area"], files: ["example/scroll-area-horizontal-demo.tsx"], }, { name: "select-demo", type: "components:example", registryDependencies: ["select"], files: ["example/select-demo.tsx"], }, { name: "select-scrollable", type: "components:example", registryDependencies: ["select"], files: ["example/select-scrollable.tsx"], }, { name: "select-form", type: "components:example", registryDependencies: ["select"], files: ["example/select-form.tsx"], }, { name: "separator-demo", type: "components:example", registryDependencies: ["separator"], files: ["example/separator-demo.tsx"], }, { name: "sheet-demo", type: "components:example", registryDependencies: ["sheet"], files: ["example/sheet-demo.tsx"], }, { name: "sheet-side", type: "components:example", registryDependencies: ["sheet"], files: ["example/sheet-side.tsx"], }, { name: "skeleton-demo", type: "components:example", registryDependencies: ["skeleton"], files: ["example/skeleton-demo.tsx"], }, { name: "slider-demo", type: "components:example", registryDependencies: ["slider"], files: ["example/slider-demo.tsx"], }, { name: "sonner-demo", type: "components:example", registryDependencies: ["sonner"], files: ["example/sonner-demo.tsx"], }, { name: "switch-demo", type: "components:example", registryDependencies: ["switch"], files: ["example/switch-demo.tsx"], }, { name: "switch-form", type: "components:example", registryDependencies: ["switch", "form"], files: ["example/switch-form.tsx"], }, { name: "table-demo", type: "components:example", registryDependencies: ["table"], files: ["example/table-demo.tsx"], }, { name: "tabs-demo", type: "components:example", registryDependencies: ["tabs"], files: ["example/tabs-demo.tsx"], }, { name: "textarea-demo", type: "components:example", registryDependencies: ["textarea"], files: ["example/textarea-demo.tsx"], }, { name: "textarea-disabled", type: "components:example", registryDependencies: ["textarea"], files: ["example/textarea-disabled.tsx"], }, { name: "textarea-form", type: "components:example", registryDependencies: ["textarea", "form"], files: ["example/textarea-form.tsx"], }, { name: "textarea-with-button", type: "components:example", registryDependencies: ["textarea", "button"], files: ["example/textarea-with-button.tsx"], }, { name: "textarea-with-label", type: "components:example", registryDependencies: ["textarea", "label"], files: ["example/textarea-with-label.tsx"], }, { name: "textarea-with-text", type: "components:example", registryDependencies: ["textarea", "label"], files: ["example/textarea-with-text.tsx"], }, { name: "toast-demo", type: "components:example", registryDependencies: ["toast"], files: ["example/toast-demo.tsx"], }, { name: "toast-destructive", type: "components:example", registryDependencies: ["toast"], files: ["example/toast-destructive.tsx"], }, { name: "toast-simple", type: "components:example", registryDependencies: ["toast"], files: ["example/toast-simple.tsx"], }, { name: "toast-with-action", type: "components:example", registryDependencies: ["toast"], files: ["example/toast-with-action.tsx"], }, { name: "toast-with-title", type: "components:example", registryDependencies: ["toast"], files: ["example/toast-with-title.tsx"], }, { name: "toggle-group-demo", type: "components:example", registryDependencies: ["toggle-group"], files: ["example/toggle-group-demo.tsx"], }, { name: "toggle-group-disabled", type: "components:example", registryDependencies: ["toggle-group"], files: ["example/toggle-group-disabled.tsx"], }, { name: "toggle-group-lg", type: "components:example", registryDependencies: ["toggle-group"], files: ["example/toggle-group-lg.tsx"], }, { name: "toggle-group-outline", type: "components:example", registryDependencies: ["toggle-group"], files: ["example/toggle-group-outline.tsx"], }, { name: "toggle-group-sm", type: "components:example", registryDependencies: ["toggle-group"], files: ["example/toggle-group-sm.tsx"], }, { name: "toggle-group-single", type: "components:example", registryDependencies: ["toggle-group"], files: ["example/toggle-group-single.tsx"], }, { name: "toggle-demo", type: "components:example", registryDependencies: ["toggle"], files: ["example/toggle-demo.tsx"], }, { name: "toggle-disabled", type: "components:example", registryDependencies: ["toggle"], files: ["example/toggle-disabled.tsx"], }, { name: "toggle-lg", type: "components:example", registryDependencies: ["toggle"], files: ["example/toggle-lg.tsx"], }, { name: "toggle-outline", type: "components:example", registryDependencies: ["toggle"], files: ["example/toggle-outline.tsx"], }, { name: "toggle-sm", type: "components:example", registryDependencies: ["toggle"], files: ["example/toggle-sm.tsx"], }, { name: "toggle-with-text", type: "components:example", registryDependencies: ["toggle"], files: ["example/toggle-with-text.tsx"], }, { name: "tooltip-demo", type: "components:example", registryDependencies: ["tooltip"], files: ["example/tooltip-demo.tsx"], }, { name: "typography-blockquote", type: "components:example", files: ["example/typography-blockquote.tsx"], }, { name: "typography-demo", type: "components:example", files: ["example/typography-demo.tsx"], }, { name: "typography-h1", type: "components:example", files: ["example/typography-h1.tsx"], }, { name: "typography-h2", type: "components:example", files: ["example/typography-h2.tsx"], }, { name: "typography-h3", type: "components:example", files: ["example/typography-h3.tsx"], }, { name: "typography-h4", type: "components:example", files: ["example/typography-h4.tsx"], }, { name: "typography-inline-code", type: "components:example", files: ["example/typography-inline-code.tsx"], }, { name: "typography-large", type: "components:example", files: ["example/typography-large.tsx"], }, { name: "typography-lead", type: "components:example", files: ["example/typography-lead.tsx"], }, { name: "typography-list", type: "components:example", files: ["example/typography-list.tsx"], }, { name: "typography-muted", type: "components:example", files: ["example/typography-muted.tsx"], }, { name: "typography-p", type: "components:example", files: ["example/typography-p.tsx"], }, { name: "typography-small", type: "components:example", files: ["example/typography-small.tsx"], }, { name: "typography-table", type: "components:example", files: ["example/typography-table.tsx"], }, { name: "mode-toggle", type: "components:example", files: ["example/mode-toggle.tsx"], }, { name: "cards", type: "components:example", files: ["example/cards/cards.tsx"], }, ] export const registry: Registry = [...ui, ...example]
apps/www/registry/registry.ts
0
https://github.com/shadcn-ui/ui/commit/4b200ebf5973602ec017294bbdaaee59cd632d0f
[ 0.00017824189853854477, 0.00017435033805668354, 0.00016529287677258253, 0.0001747411588439718, 0.0000021229618596407818 ]
{ "id": 2, "code_window": [ " </DialogTrigger>\n", " </ContextMenuContent>\n", " </ContextMenu>\n", " <DialogContent>\n", " <DialogHeader>\n", " <DialogTitle>Are you sure absolutely sure?</DialogTitle>\n", " <DialogDescription>\n", " This action cannot be undone. Are you sure you want to permanently\n", " delete this file from our servers?\n", " </DialogDescription>\n", " </DialogHeader>\n" ], "labels": [ "keep", "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ], "after_edit": [ " <DialogTitle>Are you absolutely sure?</DialogTitle>\n" ], "file_path": "apps/www/content/docs/components/dialog.mdx", "type": "replace", "edit_start_line_idx": 105 }
--- title: Scroll-area description: Augments native scroll functionality for custom, cross-browser styling. component: true links: doc: https://www.radix-ui.com/docs/primitives/components/scroll-area api: https://www.radix-ui.com/docs/primitives/components/scroll-area#api-reference --- <ComponentPreview name="scroll-area-demo" /> ## Installation <Tabs defaultValue="cli"> <TabsList> <TabsTrigger value="cli">CLI</TabsTrigger> <TabsTrigger value="manual">Manual</TabsTrigger> </TabsList> <TabsContent value="cli"> ```bash npx shadcn-ui@latest add scroll-area ``` </TabsContent> <TabsContent value="manual"> <Steps> <Step>Install the following dependencies:</Step> ```bash npm install @radix-ui/react-scroll-area ``` <Step>Copy and paste the following code into your project.</Step> <ComponentSource name="scroll-area" /> <Step>Update the import paths to match your project setup.</Step> </Steps> </TabsContent> </Tabs> ## Usage ```tsx import { ScrollArea } from "@/components/ui/scroll-area" ``` ```tsx <ScrollArea className="h-[200px] w-[350px] rounded-md border p-4"> Jokester began sneaking into the castle in the middle of the night and leaving jokes all over the place: under the king's pillow, in his soup, even in the royal toilet. The king was furious, but he couldn't seem to stop Jokester. And then, one day, the people of the kingdom discovered that the jokes left by Jokester were so funny that they couldn't help but laugh. And once they started laughing, they couldn't stop. </ScrollArea> ``` ## Examples ### Horizontal Scrolling <ComponentPreview name="scroll-area-horizontal-demo" />
apps/www/content/docs/components/scroll-area.mdx
0
https://github.com/shadcn-ui/ui/commit/4b200ebf5973602ec017294bbdaaee59cd632d0f
[ 0.00017184726311825216, 0.00016933298320509493, 0.00016582866373937577, 0.00016981802764348686, 0.0000022521028313349234 ]
{ "id": 3, "code_window": [ "```tsx showLineNumbers\n", "<Drawer>\n", " <DrawerTrigger>Open</DrawerTrigger>\n", " <DrawerContent>\n", " <DrawerHeader>\n", " <DrawerTitle>Are you sure absolutely sure?</DrawerTitle>\n", " <DrawerDescription>This action cannot be undone.</DrawerDescription>\n", " </DrawerHeader>\n", " <DrawerFooter>\n" ], "labels": [ "keep", "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep" ], "after_edit": [ " <DrawerTitle>Are you absolutely sure?</DrawerTitle>\n" ], "file_path": "apps/www/content/docs/components/drawer.mdx", "type": "replace", "edit_start_line_idx": 72 }
--- title: Dialog description: A window overlaid on either the primary window or another dialog window, rendering the content underneath inert. featured: true component: true links: doc: https://www.radix-ui.com/docs/primitives/components/dialog api: https://www.radix-ui.com/docs/primitives/components/dialog#api-reference --- <ComponentPreview name="dialog-demo" /> ## Installation <Tabs defaultValue="cli"> <TabsList> <TabsTrigger value="cli">CLI</TabsTrigger> <TabsTrigger value="manual">Manual</TabsTrigger> </TabsList> <TabsContent value="cli"> ```bash npx shadcn-ui@latest add dialog ``` </TabsContent> <TabsContent value="manual"> <Steps> <Step>Install the following dependencies:</Step> ```bash npm install @radix-ui/react-dialog ``` <Step>Copy and paste the following code into your project.</Step> <ComponentSource name="dialog" /> <Step>Update the import paths to match your project setup.</Step> </Steps> </TabsContent> </Tabs> ## Usage ```tsx import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, DialogTrigger, } from "@/components/ui/dialog" ``` ```tsx <Dialog> <DialogTrigger>Open</DialogTrigger> <DialogContent> <DialogHeader> <DialogTitle>Are you sure absolutely sure?</DialogTitle> <DialogDescription> This action cannot be undone. This will permanently delete your account and remove your data from our servers. </DialogDescription> </DialogHeader> </DialogContent> </Dialog> ``` ## Examples ### Custom close button <ComponentPreview name="dialog-close-button" /> ## Notes To activate the `Dialog` component from within a `Context Menu` or `Dropdown Menu`, you must encase the `Context Menu` or `Dropdown Menu` component in the `Dialog` component. For more information, refer to the linked issue [here](https://github.com/radix-ui/primitives/issues/1836). ```tsx {14-25} <Dialog> <ContextMenu> <ContextMenuTrigger>Right click</ContextMenuTrigger> <ContextMenuContent> <ContextMenuItem>Open</ContextMenuItem> <ContextMenuItem>Download</ContextMenuItem> <DialogTrigger asChild> <ContextMenuItem> <span>Delete</span> </ContextMenuItem> </DialogTrigger> </ContextMenuContent> </ContextMenu> <DialogContent> <DialogHeader> <DialogTitle>Are you sure absolutely sure?</DialogTitle> <DialogDescription> This action cannot be undone. Are you sure you want to permanently delete this file from our servers? </DialogDescription> </DialogHeader> <DialogFooter> <Button type="submit">Confirm</Button> </DialogFooter> </DialogContent> </Dialog> ```
apps/www/content/docs/components/dialog.mdx
1
https://github.com/shadcn-ui/ui/commit/4b200ebf5973602ec017294bbdaaee59cd632d0f
[ 0.002630793023854494, 0.0006413951050490141, 0.000164785364177078, 0.00017170605133287609, 0.0007771945674903691 ]
{ "id": 3, "code_window": [ "```tsx showLineNumbers\n", "<Drawer>\n", " <DrawerTrigger>Open</DrawerTrigger>\n", " <DrawerContent>\n", " <DrawerHeader>\n", " <DrawerTitle>Are you sure absolutely sure?</DrawerTitle>\n", " <DrawerDescription>This action cannot be undone.</DrawerDescription>\n", " </DrawerHeader>\n", " <DrawerFooter>\n" ], "labels": [ "keep", "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep" ], "after_edit": [ " <DrawerTitle>Are you absolutely sure?</DrawerTitle>\n" ], "file_path": "apps/www/content/docs/components/drawer.mdx", "type": "replace", "edit_start_line_idx": 72 }
[ { "name": "accordion", "dependencies": ["@radix-ui/react-accordion"], "files": [ { "name": "accordion.tsx", "dir": "components/ui", "content": "\"use client\"\n\nimport * as React from \"react\"\nimport * as AccordionPrimitive from \"@radix-ui/react-accordion\"\nimport { ChevronDown } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst Accordion = AccordionPrimitive.Root\n\nconst AccordionItem = React.forwardRef<\n React.ElementRef<typeof AccordionPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Item>\n>(({ className, ...props }, ref) => (\n <AccordionPrimitive.Item\n ref={ref}\n className={cn(\"border-b\", className)}\n {...props}\n />\n))\nAccordionItem.displayName = \"AccordionItem\"\n\nconst AccordionTrigger = React.forwardRef<\n React.ElementRef<typeof AccordionPrimitive.Trigger>,\n React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Trigger>\n>(({ className, children, ...props }, ref) => (\n <AccordionPrimitive.Header className=\"flex\">\n <AccordionPrimitive.Trigger\n ref={ref}\n className={cn(\n \"flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180\",\n className\n )}\n {...props}\n >\n {children}\n <ChevronDown className=\"h-4 w-4 transition-transform duration-200\" />\n </AccordionPrimitive.Trigger>\n </AccordionPrimitive.Header>\n))\nAccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName\n\nconst AccordionContent = React.forwardRef<\n React.ElementRef<typeof AccordionPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Content>\n>(({ className, children, ...props }, ref) => (\n <AccordionPrimitive.Content\n ref={ref}\n className={cn(\n \"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down\",\n className\n )}\n {...props}\n >\n <div className=\"pb-4 pt-0\">{children}</div>\n </AccordionPrimitive.Content>\n))\nAccordionContent.displayName = AccordionPrimitive.Content.displayName\n\nexport { Accordion, AccordionItem, AccordionTrigger, AccordionContent }\n" } ], "type": "ui" }, { "name": "alert", "files": [ { "name": "alert.tsx", "dir": "components/ui", "content": "import * as React from \"react\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst alertVariants = cva(\n \"relative w-full rounded-lg border p-4 [&>svg]:absolute [&>svg]:text-foreground [&>svg]:left-4 [&>svg]:top-4 [&>svg+div]:translate-y-[-3px] [&>svg~*]:pl-7\",\n {\n variants: {\n variant: {\n default: \"bg-background text-foreground\",\n destructive:\n \"text-destructive border-destructive/50 dark:border-destructive [&>svg]:text-destructive text-destructive\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n },\n }\n)\n\nconst Alert = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof alertVariants>\n>(({ className, variant, ...props }, ref) => (\n <div\n ref={ref}\n role=\"alert\"\n className={cn(alertVariants({ variant }), className)}\n {...props}\n />\n))\nAlert.displayName = \"Alert\"\n\nconst AlertTitle = React.forwardRef<\n HTMLParagraphElement,\n React.HTMLAttributes<HTMLHeadingElement>\n>(({ className, ...props }, ref) => (\n <h5\n ref={ref}\n className={cn(\"mb-1 font-medium leading-none tracking-tight\", className)}\n {...props}\n />\n))\nAlertTitle.displayName = \"AlertTitle\"\n\nconst AlertDescription = React.forwardRef<\n HTMLParagraphElement,\n React.HTMLAttributes<HTMLParagraphElement>\n>(({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\"text-sm [&_p]:leading-relaxed\", className)}\n {...props}\n />\n))\nAlertDescription.displayName = \"AlertDescription\"\n\nexport { Alert, AlertTitle, AlertDescription }\n" } ], "type": "ui" }, { "name": "alert-dialog", "dependencies": ["@radix-ui/react-alert-dialog"], "files": [ { "name": "alert-dialog.tsx", "dir": "components/ui", "content": "\"use client\"\n\nimport * as React from \"react\"\nimport * as AlertDialogPrimitive from \"@radix-ui/react-alert-dialog\"\n\nimport { cn } from \"@/lib/utils\"\nimport { buttonVariants } from \"@/components/ui/button\"\n\nconst AlertDialog = AlertDialogPrimitive.Root\n\nconst AlertDialogTrigger = AlertDialogPrimitive.Trigger\n\nconst AlertDialogPortal = ({\n className,\n children,\n ...props\n}: AlertDialogPrimitive.AlertDialogPortalProps) => (\n <AlertDialogPrimitive.Portal className={cn(className)} {...props}>\n <div className=\"fixed inset-0 z-50 flex items-end justify-center sm:items-center\">\n {children}\n </div>\n </AlertDialogPrimitive.Portal>\n)\nAlertDialogPortal.displayName = AlertDialogPrimitive.Portal.displayName\n\nconst AlertDialogOverlay = React.forwardRef<\n React.ElementRef<typeof AlertDialogPrimitive.Overlay>,\n React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Overlay>\n>(({ className, children, ...props }, ref) => (\n <AlertDialogPrimitive.Overlay\n className={cn(\n \"fixed inset-0 z-50 bg-background/80 backdrop-blur-sm transition-opacity animate-in fade-in\",\n className\n )}\n {...props}\n ref={ref}\n />\n))\nAlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName\n\nconst AlertDialogContent = React.forwardRef<\n React.ElementRef<typeof AlertDialogPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Content>\n>(({ className, ...props }, ref) => (\n <AlertDialogPortal>\n <AlertDialogOverlay />\n <AlertDialogPrimitive.Content\n ref={ref}\n className={cn(\n \"fixed z-50 grid w-full max-w-lg scale-100 gap-4 border bg-background p-6 opacity-100 shadow-lg animate-in fade-in-90 slide-in-from-bottom-10 sm:rounded-lg sm:zoom-in-90 sm:slide-in-from-bottom-0\",\n className\n )}\n {...props}\n />\n </AlertDialogPortal>\n))\nAlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName\n\nconst AlertDialogHeader = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLDivElement>) => (\n <div\n className={cn(\n \"flex flex-col space-y-2 text-center sm:text-left\",\n className\n )}\n {...props}\n />\n)\nAlertDialogHeader.displayName = \"AlertDialogHeader\"\n\nconst AlertDialogFooter = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLDivElement>) => (\n <div\n className={cn(\n \"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2\",\n className\n )}\n {...props}\n />\n)\nAlertDialogFooter.displayName = \"AlertDialogFooter\"\n\nconst AlertDialogTitle = React.forwardRef<\n React.ElementRef<typeof AlertDialogPrimitive.Title>,\n React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Title>\n>(({ className, ...props }, ref) => (\n <AlertDialogPrimitive.Title\n ref={ref}\n className={cn(\"text-lg font-semibold\", className)}\n {...props}\n />\n))\nAlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName\n\nconst AlertDialogDescription = React.forwardRef<\n React.ElementRef<typeof AlertDialogPrimitive.Description>,\n React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Description>\n>(({ className, ...props }, ref) => (\n <AlertDialogPrimitive.Description\n ref={ref}\n className={cn(\"text-sm text-muted-foreground\", className)}\n {...props}\n />\n))\nAlertDialogDescription.displayName =\n AlertDialogPrimitive.Description.displayName\n\nconst AlertDialogAction = React.forwardRef<\n React.ElementRef<typeof AlertDialogPrimitive.Action>,\n React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Action>\n>(({ className, ...props }, ref) => (\n <AlertDialogPrimitive.Action\n ref={ref}\n className={cn(buttonVariants(), className)}\n {...props}\n />\n))\nAlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName\n\nconst AlertDialogCancel = React.forwardRef<\n React.ElementRef<typeof AlertDialogPrimitive.Cancel>,\n React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Cancel>\n>(({ className, ...props }, ref) => (\n <AlertDialogPrimitive.Cancel\n ref={ref}\n className={cn(\n buttonVariants({ variant: \"outline\" }),\n \"mt-2 sm:mt-0\",\n className\n )}\n {...props}\n />\n))\nAlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName\n\nexport {\n AlertDialog,\n AlertDialogTrigger,\n AlertDialogContent,\n AlertDialogHeader,\n AlertDialogFooter,\n AlertDialogTitle,\n AlertDialogDescription,\n AlertDialogAction,\n AlertDialogCancel,\n}\n" } ], "type": "ui" }, { "name": "aspect-ratio", "dependencies": ["@radix-ui/react-aspect-ratio"], "files": [ { "name": "aspect-ratio.tsx", "dir": "components/ui", "content": "\"use client\"\n\nimport * as AspectRatioPrimitive from \"@radix-ui/react-aspect-ratio\"\n\nconst AspectRatio = AspectRatioPrimitive.Root\n\nexport { AspectRatio }\n" } ], "type": "ui" }, { "name": "avatar", "dependencies": ["@radix-ui/react-avatar"], "files": [ { "name": "avatar.tsx", "dir": "components/ui", "content": "\"use client\"\n\nimport * as React from \"react\"\nimport * as AvatarPrimitive from \"@radix-ui/react-avatar\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst Avatar = React.forwardRef<\n React.ElementRef<typeof AvatarPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root>\n>(({ className, ...props }, ref) => (\n <AvatarPrimitive.Root\n ref={ref}\n className={cn(\n \"relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full\",\n className\n )}\n {...props}\n />\n))\nAvatar.displayName = AvatarPrimitive.Root.displayName\n\nconst AvatarImage = React.forwardRef<\n React.ElementRef<typeof AvatarPrimitive.Image>,\n React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image>\n>(({ className, ...props }, ref) => (\n <AvatarPrimitive.Image\n ref={ref}\n className={cn(\"aspect-square h-full w-full\", className)}\n {...props}\n />\n))\nAvatarImage.displayName = AvatarPrimitive.Image.displayName\n\nconst AvatarFallback = React.forwardRef<\n React.ElementRef<typeof AvatarPrimitive.Fallback>,\n React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Fallback>\n>(({ className, ...props }, ref) => (\n <AvatarPrimitive.Fallback\n ref={ref}\n className={cn(\n \"flex h-full w-full items-center justify-center rounded-full bg-muted\",\n className\n )}\n {...props}\n />\n))\nAvatarFallback.displayName = AvatarPrimitive.Fallback.displayName\n\nexport { Avatar, AvatarImage, AvatarFallback }\n" } ], "type": "ui" }, { "name": "badge", "files": [ { "name": "badge.tsx", "dir": "components/ui", "content": "import * as React from \"react\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst badgeVariants = cva(\n \"inline-flex items-center border rounded-full px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2\",\n {\n variants: {\n variant: {\n default:\n \"bg-primary hover:bg-primary/80 border-transparent text-primary-foreground\",\n secondary:\n \"bg-secondary hover:bg-secondary/80 border-transparent text-secondary-foreground\",\n destructive:\n \"bg-destructive hover:bg-destructive/80 border-transparent text-destructive-foreground\",\n outline: \"text-foreground\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n },\n }\n)\n\nexport interface BadgeProps\n extends React.HTMLAttributes<HTMLDivElement>,\n VariantProps<typeof badgeVariants> {}\n\nfunction Badge({ className, variant, ...props }: BadgeProps) {\n return (\n <div className={cn(badgeVariants({ variant }), className)} {...props} />\n )\n}\n\nexport { Badge, badgeVariants }\n" } ], "type": "ui" }, { "name": "button", "dependencies": ["@radix-ui/react-slot"], "files": [ { "name": "button.tsx", "dir": "components/ui", "content": "import * as React from \"react\"\nimport { Slot } from \"@radix-ui/react-slot\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst buttonVariants = cva(\n \"inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:opacity-50 disabled:pointer-events-none ring-offset-background\",\n {\n variants: {\n variant: {\n default: \"bg-primary text-primary-foreground hover:bg-primary/90\",\n destructive:\n \"bg-destructive text-destructive-foreground hover:bg-destructive/90\",\n outline:\n \"border border-input hover:bg-accent hover:text-accent-foreground\",\n secondary:\n \"bg-secondary text-secondary-foreground hover:bg-secondary/80\",\n ghost: \"hover:bg-accent hover:text-accent-foreground\",\n link: \"underline-offset-4 hover:underline text-primary\",\n },\n size: {\n default: \"h-10 py-2 px-4\",\n sm: \"h-9 px-3 rounded-md\",\n lg: \"h-11 px-8 rounded-md\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n },\n }\n)\n\nexport interface ButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement>,\n VariantProps<typeof buttonVariants> {\n asChild?: boolean\n}\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n ({ className, variant, size, asChild = false, ...props }, ref) => {\n const Comp = asChild ? Slot : \"button\"\n return (\n <Comp\n className={cn(buttonVariants({ variant, size, className }))}\n ref={ref}\n {...props}\n />\n )\n }\n)\nButton.displayName = \"Button\"\n\nexport { Button, buttonVariants }\n" } ], "type": "ui" }, { "name": "calendar", "dependencies": ["react-day-picker", "date-fns"], "registryDependencies": ["button"], "files": [ { "name": "calendar.tsx", "dir": "components/ui", "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { ChevronLeft, ChevronRight } from \"lucide-react\"\nimport { DayPicker } from \"react-day-picker\"\n\nimport { cn } from \"@/lib/utils\"\nimport { buttonVariants } from \"@/components/ui/button\"\n\nexport type CalendarProps = React.ComponentProps<typeof DayPicker>\n\nfunction Calendar({\n className,\n classNames,\n showOutsideDays = true,\n ...props\n}: CalendarProps) {\n return (\n <DayPicker\n showOutsideDays={showOutsideDays}\n className={cn(\"p-3\", className)}\n classNames={{\n months: \"flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0\",\n month: \"space-y-4\",\n caption: \"flex justify-center pt-1 relative items-center\",\n caption_label: \"text-sm font-medium\",\n nav: \"space-x-1 flex items-center\",\n nav_button: cn(\n buttonVariants({ variant: \"outline\" }),\n \"h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100\"\n ),\n nav_button_previous: \"absolute left-1\",\n nav_button_next: \"absolute right-1\",\n table: \"w-full border-collapse space-y-1\",\n head_row: \"flex\",\n head_cell:\n \"text-muted-foreground rounded-md w-9 font-normal text-[0.8rem]\",\n row: \"flex w-full mt-2\",\n cell: \"text-center text-sm p-0 relative [&:has([aria-selected])]:bg-accent first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md focus-within:relative focus-within:z-20\",\n day: cn(\n buttonVariants({ variant: \"ghost\" }),\n \"h-9 w-9 p-0 font-normal aria-selected:opacity-100\"\n ),\n day_selected:\n \"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground\",\n day_today: \"bg-accent text-accent-foreground\",\n day_outside: \"text-muted-foreground opacity-50\",\n day_disabled: \"text-muted-foreground opacity-50\",\n day_range_middle:\n \"aria-selected:bg-accent aria-selected:text-accent-foreground\",\n day_hidden: \"invisible\",\n ...classNames,\n }}\n components={{\n IconLeft: ({ ...props }) => <ChevronLeft className=\"h-4 w-4\" />,\n IconRight: ({ ...props }) => <ChevronRight className=\"h-4 w-4\" />,\n }}\n {...props}\n />\n )\n}\nCalendar.displayName = \"Calendar\"\n\nexport { Calendar }\n" } ], "type": "ui" }, { "name": "card", "files": [ { "name": "card.tsx", "dir": "components/ui", "content": "import * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst Card = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\n \"rounded-lg border bg-card text-card-foreground shadow-sm\",\n className\n )}\n {...props}\n />\n))\nCard.displayName = \"Card\"\n\nconst CardHeader = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\"flex flex-col space-y-1.5 p-6\", className)}\n {...props}\n />\n))\nCardHeader.displayName = \"CardHeader\"\n\nconst CardTitle = React.forwardRef<\n HTMLParagraphElement,\n React.HTMLAttributes<HTMLHeadingElement>\n>(({ className, ...props }, ref) => (\n <h3\n ref={ref}\n className={cn(\n \"text-lg font-semibold leading-none tracking-tight\",\n className\n )}\n {...props}\n />\n))\nCardTitle.displayName = \"CardTitle\"\n\nconst CardDescription = React.forwardRef<\n HTMLParagraphElement,\n React.HTMLAttributes<HTMLParagraphElement>\n>(({ className, ...props }, ref) => (\n <p\n ref={ref}\n className={cn(\"text-sm text-muted-foreground\", className)}\n {...props}\n />\n))\nCardDescription.displayName = \"CardDescription\"\n\nconst CardContent = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div ref={ref} className={cn(\"p-6 pt-0\", className)} {...props} />\n))\nCardContent.displayName = \"CardContent\"\n\nconst CardFooter = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\" flex items-center p-6 pt-0\", className)}\n {...props}\n />\n))\nCardFooter.displayName = \"CardFooter\"\n\nexport { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent }\n" } ], "type": "ui" }, { "name": "checkbox", "dependencies": ["@radix-ui/react-checkbox"], "files": [ { "name": "checkbox.tsx", "dir": "components/ui", "content": "\"use client\"\n\nimport * as React from \"react\"\nimport * as CheckboxPrimitive from \"@radix-ui/react-checkbox\"\nimport { Check } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst Checkbox = React.forwardRef<\n React.ElementRef<typeof CheckboxPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>\n>(({ className, ...props }, ref) => (\n <CheckboxPrimitive.Root\n ref={ref}\n className={cn(\n \"peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground\",\n className\n )}\n {...props}\n >\n <CheckboxPrimitive.Indicator\n className={cn(\"flex items-center justify-center text-current\")}\n >\n <Check className=\"h-4 w-4\" />\n </CheckboxPrimitive.Indicator>\n </CheckboxPrimitive.Root>\n))\nCheckbox.displayName = CheckboxPrimitive.Root.displayName\n\nexport { Checkbox }\n" } ], "type": "ui" }, { "name": "collapsible", "dependencies": ["@radix-ui/react-collapsible"], "files": [ { "name": "collapsible.tsx", "dir": "components/ui", "content": "\"use client\"\n\nimport * as CollapsiblePrimitive from \"@radix-ui/react-collapsible\"\n\nconst Collapsible = CollapsiblePrimitive.Root\n\nconst CollapsibleTrigger = CollapsiblePrimitive.CollapsibleTrigger\n\nconst CollapsibleContent = CollapsiblePrimitive.CollapsibleContent\n\nexport { Collapsible, CollapsibleTrigger, CollapsibleContent }\n" } ], "type": "ui" }, { "name": "command", "dependencies": ["cmdk"], "registryDependencies": ["dialog"], "files": [ { "name": "command.tsx", "dir": "components/ui", "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { DialogProps } from \"@radix-ui/react-dialog\"\nimport { Command as CommandPrimitive } from \"cmdk\"\nimport { Search } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Dialog, DialogContent } from \"@/components/ui/dialog\"\n\nconst Command = React.forwardRef<\n React.ElementRef<typeof CommandPrimitive>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive\n ref={ref}\n className={cn(\n \"flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground\",\n className\n )}\n {...props}\n />\n))\nCommand.displayName = CommandPrimitive.displayName\n\ninterface CommandDialogProps extends DialogProps {}\n\nconst CommandDialog = ({ children, ...props }: CommandDialogProps) => {\n return (\n <Dialog {...props}>\n <DialogContent className=\"overflow-hidden p-0 shadow-2xl\">\n <Command className=\"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5\">\n {children}\n </Command>\n </DialogContent>\n </Dialog>\n )\n}\n\nconst CommandInput = React.forwardRef<\n React.ElementRef<typeof CommandPrimitive.Input>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>\n>(({ className, ...props }, ref) => (\n <div className=\"flex items-center border-b px-3\" cmdk-input-wrapper=\"\">\n <Search className=\"mr-2 h-4 w-4 shrink-0 opacity-50\" />\n <CommandPrimitive.Input\n ref={ref}\n className={cn(\n \"flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50\",\n className\n )}\n {...props}\n />\n </div>\n))\n\nCommandInput.displayName = CommandPrimitive.Input.displayName\n\nconst CommandList = React.forwardRef<\n React.ElementRef<typeof CommandPrimitive.List>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.List>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive.List\n ref={ref}\n className={cn(\"max-h-[300px] overflow-y-auto overflow-x-hidden\", className)}\n {...props}\n />\n))\n\nCommandList.displayName = CommandPrimitive.List.displayName\n\nconst CommandEmpty = React.forwardRef<\n React.ElementRef<typeof CommandPrimitive.Empty>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.Empty>\n>((props, ref) => (\n <CommandPrimitive.Empty\n ref={ref}\n className=\"py-6 text-center text-sm\"\n {...props}\n />\n))\n\nCommandEmpty.displayName = CommandPrimitive.Empty.displayName\n\nconst CommandGroup = React.forwardRef<\n React.ElementRef<typeof CommandPrimitive.Group>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.Group>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive.Group\n ref={ref}\n className={cn(\n \"overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground\",\n className\n )}\n {...props}\n />\n))\n\nCommandGroup.displayName = CommandPrimitive.Group.displayName\n\nconst CommandSeparator = React.forwardRef<\n React.ElementRef<typeof CommandPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive.Separator\n ref={ref}\n className={cn(\"-mx-1 h-px bg-border\", className)}\n {...props}\n />\n))\nCommandSeparator.displayName = CommandPrimitive.Separator.displayName\n\nconst CommandItem = React.forwardRef<\n React.ElementRef<typeof CommandPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.Item>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive.Item\n ref={ref}\n className={cn(\n \"relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n className\n )}\n {...props}\n />\n))\n\nCommandItem.displayName = CommandPrimitive.Item.displayName\n\nconst CommandShortcut = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLSpanElement>) => {\n return (\n <span\n className={cn(\n \"ml-auto text-xs tracking-widest text-muted-foreground\",\n className\n )}\n {...props}\n />\n )\n}\nCommandShortcut.displayName = \"CommandShortcut\"\n\nexport {\n Command,\n CommandDialog,\n CommandInput,\n CommandList,\n CommandEmpty,\n CommandGroup,\n CommandItem,\n CommandShortcut,\n CommandSeparator,\n}\n" } ], "type": "ui" }, { "name": "context-menu", "dependencies": ["@radix-ui/react-context-menu"], "files": [ { "name": "context-menu.tsx", "dir": "components/ui", "content": "\"use client\"\n\nimport * as React from \"react\"\nimport * as ContextMenuPrimitive from \"@radix-ui/react-context-menu\"\nimport { Check, ChevronRight, Circle } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst ContextMenu = ContextMenuPrimitive.Root\n\nconst ContextMenuTrigger = ContextMenuPrimitive.Trigger\n\nconst ContextMenuGroup = ContextMenuPrimitive.Group\n\nconst ContextMenuPortal = ContextMenuPrimitive.Portal\n\nconst ContextMenuSub = ContextMenuPrimitive.Sub\n\nconst ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup\n\nconst ContextMenuSubTrigger = React.forwardRef<\n React.ElementRef<typeof ContextMenuPrimitive.SubTrigger>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubTrigger> & {\n inset?: boolean\n }\n>(({ className, inset, children, ...props }, ref) => (\n <ContextMenuPrimitive.SubTrigger\n ref={ref}\n className={cn(\n \"flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground\",\n inset && \"pl-8\",\n className\n )}\n {...props}\n >\n {children}\n <ChevronRight className=\"ml-auto h-4 w-4\" />\n </ContextMenuPrimitive.SubTrigger>\n))\nContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName\n\nconst ContextMenuSubContent = React.forwardRef<\n React.ElementRef<typeof ContextMenuPrimitive.SubContent>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubContent>\n>(({ className, ...props }, ref) => (\n <ContextMenuPrimitive.SubContent\n ref={ref}\n className={cn(\n \"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md animate-in slide-in-from-left-1\",\n className\n )}\n {...props}\n />\n))\nContextMenuSubContent.displayName = ContextMenuPrimitive.SubContent.displayName\n\nconst ContextMenuContent = React.forwardRef<\n React.ElementRef<typeof ContextMenuPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Content>\n>(({ className, ...props }, ref) => (\n <ContextMenuPrimitive.Portal>\n <ContextMenuPrimitive.Content\n ref={ref}\n className={cn(\n \"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md animate-in fade-in-80\",\n className\n )}\n {...props}\n />\n </ContextMenuPrimitive.Portal>\n))\nContextMenuContent.displayName = ContextMenuPrimitive.Content.displayName\n\nconst ContextMenuItem = React.forwardRef<\n React.ElementRef<typeof ContextMenuPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Item> & {\n inset?: boolean\n }\n>(({ className, inset, ...props }, ref) => (\n <ContextMenuPrimitive.Item\n ref={ref}\n className={cn(\n \"relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n inset && \"pl-8\",\n className\n )}\n {...props}\n />\n))\nContextMenuItem.displayName = ContextMenuPrimitive.Item.displayName\n\nconst ContextMenuCheckboxItem = React.forwardRef<\n React.ElementRef<typeof ContextMenuPrimitive.CheckboxItem>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.CheckboxItem>\n>(({ className, children, checked, ...props }, ref) => (\n <ContextMenuPrimitive.CheckboxItem\n ref={ref}\n className={cn(\n \"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n className\n )}\n checked={checked}\n {...props}\n >\n <span className=\"absolute left-2 flex h-3.5 w-3.5 items-center justify-center\">\n <ContextMenuPrimitive.ItemIndicator>\n <Check className=\"h-4 w-4\" />\n </ContextMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </ContextMenuPrimitive.CheckboxItem>\n))\nContextMenuCheckboxItem.displayName =\n ContextMenuPrimitive.CheckboxItem.displayName\n\nconst ContextMenuRadioItem = React.forwardRef<\n React.ElementRef<typeof ContextMenuPrimitive.RadioItem>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.RadioItem>\n>(({ className, children, ...props }, ref) => (\n <ContextMenuPrimitive.RadioItem\n ref={ref}\n className={cn(\n \"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n className\n )}\n {...props}\n >\n <span className=\"absolute left-2 flex h-3.5 w-3.5 items-center justify-center\">\n <ContextMenuPrimitive.ItemIndicator>\n <Circle className=\"h-2 w-2 fill-current\" />\n </ContextMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </ContextMenuPrimitive.RadioItem>\n))\nContextMenuRadioItem.displayName = ContextMenuPrimitive.RadioItem.displayName\n\nconst ContextMenuLabel = React.forwardRef<\n React.ElementRef<typeof ContextMenuPrimitive.Label>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Label> & {\n inset?: boolean\n }\n>(({ className, inset, ...props }, ref) => (\n <ContextMenuPrimitive.Label\n ref={ref}\n className={cn(\n \"px-2 py-1.5 text-sm font-semibold text-foreground\",\n inset && \"pl-8\",\n className\n )}\n {...props}\n />\n))\nContextMenuLabel.displayName = ContextMenuPrimitive.Label.displayName\n\nconst ContextMenuSeparator = React.forwardRef<\n React.ElementRef<typeof ContextMenuPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <ContextMenuPrimitive.Separator\n ref={ref}\n className={cn(\"-mx-1 my-1 h-px bg-border\", className)}\n {...props}\n />\n))\nContextMenuSeparator.displayName = ContextMenuPrimitive.Separator.displayName\n\nconst ContextMenuShortcut = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLSpanElement>) => {\n return (\n <span\n className={cn(\n \"ml-auto text-xs tracking-widest text-muted-foreground\",\n className\n )}\n {...props}\n />\n )\n}\nContextMenuShortcut.displayName = \"ContextMenuShortcut\"\n\nexport {\n ContextMenu,\n ContextMenuTrigger,\n ContextMenuContent,\n ContextMenuItem,\n ContextMenuCheckboxItem,\n ContextMenuRadioItem,\n ContextMenuLabel,\n ContextMenuSeparator,\n ContextMenuShortcut,\n ContextMenuGroup,\n ContextMenuPortal,\n ContextMenuSub,\n ContextMenuSubContent,\n ContextMenuSubTrigger,\n ContextMenuRadioGroup,\n}\n" } ], "type": "ui" }, { "name": "dialog", "dependencies": ["@radix-ui/react-dialog"], "files": [ { "name": "dialog.tsx", "dir": "components/ui", "content": "\"use client\"\n\nimport * as React from \"react\"\nimport * as DialogPrimitive from \"@radix-ui/react-dialog\"\nimport { X } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst Dialog = DialogPrimitive.Root\n\nconst DialogTrigger = DialogPrimitive.Trigger\n\nconst DialogPortal = ({\n className,\n children,\n ...props\n}: DialogPrimitive.DialogPortalProps) => (\n <DialogPrimitive.Portal className={cn(className)} {...props}>\n <div className=\"fixed inset-0 z-50 flex items-start justify-center sm:items-center\">\n {children}\n </div>\n </DialogPrimitive.Portal>\n)\nDialogPortal.displayName = DialogPrimitive.Portal.displayName\n\nconst DialogOverlay = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Overlay>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Overlay\n ref={ref}\n className={cn(\n \"fixed inset-0 z-50 bg-background/80 backdrop-blur-sm transition-all duration-100 data-[state=closed]:animate-out data-[state=closed]:fade-out data-[state=open]:fade-in\",\n className\n )}\n {...props}\n />\n))\nDialogOverlay.displayName = DialogPrimitive.Overlay.displayName\n\nconst DialogContent = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>\n>(({ className, children, ...props }, ref) => (\n <DialogPortal>\n <DialogOverlay />\n <DialogPrimitive.Content\n ref={ref}\n className={cn(\n \"fixed z-50 grid w-full gap-4 rounded-b-lg border bg-background p-6 shadow-lg animate-in data-[state=open]:fade-in-90 data-[state=open]:slide-in-from-bottom-10 sm:max-w-lg sm:rounded-lg sm:zoom-in-90 data-[state=open]:sm:slide-in-from-bottom-0\",\n className\n )}\n {...props}\n >\n {children}\n <DialogPrimitive.Close className=\"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground\">\n <X className=\"h-4 w-4\" />\n <span className=\"sr-only\">Close</span>\n </DialogPrimitive.Close>\n </DialogPrimitive.Content>\n </DialogPortal>\n))\nDialogContent.displayName = DialogPrimitive.Content.displayName\n\nconst DialogHeader = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLDivElement>) => (\n <div\n className={cn(\n \"flex flex-col space-y-1.5 text-center sm:text-left\",\n className\n )}\n {...props}\n />\n)\nDialogHeader.displayName = \"DialogHeader\"\n\nconst DialogFooter = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLDivElement>) => (\n <div\n className={cn(\n \"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2\",\n className\n )}\n {...props}\n />\n)\nDialogFooter.displayName = \"DialogFooter\"\n\nconst DialogTitle = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Title>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Title\n ref={ref}\n className={cn(\n \"text-lg font-semibold leading-none tracking-tight\",\n className\n )}\n {...props}\n />\n))\nDialogTitle.displayName = DialogPrimitive.Title.displayName\n\nconst DialogDescription = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Description>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Description\n ref={ref}\n className={cn(\"text-sm text-muted-foreground\", className)}\n {...props}\n />\n))\nDialogDescription.displayName = DialogPrimitive.Description.displayName\n\nexport {\n Dialog,\n DialogTrigger,\n DialogContent,\n DialogHeader,\n DialogFooter,\n DialogTitle,\n DialogDescription,\n}\n" } ], "type": "ui" }, { "name": "dropdown-menu", "dependencies": ["@radix-ui/react-dropdown-menu"], "files": [ { "name": "dropdown-menu.tsx", "dir": "components/ui", "content": "\"use client\"\n\nimport * as React from \"react\"\nimport * as DropdownMenuPrimitive from \"@radix-ui/react-dropdown-menu\"\nimport { Check, ChevronRight, Circle } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst DropdownMenu = DropdownMenuPrimitive.Root\n\nconst DropdownMenuTrigger = DropdownMenuPrimitive.Trigger\n\nconst DropdownMenuGroup = DropdownMenuPrimitive.Group\n\nconst DropdownMenuPortal = DropdownMenuPrimitive.Portal\n\nconst DropdownMenuSub = DropdownMenuPrimitive.Sub\n\nconst DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup\n\nconst DropdownMenuSubTrigger = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.SubTrigger>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & {\n inset?: boolean\n }\n>(({ className, inset, children, ...props }, ref) => (\n <DropdownMenuPrimitive.SubTrigger\n ref={ref}\n className={cn(\n \"flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent\",\n inset && \"pl-8\",\n className\n )}\n {...props}\n >\n {children}\n <ChevronRight className=\"ml-auto h-4 w-4\" />\n </DropdownMenuPrimitive.SubTrigger>\n))\nDropdownMenuSubTrigger.displayName =\n DropdownMenuPrimitive.SubTrigger.displayName\n\nconst DropdownMenuSubContent = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.SubContent>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>\n>(({ className, ...props }, ref) => (\n <DropdownMenuPrimitive.SubContent\n ref={ref}\n className={cn(\n \"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md animate-in data-[side=bottom]:slide-in-from-top-1 data-[side=left]:slide-in-from-right-1 data-[side=right]:slide-in-from-left-1 data-[side=top]:slide-in-from-bottom-1\",\n className\n )}\n {...props}\n />\n))\nDropdownMenuSubContent.displayName =\n DropdownMenuPrimitive.SubContent.displayName\n\nconst DropdownMenuContent = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>\n>(({ className, sideOffset = 4, ...props }, ref) => (\n <DropdownMenuPrimitive.Portal>\n <DropdownMenuPrimitive.Content\n ref={ref}\n sideOffset={sideOffset}\n className={cn(\n \"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md animate-in data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\",\n className\n )}\n {...props}\n />\n </DropdownMenuPrimitive.Portal>\n))\nDropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName\n\nconst DropdownMenuItem = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & {\n inset?: boolean\n }\n>(({ className, inset, ...props }, ref) => (\n <DropdownMenuPrimitive.Item\n ref={ref}\n className={cn(\n \"relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n inset && \"pl-8\",\n className\n )}\n {...props}\n />\n))\nDropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName\n\nconst DropdownMenuCheckboxItem = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.CheckboxItem>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>\n>(({ className, children, checked, ...props }, ref) => (\n <DropdownMenuPrimitive.CheckboxItem\n ref={ref}\n className={cn(\n \"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n className\n )}\n checked={checked}\n {...props}\n >\n <span className=\"absolute left-2 flex h-3.5 w-3.5 items-center justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>\n <Check className=\"h-4 w-4\" />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.CheckboxItem>\n))\nDropdownMenuCheckboxItem.displayName =\n DropdownMenuPrimitive.CheckboxItem.displayName\n\nconst DropdownMenuRadioItem = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.RadioItem>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>\n>(({ className, children, ...props }, ref) => (\n <DropdownMenuPrimitive.RadioItem\n ref={ref}\n className={cn(\n \"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n className\n )}\n {...props}\n >\n <span className=\"absolute left-2 flex h-3.5 w-3.5 items-center justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>\n <Circle className=\"h-2 w-2 fill-current\" />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.RadioItem>\n))\nDropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName\n\nconst DropdownMenuLabel = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Label>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & {\n inset?: boolean\n }\n>(({ className, inset, ...props }, ref) => (\n <DropdownMenuPrimitive.Label\n ref={ref}\n className={cn(\n \"px-2 py-1.5 text-sm font-semibold\",\n inset && \"pl-8\",\n className\n )}\n {...props}\n />\n))\nDropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName\n\nconst DropdownMenuSeparator = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <DropdownMenuPrimitive.Separator\n ref={ref}\n className={cn(\"-mx-1 my-1 h-px bg-muted\", className)}\n {...props}\n />\n))\nDropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName\n\nconst DropdownMenuShortcut = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLSpanElement>) => {\n return (\n <span\n className={cn(\"ml-auto text-xs tracking-widest opacity-60\", className)}\n {...props}\n />\n )\n}\nDropdownMenuShortcut.displayName = \"DropdownMenuShortcut\"\n\nexport {\n DropdownMenu,\n DropdownMenuTrigger,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuCheckboxItem,\n DropdownMenuRadioItem,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuShortcut,\n DropdownMenuGroup,\n DropdownMenuPortal,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuRadioGroup,\n}\n" } ], "type": "ui" }, { "name": "hover-card", "dependencies": ["@radix-ui/react-hover-card"], "files": [ { "name": "hover-card.tsx", "dir": "components/ui", "content": "\"use client\"\n\nimport * as React from \"react\"\nimport * as HoverCardPrimitive from \"@radix-ui/react-hover-card\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst HoverCard = HoverCardPrimitive.Root\n\nconst HoverCardTrigger = HoverCardPrimitive.Trigger\n\nconst HoverCardContent = React.forwardRef<\n React.ElementRef<typeof HoverCardPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof HoverCardPrimitive.Content>\n>(({ className, align = \"center\", sideOffset = 4, ...props }, ref) => (\n <HoverCardPrimitive.Content\n ref={ref}\n align={align}\n sideOffset={sideOffset}\n className={cn(\n \"z-50 w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none animate-in zoom-in-90\",\n className\n )}\n {...props}\n />\n))\nHoverCardContent.displayName = HoverCardPrimitive.Content.displayName\n\nexport { HoverCard, HoverCardTrigger, HoverCardContent }\n" } ], "type": "ui" }, { "name": "input", "files": [ { "name": "input.tsx", "dir": "components/ui", "content": "import * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\n\nexport interface InputProps\n extends React.InputHTMLAttributes<HTMLInputElement> {}\n\nconst Input = React.forwardRef<HTMLInputElement, InputProps>(\n ({ className, type, ...props }, ref) => {\n return (\n <input\n type={type}\n className={cn(\n \"flex h-10 w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50\",\n className\n )}\n ref={ref}\n {...props}\n />\n )\n }\n)\nInput.displayName = \"Input\"\n\nexport { Input }\n" } ], "type": "ui" }, { "name": "label", "dependencies": ["@radix-ui/react-label"], "files": [ { "name": "label.tsx", "dir": "components/ui", "content": "\"use client\"\n\nimport * as React from \"react\"\nimport * as LabelPrimitive from \"@radix-ui/react-label\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst labelVariants = cva(\n \"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70\"\n)\n\nconst Label = React.forwardRef<\n React.ElementRef<typeof LabelPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> &\n VariantProps<typeof labelVariants>\n>(({ className, ...props }, ref) => (\n <LabelPrimitive.Root\n ref={ref}\n className={cn(labelVariants(), className)}\n {...props}\n />\n))\nLabel.displayName = LabelPrimitive.Root.displayName\n\nexport { Label }\n" } ], "type": "ui" }, { "name": "menubar", "dependencies": ["@radix-ui/react-menubar"], "files": [ { "name": "menubar.tsx", "dir": "components/ui", "content": "\"use client\"\n\nimport * as React from \"react\"\nimport * as MenubarPrimitive from \"@radix-ui/react-menubar\"\nimport { Check, ChevronRight, Circle } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst MenubarMenu = MenubarPrimitive.Menu\n\nconst MenubarGroup = MenubarPrimitive.Group\n\nconst MenubarPortal = MenubarPrimitive.Portal\n\nconst MenubarSub = MenubarPrimitive.Sub\n\nconst MenubarRadioGroup = MenubarPrimitive.RadioGroup\n\nconst Menubar = React.forwardRef<\n React.ElementRef<typeof MenubarPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Root>\n>(({ className, ...props }, ref) => (\n <MenubarPrimitive.Root\n ref={ref}\n className={cn(\n \"flex h-10 items-center space-x-1 rounded-md border bg-background p-1\",\n className\n )}\n {...props}\n />\n))\nMenubar.displayName = MenubarPrimitive.Root.displayName\n\nconst MenubarTrigger = React.forwardRef<\n React.ElementRef<typeof MenubarPrimitive.Trigger>,\n React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Trigger>\n>(({ className, ...props }, ref) => (\n <MenubarPrimitive.Trigger\n ref={ref}\n className={cn(\n \"flex cursor-default select-none items-center rounded-sm px-3 py-1.5 text-sm font-medium outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground\",\n className\n )}\n {...props}\n />\n))\nMenubarTrigger.displayName = MenubarPrimitive.Trigger.displayName\n\nconst MenubarSubTrigger = React.forwardRef<\n React.ElementRef<typeof MenubarPrimitive.SubTrigger>,\n React.ComponentPropsWithoutRef<typeof MenubarPrimitive.SubTrigger> & {\n inset?: boolean\n }\n>(({ className, inset, children, ...props }, ref) => (\n <MenubarPrimitive.SubTrigger\n ref={ref}\n className={cn(\n \"flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground\",\n inset && \"pl-8\",\n className\n )}\n {...props}\n >\n {children}\n <ChevronRight className=\"ml-auto h-4 w-4\" />\n </MenubarPrimitive.SubTrigger>\n))\nMenubarSubTrigger.displayName = MenubarPrimitive.SubTrigger.displayName\n\nconst MenubarSubContent = React.forwardRef<\n React.ElementRef<typeof MenubarPrimitive.SubContent>,\n React.ComponentPropsWithoutRef<typeof MenubarPrimitive.SubContent>\n>(({ className, ...props }, ref) => (\n <MenubarPrimitive.SubContent\n ref={ref}\n className={cn(\n \"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md animate-in data-[side=bottom]:slide-in-from-top-1 data-[side=left]:slide-in-from-right-1 data-[side=right]:slide-in-from-left-1 data-[side=top]:slide-in-from-bottom-1\",\n className\n )}\n {...props}\n />\n))\nMenubarSubContent.displayName = MenubarPrimitive.SubContent.displayName\n\nconst MenubarContent = React.forwardRef<\n React.ElementRef<typeof MenubarPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Content>\n>(\n (\n { className, align = \"start\", alignOffset = -4, sideOffset = 8, ...props },\n ref\n ) => (\n <MenubarPrimitive.Portal>\n <MenubarPrimitive.Content\n ref={ref}\n align={align}\n alignOffset={alignOffset}\n sideOffset={sideOffset}\n className={cn(\n \"z-50 min-w-[12rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md animate-in slide-in-from-top-1\",\n className\n )}\n {...props}\n />\n </MenubarPrimitive.Portal>\n )\n)\nMenubarContent.displayName = MenubarPrimitive.Content.displayName\n\nconst MenubarItem = React.forwardRef<\n React.ElementRef<typeof MenubarPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Item> & {\n inset?: boolean\n }\n>(({ className, inset, ...props }, ref) => (\n <MenubarPrimitive.Item\n ref={ref}\n className={cn(\n \"relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n inset && \"pl-8\",\n className\n )}\n {...props}\n />\n))\nMenubarItem.displayName = MenubarPrimitive.Item.displayName\n\nconst MenubarCheckboxItem = React.forwardRef<\n React.ElementRef<typeof MenubarPrimitive.CheckboxItem>,\n React.ComponentPropsWithoutRef<typeof MenubarPrimitive.CheckboxItem>\n>(({ className, children, checked, ...props }, ref) => (\n <MenubarPrimitive.CheckboxItem\n ref={ref}\n className={cn(\n \"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n className\n )}\n checked={checked}\n {...props}\n >\n <span className=\"absolute left-2 flex h-3.5 w-3.5 items-center justify-center\">\n <MenubarPrimitive.ItemIndicator>\n <Check className=\"h-4 w-4\" />\n </MenubarPrimitive.ItemIndicator>\n </span>\n {children}\n </MenubarPrimitive.CheckboxItem>\n))\nMenubarCheckboxItem.displayName = MenubarPrimitive.CheckboxItem.displayName\n\nconst MenubarRadioItem = React.forwardRef<\n React.ElementRef<typeof MenubarPrimitive.RadioItem>,\n React.ComponentPropsWithoutRef<typeof MenubarPrimitive.RadioItem>\n>(({ className, children, ...props }, ref) => (\n <MenubarPrimitive.RadioItem\n ref={ref}\n className={cn(\n \"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n className\n )}\n {...props}\n >\n <span className=\"absolute left-2 flex h-3.5 w-3.5 items-center justify-center\">\n <MenubarPrimitive.ItemIndicator>\n <Circle className=\"h-2 w-2 fill-current\" />\n </MenubarPrimitive.ItemIndicator>\n </span>\n {children}\n </MenubarPrimitive.RadioItem>\n))\nMenubarRadioItem.displayName = MenubarPrimitive.RadioItem.displayName\n\nconst MenubarLabel = React.forwardRef<\n React.ElementRef<typeof MenubarPrimitive.Label>,\n React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Label> & {\n inset?: boolean\n }\n>(({ className, inset, ...props }, ref) => (\n <MenubarPrimitive.Label\n ref={ref}\n className={cn(\n \"px-2 py-1.5 text-sm font-semibold\",\n inset && \"pl-8\",\n className\n )}\n {...props}\n />\n))\nMenubarLabel.displayName = MenubarPrimitive.Label.displayName\n\nconst MenubarSeparator = React.forwardRef<\n React.ElementRef<typeof MenubarPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <MenubarPrimitive.Separator\n ref={ref}\n className={cn(\"-mx-1 my-1 h-px bg-muted\", className)}\n {...props}\n />\n))\nMenubarSeparator.displayName = MenubarPrimitive.Separator.displayName\n\nconst MenubarShortcut = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLSpanElement>) => {\n return (\n <span\n className={cn(\n \"ml-auto text-xs tracking-widest text-muted-foreground\",\n className\n )}\n {...props}\n />\n )\n}\nMenubarShortcut.displayname = \"MenubarShortcut\"\n\nexport {\n Menubar,\n MenubarMenu,\n MenubarTrigger,\n MenubarContent,\n MenubarItem,\n MenubarSeparator,\n MenubarLabel,\n MenubarCheckboxItem,\n MenubarRadioGroup,\n MenubarRadioItem,\n MenubarPortal,\n MenubarSubContent,\n MenubarSubTrigger,\n MenubarGroup,\n MenubarSub,\n MenubarShortcut,\n}\n" } ], "type": "ui" }, { "name": "navigation-menu", "dependencies": ["@radix-ui/react-navigation-menu"], "files": [ { "name": "navigation-menu.tsx", "dir": "components/ui", "content": "import * as React from \"react\"\nimport * as NavigationMenuPrimitive from \"@radix-ui/react-navigation-menu\"\nimport { cva } from \"class-variance-authority\"\nimport { ChevronDown } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst NavigationMenu = React.forwardRef<\n React.ElementRef<typeof NavigationMenuPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Root>\n>(({ className, children, ...props }, ref) => (\n <NavigationMenuPrimitive.Root\n ref={ref}\n className={cn(\n \"relative z-10 flex flex-1 items-center justify-center\",\n className\n )}\n {...props}\n >\n {children}\n <NavigationMenuViewport />\n </NavigationMenuPrimitive.Root>\n))\nNavigationMenu.displayName = NavigationMenuPrimitive.Root.displayName\n\nconst NavigationMenuList = React.forwardRef<\n React.ElementRef<typeof NavigationMenuPrimitive.List>,\n React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.List>\n>(({ className, ...props }, ref) => (\n <NavigationMenuPrimitive.List\n ref={ref}\n className={cn(\n \"group flex flex-1 list-none items-center justify-center space-x-1\",\n className\n )}\n {...props}\n />\n))\nNavigationMenuList.displayName = NavigationMenuPrimitive.List.displayName\n\nconst NavigationMenuItem = NavigationMenuPrimitive.Item\n\nconst navigationMenuTriggerStyle = cva(\n \"inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors focus:outline-none focus:bg-accent focus:text-accent-foreground disabled:opacity-50 disabled:pointer-events-none bg-background hover:bg-accent hover:text-accent-foreground data-[state=open]:bg-accent/50 data-[active]:bg-accent/50 h-10 py-2 px-4 group w-max\"\n)\n\nconst NavigationMenuTrigger = React.forwardRef<\n React.ElementRef<typeof NavigationMenuPrimitive.Trigger>,\n React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Trigger>\n>(({ className, children, ...props }, ref) => (\n <NavigationMenuPrimitive.Trigger\n ref={ref}\n className={cn(navigationMenuTriggerStyle(), \"group\", className)}\n {...props}\n >\n {children}{\" \"}\n <ChevronDown\n className=\"relative top-[1px] ml-1 h-3 w-3 transition duration-200 group-data-[state=open]:rotate-180\"\n aria-hidden=\"true\"\n />\n </NavigationMenuPrimitive.Trigger>\n))\nNavigationMenuTrigger.displayName = NavigationMenuPrimitive.Trigger.displayName\n\nconst NavigationMenuContent = React.forwardRef<\n React.ElementRef<typeof NavigationMenuPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Content>\n>(({ className, ...props }, ref) => (\n <NavigationMenuPrimitive.Content\n ref={ref}\n className={cn(\n \"left-0 top-0 w-full data-[motion^=from-]:animate-in data-[motion^=to-]:animate-out data-[motion^=from-]:fade-in data-[motion^=to-]:fade-out data-[motion=from-end]:slide-in-from-right-52 data-[motion=from-start]:slide-in-from-left-52 data-[motion=to-end]:slide-out-to-right-52 data-[motion=to-start]:slide-out-to-left-52 md:absolute md:w-auto \",\n className\n )}\n {...props}\n />\n))\nNavigationMenuContent.displayName = NavigationMenuPrimitive.Content.displayName\n\nconst NavigationMenuLink = NavigationMenuPrimitive.Link\n\nconst NavigationMenuViewport = React.forwardRef<\n React.ElementRef<typeof NavigationMenuPrimitive.Viewport>,\n React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Viewport>\n>(({ className, ...props }, ref) => (\n <div className={cn(\"absolute left-0 top-full flex justify-center\")}>\n <NavigationMenuPrimitive.Viewport\n className={cn(\n \"origin-top-center relative mt-1.5 h-[var(--radix-navigation-menu-viewport-height)] w-full overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-90 md:w-[var(--radix-navigation-menu-viewport-width)]\",\n className\n )}\n ref={ref}\n {...props}\n />\n </div>\n))\nNavigationMenuViewport.displayName =\n NavigationMenuPrimitive.Viewport.displayName\n\nconst NavigationMenuIndicator = React.forwardRef<\n React.ElementRef<typeof NavigationMenuPrimitive.Indicator>,\n React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Indicator>\n>(({ className, ...props }, ref) => (\n <NavigationMenuPrimitive.Indicator\n ref={ref}\n className={cn(\n \"top-full z-[1] flex h-1.5 items-end justify-center overflow-hidden data-[state=visible]:animate-in data-[state=hidden]:animate-out data-[state=hidden]:fade-out data-[state=visible]:fade-in\",\n className\n )}\n {...props}\n >\n <div className=\"relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm bg-border shadow-md\" />\n </NavigationMenuPrimitive.Indicator>\n))\nNavigationMenuIndicator.displayName =\n NavigationMenuPrimitive.Indicator.displayName\n\nexport {\n navigationMenuTriggerStyle,\n NavigationMenu,\n NavigationMenuList,\n NavigationMenuItem,\n NavigationMenuContent,\n NavigationMenuTrigger,\n NavigationMenuLink,\n NavigationMenuIndicator,\n NavigationMenuViewport,\n}\n" } ], "type": "ui" }, { "name": "popover", "dependencies": ["@radix-ui/react-popover"], "files": [ { "name": "popover.tsx", "dir": "components/ui", "content": "\"use client\"\n\nimport * as React from \"react\"\nimport * as PopoverPrimitive from \"@radix-ui/react-popover\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst Popover = PopoverPrimitive.Root\n\nconst PopoverTrigger = PopoverPrimitive.Trigger\n\nconst PopoverContent = React.forwardRef<\n React.ElementRef<typeof PopoverPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>\n>(({ className, align = \"center\", sideOffset = 4, ...props }, ref) => (\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n ref={ref}\n align={align}\n sideOffset={sideOffset}\n className={cn(\n \"z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none animate-in data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\",\n className\n )}\n {...props}\n />\n </PopoverPrimitive.Portal>\n))\nPopoverContent.displayName = PopoverPrimitive.Content.displayName\n\nexport { Popover, PopoverTrigger, PopoverContent }\n" } ], "type": "ui" }, { "name": "progress", "dependencies": ["@radix-ui/react-progress"], "files": [ { "name": "progress.tsx", "dir": "components/ui", "content": "\"use client\"\n\nimport * as React from \"react\"\nimport * as ProgressPrimitive from \"@radix-ui/react-progress\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst Progress = React.forwardRef<\n React.ElementRef<typeof ProgressPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Root>\n>(({ className, value, ...props }, ref) => (\n <ProgressPrimitive.Root\n ref={ref}\n className={cn(\n \"relative h-4 w-full overflow-hidden rounded-full bg-secondary\",\n className\n )}\n {...props}\n >\n <ProgressPrimitive.Indicator\n className=\"h-full w-full flex-1 bg-primary transition-all\"\n style={{ transform: `translateX(-${100 - (value || 0)}%)` }}\n />\n </ProgressPrimitive.Root>\n))\nProgress.displayName = ProgressPrimitive.Root.displayName\n\nexport { Progress }\n" } ], "type": "ui" }, { "name": "radio-group", "dependencies": ["@radix-ui/react-radio-group"], "files": [ { "name": "radio-group.tsx", "dir": "components/ui", "content": "\"use client\"\n\nimport * as React from \"react\"\nimport * as RadioGroupPrimitive from \"@radix-ui/react-radio-group\"\nimport { Circle } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst RadioGroup = React.forwardRef<\n React.ElementRef<typeof RadioGroupPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root>\n>(({ className, ...props }, ref) => {\n return (\n <RadioGroupPrimitive.Root\n className={cn(\"grid gap-2\", className)}\n {...props}\n ref={ref}\n />\n )\n})\nRadioGroup.displayName = RadioGroupPrimitive.Root.displayName\n\nconst RadioGroupItem = React.forwardRef<\n React.ElementRef<typeof RadioGroupPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Item>\n>(({ className, children, ...props }, ref) => {\n return (\n <RadioGroupPrimitive.Item\n ref={ref}\n className={cn(\n \"aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50\",\n className\n )}\n {...props}\n >\n <RadioGroupPrimitive.Indicator className=\"flex items-center justify-center\">\n <Circle className=\"h-2.5 w-2.5 fill-current text-current\" />\n </RadioGroupPrimitive.Indicator>\n </RadioGroupPrimitive.Item>\n )\n})\nRadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName\n\nexport { RadioGroup, RadioGroupItem }\n" } ], "type": "ui" }, { "name": "scroll-area", "dependencies": ["@radix-ui/react-scroll-area"], "files": [ { "name": "scroll-area.tsx", "dir": "components/ui", "content": "\"use client\"\n\nimport * as React from \"react\"\nimport * as ScrollAreaPrimitive from \"@radix-ui/react-scroll-area\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst ScrollArea = React.forwardRef<\n React.ElementRef<typeof ScrollAreaPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Root>\n>(({ className, children, ...props }, ref) => (\n <ScrollAreaPrimitive.Root\n ref={ref}\n className={cn(\"relative overflow-hidden\", className)}\n {...props}\n >\n <ScrollAreaPrimitive.Viewport className=\"h-full w-full rounded-[inherit]\">\n {children}\n </ScrollAreaPrimitive.Viewport>\n <ScrollBar />\n <ScrollAreaPrimitive.Corner />\n </ScrollAreaPrimitive.Root>\n))\nScrollArea.displayName = ScrollAreaPrimitive.Root.displayName\n\nconst ScrollBar = React.forwardRef<\n React.ElementRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>,\n React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>\n>(({ className, orientation = \"vertical\", ...props }, ref) => (\n <ScrollAreaPrimitive.ScrollAreaScrollbar\n ref={ref}\n orientation={orientation}\n className={cn(\n \"flex touch-none select-none transition-colors\",\n orientation === \"vertical\" &&\n \"h-full w-2.5 border-l border-l-transparent p-[1px]\",\n orientation === \"horizontal\" &&\n \"h-2.5 border-t border-t-transparent p-[1px]\",\n className\n )}\n {...props}\n >\n <ScrollAreaPrimitive.ScrollAreaThumb className=\"relative flex-1 rounded-full bg-border\" />\n </ScrollAreaPrimitive.ScrollAreaScrollbar>\n))\nScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName\n\nexport { ScrollArea, ScrollBar }\n" } ], "type": "ui" }, { "name": "select", "dependencies": ["@radix-ui/react-select"], "files": [ { "name": "select.tsx", "dir": "components/ui", "content": "\"use client\"\n\nimport * as React from \"react\"\nimport * as SelectPrimitive from \"@radix-ui/react-select\"\nimport { Check, ChevronDown } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst Select = SelectPrimitive.Root\n\nconst SelectGroup = SelectPrimitive.Group\n\nconst SelectValue = SelectPrimitive.Value\n\nconst SelectTrigger = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Trigger>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>\n>(({ className, children, ...props }, ref) => (\n <SelectPrimitive.Trigger\n ref={ref}\n className={cn(\n \"flex h-10 w-full items-center justify-between rounded-md border border-input bg-transparent px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50\",\n className\n )}\n {...props}\n >\n {children}\n <SelectPrimitive.Icon asChild>\n <ChevronDown className=\"h-4 w-4 opacity-50\" />\n </SelectPrimitive.Icon>\n </SelectPrimitive.Trigger>\n))\nSelectTrigger.displayName = SelectPrimitive.Trigger.displayName\n\nconst SelectContent = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content>\n>(({ className, children, position = \"popper\", ...props }, ref) => (\n <SelectPrimitive.Portal>\n <SelectPrimitive.Content\n ref={ref}\n className={cn(\n \"relative z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md animate-in fade-in-80\",\n position === \"popper\" && \"translate-y-1\",\n className\n )}\n position={position}\n {...props}\n >\n <SelectPrimitive.Viewport\n className={cn(\n \"p-1\",\n position === \"popper\" &&\n \"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]\"\n )}\n >\n {children}\n </SelectPrimitive.Viewport>\n </SelectPrimitive.Content>\n </SelectPrimitive.Portal>\n))\nSelectContent.displayName = SelectPrimitive.Content.displayName\n\nconst SelectLabel = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Label>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.Label\n ref={ref}\n className={cn(\"py-1.5 pl-8 pr-2 text-sm font-semibold\", className)}\n {...props}\n />\n))\nSelectLabel.displayName = SelectPrimitive.Label.displayName\n\nconst SelectItem = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item>\n>(({ className, children, ...props }, ref) => (\n <SelectPrimitive.Item\n ref={ref}\n className={cn(\n \"relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n className\n )}\n {...props}\n >\n <span className=\"absolute left-2 flex h-3.5 w-3.5 items-center justify-center\">\n <SelectPrimitive.ItemIndicator>\n <Check className=\"h-4 w-4\" />\n </SelectPrimitive.ItemIndicator>\n </span>\n\n <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n </SelectPrimitive.Item>\n))\nSelectItem.displayName = SelectPrimitive.Item.displayName\n\nconst SelectSeparator = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.Separator\n ref={ref}\n className={cn(\"-mx-1 my-1 h-px bg-muted\", className)}\n {...props}\n />\n))\nSelectSeparator.displayName = SelectPrimitive.Separator.displayName\n\nexport {\n Select,\n SelectGroup,\n SelectValue,\n SelectTrigger,\n SelectContent,\n SelectLabel,\n SelectItem,\n SelectSeparator,\n}\n" } ], "type": "ui" }, { "name": "separator", "dependencies": ["@radix-ui/react-separator"], "files": [ { "name": "separator.tsx", "dir": "components/ui", "content": "\"use client\"\n\nimport * as React from \"react\"\nimport * as SeparatorPrimitive from \"@radix-ui/react-separator\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst Separator = React.forwardRef<\n React.ElementRef<typeof SeparatorPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>\n>(\n (\n { className, orientation = \"horizontal\", decorative = true, ...props },\n ref\n ) => (\n <SeparatorPrimitive.Root\n ref={ref}\n decorative={decorative}\n orientation={orientation}\n className={cn(\n \"shrink-0 bg-border\",\n orientation === \"horizontal\" ? \"h-[1px] w-full\" : \"h-full w-[1px]\",\n className\n )}\n {...props}\n />\n )\n)\nSeparator.displayName = SeparatorPrimitive.Root.displayName\n\nexport { Separator }\n" } ], "type": "ui" }, { "name": "sheet", "dependencies": ["@radix-ui/react-dialog"], "files": [ { "name": "sheet.tsx", "dir": "components/ui", "content": "\"use client\"\n\nimport * as React from \"react\"\nimport * as SheetPrimitive from \"@radix-ui/react-dialog\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport { X } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst Sheet = SheetPrimitive.Root\n\nconst SheetTrigger = SheetPrimitive.Trigger\n\nconst SheetClose = SheetPrimitive.Close\n\nconst portalVariants = cva(\"fixed inset-0 z-50 flex\", {\n variants: {\n position: {\n top: \"items-start\",\n bottom: \"items-end\",\n left: \"justify-start\",\n right: \"justify-end\",\n },\n },\n defaultVariants: { position: \"right\" },\n})\n\ninterface SheetPortalProps\n extends SheetPrimitive.DialogPortalProps,\n VariantProps<typeof portalVariants> {}\n\nconst SheetPortal = ({\n position,\n className,\n children,\n ...props\n}: SheetPortalProps) => (\n <SheetPrimitive.Portal className={cn(className)} {...props}>\n <div className={portalVariants({ position })}>{children}</div>\n </SheetPrimitive.Portal>\n)\nSheetPortal.displayName = SheetPrimitive.Portal.displayName\n\nconst SheetOverlay = React.forwardRef<\n React.ElementRef<typeof SheetPrimitive.Overlay>,\n React.ComponentPropsWithoutRef<typeof SheetPrimitive.Overlay>\n>(({ className, children, ...props }, ref) => (\n <SheetPrimitive.Overlay\n className={cn(\n \"fixed inset-0 z-50 bg-background/80 backdrop-blur-sm transition-all duration-100 data-[state=closed]:animate-out data-[state=closed]:fade-out data-[state=open]:fade-in\",\n className\n )}\n {...props}\n ref={ref}\n />\n))\nSheetOverlay.displayName = SheetPrimitive.Overlay.displayName\n\nconst sheetVariants = cva(\n \"fixed z-50 scale-100 gap-4 bg-background p-6 opacity-100 shadow-lg border\",\n {\n variants: {\n position: {\n top: \"animate-in slide-in-from-top w-full duration-300\",\n bottom: \"animate-in slide-in-from-bottom w-full duration-300\",\n left: \"animate-in slide-in-from-left h-full duration-300\",\n right: \"animate-in slide-in-from-right h-full duration-300\",\n },\n size: {\n content: \"\",\n default: \"\",\n sm: \"\",\n lg: \"\",\n xl: \"\",\n full: \"\",\n },\n },\n compoundVariants: [\n {\n position: [\"top\", \"bottom\"],\n size: \"content\",\n class: \"max-h-screen\",\n },\n {\n position: [\"top\", \"bottom\"],\n size: \"default\",\n class: \"h-1/3\",\n },\n {\n position: [\"top\", \"bottom\"],\n size: \"sm\",\n class: \"h-1/4\",\n },\n {\n position: [\"top\", \"bottom\"],\n size: \"lg\",\n class: \"h-1/2\",\n },\n {\n position: [\"top\", \"bottom\"],\n size: \"xl\",\n class: \"h-5/6\",\n },\n {\n position: [\"top\", \"bottom\"],\n size: \"full\",\n class: \"h-screen\",\n },\n {\n position: [\"right\", \"left\"],\n size: \"content\",\n class: \"max-w-screen\",\n },\n {\n position: [\"right\", \"left\"],\n size: \"default\",\n class: \"w-1/3\",\n },\n {\n position: [\"right\", \"left\"],\n size: \"sm\",\n class: \"w-1/4\",\n },\n {\n position: [\"right\", \"left\"],\n size: \"lg\",\n class: \"w-1/2\",\n },\n {\n position: [\"right\", \"left\"],\n size: \"xl\",\n class: \"w-5/6\",\n },\n {\n position: [\"right\", \"left\"],\n size: \"full\",\n class: \"w-screen\",\n },\n ],\n defaultVariants: {\n position: \"right\",\n size: \"default\",\n },\n }\n)\n\nexport interface DialogContentProps\n extends React.ComponentPropsWithoutRef<typeof SheetPrimitive.Content>,\n VariantProps<typeof sheetVariants> {}\n\nconst SheetContent = React.forwardRef<\n React.ElementRef<typeof SheetPrimitive.Content>,\n DialogContentProps\n>(({ position, size, className, children, ...props }, ref) => (\n <SheetPortal position={position}>\n <SheetOverlay />\n <SheetPrimitive.Content\n ref={ref}\n className={cn(sheetVariants({ position, size }), className)}\n {...props}\n >\n {children}\n <SheetPrimitive.Close className=\"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary\">\n <X className=\"h-4 w-4\" />\n <span className=\"sr-only\">Close</span>\n </SheetPrimitive.Close>\n </SheetPrimitive.Content>\n </SheetPortal>\n))\nSheetContent.displayName = SheetPrimitive.Content.displayName\n\nconst SheetHeader = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLDivElement>) => (\n <div\n className={cn(\n \"flex flex-col space-y-2 text-center sm:text-left\",\n className\n )}\n {...props}\n />\n)\nSheetHeader.displayName = \"SheetHeader\"\n\nconst SheetFooter = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLDivElement>) => (\n <div\n className={cn(\n \"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2\",\n className\n )}\n {...props}\n />\n)\nSheetFooter.displayName = \"SheetFooter\"\n\nconst SheetTitle = React.forwardRef<\n React.ElementRef<typeof SheetPrimitive.Title>,\n React.ComponentPropsWithoutRef<typeof SheetPrimitive.Title>\n>(({ className, ...props }, ref) => (\n <SheetPrimitive.Title\n ref={ref}\n className={cn(\"text-lg font-semibold text-foreground\", className)}\n {...props}\n />\n))\nSheetTitle.displayName = SheetPrimitive.Title.displayName\n\nconst SheetDescription = React.forwardRef<\n React.ElementRef<typeof SheetPrimitive.Description>,\n React.ComponentPropsWithoutRef<typeof SheetPrimitive.Description>\n>(({ className, ...props }, ref) => (\n <SheetPrimitive.Description\n ref={ref}\n className={cn(\"text-sm text-muted-foreground\", className)}\n {...props}\n />\n))\nSheetDescription.displayName = SheetPrimitive.Description.displayName\n\nexport {\n Sheet,\n SheetTrigger,\n SheetClose,\n SheetContent,\n SheetHeader,\n SheetFooter,\n SheetTitle,\n SheetDescription,\n}\n" } ], "type": "ui" }, { "name": "skeleton", "files": [ { "name": "skeleton.tsx", "dir": "components/ui", "content": "import { cn } from \"@/lib/utils\"\n\nfunction Skeleton({\n className,\n ...props\n}: React.HTMLAttributes<HTMLDivElement>) {\n return (\n <div\n className={cn(\"animate-pulse rounded-md bg-muted\", className)}\n {...props}\n />\n )\n}\n\nexport { Skeleton }\n" } ], "type": "ui" }, { "name": "slider", "dependencies": ["@radix-ui/react-slider"], "files": [ { "name": "slider.tsx", "dir": "components/ui", "content": "\"use client\"\n\nimport * as React from \"react\"\nimport * as SliderPrimitive from \"@radix-ui/react-slider\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst Slider = React.forwardRef<\n React.ElementRef<typeof SliderPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof SliderPrimitive.Root>\n>(({ className, ...props }, ref) => (\n <SliderPrimitive.Root\n ref={ref}\n className={cn(\n \"relative flex w-full touch-none select-none items-center\",\n className\n )}\n {...props}\n >\n <SliderPrimitive.Track className=\"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary\">\n <SliderPrimitive.Range className=\"absolute h-full bg-primary\" />\n </SliderPrimitive.Track>\n <SliderPrimitive.Thumb className=\"block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50\" />\n </SliderPrimitive.Root>\n))\nSlider.displayName = SliderPrimitive.Root.displayName\n\nexport { Slider }\n" } ], "type": "ui" }, { "name": "switch", "dependencies": ["@radix-ui/react-switch"], "files": [ { "name": "switch.tsx", "dir": "components/ui", "content": "\"use client\"\n\nimport * as React from \"react\"\nimport * as SwitchPrimitives from \"@radix-ui/react-switch\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst Switch = React.forwardRef<\n React.ElementRef<typeof SwitchPrimitives.Root>,\n React.ComponentPropsWithoutRef<typeof SwitchPrimitives.Root>\n>(({ className, ...props }, ref) => (\n <SwitchPrimitives.Root\n className={cn(\n \"peer inline-flex h-[24px] w-[44px] shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input\",\n className\n )}\n {...props}\n ref={ref}\n >\n <SwitchPrimitives.Thumb\n className={cn(\n \"pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0\"\n )}\n />\n </SwitchPrimitives.Root>\n))\nSwitch.displayName = SwitchPrimitives.Root.displayName\n\nexport { Switch }\n" } ], "type": "ui" }, { "name": "table", "files": [ { "name": "table.tsx", "dir": "components/ui", "content": "import * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst Table = React.forwardRef<\n HTMLTableElement,\n React.HTMLAttributes<HTMLTableElement>\n>(({ className, ...props }, ref) => (\n <div className=\"w-full overflow-auto\">\n <table\n ref={ref}\n className={cn(\"w-full caption-bottom text-sm\", className)}\n {...props}\n />\n </div>\n))\nTable.displayName = \"Table\"\n\nconst TableHeader = React.forwardRef<\n HTMLTableSectionElement,\n React.HTMLAttributes<HTMLTableSectionElement>\n>(({ className, ...props }, ref) => (\n <thead ref={ref} className={cn(\"[&_tr]:border-b\", className)} {...props} />\n))\nTableHeader.displayName = \"TableHeader\"\n\nconst TableBody = React.forwardRef<\n HTMLTableSectionElement,\n React.HTMLAttributes<HTMLTableSectionElement>\n>(({ className, ...props }, ref) => (\n <tbody\n ref={ref}\n className={cn(\"[&_tr:last-child]:border-0\", className)}\n {...props}\n />\n))\nTableBody.displayName = \"TableBody\"\n\nconst TableFooter = React.forwardRef<\n HTMLTableSectionElement,\n React.HTMLAttributes<HTMLTableSectionElement>\n>(({ className, ...props }, ref) => (\n <tfoot\n ref={ref}\n className={cn(\"bg-primary font-medium text-primary-foreground\", className)}\n {...props}\n />\n))\nTableFooter.displayName = \"TableFooter\"\n\nconst TableRow = React.forwardRef<\n HTMLTableRowElement,\n React.HTMLAttributes<HTMLTableRowElement>\n>(({ className, ...props }, ref) => (\n <tr\n ref={ref}\n className={cn(\n \"border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted\",\n className\n )}\n {...props}\n />\n))\nTableRow.displayName = \"TableRow\"\n\nconst TableHead = React.forwardRef<\n HTMLTableCellElement,\n React.ThHTMLAttributes<HTMLTableCellElement>\n>(({ className, ...props }, ref) => (\n <th\n ref={ref}\n className={cn(\n \"h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0\",\n className\n )}\n {...props}\n />\n))\nTableHead.displayName = \"TableHead\"\n\nconst TableCell = React.forwardRef<\n HTMLTableCellElement,\n React.TdHTMLAttributes<HTMLTableCellElement>\n>(({ className, ...props }, ref) => (\n <td\n ref={ref}\n className={cn(\"p-4 align-middle [&:has([role=checkbox])]:pr-0\", className)}\n {...props}\n />\n))\nTableCell.displayName = \"TableCell\"\n\nconst TableCaption = React.forwardRef<\n HTMLTableCaptionElement,\n React.HTMLAttributes<HTMLTableCaptionElement>\n>(({ className, ...props }, ref) => (\n <caption\n ref={ref}\n className={cn(\"mt-4 text-sm text-muted-foreground\", className)}\n {...props}\n />\n))\nTableCaption.displayName = \"TableCaption\"\n\nexport {\n Table,\n TableHeader,\n TableBody,\n TableFooter,\n TableHead,\n TableRow,\n TableCell,\n TableCaption,\n}\n" } ], "type": "ui" }, { "name": "tabs", "dependencies": ["@radix-ui/react-tabs"], "files": [ { "name": "tabs.tsx", "dir": "components/ui", "content": "\"use client\"\n\nimport * as React from \"react\"\nimport * as TabsPrimitive from \"@radix-ui/react-tabs\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst Tabs = TabsPrimitive.Root\n\nconst TabsList = React.forwardRef<\n React.ElementRef<typeof TabsPrimitive.List>,\n React.ComponentPropsWithoutRef<typeof TabsPrimitive.List>\n>(({ className, ...props }, ref) => (\n <TabsPrimitive.List\n ref={ref}\n className={cn(\n \"inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground\",\n className\n )}\n {...props}\n />\n))\nTabsList.displayName = TabsPrimitive.List.displayName\n\nconst TabsTrigger = React.forwardRef<\n React.ElementRef<typeof TabsPrimitive.Trigger>,\n React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>\n>(({ className, ...props }, ref) => (\n <TabsPrimitive.Trigger\n ref={ref}\n className={cn(\n \"inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm\",\n className\n )}\n {...props}\n />\n))\nTabsTrigger.displayName = TabsPrimitive.Trigger.displayName\n\nconst TabsContent = React.forwardRef<\n React.ElementRef<typeof TabsPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof TabsPrimitive.Content>\n>(({ className, ...props }, ref) => (\n <TabsPrimitive.Content\n ref={ref}\n className={cn(\n \"mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2\",\n className\n )}\n {...props}\n />\n))\nTabsContent.displayName = TabsPrimitive.Content.displayName\n\nexport { Tabs, TabsList, TabsTrigger, TabsContent }\n" } ], "type": "ui" }, { "name": "textarea", "files": [ { "name": "textarea.tsx", "dir": "components/ui", "content": "import * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\n\nexport interface TextareaProps\n extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {}\n\nconst Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(\n ({ className, ...props }, ref) => {\n return (\n <textarea\n className={cn(\n \"flex min-h-[80px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50\",\n className\n )}\n ref={ref}\n {...props}\n />\n )\n }\n)\nTextarea.displayName = \"Textarea\"\n\nexport { Textarea }\n" } ], "type": "ui" }, { "name": "toast", "dependencies": ["@radix-ui/react-toast"], "files": [ { "name": "toast.tsx", "dir": "components/ui", "content": "import * as React from \"react\"\nimport * as ToastPrimitives from \"@radix-ui/react-toast\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport { X } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst ToastProvider = ToastPrimitives.Provider\n\nconst ToastViewport = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Viewport>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Viewport>\n>(({ className, ...props }, ref) => (\n <ToastPrimitives.Viewport\n ref={ref}\n className={cn(\n \"fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]\",\n className\n )}\n {...props}\n />\n))\nToastViewport.displayName = ToastPrimitives.Viewport.displayName\n\nconst toastVariants = cva(\n \"data-[swipe=move]:transition-none group relative pointer-events-auto flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full data-[state=closed]:slide-out-to-right-full\",\n {\n variants: {\n variant: {\n default: \"bg-background border\",\n destructive:\n \"group destructive border-destructive bg-destructive text-destructive-foreground\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n },\n }\n)\n\nconst Toast = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Root>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Root> &\n VariantProps<typeof toastVariants>\n>(({ className, variant, ...props }, ref) => {\n return (\n <ToastPrimitives.Root\n ref={ref}\n className={cn(toastVariants({ variant }), className)}\n {...props}\n />\n )\n})\nToast.displayName = ToastPrimitives.Root.displayName\n\nconst ToastAction = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Action>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Action>\n>(({ className, ...props }, ref) => (\n <ToastPrimitives.Action\n ref={ref}\n className={cn(\n \"inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-destructive/30 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive\",\n className\n )}\n {...props}\n />\n))\nToastAction.displayName = ToastPrimitives.Action.displayName\n\nconst ToastClose = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Close>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Close>\n>(({ className, ...props }, ref) => (\n <ToastPrimitives.Close\n ref={ref}\n className={cn(\n \"absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600\",\n className\n )}\n toast-close=\"\"\n {...props}\n >\n <X className=\"h-4 w-4\" />\n </ToastPrimitives.Close>\n))\nToastClose.displayName = ToastPrimitives.Close.displayName\n\nconst ToastTitle = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Title>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Title>\n>(({ className, ...props }, ref) => (\n <ToastPrimitives.Title\n ref={ref}\n className={cn(\"text-sm font-semibold\", className)}\n {...props}\n />\n))\nToastTitle.displayName = ToastPrimitives.Title.displayName\n\nconst ToastDescription = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Description>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Description>\n>(({ className, ...props }, ref) => (\n <ToastPrimitives.Description\n ref={ref}\n className={cn(\"text-sm opacity-90\", className)}\n {...props}\n />\n))\nToastDescription.displayName = ToastPrimitives.Description.displayName\n\ntype ToastProps = React.ComponentPropsWithoutRef<typeof Toast>\n\ntype ToastActionElement = React.ReactElement<typeof ToastAction>\n\nexport {\n type ToastProps,\n type ToastActionElement,\n ToastProvider,\n ToastViewport,\n Toast,\n ToastTitle,\n ToastDescription,\n ToastClose,\n ToastAction,\n}\n" }, { "name": "use-toast.ts", "dir": "components/ui", "content": "// Inspired by react-hot-toast library\nimport * as React from \"react\"\n\nimport type { ToastActionElement, ToastProps } from \"@/components/ui/toast\"\n\nconst TOAST_LIMIT = 1\nconst TOAST_REMOVE_DELAY = 1000000\n\ntype ToasterToast = ToastProps & {\n id: string\n title?: React.ReactNode\n description?: React.ReactNode\n action?: ToastActionElement\n}\n\nconst actionTypes = {\n ADD_TOAST: \"ADD_TOAST\",\n UPDATE_TOAST: \"UPDATE_TOAST\",\n DISMISS_TOAST: \"DISMISS_TOAST\",\n REMOVE_TOAST: \"REMOVE_TOAST\",\n} as const\n\nlet count = 0\n\nfunction genId() {\n count = (count + 1) % Number.MAX_VALUE\n return count.toString()\n}\n\ntype ActionType = typeof actionTypes\n\ntype Action =\n | {\n type: ActionType[\"ADD_TOAST\"]\n toast: ToasterToast\n }\n | {\n type: ActionType[\"UPDATE_TOAST\"]\n toast: Partial<ToasterToast>\n }\n | {\n type: ActionType[\"DISMISS_TOAST\"]\n toastId?: ToasterToast[\"id\"]\n }\n | {\n type: ActionType[\"REMOVE_TOAST\"]\n toastId?: ToasterToast[\"id\"]\n }\n\ninterface State {\n toasts: ToasterToast[]\n}\n\nconst toastTimeouts = new Map<string, ReturnType<typeof setTimeout>>()\n\nconst addToRemoveQueue = (toastId: string) => {\n if (toastTimeouts.has(toastId)) {\n return\n }\n\n const timeout = setTimeout(() => {\n toastTimeouts.delete(toastId)\n dispatch({\n type: \"REMOVE_TOAST\",\n toastId: toastId,\n })\n }, TOAST_REMOVE_DELAY)\n\n toastTimeouts.set(toastId, timeout)\n}\n\nexport const reducer = (state: State, action: Action): State => {\n switch (action.type) {\n case \"ADD_TOAST\":\n return {\n ...state,\n toasts: [action.toast, ...state.toasts].slice(0, TOAST_LIMIT),\n }\n\n case \"UPDATE_TOAST\":\n return {\n ...state,\n toasts: state.toasts.map((t) =>\n t.id === action.toast.id ? { ...t, ...action.toast } : t\n ),\n }\n\n case \"DISMISS_TOAST\": {\n const { toastId } = action\n\n // ! Side effects ! - This could be extracted into a dismissToast() action,\n // but I'll keep it here for simplicity\n if (toastId) {\n addToRemoveQueue(toastId)\n } else {\n state.toasts.forEach((toast) => {\n addToRemoveQueue(toast.id)\n })\n }\n\n return {\n ...state,\n toasts: state.toasts.map((t) =>\n t.id === toastId || toastId === undefined\n ? {\n ...t,\n open: false,\n }\n : t\n ),\n }\n }\n case \"REMOVE_TOAST\":\n if (action.toastId === undefined) {\n return {\n ...state,\n toasts: [],\n }\n }\n return {\n ...state,\n toasts: state.toasts.filter((t) => t.id !== action.toastId),\n }\n }\n}\n\nconst listeners: Array<(state: State) => void> = []\n\nlet memoryState: State = { toasts: [] }\n\nfunction dispatch(action: Action) {\n memoryState = reducer(memoryState, action)\n listeners.forEach((listener) => {\n listener(memoryState)\n })\n}\n\ntype Toast = Omit<ToasterToast, \"id\">\n\nfunction toast({ ...props }: Toast) {\n const id = genId()\n\n const update = (props: ToasterToast) =>\n dispatch({\n type: \"UPDATE_TOAST\",\n toast: { ...props, id },\n })\n const dismiss = () => dispatch({ type: \"DISMISS_TOAST\", toastId: id })\n\n dispatch({\n type: \"ADD_TOAST\",\n toast: {\n ...props,\n id,\n open: true,\n onOpenChange: (open) => {\n if (!open) dismiss()\n },\n },\n })\n\n return {\n id: id,\n dismiss,\n update,\n }\n}\n\nfunction useToast() {\n const [state, setState] = React.useState<State>(memoryState)\n\n React.useEffect(() => {\n listeners.push(setState)\n return () => {\n const index = listeners.indexOf(setState)\n if (index > -1) {\n listeners.splice(index, 1)\n }\n }\n }, [state])\n\n return {\n ...state,\n toast,\n dismiss: (toastId?: string) => dispatch({ type: \"DISMISS_TOAST\", toastId }),\n }\n}\n\nexport { useToast, toast }\n" }, { "name": "toaster.tsx", "dir": "components/ui", "content": "\"use client\"\n\nimport {\n Toast,\n ToastClose,\n ToastDescription,\n ToastProvider,\n ToastTitle,\n ToastViewport,\n} from \"@/components/ui/toast\"\nimport { useToast } from \"@/components/ui/use-toast\"\n\nexport function Toaster() {\n const { toasts } = useToast()\n\n return (\n <ToastProvider>\n {toasts.map(function ({ id, title, description, action, ...props }) {\n return (\n <Toast key={id} {...props}>\n <div className=\"grid gap-1\">\n {title && <ToastTitle>{title}</ToastTitle>}\n {description && (\n <ToastDescription>{description}</ToastDescription>\n )}\n </div>\n {action}\n <ToastClose />\n </Toast>\n )\n })}\n <ToastViewport />\n </ToastProvider>\n )\n}\n" } ], "type": "ui" }, { "name": "toggle", "dependencies": ["@radix-ui/react-toggle"], "files": [ { "name": "toggle.tsx", "dir": "components/ui", "content": "\"use client\"\n\nimport * as React from \"react\"\nimport * as TogglePrimitive from \"@radix-ui/react-toggle\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst toggleVariants = cva(\n \"inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors data-[state=on]:bg-accent data-[state=on]:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 ring-offset-background hover:bg-muted hover:text-muted-foreground\",\n {\n variants: {\n variant: {\n default: \"bg-transparent\",\n outline:\n \"bg-transparent border border-input hover:bg-accent hover:text-accent-foreground\",\n },\n size: {\n default: \"h-10 px-3\",\n sm: \"h-9 px-2.5\",\n lg: \"h-11 px-5\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n },\n }\n)\n\nconst Toggle = React.forwardRef<\n React.ElementRef<typeof TogglePrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof TogglePrimitive.Root> &\n VariantProps<typeof toggleVariants>\n>(({ className, variant, size, ...props }, ref) => (\n <TogglePrimitive.Root\n ref={ref}\n className={cn(toggleVariants({ variant, size, className }))}\n {...props}\n />\n))\n\nToggle.displayName = TogglePrimitive.Root.displayName\n\nexport { Toggle, toggleVariants }\n" } ], "type": "ui" }, { "name": "toggle-group", "dependencies": ["@radix-ui/react-toggle-group"], "files": [ { "name": "toggle-group.tsx", "dir": "components/ui", "content": "\"use client\"\n\nimport * as React from \"react\"\nimport * as ToggleGroupPrimitive from \"@radix-ui/react-toggle-group\"\nimport { VariantProps, cva } from \"class-variance-authority\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst ToggleGroupContext = React.createContext<\n VariantProps<typeof toggleGroupItemVariants>\n>({\n size: \"default\",\n variant: \"default\",\n})\n\nconst toggleGroupItemVariants = cva(\n \"inline-flex items-center justify-center text-sm font-medium ring-offset-background transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground\",\n {\n variants: {\n variant: {\n default: \"bg-transparent\",\n outline:\n \"border-r border-input bg-transparent last:border-0 hover:bg-accent hover:text-accent-foreground\",\n },\n size: {\n default: \"h-10 px-3\",\n sm: \"h-9 px-2.5\",\n lg: \"h-11 px-5\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n },\n }\n)\n\nconst ToggleGroup = React.forwardRef<\n React.ElementRef<typeof ToggleGroupPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Root> &\n VariantProps<typeof toggleGroupItemVariants>\n>(({ className, variant, size, children, ...props }, ref) => (\n <ToggleGroupPrimitive.Root\n ref={ref}\n className={cn(\n \"inline-flex items-center justify-center overflow-hidden rounded-md border border-input bg-transparent shadow\",\n className\n )}\n {...props}\n >\n <ToggleGroupContext.Provider value={{ variant, size }}>\n {children}\n </ToggleGroupContext.Provider>\n </ToggleGroupPrimitive.Root>\n))\n\nToggleGroup.displayName = ToggleGroupPrimitive.Root.displayName\n\nconst ToggleGroupItem = React.forwardRef<\n React.ElementRef<typeof ToggleGroupPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Item> &\n VariantProps<typeof toggleGroupItemVariants>\n>(({ className, children, variant, size, ...props }, ref) => {\n const context = React.useContext(ToggleGroupContext)\n\n return (\n <ToggleGroupPrimitive.Item\n ref={ref}\n className={cn(\n toggleGroupItemVariants({\n variant: context.variant || variant,\n size: context.size || size,\n }),\n className\n )}\n {...props}\n >\n {children}\n </ToggleGroupPrimitive.Item>\n )\n})\n\nToggleGroupItem.displayName = ToggleGroupPrimitive.Item.displayName\n\nexport { ToggleGroup, ToggleGroupItem }\n" } ], "type": "ui" }, { "name": "tooltip", "dependencies": ["@radix-ui/react-tooltip"], "files": [ { "name": "tooltip.tsx", "dir": "components/ui", "content": "\"use client\"\n\nimport * as React from \"react\"\nimport * as TooltipPrimitive from \"@radix-ui/react-tooltip\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst TooltipProvider = TooltipPrimitive.Provider\n\nconst Tooltip = TooltipPrimitive.Root\n\nconst TooltipTrigger = TooltipPrimitive.Trigger\n\nconst TooltipContent = React.forwardRef<\n React.ElementRef<typeof TooltipPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>\n>(({ className, sideOffset = 4, ...props }, ref) => (\n <TooltipPrimitive.Content\n ref={ref}\n sideOffset={sideOffset}\n className={cn(\n \"z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-50 data-[side=bottom]:slide-in-from-top-1 data-[side=left]:slide-in-from-right-1 data-[side=right]:slide-in-from-left-1 data-[side=top]:slide-in-from-bottom-1\",\n className\n )}\n {...props}\n />\n))\nTooltipContent.displayName = TooltipPrimitive.Content.displayName\n\nexport { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider }\n" } ], "type": "ui" } ]
apps/www/pages/api/components.json
0
https://github.com/shadcn-ui/ui/commit/4b200ebf5973602ec017294bbdaaee59cd632d0f
[ 0.0005048697930760682, 0.00018361351976636797, 0.00016481599595863372, 0.00016965318354777992, 0.0000512576152686961 ]
{ "id": 3, "code_window": [ "```tsx showLineNumbers\n", "<Drawer>\n", " <DrawerTrigger>Open</DrawerTrigger>\n", " <DrawerContent>\n", " <DrawerHeader>\n", " <DrawerTitle>Are you sure absolutely sure?</DrawerTitle>\n", " <DrawerDescription>This action cannot be undone.</DrawerDescription>\n", " </DrawerHeader>\n", " <DrawerFooter>\n" ], "labels": [ "keep", "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep" ], "after_edit": [ " <DrawerTitle>Are you absolutely sure?</DrawerTitle>\n" ], "file_path": "apps/www/content/docs/components/drawer.mdx", "type": "replace", "edit_start_line_idx": 72 }
# Adapted from create-t3-app. name: Write Beta Release comment on: workflow_run: workflows: ["Release - Beta"] types: - completed jobs: comment: if: | github.repository_owner == 'shadcn-ui' && ${{ github.event.workflow_run.conclusion == 'success' }} runs-on: ubuntu-latest name: Write comment to the PR steps: - name: "Comment on PR" uses: actions/github-script@v6 with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | const allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ owner: context.repo.owner, repo: context.repo.repo, run_id: context.payload.workflow_run.id, }); for (const artifact of allArtifacts.data.artifacts) { // Extract the PR number and package version from the artifact name const match = /^npm-package-shadcn-ui@(.*?)-pr-(\d+)/.exec(artifact.name); if (match) { require("fs").appendFileSync( process.env.GITHUB_ENV, `\nBETA_PACKAGE_VERSION=${match[1]}` + `\nWORKFLOW_RUN_PR=${match[2]}` + `\nWORKFLOW_RUN_ID=${context.payload.workflow_run.id}` ); break; } } - name: "Comment on PR with Link" uses: marocchino/sticky-pull-request-comment@v2 with: number: ${{ env.WORKFLOW_RUN_PR }} message: | A new prerelease is available for testing: ```sh npx shadcn-ui@${{ env.BETA_PACKAGE_VERSION }} ``` - name: "Remove the autorelease label once published" uses: actions/github-script@v6 with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | github.rest.issues.removeLabel({ owner: context.repo.owner, repo: context.repo.repo, issue_number: '${{ env.WORKFLOW_RUN_PR }}', name: '🚀 autorelease', });
.github/workflows/prerelease-comment.yml
0
https://github.com/shadcn-ui/ui/commit/4b200ebf5973602ec017294bbdaaee59cd632d0f
[ 0.00017505351570434868, 0.00017099174147006124, 0.00016647092706989497, 0.00017013531760312617, 0.0000033980429634539178 ]
{ "id": 3, "code_window": [ "```tsx showLineNumbers\n", "<Drawer>\n", " <DrawerTrigger>Open</DrawerTrigger>\n", " <DrawerContent>\n", " <DrawerHeader>\n", " <DrawerTitle>Are you sure absolutely sure?</DrawerTitle>\n", " <DrawerDescription>This action cannot be undone.</DrawerDescription>\n", " </DrawerHeader>\n", " <DrawerFooter>\n" ], "labels": [ "keep", "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep" ], "after_edit": [ " <DrawerTitle>Are you absolutely sure?</DrawerTitle>\n" ], "file_path": "apps/www/content/docs/components/drawer.mdx", "type": "replace", "edit_start_line_idx": 72 }
import { z } from "zod" // We're keeping a simple non-relational schema here. // IRL, you will have a schema for your data models. export const taskSchema = z.object({ id: z.string(), title: z.string(), status: z.string(), label: z.string(), priority: z.string(), }) export type Task = z.infer<typeof taskSchema>
apps/www/app/examples/tasks/data/schema.ts
0
https://github.com/shadcn-ui/ui/commit/4b200ebf5973602ec017294bbdaaee59cd632d0f
[ 0.00017736252630129457, 0.00017515284707769752, 0.0001729431824060157, 0.00017515284707769752, 0.0000022096719476394355 ]
{ "id": 4, "code_window": [ " <SheetTrigger>Open</SheetTrigger>\n", " <SheetContent>\n", " <SheetHeader>\n", " <SheetTitle>Are you sure absolutely sure?</SheetTitle>\n", " <SheetDescription>\n", " This action cannot be undone. This will permanently delete your account\n", " and remove your data from our servers.\n" ], "labels": [ "keep", "keep", "keep", "replace", "keep", "keep", "keep" ], "after_edit": [ " <SheetTitle>Are you absolutely sure?</SheetTitle>\n" ], "file_path": "apps/www/content/docs/components/sheet.mdx", "type": "replace", "edit_start_line_idx": 67 }
--- title: Sheet description: Extends the Dialog component to display content that complements the main content of the screen. component: true links: doc: https://www.radix-ui.com/docs/primitives/components/dialog api: https://www.radix-ui.com/docs/primitives/components/dialog#api-reference --- <ComponentPreview name="sheet-demo" /> ## Installation <Tabs defaultValue="cli"> <TabsList> <TabsTrigger value="cli">CLI</TabsTrigger> <TabsTrigger value="manual">Manual</TabsTrigger> </TabsList> <TabsContent value="cli"> ```bash npx shadcn-ui@latest add sheet ``` </TabsContent> <TabsContent value="manual"> <Steps> <Step>Install the following dependencies:</Step> ```bash npm install @radix-ui/react-dialog ``` <Step>Copy and paste the following code into your project.</Step> <ComponentSource name="sheet" /> <Step>Update the import paths to match your project setup.</Step> </Steps> </TabsContent> </Tabs> ### Usage ```tsx import { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle, SheetTrigger, } from "@/components/ui/sheet" ``` ```tsx <Sheet> <SheetTrigger>Open</SheetTrigger> <SheetContent> <SheetHeader> <SheetTitle>Are you sure absolutely sure?</SheetTitle> <SheetDescription> This action cannot be undone. This will permanently delete your account and remove your data from our servers. </SheetDescription> </SheetHeader> </SheetContent> </Sheet> ``` ## Examples ### Side Use the `side` property to `<SheetContent />` to indicate the edge of the screen where the component will appear. The values can be `top`, `right`, `bottom` or `left`. <ComponentPreview name="sheet-side" /> ### Size You can adjust the size of the sheet using CSS classes: ```tsx {3} <Sheet> <SheetTrigger>Open</SheetTrigger> <SheetContent className="w-[400px] sm:w-[540px]"> <SheetHeader> <SheetTitle>Are you sure absolutely sure?</SheetTitle> <SheetDescription> This action cannot be undone. This will permanently delete your account and remove your data from our servers. </SheetDescription> </SheetHeader> </SheetContent> </Sheet> ```
apps/www/content/docs/components/sheet.mdx
1
https://github.com/shadcn-ui/ui/commit/4b200ebf5973602ec017294bbdaaee59cd632d0f
[ 0.9960129261016846, 0.17538617551326752, 0.000161527466843836, 0.000460414303233847, 0.36896827816963196 ]
{ "id": 4, "code_window": [ " <SheetTrigger>Open</SheetTrigger>\n", " <SheetContent>\n", " <SheetHeader>\n", " <SheetTitle>Are you sure absolutely sure?</SheetTitle>\n", " <SheetDescription>\n", " This action cannot be undone. This will permanently delete your account\n", " and remove your data from our servers.\n" ], "labels": [ "keep", "keep", "keep", "replace", "keep", "keep", "keep" ], "after_edit": [ " <SheetTitle>Are you absolutely sure?</SheetTitle>\n" ], "file_path": "apps/www/content/docs/components/sheet.mdx", "type": "replace", "edit_start_line_idx": 67 }
# editorconfig.org root = true [*] charset = utf-8 end_of_line = lf indent_size = 2 indent_style = space insert_final_newline = true trim_trailing_whitespace = true
.editorconfig
0
https://github.com/shadcn-ui/ui/commit/4b200ebf5973602ec017294bbdaaee59cd632d0f
[ 0.00017629725334700197, 0.00017211610975209624, 0.0001679349661571905, 0.00017211610975209624, 0.000004181143594905734 ]
{ "id": 4, "code_window": [ " <SheetTrigger>Open</SheetTrigger>\n", " <SheetContent>\n", " <SheetHeader>\n", " <SheetTitle>Are you sure absolutely sure?</SheetTitle>\n", " <SheetDescription>\n", " This action cannot be undone. This will permanently delete your account\n", " and remove your data from our servers.\n" ], "labels": [ "keep", "keep", "keep", "replace", "keep", "keep", "keep" ], "after_edit": [ " <SheetTitle>Are you absolutely sure?</SheetTitle>\n" ], "file_path": "apps/www/content/docs/components/sheet.mdx", "type": "replace", "edit_start_line_idx": 67 }
import { EnvelopeOpenIcon } from "@radix-ui/react-icons" import { Button } from "@/registry/new-york/ui/button" export default function ButtonWithIcon() { return ( <Button> <EnvelopeOpenIcon className="mr-2 h-4 w-4" /> Login with Email </Button> ) }
apps/www/registry/new-york/example/button-with-icon.tsx
0
https://github.com/shadcn-ui/ui/commit/4b200ebf5973602ec017294bbdaaee59cd632d0f
[ 0.00017752494022715837, 0.00017284564091823995, 0.00016816635616123676, 0.00017284564091823995, 0.000004679292032960802 ]
{ "id": 4, "code_window": [ " <SheetTrigger>Open</SheetTrigger>\n", " <SheetContent>\n", " <SheetHeader>\n", " <SheetTitle>Are you sure absolutely sure?</SheetTitle>\n", " <SheetDescription>\n", " This action cannot be undone. This will permanently delete your account\n", " and remove your data from our servers.\n" ], "labels": [ "keep", "keep", "keep", "replace", "keep", "keep", "keep" ], "after_edit": [ " <SheetTitle>Are you absolutely sure?</SheetTitle>\n" ], "file_path": "apps/www/content/docs/components/sheet.mdx", "type": "replace", "edit_start_line_idx": 67 }
import { Node } from "unist-builder" export interface UnistNode extends Node { type: string name?: string tagName?: string value?: string properties?: { __rawString__?: string __className__?: string __event__?: string [key: string]: unknown } & NpmCommands attributes?: { name: string value: unknown type?: string }[] children?: UnistNode[] } export interface UnistTree extends Node { children: UnistNode[] } export interface NpmCommands { __npmCommand__?: string __yarnCommand__?: string __pnpmCommand__?: string __bunCommand__?: string }
apps/www/types/unist.ts
0
https://github.com/shadcn-ui/ui/commit/4b200ebf5973602ec017294bbdaaee59cd632d0f
[ 0.00017752494022715837, 0.00017501512775197625, 0.00017132109496742487, 0.0001756072451826185, 0.0000023338832306762924 ]
{ "id": 5, "code_window": [ " <SheetTrigger>Open</SheetTrigger>\n", " <SheetContent className=\"w-[400px] sm:w-[540px]\">\n", " <SheetHeader>\n", " <SheetTitle>Are you sure absolutely sure?</SheetTitle>\n", " <SheetDescription>\n", " This action cannot be undone. This will permanently delete your account\n", " and remove your data from our servers.\n", " </SheetDescription>\n" ], "labels": [ "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep" ], "after_edit": [ " <SheetTitle>Are you absolutely sure?</SheetTitle>\n" ], "file_path": "apps/www/content/docs/components/sheet.mdx", "type": "replace", "edit_start_line_idx": 94 }
--- title: Sheet description: Extends the Dialog component to display content that complements the main content of the screen. component: true links: doc: https://www.radix-ui.com/docs/primitives/components/dialog api: https://www.radix-ui.com/docs/primitives/components/dialog#api-reference --- <ComponentPreview name="sheet-demo" /> ## Installation <Tabs defaultValue="cli"> <TabsList> <TabsTrigger value="cli">CLI</TabsTrigger> <TabsTrigger value="manual">Manual</TabsTrigger> </TabsList> <TabsContent value="cli"> ```bash npx shadcn-ui@latest add sheet ``` </TabsContent> <TabsContent value="manual"> <Steps> <Step>Install the following dependencies:</Step> ```bash npm install @radix-ui/react-dialog ``` <Step>Copy and paste the following code into your project.</Step> <ComponentSource name="sheet" /> <Step>Update the import paths to match your project setup.</Step> </Steps> </TabsContent> </Tabs> ### Usage ```tsx import { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle, SheetTrigger, } from "@/components/ui/sheet" ``` ```tsx <Sheet> <SheetTrigger>Open</SheetTrigger> <SheetContent> <SheetHeader> <SheetTitle>Are you sure absolutely sure?</SheetTitle> <SheetDescription> This action cannot be undone. This will permanently delete your account and remove your data from our servers. </SheetDescription> </SheetHeader> </SheetContent> </Sheet> ``` ## Examples ### Side Use the `side` property to `<SheetContent />` to indicate the edge of the screen where the component will appear. The values can be `top`, `right`, `bottom` or `left`. <ComponentPreview name="sheet-side" /> ### Size You can adjust the size of the sheet using CSS classes: ```tsx {3} <Sheet> <SheetTrigger>Open</SheetTrigger> <SheetContent className="w-[400px] sm:w-[540px]"> <SheetHeader> <SheetTitle>Are you sure absolutely sure?</SheetTitle> <SheetDescription> This action cannot be undone. This will permanently delete your account and remove your data from our servers. </SheetDescription> </SheetHeader> </SheetContent> </Sheet> ```
apps/www/content/docs/components/sheet.mdx
1
https://github.com/shadcn-ui/ui/commit/4b200ebf5973602ec017294bbdaaee59cd632d0f
[ 0.9953595995903015, 0.11078169196844101, 0.00016126816626638174, 0.0004182893317192793, 0.2860857844352722 ]
{ "id": 5, "code_window": [ " <SheetTrigger>Open</SheetTrigger>\n", " <SheetContent className=\"w-[400px] sm:w-[540px]\">\n", " <SheetHeader>\n", " <SheetTitle>Are you sure absolutely sure?</SheetTitle>\n", " <SheetDescription>\n", " This action cannot be undone. This will permanently delete your account\n", " and remove your data from our servers.\n", " </SheetDescription>\n" ], "labels": [ "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep" ], "after_edit": [ " <SheetTitle>Are you absolutely sure?</SheetTitle>\n" ], "file_path": "apps/www/content/docs/components/sheet.mdx", "type": "replace", "edit_start_line_idx": 94 }
--- title: Select description: Displays a list of options for the user to pick from—triggered by a button. component: true featured: true links: doc: https://www.radix-ui.com/docs/primitives/components/select api: https://www.radix-ui.com/docs/primitives/components/select#api-reference --- <ComponentPreview name="select-demo" /> ## Installation <Tabs defaultValue="cli"> <TabsList> <TabsTrigger value="cli">CLI</TabsTrigger> <TabsTrigger value="manual">Manual</TabsTrigger> </TabsList> <TabsContent value="cli"> ```bash npx shadcn-ui@latest add select ``` </TabsContent> <TabsContent value="manual"> <Steps> <Step>Install the following dependencies:</Step> ```bash npm install @radix-ui/react-select ``` <Step>Copy and paste the following code into your project.</Step> <ComponentSource name="select" /> <Step>Update the import paths to match your project setup.</Step> </Steps> </TabsContent> </Tabs> ## Usage ```tsx import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "@/components/ui/select" ``` ```tsx <Select> <SelectTrigger className="w-[180px]"> <SelectValue placeholder="Theme" /> </SelectTrigger> <SelectContent> <SelectItem value="light">Light</SelectItem> <SelectItem value="dark">Dark</SelectItem> <SelectItem value="system">System</SelectItem> </SelectContent> </Select> ``` ## Examples ### Scrollable <ComponentPreview name="select-scrollable" /> ### Form <ComponentPreview name="select-form" />
apps/www/content/docs/components/select.mdx
0
https://github.com/shadcn-ui/ui/commit/4b200ebf5973602ec017294bbdaaee59cd632d0f
[ 0.000185111872269772, 0.0001715859107207507, 0.00016590520681347698, 0.00017076007497962564, 0.000005155710368853761 ]