type
stringclasses 7
values | content
stringlengths 4
9.55k
| repo
stringlengths 7
96
| path
stringlengths 4
178
| language
stringclasses 1
value |
|---|---|---|---|---|
InterfaceDeclaration
|
/**
* Test definition.
*
* ERC20: ZXC, BNB, OMG, GNT
*/
/**
* Spec context interfaces.
*/
interface Data {
orderGateway?: any;
tokenProxy?: any;
owner?: string;
bob?: string;
jane?: string;
zeroAddress?: string;
zxc?: any;
gnt?: any;
bnb?: any;
omg?: any;
}
|
SparkAssets/framework
|
packages/0xcert-ethereum-order-gateway-contracts/src/tests/transfer-instance-method-any-taker/transfer-erc20s.test.ts
|
TypeScript
|
ClassDeclaration
|
declare class MixContract extends KIP7Contract {
constructor();
}
|
dogesoundclub/dsc-app-v2
|
lib/contracts/mix/MixContract.d.ts
|
TypeScript
|
ArrowFunction
|
(
getState: GetStateFn,
baseConfig: BaseConfig
): types.Expedition => {
const state = getState()
const { expeditionConfig } = baseConfig
if (expeditionConfig) {
return handleExistingConfig(
{
// This transformation is necessary so that typescript knows
// that we actually have an expedition (just checking baseConfig.expeditionConfig
// and handing that over as argument did somehow not work)
...baseConfig,
expeditionConfig,
},
state
)
} else {
return handleWithoutConfig(baseConfig, state)
}
}
|
Quicksav/aeons-end-randomizer
|
src/Redux/Store/Expeditions/Expeditions/sideEffects/createExpeditionConfig/index.ts
|
TypeScript
|
EnumDeclaration
|
/*
* diagnosticRules.ts
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT license.
* Author: Eric Traut
*
* Strings that represent each of the diagnostic rules
* that can be enabled or disabled in the configuration.
*/
export const enum DiagnosticRule {
strictListInference = 'strictListInference',
strictDictionaryInference = 'strictDictionaryInference',
strictParameterNoneValue = 'strictParameterNoneValue',
enableTypeIgnoreComments = 'enableTypeIgnoreComments',
reportTypeshedErrors = 'reportTypeshedErrors',
reportMissingImports = 'reportMissingImports',
reportMissingTypeStubs = 'reportMissingTypeStubs',
reportImportCycles = 'reportImportCycles',
reportUnusedImport = 'reportUnusedImport',
reportUnusedClass = 'reportUnusedClass',
reportUnusedFunction = 'reportUnusedFunction',
reportUnusedVariable = 'reportUnusedVariable',
reportDuplicateImport = 'reportDuplicateImport',
reportOptionalSubscript = 'reportOptionalSubscript',
reportOptionalMemberAccess = 'reportOptionalMemberAccess',
reportOptionalCall = 'reportOptionalCall',
reportOptionalIterable = 'reportOptionalIterable',
reportOptionalContextManager = 'reportOptionalContextManager',
reportOptionalOperand = 'reportOptionalOperand',
reportUntypedFunctionDecorator = 'reportUntypedFunctionDecorator',
reportUntypedClassDecorator = 'reportUntypedClassDecorator',
reportUntypedBaseClass = 'reportUntypedBaseClass',
reportUntypedNamedTuple = 'reportUntypedNamedTuple',
reportPrivateUsage = 'reportPrivateUsage',
reportConstantRedefinition = 'reportConstantRedefinition',
reportIncompatibleMethodOverride = 'reportIncompatibleMethodOverride',
reportInvalidStringEscapeSequence = 'reportInvalidStringEscapeSequence',
reportUnknownParameterType = 'reportUnknownParameterType',
reportUnknownLambdaType = 'reportUnknownLambdaType',
reportUnknownVariableType = 'reportUnknownVariableType',
reportUnknownMemberType = 'reportUnknownMemberType',
reportCallInDefaultInitializer = 'reportCallInDefaultInitializer',
reportUnnecessaryIsInstance = 'reportUnnecessaryIsInstance',
reportUnnecessaryCast = 'reportUnnecessaryCast',
reportAssertAlwaysTrue = 'reportAssertAlwaysTrue',
reportSelfClsParameterName = 'reportSelfClsParameterName'
}
|
mewbak/pyright
|
server/src/common/diagnosticRules.ts
|
TypeScript
|
ClassDeclaration
|
@NgModule({
imports: [
HomeRoutingModule,
],
declarations: [
HomeComponent,
],
exports: [
HomeComponent,
],
})
export class HomeModule {
}
|
w12rr/gui-for-cli
|
src/app/modules/home/home.module.ts
|
TypeScript
|
ClassDeclaration
|
export class Run {
static getRun(data: any): Run {
const run = new Run();
run.restore(data);
return run;
}
expPerSec = new Decimal(0);
constructor(
public endDate = new Date(),
public startDate = new Date(),
public worldName = "",
public experience = new Decimal(0),
public completed = false
) {}
reloadExpPerSec() {
this.expPerSec = this.experience.div(
(this.endDate.getTime() - this.startDate.getTime()) / 1000
);
}
//#region Save and Load
getSave(): any {
return {
f: this.endDate,
w: this.worldName,
e: this.experience,
c: this.completed,
s: this.startDate
};
}
restore(data: any) {
if ("f" in data) this.endDate = new Date(data.f);
if ("s" in data) this.startDate = new Date(data.s);
if ("w" in data) this.worldName = data.w;
if ("e" in data) this.experience = new Decimal(data.e);
this.completed = !!data.c;
this.reloadExpPerSec();
}
//#endregion
}
|
indeterminateoutcomesstudios/IdleAnt2
|
src/app/model/stats/run.ts
|
TypeScript
|
MethodDeclaration
|
static getRun(data: any): Run {
const run = new Run();
run.restore(data);
return run;
}
|
indeterminateoutcomesstudios/IdleAnt2
|
src/app/model/stats/run.ts
|
TypeScript
|
MethodDeclaration
|
reloadExpPerSec() {
this.expPerSec = this.experience.div(
(this.endDate.getTime() - this.startDate.getTime()) / 1000
);
}
|
indeterminateoutcomesstudios/IdleAnt2
|
src/app/model/stats/run.ts
|
TypeScript
|
MethodDeclaration
|
//#region Save and Load
getSave(): any {
return {
f: this.endDate,
w: this.worldName,
e: this.experience,
c: this.completed,
s: this.startDate
};
}
|
indeterminateoutcomesstudios/IdleAnt2
|
src/app/model/stats/run.ts
|
TypeScript
|
MethodDeclaration
|
restore(data: any) {
if ("f" in data) this.endDate = new Date(data.f);
if ("s" in data) this.startDate = new Date(data.s);
if ("w" in data) this.worldName = data.w;
if ("e" in data) this.experience = new Decimal(data.e);
this.completed = !!data.c;
this.reloadExpPerSec();
}
|
indeterminateoutcomesstudios/IdleAnt2
|
src/app/model/stats/run.ts
|
TypeScript
|
ArrowFunction
|
(i18n) => {
const rule: RuleFunction = async (context: RuleContext): Promise<void> => {
const { utils } = context
const maxIdentical = utils.getOption('maxIdentical')
assertNumber(maxIdentical)
const results: Map<string, FileFormat.Text[]> = new Map()
for (const text of utils.objects.text) {
if (typeof text.sharedStyleID === 'string') continue // Ignore layers using a shared style
// Determine whether we're inside a symbol instance, if so return early since
// duplicate layer styles are to be expected across the docucument in instances
if (isChildOfClass(text, FileFormat.ClassValue.SymbolInstance, utils)) continue
// Get a string hash of the style object.
const hash = utils.textStyleHash(text.style)
// Add the style object hash and current node to the result set
if (results.has(hash)) {
const texts = results.get(hash)
texts?.push(text)
} else {
results.set(hash, [text])
}
}
// Loop the results, generating violations as needed
for (const [, objects] of results) {
const numIdentical = objects.length
if (numIdentical > maxIdentical) {
utils.report(
i18n._(
plural({
value: maxIdentical,
one: `Expected no identical text styles in the document, but found ${numIdentical} matching this layer's text style. Consider a shared text style instead`,
other: `Expected a maximum of # identical text styles in the document, but found ${numIdentical} instances of this layer's text style. Consider a shared text style instead`,
}),
),
...objects,
)
}
}
}
return {
rule,
name: 'text-styles-prefer-shared',
title: (ruleConfig) => {
const { maxIdentical } = ruleConfig
if (typeof maxIdentical !== 'number') return ''
return i18n._(
plural({
value: maxIdentical,
one: 'Text styles should not be identical',
other: 'No more than # text styles should be identical',
}),
)
},
description: i18n._(
t`You could simplify things by removing identical text styles and applying a single style to all affected text.`,
),
getOptions: (helpers) => [
helpers.integerOption({
name: 'maxIdentical',
title: i18n._(t`Max Identical`),
description: i18n._(t`The maximum allowed number of identical text styles`),
minimum: 1,
defaultValue: 1,
}),
],
}
}
|
CheungKingwei/sketch-hst
|
assistants/core/src/rules/text-styles-prefer-shared/index.ts
|
TypeScript
|
ArrowFunction
|
async (context: RuleContext): Promise<void> => {
const { utils } = context
const maxIdentical = utils.getOption('maxIdentical')
assertNumber(maxIdentical)
const results: Map<string, FileFormat.Text[]> = new Map()
for (const text of utils.objects.text) {
if (typeof text.sharedStyleID === 'string') continue // Ignore layers using a shared style
// Determine whether we're inside a symbol instance, if so return early since
// duplicate layer styles are to be expected across the docucument in instances
if (isChildOfClass(text, FileFormat.ClassValue.SymbolInstance, utils)) continue
// Get a string hash of the style object.
const hash = utils.textStyleHash(text.style)
// Add the style object hash and current node to the result set
if (results.has(hash)) {
const texts = results.get(hash)
texts?.push(text)
} else {
results.set(hash, [text])
}
}
// Loop the results, generating violations as needed
for (const [, objects] of results) {
const numIdentical = objects.length
if (numIdentical > maxIdentical) {
utils.report(
i18n._(
plural({
value: maxIdentical,
one: `Expected no identical text styles in the document, but found ${numIdentical} matching this layer's text style. Consider a shared text style instead`,
other: `Expected a maximum of # identical text styles in the document, but found ${numIdentical} instances of this layer's text style. Consider a shared text style instead`,
}),
),
...objects,
)
}
}
}
|
CheungKingwei/sketch-hst
|
assistants/core/src/rules/text-styles-prefer-shared/index.ts
|
TypeScript
|
ArrowFunction
|
(ruleConfig) => {
const { maxIdentical } = ruleConfig
if (typeof maxIdentical !== 'number') return ''
return i18n._(
plural({
value: maxIdentical,
one: 'Text styles should not be identical',
other: 'No more than # text styles should be identical',
}),
)
}
|
CheungKingwei/sketch-hst
|
assistants/core/src/rules/text-styles-prefer-shared/index.ts
|
TypeScript
|
ArrowFunction
|
(helpers) => [
helpers.integerOption({
name: 'maxIdentical',
title: i18n._(t`Max Identical`),
description: i18n._(t`The maximum allowed number of identical text styles`),
minimum: 1,
defaultValue: 1,
}),
]
|
CheungKingwei/sketch-hst
|
assistants/core/src/rules/text-styles-prefer-shared/index.ts
|
TypeScript
|
ArrowFunction
|
(newMetric) => this.assignReport(this.report, newMetric)
|
DarshitChanpura/OpenSearch-Dashboards
|
packages/osd-analytics/src/report.ts
|
TypeScript
|
ClassDeclaration
|
export class ReportManager {
static REPORT_VERSION = REPORT_VERSION;
public report: Report;
constructor(report?: Report) {
this.report = report || ReportManager.createReport();
}
static createReport(): Report {
return { reportVersion: REPORT_VERSION };
}
public clearReport() {
this.report = ReportManager.createReport();
}
public isReportEmpty(): boolean {
const { uiStatsMetrics, userAgent, application_usage: appUsage } = this.report;
const noUiStats = !uiStatsMetrics || Object.keys(uiStatsMetrics).length === 0;
const noUserAgent = !userAgent || Object.keys(userAgent).length === 0;
const noAppUsage = !appUsage || Object.keys(appUsage).length === 0;
return noUiStats && noUserAgent && noAppUsage;
}
private incrementStats(count: number, stats?: Stats): Stats {
const { min = 0, max = 0, sum = 0 } = stats || {};
const newMin = Math.min(min, count);
const newMax = Math.max(max, count);
const newAvg = newMin + newMax / 2;
const newSum = sum + count;
return {
min: newMin,
max: newMax,
avg: newAvg,
sum: newSum,
};
}
assignReports(newMetrics: Metric | Metric[]) {
wrapArray(newMetrics).forEach((newMetric) => this.assignReport(this.report, newMetric));
return { report: this.report };
}
static createMetricKey(metric: Metric): string {
switch (metric.type) {
case METRIC_TYPE.USER_AGENT: {
const { appName, type } = metric;
return `${appName}-${type}`;
}
case METRIC_TYPE.CLICK:
case METRIC_TYPE.LOADED:
case METRIC_TYPE.COUNT: {
const { appName, eventName, type } = metric;
return `${appName}-${type}-${eventName}`;
}
case METRIC_TYPE.APPLICATION_USAGE:
return metric.appId;
default:
throw new UnreachableCaseError(metric);
}
}
private assignReport(report: Report, metric: Metric) {
const key = ReportManager.createMetricKey(metric);
switch (metric.type) {
case METRIC_TYPE.USER_AGENT: {
const { appName, type, userAgent } = metric;
if (userAgent) {
report.userAgent = {
[key]: {
key,
appName,
type,
userAgent: metric.userAgent,
},
};
}
return;
}
case METRIC_TYPE.CLICK:
case METRIC_TYPE.LOADED:
case METRIC_TYPE.COUNT: {
const { appName, type, eventName, count } = metric;
report.uiStatsMetrics = report.uiStatsMetrics || {};
const existingStats = (report.uiStatsMetrics[key] || {}).stats;
report.uiStatsMetrics[key] = {
key,
appName,
eventName,
type,
stats: this.incrementStats(count, existingStats),
};
return;
}
case METRIC_TYPE.APPLICATION_USAGE:
const { numberOfClicks, startTime } = metric;
const minutesOnScreen = moment().diff(startTime, 'minutes', true);
report.application_usage = report.application_usage || {};
const appExistingData = report.application_usage[key] || {
minutesOnScreen: 0,
numberOfClicks: 0,
};
report.application_usage[key] = {
minutesOnScreen: appExistingData.minutesOnScreen + minutesOnScreen,
numberOfClicks: appExistingData.numberOfClicks + numberOfClicks,
};
break;
default:
throw new UnreachableCaseError(metric);
}
}
}
|
DarshitChanpura/OpenSearch-Dashboards
|
packages/osd-analytics/src/report.ts
|
TypeScript
|
InterfaceDeclaration
|
export interface Report {
reportVersion: typeof REPORT_VERSION;
uiStatsMetrics?: Record<
string,
{
key: string;
appName: string;
eventName: string;
type: UiStatsMetricType;
stats: Stats;
}
>;
userAgent?: Record<
string,
{
userAgent: string;
key: string;
type: METRIC_TYPE.USER_AGENT;
appName: string;
}
>;
application_usage?: Record<
string,
{
minutesOnScreen: number;
numberOfClicks: number;
}
>;
}
|
DarshitChanpura/OpenSearch-Dashboards
|
packages/osd-analytics/src/report.ts
|
TypeScript
|
MethodDeclaration
|
static createReport(): Report {
return { reportVersion: REPORT_VERSION };
}
|
DarshitChanpura/OpenSearch-Dashboards
|
packages/osd-analytics/src/report.ts
|
TypeScript
|
MethodDeclaration
|
public clearReport() {
this.report = ReportManager.createReport();
}
|
DarshitChanpura/OpenSearch-Dashboards
|
packages/osd-analytics/src/report.ts
|
TypeScript
|
MethodDeclaration
|
public isReportEmpty(): boolean {
const { uiStatsMetrics, userAgent, application_usage: appUsage } = this.report;
const noUiStats = !uiStatsMetrics || Object.keys(uiStatsMetrics).length === 0;
const noUserAgent = !userAgent || Object.keys(userAgent).length === 0;
const noAppUsage = !appUsage || Object.keys(appUsage).length === 0;
return noUiStats && noUserAgent && noAppUsage;
}
|
DarshitChanpura/OpenSearch-Dashboards
|
packages/osd-analytics/src/report.ts
|
TypeScript
|
MethodDeclaration
|
private incrementStats(count: number, stats?: Stats): Stats {
const { min = 0, max = 0, sum = 0 } = stats || {};
const newMin = Math.min(min, count);
const newMax = Math.max(max, count);
const newAvg = newMin + newMax / 2;
const newSum = sum + count;
return {
min: newMin,
max: newMax,
avg: newAvg,
sum: newSum,
};
}
|
DarshitChanpura/OpenSearch-Dashboards
|
packages/osd-analytics/src/report.ts
|
TypeScript
|
MethodDeclaration
|
assignReports(newMetrics: Metric | Metric[]) {
wrapArray(newMetrics).forEach((newMetric) => this.assignReport(this.report, newMetric));
return { report: this.report };
}
|
DarshitChanpura/OpenSearch-Dashboards
|
packages/osd-analytics/src/report.ts
|
TypeScript
|
MethodDeclaration
|
static createMetricKey(metric: Metric): string {
switch (metric.type) {
case METRIC_TYPE.USER_AGENT: {
const { appName, type } = metric;
return `${appName}-${type}`;
}
case METRIC_TYPE.CLICK:
case METRIC_TYPE.LOADED:
case METRIC_TYPE.COUNT: {
const { appName, eventName, type } = metric;
return `${appName}-${type}-${eventName}`;
}
case METRIC_TYPE.APPLICATION_USAGE:
return metric.appId;
default:
throw new UnreachableCaseError(metric);
}
}
|
DarshitChanpura/OpenSearch-Dashboards
|
packages/osd-analytics/src/report.ts
|
TypeScript
|
MethodDeclaration
|
private assignReport(report: Report, metric: Metric) {
const key = ReportManager.createMetricKey(metric);
switch (metric.type) {
case METRIC_TYPE.USER_AGENT: {
const { appName, type, userAgent } = metric;
if (userAgent) {
report.userAgent = {
[key]: {
key,
appName,
type,
userAgent: metric.userAgent,
},
};
}
return;
}
case METRIC_TYPE.CLICK:
case METRIC_TYPE.LOADED:
case METRIC_TYPE.COUNT: {
const { appName, type, eventName, count } = metric;
report.uiStatsMetrics = report.uiStatsMetrics || {};
const existingStats = (report.uiStatsMetrics[key] || {}).stats;
report.uiStatsMetrics[key] = {
key,
appName,
eventName,
type,
stats: this.incrementStats(count, existingStats),
};
return;
}
case METRIC_TYPE.APPLICATION_USAGE:
const { numberOfClicks, startTime } = metric;
const minutesOnScreen = moment().diff(startTime, 'minutes', true);
report.application_usage = report.application_usage || {};
const appExistingData = report.application_usage[key] || {
minutesOnScreen: 0,
numberOfClicks: 0,
};
report.application_usage[key] = {
minutesOnScreen: appExistingData.minutesOnScreen + minutesOnScreen,
numberOfClicks: appExistingData.numberOfClicks + numberOfClicks,
};
break;
default:
throw new UnreachableCaseError(metric);
}
}
|
DarshitChanpura/OpenSearch-Dashboards
|
packages/osd-analytics/src/report.ts
|
TypeScript
|
InterfaceDeclaration
|
export interface ExampleInfo {
statements: string[],
logs: {
arg: string,
output: string
}[]
message: string
}
|
Devorein/exgen
|
packages/embedder/libs/types.ts
|
TypeScript
|
TypeAliasDeclaration
|
export type FunctionExampleRecord = Record<string, ExampleInfo[]>
|
Devorein/exgen
|
packages/embedder/libs/types.ts
|
TypeScript
|
ClassDeclaration
|
export declare class User extends BaseEntity {
id: number;
firstName: string;
lastName: string;
address: string;
email: string;
password: string;
certification: string;
}
|
ryzzaki/OxHack2019
|
dist/auth/entities/user.entity.d.ts
|
TypeScript
|
FunctionDeclaration
|
function onResult(args){
app.android.off(app.AndroidApplication.activityResultEvent, onResult);
t.handleResult(args.requestCode, args.resultCode, args.intent);
}
|
k4ng-fork/nativescript-mediafilepicker
|
src/mediafilepicker.android.ts
|
TypeScript
|
ArrowFunction
|
val => {
let newVal = val.replace(/^\s+/g, '');
t.output = newVal + "," + t.output;
}
|
k4ng-fork/nativescript-mediafilepicker
|
src/mediafilepicker.android.ts
|
TypeScript
|
ClassDeclaration
|
export class Mediafilepicker extends Common implements CommonFilePicker {
public output = "";
public startFilePicker(params: MediaFilepickerOptions) {
let activity = app.android.foregroundActivity || app.android.startActivity;
let t = this;
let builder = FilePickerBuilder.getInstance();
let options = params.android;
options.enableImagePicker ? builder.enableImagePicker(true) : builder.enableImagePicker(false);
options.enableVideoPicker ? builder.enableVideoPicker(true) : builder.enableVideoPicker(false);
options.enableDocSupport ? builder.enableDocSupport(true) : builder.enableDocSupport(false);
options.enableCameraSupport ? builder.enableCameraSupport(true) : builder.enableCameraSupport(false);
options.showGifs ? builder.showGifs(true) : builder.showGifs(false);
if (options.mxcount) {
builder.setMaxCount(options.mxcount);
}
if (options.setSelectedFiles) {
builder.setSelectedFiles(options.setSelectedFiles)
}
if (options.setActivityTheme) {
builder.setActivityTheme(options.setActivityTheme);
}
if (options.addFileSupport) {
builder.addFileSupport(options.addFileSupport.title, options.addFileSupport.type, options.addFileSupport.icon);
}
permissions.requestPermission([android.Manifest.permission.CAMERA, android.Manifest.permission.WRITE_EXTERNAL_STORAGE], "Need these permissions to access files")
.then(function () {
if (options.pickFile) {
builder.pickFile(activity);
} else {
builder.pickPhoto(activity);
}
})
.catch(function () {
alert("Need permission to access files!");
t.notify({
eventName: "error",
object: t,
data: "Need permission to access files!"
})
});
app.android.on(app.AndroidApplication.activityResultEvent, onResult);
function onResult(args){
app.android.off(app.AndroidApplication.activityResultEvent, onResult);
t.handleResult(args.requestCode, args.resultCode, args.intent);
}
}
/**
* handleResult
*/
public handleResult(requestCode, resultCode, data) {
let t = this;
let androidAcivity = android.app.Activity;
switch (requestCode) {
case FilePickerConst.REQUEST_CODE_PHOTO:
if (resultCode == androidAcivity.RESULT_OK && data != null) {
let photoPaths = data.getStringArrayListExtra(FilePickerConst.KEY_SELECTED_MEDIA);
photoPaths = photoPaths.toString();
photoPaths = photoPaths.replace(/[\[\]']+/g, "");
photoPaths = photoPaths.split(",");
photoPaths.forEach(val => {
let newVal = val.replace(/^\s+/g, '');
t.output = newVal + "," + t.output;
});
t.notify({
eventName: "getFiles",
object: t,
files: t.output.replace(/\,+$/, "")
})
}
break;
case FilePickerConst.REQUEST_CODE_DOC:
if (resultCode == androidAcivity.RESULT_OK && data != null) {
let docPaths = data.getStringArrayListExtra(FilePickerConst.KEY_SELECTED_DOCS);
docPaths = docPaths.toString();
docPaths = docPaths.replace(/[\[\]']+/g, "");
docPaths = docPaths.split(",");
docPaths.forEach(val => {
let newVal = val.replace(/^\s+/g, '');
t.output = newVal + "," + t.output;
});
t.notify({
eventName: "getFiles",
object: t,
files: t.output.replace(/\,+$/, "")
})
}
break;
}
}
}
|
k4ng-fork/nativescript-mediafilepicker
|
src/mediafilepicker.android.ts
|
TypeScript
|
MethodDeclaration
|
public startFilePicker(params: MediaFilepickerOptions) {
let activity = app.android.foregroundActivity || app.android.startActivity;
let t = this;
let builder = FilePickerBuilder.getInstance();
let options = params.android;
options.enableImagePicker ? builder.enableImagePicker(true) : builder.enableImagePicker(false);
options.enableVideoPicker ? builder.enableVideoPicker(true) : builder.enableVideoPicker(false);
options.enableDocSupport ? builder.enableDocSupport(true) : builder.enableDocSupport(false);
options.enableCameraSupport ? builder.enableCameraSupport(true) : builder.enableCameraSupport(false);
options.showGifs ? builder.showGifs(true) : builder.showGifs(false);
if (options.mxcount) {
builder.setMaxCount(options.mxcount);
}
if (options.setSelectedFiles) {
builder.setSelectedFiles(options.setSelectedFiles)
}
if (options.setActivityTheme) {
builder.setActivityTheme(options.setActivityTheme);
}
if (options.addFileSupport) {
builder.addFileSupport(options.addFileSupport.title, options.addFileSupport.type, options.addFileSupport.icon);
}
permissions.requestPermission([android.Manifest.permission.CAMERA, android.Manifest.permission.WRITE_EXTERNAL_STORAGE], "Need these permissions to access files")
.then(function () {
if (options.pickFile) {
builder.pickFile(activity);
} else {
builder.pickPhoto(activity);
}
})
.catch(function () {
alert("Need permission to access files!");
t.notify({
eventName: "error",
object: t,
data: "Need permission to access files!"
})
});
app.android.on(app.AndroidApplication.activityResultEvent, onResult);
function onResult(args){
app.android.off(app.AndroidApplication.activityResultEvent, onResult);
t.handleResult(args.requestCode, args.resultCode, args.intent);
}
}
|
k4ng-fork/nativescript-mediafilepicker
|
src/mediafilepicker.android.ts
|
TypeScript
|
MethodDeclaration
|
/**
* handleResult
*/
public handleResult(requestCode, resultCode, data) {
let t = this;
let androidAcivity = android.app.Activity;
switch (requestCode) {
case FilePickerConst.REQUEST_CODE_PHOTO:
if (resultCode == androidAcivity.RESULT_OK && data != null) {
let photoPaths = data.getStringArrayListExtra(FilePickerConst.KEY_SELECTED_MEDIA);
photoPaths = photoPaths.toString();
photoPaths = photoPaths.replace(/[\[\]']+/g, "");
photoPaths = photoPaths.split(",");
photoPaths.forEach(val => {
let newVal = val.replace(/^\s+/g, '');
t.output = newVal + "," + t.output;
});
t.notify({
eventName: "getFiles",
object: t,
files: t.output.replace(/\,+$/, "")
})
}
break;
case FilePickerConst.REQUEST_CODE_DOC:
if (resultCode == androidAcivity.RESULT_OK && data != null) {
let docPaths = data.getStringArrayListExtra(FilePickerConst.KEY_SELECTED_DOCS);
docPaths = docPaths.toString();
docPaths = docPaths.replace(/[\[\]']+/g, "");
docPaths = docPaths.split(",");
docPaths.forEach(val => {
let newVal = val.replace(/^\s+/g, '');
t.output = newVal + "," + t.output;
});
t.notify({
eventName: "getFiles",
object: t,
files: t.output.replace(/\,+$/, "")
})
}
break;
}
}
|
k4ng-fork/nativescript-mediafilepicker
|
src/mediafilepicker.android.ts
|
TypeScript
|
FunctionDeclaration
|
function replaceFile(filePath: string, replaceKeyValues: Array<ReplaceOccurence>, done: Function) {
let stream = new Readable();
let dotIndex = filePath.lastIndexOf('.');
let newFilePath = filePath.substr(0, dotIndex) + '-replaced-' + filePath.substr(dotIndex);
let slashIndex = filePath.lastIndexOf('/');
newFilePath = './' + filePath.substr(0, slashIndex);
return gulp.src([filePath])
.pipe(through.obj((chunk, enc, cb) => {
let txt = chunk.contents.toString();
let lines = txt.split('\n');
for (let line of lines) {
for (let occurence of replaceKeyValues) {
line = line.replace(occurence.key, occurence.value);
}
stream.push(line);
stream.push('\n');
}
stream.push(null);
chunk.contents = stream;
cb(null, chunk);
})).pipe(gulp.dest(newFilePath)).on('end', () => done());
}
|
Tamu/ifcopenshellbuilds
|
aurelia_project/tasks/replace.ts
|
TypeScript
|
FunctionDeclaration
|
function replaceAll(settings) {
let tasks = [];
for (let filePath in settings) {
gulp.task(filePath, (done) => {
replaceFile(filePath, settings[filePath], done);
});
tasks.push(filePath);
}
return tasks;
}
|
Tamu/ifcopenshellbuilds
|
aurelia_project/tasks/replace.ts
|
TypeScript
|
ArrowFunction
|
(chunk, enc, cb) => {
let txt = chunk.contents.toString();
let lines = txt.split('\n');
for (let line of lines) {
for (let occurence of replaceKeyValues) {
line = line.replace(occurence.key, occurence.value);
}
stream.push(line);
stream.push('\n');
}
stream.push(null);
chunk.contents = stream;
cb(null, chunk);
}
|
Tamu/ifcopenshellbuilds
|
aurelia_project/tasks/replace.ts
|
TypeScript
|
ArrowFunction
|
(done) => {
replaceFile(filePath, settings[filePath], done);
}
|
Tamu/ifcopenshellbuilds
|
aurelia_project/tasks/replace.ts
|
TypeScript
|
InterfaceDeclaration
|
export interface StringTMap<T> { [key: string]: T; }
|
Tamu/ifcopenshellbuilds
|
aurelia_project/tasks/replace.ts
|
TypeScript
|
InterfaceDeclaration
|
export interface NumberTMap<T> { [key: number]: T; }
|
Tamu/ifcopenshellbuilds
|
aurelia_project/tasks/replace.ts
|
TypeScript
|
InterfaceDeclaration
|
export interface StringAnyMap extends StringTMap<any> {}
|
Tamu/ifcopenshellbuilds
|
aurelia_project/tasks/replace.ts
|
TypeScript
|
InterfaceDeclaration
|
export interface NumberAnyMap extends NumberTMap<any> {}
|
Tamu/ifcopenshellbuilds
|
aurelia_project/tasks/replace.ts
|
TypeScript
|
InterfaceDeclaration
|
export interface StringStringMap extends StringTMap<string> {}
|
Tamu/ifcopenshellbuilds
|
aurelia_project/tasks/replace.ts
|
TypeScript
|
InterfaceDeclaration
|
export interface NumberStringMap extends NumberTMap<string> {}
|
Tamu/ifcopenshellbuilds
|
aurelia_project/tasks/replace.ts
|
TypeScript
|
InterfaceDeclaration
|
export interface StringNumberMap extends StringTMap<number> {}
|
Tamu/ifcopenshellbuilds
|
aurelia_project/tasks/replace.ts
|
TypeScript
|
InterfaceDeclaration
|
export interface NumberNumberMap extends NumberTMap<number> {}
|
Tamu/ifcopenshellbuilds
|
aurelia_project/tasks/replace.ts
|
TypeScript
|
InterfaceDeclaration
|
export interface StringBooleanMap extends StringTMap<boolean> {}
|
Tamu/ifcopenshellbuilds
|
aurelia_project/tasks/replace.ts
|
TypeScript
|
InterfaceDeclaration
|
export interface NumberBooleanMap extends NumberTMap<boolean> {}
|
Tamu/ifcopenshellbuilds
|
aurelia_project/tasks/replace.ts
|
TypeScript
|
InterfaceDeclaration
|
export interface ReplaceOccurence {
key: string;
value: string;
}
|
Tamu/ifcopenshellbuilds
|
aurelia_project/tasks/replace.ts
|
TypeScript
|
ArrowFunction
|
(event:any):void =>
{
let textEntered = event.target.value as string;
this.setState({
textContent : textEntered
});
}
|
WeaveTeam/WeaveJS
|
WeaveTSJS/src/weavejs/ui/EditableTextCell.tsx
|
TypeScript
|
ArrowFunction
|
():void =>
{
this.setState({
editMode : true
});
}
|
WeaveTeam/WeaveJS
|
WeaveTSJS/src/weavejs/ui/EditableTextCell.tsx
|
TypeScript
|
ArrowFunction
|
(event:MouseEvent):void =>
{
//check if the click target is not within the element and the editable mode is on
if (!this.element.contains(event.target as HTMLElement) && this.state.editMode)
{
this.setDisabledState();
}
}
|
WeaveTeam/WeaveJS
|
WeaveTSJS/src/weavejs/ui/EditableTextCell.tsx
|
TypeScript
|
ArrowFunction
|
():void => {
this.setState({
editMode :false
});
this.props.onChange && this.props.onChange(this.state.textContent);//onChange called once element is no longer in focus
}
|
WeaveTeam/WeaveJS
|
WeaveTSJS/src/weavejs/ui/EditableTextCell.tsx
|
TypeScript
|
ArrowFunction
|
(event:any) => {
if(event.key == 'Enter'){
this.setDisabledState();
}
}
|
WeaveTeam/WeaveJS
|
WeaveTSJS/src/weavejs/ui/EditableTextCell.tsx
|
TypeScript
|
ClassDeclaration
|
export class EditableTextCell extends SmartComponent<IEditableTextCellProps, IEditableTextCellState>
{
constructor(props:IEditableTextCellProps)
{
super(props);
this.state = {
editMode: false,
textContent: props.textContent
}
}
static defaultProps:IEditableTextCellProps = {
emptyText: 'Double click to edit and rename'
};
componentWillReceiveProps(nextProps:IEditableTextCellProps)
{
if (nextProps.textContent != this.props.textContent)
{
this.setState({
textContent : nextProps.textContent
});
}
}
private element:HTMLElement;
handleEditableContent =(event:any):void =>
{
let textEntered = event.target.value as string;
this.setState({
textContent : textEntered
});
};
enableEditMode =():void =>
{
this.setState({
editMode : true
});
};
disableEditMode =(event:MouseEvent):void =>
{
//check if the click target is not within the element and the editable mode is on
if (!this.element.contains(event.target as HTMLElement) && this.state.editMode)
{
this.setDisabledState();
}
};
setDisabledState=():void => {
this.setState({
editMode :false
});
this.props.onChange && this.props.onChange(this.state.textContent);//onChange called once element is no longer in focus
};
handleKeyPress = (event:any) => {
if(event.key == 'Enter'){
this.setDisabledState();
}
};
componentDidMount()
{
this.element = ReactDOM.findDOMNode(this) as HTMLElement;//done so that findDomNode needs to be invoked only once
document.addEventListener('mousedown', this.disableEditMode);
}
componentWillUnmount()
{
document.removeEventListener('mousedown', this.disableEditMode);
}
//TODO fix styles
render():JSX.Element
{
return(
<VBox style={this.props.style} onDoubleClick={ this.enableEditMode }>
{ (this.state.editMode) ?
<Input value={ this.state.textContent } onChange={ this.handleEditableContent } onKeyPress={this.handleKeyPress}/>
:
<div className="weave-input-div">
{ this.state.textContent ? this.state.textContent : this.props.emptyText}
</div>
}
|
WeaveTeam/WeaveJS
|
WeaveTSJS/src/weavejs/ui/EditableTextCell.tsx
|
TypeScript
|
InterfaceDeclaration
|
export interface IEditableTextCellProps extends React.Props<EditableTextCell>//not extending react.HTML properties because onChange have different signatures
{
textContent?:string
onChange?:(newName:string)=> void
style?:React.CSSProperties
emptyText?:string
}
|
WeaveTeam/WeaveJS
|
WeaveTSJS/src/weavejs/ui/EditableTextCell.tsx
|
TypeScript
|
InterfaceDeclaration
|
export interface IEditableTextCellState
{
editMode?:Boolean
textContent?:string
}
|
WeaveTeam/WeaveJS
|
WeaveTSJS/src/weavejs/ui/EditableTextCell.tsx
|
TypeScript
|
MethodDeclaration
|
componentWillReceiveProps(nextProps:IEditableTextCellProps)
{
if (nextProps.textContent != this.props.textContent)
{
this.setState({
textContent : nextProps.textContent
});
}
}
|
WeaveTeam/WeaveJS
|
WeaveTSJS/src/weavejs/ui/EditableTextCell.tsx
|
TypeScript
|
MethodDeclaration
|
componentDidMount()
{
this.element = ReactDOM.findDOMNode(this) as HTMLElement;//done so that findDomNode needs to be invoked only once
document.addEventListener('mousedown', this.disableEditMode);
}
|
WeaveTeam/WeaveJS
|
WeaveTSJS/src/weavejs/ui/EditableTextCell.tsx
|
TypeScript
|
MethodDeclaration
|
componentWillUnmount()
{
document.removeEventListener('mousedown', this.disableEditMode);
}
|
WeaveTeam/WeaveJS
|
WeaveTSJS/src/weavejs/ui/EditableTextCell.tsx
|
TypeScript
|
MethodDeclaration
|
//TODO fix styles
render():JSX.Element
{
return(
<VBox style={this.props.style} onDoubleClick={ this.enableEditMode }>
{ (this.state.editMode) ?
<Input value={ this.state.textContent } onChange={ this.handleEditableContent } onKeyPress={this.handleKeyPress}/>
:
<div className="weave-input-div">
{ this.state.textContent ? this.state.textContent : this.props.emptyText}
</div>
}
|
WeaveTeam/WeaveJS
|
WeaveTSJS/src/weavejs/ui/EditableTextCell.tsx
|
TypeScript
|
ArrowFunction
|
(props: FsmFileSelectProps) => {
const { files, handleSelect } = props;
const fileList = (
<SimpleList
onSelect={(_: any, listItemProps: any)
|
AryaArunB/ChRIS_ui
|
src/components/detailedView/displays/XtkViewer/PrimaryFileSelect.tsx
|
TypeScript
|
ArrowFunction
|
(file) => {
const id = file.file?.data.id;
return (
<SimpleListItem key={id} x-file={file}>
{file.title}
</SimpleListItem>
|
AryaArunB/ChRIS_ui
|
src/components/detailedView/displays/XtkViewer/PrimaryFileSelect.tsx
|
TypeScript
|
InterfaceDeclaration
|
interface FsmFileSelectProps {
files: DataNode[];
handleSelect: (file: DataNode) => void;
}
|
AryaArunB/ChRIS_ui
|
src/components/detailedView/displays/XtkViewer/PrimaryFileSelect.tsx
|
TypeScript
|
ClassDeclaration
|
export class Session {
User: any;
}
|
climbing-org/admin-climbing
|
src/app/shared/classes/error/session.ts
|
TypeScript
|
ArrowFunction
|
() => (
<PageSection>
<Title headingLevel="h1"
|
amadhusu/shareNwork-ui
|
src/app/modules/ResourceManagement/ResourceManagement.tsx
|
TypeScript
|
ArrowFunction
|
(component: React.ReactElement) => (
<ThemeProvider theme={theme}>{component} </ThemeProvider>
|
joao-ed/skald-record-shop
|
src/hocs/with-theme-provider/with-theme-provider.tsx
|
TypeScript
|
ArrowFunction
|
async (): Promise<void> => {
const docker = new Docker();
const container = await docker.getContainer(CONTAINER_NAME);
await container.stop();
await container.remove({ v: true });
}
|
Quantum-One-DLT/bcc-rosetta
|
bcc-rosetta-server/test/e2e/jest-setup/docker.ts
|
TypeScript
|
ArrowFunction
|
async (databaseConfig: DatabaseConfig, user: string, container: Docker.Container) => {
const database = databaseConfig.database;
await containerExec(container, ['bash', '-c', `psql -U ${user} -c "CREATE DATABASE ${database}"`]);
if (databaseConfig.snapshot) {
await container.putArchive(path.join(__dirname, `${database}-db-snapshot.tar`), {
path: CONTAINER_TEMP_DIR,
User: 'root'
});
// Execute backup restore
await containerExec(container, [
'bash',
'-c',
`cat ${CONTAINER_TEMP_DIR}/${database}.bak | psql -U ${user} ${database}`
]);
}
if (databaseConfig.fixture) {
await container.putArchive(path.join(__dirname, `${database}-fixture-data.tar`), {
path: CONTAINER_TEMP_DIR,
User: 'root'
});
await containerExec(container, [
'bash',
'-c',
`cat ${CONTAINER_TEMP_DIR}/${database}-fixture-data.sql | psql -U ${user} ${database}`
]);
}
}
|
Quantum-One-DLT/bcc-rosetta
|
bcc-rosetta-server/test/e2e/jest-setup/docker.ts
|
TypeScript
|
ArrowFunction
|
async (user: string, password: string, port: string): Promise<void> => {
const docker = new Docker();
const needsToPull = !(await imageExists(docker, CONTAINER_IMAGE));
if (needsToPull) await pullImageAsync(docker, CONTAINER_IMAGE);
const container = await docker.createContainer({
Image: CONTAINER_IMAGE,
Env: [`POSTGRES_PASSWORD=${password}`, `POSTGRES_USER=${user}`],
HostConfig: {
PortBindings: {
'5432/tcp': [
{
HostPort: port
}
]
}
},
name: CONTAINER_NAME
});
await container.start();
// Wait for the db service to be running (container started event is not enough)
await containerExec(container, [
'bash',
'-c',
`until psql -U ${user} -c "select 1" > /dev/null 2>&1 ; do sleep 1; done`
]);
const databaseConfigs = [
{
snapshot: true,
fixture: true,
database: 'mainnet'
}
];
for (const databaseConfig of databaseConfigs) {
await setupDBData(databaseConfig, user, container);
}
}
|
Quantum-One-DLT/bcc-rosetta
|
bcc-rosetta-server/test/e2e/jest-setup/docker.ts
|
TypeScript
|
InterfaceDeclaration
|
interface DatabaseConfig {
database: string;
snapshot: boolean;
fixture: boolean;
}
|
Quantum-One-DLT/bcc-rosetta
|
bcc-rosetta-server/test/e2e/jest-setup/docker.ts
|
TypeScript
|
ArrowFunction
|
async (
/* eslint-disable @typescript-eslint/no-unused-vars */
requestCredentials: IRequestCredentials,
requestInfo: RequestInfo,
requestInit: RequestInit
/* eslint-enable @typescript-eslint/no-unused-vars */
) => true as boolean
|
travis/solid-client-authn-js
|
src/authenticatedFetch/__mocks__/AuthenticatedFetcher.ts
|
TypeScript
|
ArrowFunction
|
async (
/* eslint-disable @typescript-eslint/no-unused-vars */
requestCredentials: IRequestCredentials,
requestInfo: RequestInfo,
requestInit: RequestInit
/* eslint-enable @typescript-eslint/no-unused-vars */
) => AuthenticatedFetcherResponse
|
travis/solid-client-authn-js
|
src/authenticatedFetch/__mocks__/AuthenticatedFetcher.ts
|
TypeScript
|
FunctionDeclaration
|
export async function cancelJob(providers: ProviderCollection, workerRequest: WorkerRequest, context: { requestId: string, dataController: DataController }) {
const jobId = workerRequest.input.jobId;
const logger = workerRequest.logger;
const resourceManager = providers.resourceManagerProvider.get();
const dataController = context.dataController;
const mutex = await dataController.createMutex(jobId, context.requestId);
let job: Job;
await mutex.lock();
try {
job = await dataController.getJob(jobId);
if (!job) {
throw new McmaException(`Job with id '${jobId}' not found`);
}
job = await cancelExecution(job, dataController, resourceManager, providers.authProvider, logger);
} finally {
await mutex.unlock();
}
await resourceManager.sendNotification(job);
}
|
ebu/mcma-projects
|
simple-azure/services/job-processor/worker/src/operations/cancel-job.ts
|
TypeScript
|
FunctionDeclaration
|
export async function cancelExecution(job: Job, dataController: DataController, resourceManager: ResourceManager, authProvider: AuthProvider, logger: Logger): Promise<Job> {
if (job.status === JobStatus.Completed || job.status === JobStatus.Failed || job.status === JobStatus.Canceled) {
return job;
}
const [jobExecution] = (await dataController.getExecutions(job.id)).results;
if (jobExecution) {
if (jobExecution.jobAssignmentId) {
try {
const client = await resourceManager.getResourceEndpointClient(jobExecution.jobAssignmentId);
await client.post(undefined, `${jobExecution.jobAssignmentId}/cancel`);
} catch (error) {
logger.warn(`Canceling job assignment '${jobExecution.jobAssignmentId} failed`);
logger.warn(error?.toString());
}
}
jobExecution.status = JobStatus.Canceled;
await dataController.updateExecution(jobExecution);
}
job.status = JobStatus.Canceled;
await dataController.updateJob(job);
await logJobEvent(logger, resourceManager, job, jobExecution);
return job;
}
|
ebu/mcma-projects
|
simple-azure/services/job-processor/worker/src/operations/cancel-job.ts
|
TypeScript
|
ArrowFunction
|
(props: Props): JSX.Element => {
return <PageWrapper>User Guide</PageWrapper>;
}
|
RealDyllon/hexapod-app
|
src/renderer/pages/UserGuide/UserGuide.tsx
|
TypeScript
|
InterfaceDeclaration
|
// eslint-disable-next-line @typescript-eslint/no-empty-interface
interface Props {}
|
RealDyllon/hexapod-app
|
src/renderer/pages/UserGuide/UserGuide.tsx
|
TypeScript
|
ClassDeclaration
|
@Component({
/**
* The selector is what angular internally uses
* for `document.querySelectorAll(selector)` in our index.html
* where, in this case, selector is the string 'home'.
*/
selector: 'titlebar', // <titlebar></titlebar>
/**
* We need to tell Angular's Dependency Injection which providers are in our app.
*/
providers: [ ],
/**
* Our list of styles in our component. We may add more to compose many styles together.
*/
styleUrls: [ './titlebar.component.css' ],
/**
* Every Angular template is first compiled by the browser before Angular runs it's compiler.
*/
templateUrl: './titlebar.component.html'
})
export class TitleBarComponent implements OnInit {
/**
* Set our default values
*/
public localState = { value: '' };
/**
* TypeScript public modifiers
*/
constructor(
public appState: AppState
) {}
public ngOnInit() {
console.log('Hello from the `TitleBar` component');
/**
* this.title.getData().subscribe(data => this.data = data);
*/
}
}
|
colinfagence/SimpleWebStore
|
ProductsUI/src/app/components/titlebar/titlebar.component.ts
|
TypeScript
|
MethodDeclaration
|
public ngOnInit() {
console.log('Hello from the `TitleBar` component');
/**
* this.title.getData().subscribe(data => this.data = data);
*/
}
|
colinfagence/SimpleWebStore
|
ProductsUI/src/app/components/titlebar/titlebar.component.ts
|
TypeScript
|
ClassDeclaration
|
@Component({
selector: 'app-comp-659',
templateUrl: './comp-659.component.html',
styleUrls: ['./comp-659.component.css']
})
export class Comp659Component implements OnInit {
constructor(private _service: Service659Service) { }
ngOnInit() {
}
}
|
angular/angular-cli-stress-test
|
src/app/components/comp-659/comp-659.component.ts
|
TypeScript
|
ArrowFunction
|
(extensions) => {
extensions.forEach(extension => {
extension.value.forEach(rawAdapter => {
const adapter = new Adapter(rawAdapter, this.systemVariables, extension.description);
const duplicate = this.adapters.filter(a => a.type === adapter.type)[0];
if (!rawAdapter.type || (typeof rawAdapter.type !== 'string')) {
extension.collector.error(nls.localize('debugNoType', "Debug adapter 'type' can not be omitted and must be of type 'string'."));
}
if (duplicate) {
Object.keys(adapter).forEach(attribute => {
if (adapter[attribute]) {
if (attribute === 'enableBreakpointsFor') {
Object.keys(adapter.enableBreakpointsFor).forEach(languageId => duplicate.enableBreakpointsFor[languageId] = true);
} else if (duplicate[attribute] && attribute !== 'type' && attribute !== 'extensionDescription') {
// give priority to the later registered extension.
duplicate[attribute] = adapter[attribute];
extension.collector.error(nls.localize('duplicateDebuggerType', "Debug type '{0}' is already registered and has attribute '{1}', ignoring attribute '{1}'.", adapter.type, attribute));
} else {
duplicate[attribute] = adapter[attribute];
}
}
});
} else {
this.adapters.push(adapter);
}
if (adapter.enableBreakpointsFor) {
adapter.enableBreakpointsFor.languageIds.forEach(modeId => {
this.allModeIdsForBreakpoints[modeId] = true;
});
}
});
});
// update the schema to include all attributes and types from extensions.
// debug.schema.properties['configurations'].items.properties.type.enum = this.adapters.map(adapter => adapter.type);
this.adapters.forEach(adapter => {
const schemaAttributes = adapter.getSchemaAttributes();
if (schemaAttributes) {
(<IJSONSchema> schema.properties['configurations'].items).oneOf.push(...schemaAttributes);
}
});
}
|
blackViking007/redesigned-VSCode
|
src/vs/workbench/parts/debug/node/debugConfigurationManager.ts
|
TypeScript
|
ArrowFunction
|
extension => {
extension.value.forEach(rawAdapter => {
const adapter = new Adapter(rawAdapter, this.systemVariables, extension.description);
const duplicate = this.adapters.filter(a => a.type === adapter.type)[0];
if (!rawAdapter.type || (typeof rawAdapter.type !== 'string')) {
extension.collector.error(nls.localize('debugNoType', "Debug adapter 'type' can not be omitted and must be of type 'string'."));
}
if (duplicate) {
Object.keys(adapter).forEach(attribute => {
if (adapter[attribute]) {
if (attribute === 'enableBreakpointsFor') {
Object.keys(adapter.enableBreakpointsFor).forEach(languageId => duplicate.enableBreakpointsFor[languageId] = true);
} else if (duplicate[attribute] && attribute !== 'type' && attribute !== 'extensionDescription') {
// give priority to the later registered extension.
duplicate[attribute] = adapter[attribute];
extension.collector.error(nls.localize('duplicateDebuggerType', "Debug type '{0}' is already registered and has attribute '{1}', ignoring attribute '{1}'.", adapter.type, attribute));
} else {
duplicate[attribute] = adapter[attribute];
}
}
});
} else {
this.adapters.push(adapter);
}
if (adapter.enableBreakpointsFor) {
adapter.enableBreakpointsFor.languageIds.forEach(modeId => {
this.allModeIdsForBreakpoints[modeId] = true;
});
}
});
}
|
blackViking007/redesigned-VSCode
|
src/vs/workbench/parts/debug/node/debugConfigurationManager.ts
|
TypeScript
|
ArrowFunction
|
rawAdapter => {
const adapter = new Adapter(rawAdapter, this.systemVariables, extension.description);
const duplicate = this.adapters.filter(a => a.type === adapter.type)[0];
if (!rawAdapter.type || (typeof rawAdapter.type !== 'string')) {
extension.collector.error(nls.localize('debugNoType', "Debug adapter 'type' can not be omitted and must be of type 'string'."));
}
if (duplicate) {
Object.keys(adapter).forEach(attribute => {
if (adapter[attribute]) {
if (attribute === 'enableBreakpointsFor') {
Object.keys(adapter.enableBreakpointsFor).forEach(languageId => duplicate.enableBreakpointsFor[languageId] = true);
} else if (duplicate[attribute] && attribute !== 'type' && attribute !== 'extensionDescription') {
// give priority to the later registered extension.
duplicate[attribute] = adapter[attribute];
extension.collector.error(nls.localize('duplicateDebuggerType', "Debug type '{0}' is already registered and has attribute '{1}', ignoring attribute '{1}'.", adapter.type, attribute));
} else {
duplicate[attribute] = adapter[attribute];
}
}
});
} else {
this.adapters.push(adapter);
}
if (adapter.enableBreakpointsFor) {
adapter.enableBreakpointsFor.languageIds.forEach(modeId => {
this.allModeIdsForBreakpoints[modeId] = true;
});
}
}
|
blackViking007/redesigned-VSCode
|
src/vs/workbench/parts/debug/node/debugConfigurationManager.ts
|
TypeScript
|
ArrowFunction
|
a => a.type === adapter.type
|
blackViking007/redesigned-VSCode
|
src/vs/workbench/parts/debug/node/debugConfigurationManager.ts
|
TypeScript
|
ArrowFunction
|
attribute => {
if (adapter[attribute]) {
if (attribute === 'enableBreakpointsFor') {
Object.keys(adapter.enableBreakpointsFor).forEach(languageId => duplicate.enableBreakpointsFor[languageId] = true);
} else if (duplicate[attribute] && attribute !== 'type' && attribute !== 'extensionDescription') {
// give priority to the later registered extension.
duplicate[attribute] = adapter[attribute];
extension.collector.error(nls.localize('duplicateDebuggerType', "Debug type '{0}' is already registered and has attribute '{1}', ignoring attribute '{1}'.", adapter.type, attribute));
} else {
duplicate[attribute] = adapter[attribute];
}
}
}
|
blackViking007/redesigned-VSCode
|
src/vs/workbench/parts/debug/node/debugConfigurationManager.ts
|
TypeScript
|
ArrowFunction
|
languageId => duplicate.enableBreakpointsFor[languageId] = true
|
blackViking007/redesigned-VSCode
|
src/vs/workbench/parts/debug/node/debugConfigurationManager.ts
|
TypeScript
|
ArrowFunction
|
modeId => {
this.allModeIdsForBreakpoints[modeId] = true;
}
|
blackViking007/redesigned-VSCode
|
src/vs/workbench/parts/debug/node/debugConfigurationManager.ts
|
TypeScript
|
ArrowFunction
|
adapter => {
const schemaAttributes = adapter.getSchemaAttributes();
if (schemaAttributes) {
(<IJSONSchema> schema.properties['configurations'].items).oneOf.push(...schemaAttributes);
}
}
|
blackViking007/redesigned-VSCode
|
src/vs/workbench/parts/debug/node/debugConfigurationManager.ts
|
TypeScript
|
ArrowFunction
|
adapter => strings.equalsIgnoreCase(adapter.type, this.configuration.type)
|
blackViking007/redesigned-VSCode
|
src/vs/workbench/parts/debug/node/debugConfigurationManager.ts
|
TypeScript
|
ArrowFunction
|
(object: any) => {
Object.keys(object).forEach(key => {
if (object[key] && typeof object[key] === 'object') {
findInteractiveVariables(object[key]);
} else if (typeof object[key] === 'string') {
const matches = /\${command.(.+)}/.exec(object[key]);
if (matches && matches.length === 2) {
const interactiveVariable = matches[1];
if (!interactiveVariablesToKeys[interactiveVariable]) {
interactiveVariablesToKeys[interactiveVariable] = [];
}
interactiveVariablesToKeys[interactiveVariable].push(key);
}
}
});
}
|
blackViking007/redesigned-VSCode
|
src/vs/workbench/parts/debug/node/debugConfigurationManager.ts
|
TypeScript
|
ArrowFunction
|
key => {
if (object[key] && typeof object[key] === 'object') {
findInteractiveVariables(object[key]);
} else if (typeof object[key] === 'string') {
const matches = /\${command.(.+)}/.exec(object[key]);
if (matches && matches.length === 2) {
const interactiveVariable = matches[1];
if (!interactiveVariablesToKeys[interactiveVariable]) {
interactiveVariablesToKeys[interactiveVariable] = [];
}
interactiveVariablesToKeys[interactiveVariable].push(key);
}
}
}
|
blackViking007/redesigned-VSCode
|
src/vs/workbench/parts/debug/node/debugConfigurationManager.ts
|
TypeScript
|
ArrowFunction
|
interactiveVariable => {
return () => {
const commandId = this.adapter.variables ? this.adapter.variables[interactiveVariable] : null;
if (!commandId) {
return TPromise.wrapError(nls.localize('interactiveVariableNotFound', "Adapter {0} does not contribute variable {1} that is specified in launch configuration.", this.adapter.type, interactiveVariable));
} else {
return this.keybindingService.executeCommand<string>(commandId, this.configuration).then(result => {
if (!result) {
this.configuration.silentlyAbort = true;
}
interactiveVariablesToKeys[interactiveVariable].forEach(key => this.configuration[key] = this.configuration[key].replace(`\${command.${ interactiveVariable }}`, result));
});
}
};
}
|
blackViking007/redesigned-VSCode
|
src/vs/workbench/parts/debug/node/debugConfigurationManager.ts
|
TypeScript
|
ArrowFunction
|
() => {
const commandId = this.adapter.variables ? this.adapter.variables[interactiveVariable] : null;
if (!commandId) {
return TPromise.wrapError(nls.localize('interactiveVariableNotFound', "Adapter {0} does not contribute variable {1} that is specified in launch configuration.", this.adapter.type, interactiveVariable));
} else {
return this.keybindingService.executeCommand<string>(commandId, this.configuration).then(result => {
if (!result) {
this.configuration.silentlyAbort = true;
}
interactiveVariablesToKeys[interactiveVariable].forEach(key => this.configuration[key] = this.configuration[key].replace(`\${command.${ interactiveVariable }}`, result));
});
}
}
|
blackViking007/redesigned-VSCode
|
src/vs/workbench/parts/debug/node/debugConfigurationManager.ts
|
TypeScript
|
ArrowFunction
|
result => {
if (!result) {
this.configuration.silentlyAbort = true;
}
interactiveVariablesToKeys[interactiveVariable].forEach(key => this.configuration[key] = this.configuration[key].replace(`\${command.${ interactiveVariable }}`, result));
}
|
blackViking007/redesigned-VSCode
|
src/vs/workbench/parts/debug/node/debugConfigurationManager.ts
|
TypeScript
|
ArrowFunction
|
key => this.configuration[key] = this.configuration[key].replace(`\${command.${ interactiveVariable }}`, result)
|
blackViking007/redesigned-VSCode
|
src/vs/workbench/parts/debug/node/debugConfigurationManager.ts
|
TypeScript
|
ArrowFunction
|
() => this.configuration
|
blackViking007/redesigned-VSCode
|
src/vs/workbench/parts/debug/node/debugConfigurationManager.ts
|
TypeScript
|
ArrowFunction
|
config => {
if (types.isObject(nameOrConfig)) {
this.configuration = objects.deepClone(nameOrConfig) as debug.IConfig;
} else {
if (!config || !config.configurations) {
this.configuration = null;
return;
}
// if the configuration name is not set yet, take the first launch config (can happen if debug viewlet has not been opened yet).
const filtered = nameOrConfig ? config.configurations.filter(cfg => cfg.name === nameOrConfig) : [config.configurations[0]];
this.configuration = filtered.length === 1 ? objects.deepClone(filtered[0]) : null;
if (config && this.configuration) {
this.configuration.debugServer = config.debugServer;
}
}
if (this.configuration) {
// Set operating system specific properties #1873
if (isWindows && this.configuration.windows) {
Object.keys(this.configuration.windows).forEach(key => {
this.configuration[key] = this.configuration.windows[key];
});
}
if (isMacintosh && this.configuration.osx) {
Object.keys(this.configuration.osx).forEach(key => {
this.configuration[key] = this.configuration.osx[key];
});
}
if (isLinux && this.configuration.linux) {
Object.keys(this.configuration.linux).forEach(key => {
this.configuration[key] = this.configuration.linux[key];
});
}
// massage configuration attributes - append workspace path to relatvie paths, substitute variables in paths.
if (this.systemVariables) {
Object.keys(this.configuration).forEach(key => {
this.configuration[key] = this.systemVariables.resolveAny(this.configuration[key]);
});
}
}
}
|
blackViking007/redesigned-VSCode
|
src/vs/workbench/parts/debug/node/debugConfigurationManager.ts
|
TypeScript
|
ArrowFunction
|
cfg => cfg.name === nameOrConfig
|
blackViking007/redesigned-VSCode
|
src/vs/workbench/parts/debug/node/debugConfigurationManager.ts
|
TypeScript
|
ArrowFunction
|
key => {
this.configuration[key] = this.configuration.windows[key];
}
|
blackViking007/redesigned-VSCode
|
src/vs/workbench/parts/debug/node/debugConfigurationManager.ts
|
TypeScript
|
ArrowFunction
|
key => {
this.configuration[key] = this.configuration.osx[key];
}
|
blackViking007/redesigned-VSCode
|
src/vs/workbench/parts/debug/node/debugConfigurationManager.ts
|
TypeScript
|
ArrowFunction
|
key => {
this.configuration[key] = this.configuration.linux[key];
}
|
blackViking007/redesigned-VSCode
|
src/vs/workbench/parts/debug/node/debugConfigurationManager.ts
|
TypeScript
|
ArrowFunction
|
key => {
this.configuration[key] = this.systemVariables.resolveAny(this.configuration[key]);
}
|
blackViking007/redesigned-VSCode
|
src/vs/workbench/parts/debug/node/debugConfigurationManager.ts
|
TypeScript
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.