type
stringclasses 7
values | content
stringlengths 4
9.55k
| repo
stringlengths 7
96
| path
stringlengths 4
178
| language
stringclasses 1
value |
---|---|---|---|---|
InterfaceDeclaration | /**
* The set of arguments for constructing a TeamMembershipTeam resource.
*/
export interface TeamMembershipTeamArgs {
readonly role?: pulumi.Input<string>;
readonly teamId: pulumi.Input<string>;
readonly username: pulumi.Input<string>;
} | RichardWLaub/pulumi-github | sdk/nodejs/teamMembershipTeam.ts | TypeScript |
MethodDeclaration | /**
* Get an existing TeamMembershipTeam resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state Any extra arguments used during the lookup.
*/
public static get(name: string, id: pulumi.Input<pulumi.ID>, state?: TeamMembershipTeamState, opts?: pulumi.CustomResourceOptions): TeamMembershipTeam {
return new TeamMembershipTeam(name, <any>state, { ...opts, id: id });
} | RichardWLaub/pulumi-github | sdk/nodejs/teamMembershipTeam.ts | TypeScript |
FunctionDeclaration |
function AppRouter() {
return (
<Router>
<Route path="/" exact component={Inference} />
<Route path="/home" component={Home} />
</Router>
);
} | kennysama/react-hooks-boilerplate | front/src/app/AppRouter.tsx | TypeScript |
ArrowFunction |
(callback) => {
storedCallback = callback
} | AlphaWong/html5-media-converter | src/Html5MediaConverter.ts | TypeScript |
ArrowFunction |
(err, mimeType, stream) => {
presets.convertersFor(mimeType.type).forEach((converter) => {
stream.converter = converter;
stream.pipe(converter.toStream(size));
storedCallback.call(stream, stream);
})
} | AlphaWong/html5-media-converter | src/Html5MediaConverter.ts | TypeScript |
ArrowFunction |
(converter) => {
stream.converter = converter;
stream.pipe(converter.toStream(size));
storedCallback.call(stream, stream);
} | AlphaWong/html5-media-converter | src/Html5MediaConverter.ts | TypeScript |
ClassDeclaration |
export default class MediaConverter {
private videoConverter = new VideoConverter()
constructor(options = _options) {
this.videoConverter.setFfmpegPath(options.programs.ffmpeg)
}
public thumbs(size) {
let input = new Stream.PassThrough(),
storedCallback
input.forEach = (callback) => {
storedCallback = callback
}
magic(input, (err, mimeType, stream) => {
presets.convertersFor(mimeType.type).forEach((converter) => {
stream.converter = converter;
stream.pipe(converter.toStream(size));
storedCallback.call(stream, stream);
})
})
return input
}
public mp4Copy(){
return presets.converters.mp4_copy.toStream()
}
} | AlphaWong/html5-media-converter | src/Html5MediaConverter.ts | TypeScript |
MethodDeclaration |
public thumbs(size) {
let input = new Stream.PassThrough(),
storedCallback
input.forEach = (callback) => {
storedCallback = callback
}
magic(input, (err, mimeType, stream) => {
presets.convertersFor(mimeType.type).forEach((converter) => {
stream.converter = converter;
stream.pipe(converter.toStream(size));
storedCallback.call(stream, stream);
})
})
return input
} | AlphaWong/html5-media-converter | src/Html5MediaConverter.ts | TypeScript |
MethodDeclaration |
public mp4Copy(){
return presets.converters.mp4_copy.toStream()
} | AlphaWong/html5-media-converter | src/Html5MediaConverter.ts | TypeScript |
FunctionDeclaration |
function d(name: string, use: string, doc: string): vscode.CompletionItem {
const i = new vscode.CompletionItem(name, vscode.CompletionItemKind.Variable);
i.detail = use;
i.documentation = doc;
return i;
} | Azure/vscode-kubernetes-tools | src/helm.resources.ts | TypeScript |
FunctionDeclaration |
function val(name: string, use: string, doc: string): vscode.CompletionItem {
const i = new vscode.CompletionItem(name, vscode.CompletionItemKind.Value);
i.detail = use;
i.documentation = doc;
return i;
} | Azure/vscode-kubernetes-tools | src/helm.resources.ts | TypeScript |
ArrowFunction |
(item) => {
const itemPath = filepath.join(path, item);
const stat = fs.statSync(itemPath);
if (stat.isDirectory()) {
return;
}
const schema = JSON.parse(shell.cat(itemPath));
if (!schema.models) {
return;
}
console.log("Adding schema " + itemPath);
res = res.concat(this.fromSchema(schema.models));
} | Azure/vscode-kubernetes-tools | src/helm.resources.ts | TypeScript |
ArrowFunction |
(v, k) => {
const i = k.lastIndexOf(".");
const kind = k.substr(i+1);
res.push(val(kind, `kind: ${ kind }`, v.description));
_.each(v.properties, (spec, label) => {
let type = "undefined";
switch (spec.type) {
case undefined:
// This usually means there's a $ref instead of a type
if (spec["$ref"]) {
type = spec["$ref"];
}
break;
case "array":
// Try to give a pretty type.
if (spec.items.type) {
type = spec.items.type + "[]";
break;
} else if (spec.items["$ref"]) {
type = spec.items["$ref"] + "[]";
break;
}
type = "[]";
break;
default:
if (spec.type) {
type = spec.type;
}
break;
}
res.push(d(label, `${ label }: ${ type }`, spec.description));
});
} | Azure/vscode-kubernetes-tools | src/helm.resources.ts | TypeScript |
ArrowFunction |
(spec, label) => {
let type = "undefined";
switch (spec.type) {
case undefined:
// This usually means there's a $ref instead of a type
if (spec["$ref"]) {
type = spec["$ref"];
}
break;
case "array":
// Try to give a pretty type.
if (spec.items.type) {
type = spec.items.type + "[]";
break;
} else if (spec.items["$ref"]) {
type = spec.items["$ref"] + "[]";
break;
}
type = "[]";
break;
default:
if (spec.type) {
type = spec.type;
}
break;
}
res.push(d(label, `${ label }: ${ type }`, spec.description));
} | Azure/vscode-kubernetes-tools | src/helm.resources.ts | TypeScript |
ClassDeclaration | // Resources describes Kubernetes resource keywords.
export class Resources {
public all(): vscode.CompletionItem[] {
const home = shell.home();
const schemaDir = filepath.join(home, ".kube/schema");
if (!fs.existsSync(schemaDir)) {
// Return the default set.
return this.v1();
}
const stat = fs.statSync(schemaDir);
if (!stat.isDirectory()) {
// Return the default set.
return this.v1();
}
// Otherwise, try to dynamically build completion items from the
// entire schema.
const schemaDirContents = shell.ls(schemaDir);
if (schemaDirContents.length === 0) {
// Return the default set.
return this.v1();
}
const kversion = _.last(schemaDirContents)!;
console.log("Loading schema for version " + kversion);
// Inside of the schemaDir, there are some top-level copies of the schemata.
// Instead of walking the tree, we just parse those. Note that kubectl loads
// schemata on demand, which means we won't have an exhaustive list, but we are
// more likely to get the ones that this user is actually using, including
// TPRs.
let res = Array.of<vscode.CompletionItem>();
const path = filepath.join(schemaDir, kversion);
shell.ls(path).forEach((item) => {
const itemPath = filepath.join(path, item);
const stat = fs.statSync(itemPath);
if (stat.isDirectory()) {
return;
}
const schema = JSON.parse(shell.cat(itemPath));
if (!schema.models) {
return;
}
console.log("Adding schema " + itemPath);
res = res.concat(this.fromSchema(schema.models));
});
console.log(`Attached ${res.length} resource kinds`);
return res;
}
v1(): vscode.CompletionItem[] {
return this.fromSchema(v1.default.models);
}
// Extract hover documentation from a Swagger model.
fromSchema(schema: any): vscode.CompletionItem[] {
const res = Array.of<vscode.CompletionItem>();
_.each(schema, (v, k) => {
const i = k.lastIndexOf(".");
const kind = k.substr(i+1);
res.push(val(kind, `kind: ${ kind }`, v.description));
_.each(v.properties, (spec, label) => {
let type = "undefined";
switch (spec.type) {
case undefined:
// This usually means there's a $ref instead of a type
if (spec["$ref"]) {
type = spec["$ref"];
}
break;
case "array":
// Try to give a pretty type.
if (spec.items.type) {
type = spec.items.type + "[]";
break;
} else if (spec.items["$ref"]) {
type = spec.items["$ref"] + "[]";
break;
}
type = "[]";
break;
default:
if (spec.type) {
type = spec.type;
}
break;
}
res.push(d(label, `${ label }: ${ type }`, spec.description));
});
});
return res;
}
} | Azure/vscode-kubernetes-tools | src/helm.resources.ts | TypeScript |
MethodDeclaration |
public all(): vscode.CompletionItem[] {
const home = shell.home();
const schemaDir = filepath.join(home, ".kube/schema");
if (!fs.existsSync(schemaDir)) {
// Return the default set.
return this.v1();
}
const stat = fs.statSync(schemaDir);
if (!stat.isDirectory()) {
// Return the default set.
return this.v1();
}
// Otherwise, try to dynamically build completion items from the
// entire schema.
const schemaDirContents = shell.ls(schemaDir);
if (schemaDirContents.length === 0) {
// Return the default set.
return this.v1();
}
const kversion = _.last(schemaDirContents)!;
console.log("Loading schema for version " + kversion);
// Inside of the schemaDir, there are some top-level copies of the schemata.
// Instead of walking the tree, we just parse those. Note that kubectl loads
// schemata on demand, which means we won't have an exhaustive list, but we are
// more likely to get the ones that this user is actually using, including
// TPRs.
let res = Array.of<vscode.CompletionItem>();
const path = filepath.join(schemaDir, kversion);
shell.ls(path).forEach((item) => {
const itemPath = filepath.join(path, item);
const stat = fs.statSync(itemPath);
if (stat.isDirectory()) {
return;
}
const schema = JSON.parse(shell.cat(itemPath));
if (!schema.models) {
return;
}
console.log("Adding schema " + itemPath);
res = res.concat(this.fromSchema(schema.models));
});
console.log(`Attached ${res.length} resource kinds`);
return res;
} | Azure/vscode-kubernetes-tools | src/helm.resources.ts | TypeScript |
MethodDeclaration |
v1(): vscode.CompletionItem[] {
return this.fromSchema(v1.default.models);
} | Azure/vscode-kubernetes-tools | src/helm.resources.ts | TypeScript |
MethodDeclaration | // Extract hover documentation from a Swagger model.
fromSchema(schema: any): vscode.CompletionItem[] {
const res = Array.of<vscode.CompletionItem>();
_.each(schema, (v, k) => {
const i = k.lastIndexOf(".");
const kind = k.substr(i+1);
res.push(val(kind, `kind: ${ kind }`, v.description));
_.each(v.properties, (spec, label) => {
let type = "undefined";
switch (spec.type) {
case undefined:
// This usually means there's a $ref instead of a type
if (spec["$ref"]) {
type = spec["$ref"];
}
break;
case "array":
// Try to give a pretty type.
if (spec.items.type) {
type = spec.items.type + "[]";
break;
} else if (spec.items["$ref"]) {
type = spec.items["$ref"] + "[]";
break;
}
type = "[]";
break;
default:
if (spec.type) {
type = spec.type;
}
break;
}
res.push(d(label, `${ label }: ${ type }`, spec.description));
});
});
return res;
} | Azure/vscode-kubernetes-tools | src/helm.resources.ts | TypeScript |
ArrowFunction |
() => {
const mockClient = {
clearStaleState: jest.fn(),
};
return {
OidcClient: jest.fn().mockImplementation(() => {
return mockClient;
}),
WebStorageStateStore: jest.fn(),
};
} | CopChristophe/solid-client-authn-js | packages/oidc/src/cleanup/cleanup.spec.ts | TypeScript |
ArrowFunction |
() => {
return mockClient;
} | CopChristophe/solid-client-authn-js | packages/oidc/src/cleanup/cleanup.spec.ts | TypeScript |
ArrowFunction |
() => {
it("removes the 'code' query string if present", () => {
expect(removeOidcQueryParam("https://some.url/?code=aCode")).toEqual(
"https://some.url/"
);
});
it("removes the 'state' query string if present", () => {
expect(removeOidcQueryParam("https://some.url/?state=arkansas")).toEqual(
"https://some.url/"
);
});
it("removes the hash part of the IRI", () => {
expect(removeOidcQueryParam("https://some.url/#some-anchor")).toEqual(
"https://some.url/"
);
});
it("returns an URL without query strings as is", () => {
expect(removeOidcQueryParam("https://some.url/")).toEqual(
"https://some.url/"
);
});
it("preserves other query strings", () => {
expect(
removeOidcQueryParam(
"https://some.url/?code=someCode&state=someState&otherQuery=aValue"
)
).toEqual("https://some.url/?otherQuery=aValue");
});
} | CopChristophe/solid-client-authn-js | packages/oidc/src/cleanup/cleanup.spec.ts | TypeScript |
ArrowFunction |
() => {
expect(removeOidcQueryParam("https://some.url/?code=aCode")).toEqual(
"https://some.url/"
);
} | CopChristophe/solid-client-authn-js | packages/oidc/src/cleanup/cleanup.spec.ts | TypeScript |
ArrowFunction |
() => {
expect(removeOidcQueryParam("https://some.url/?state=arkansas")).toEqual(
"https://some.url/"
);
} | CopChristophe/solid-client-authn-js | packages/oidc/src/cleanup/cleanup.spec.ts | TypeScript |
ArrowFunction |
() => {
expect(removeOidcQueryParam("https://some.url/#some-anchor")).toEqual(
"https://some.url/"
);
} | CopChristophe/solid-client-authn-js | packages/oidc/src/cleanup/cleanup.spec.ts | TypeScript |
ArrowFunction |
() => {
expect(removeOidcQueryParam("https://some.url/")).toEqual(
"https://some.url/"
);
} | CopChristophe/solid-client-authn-js | packages/oidc/src/cleanup/cleanup.spec.ts | TypeScript |
ArrowFunction |
() => {
expect(
removeOidcQueryParam(
"https://some.url/?code=someCode&state=someState&otherQuery=aValue"
)
).toEqual("https://some.url/?otherQuery=aValue");
} | CopChristophe/solid-client-authn-js | packages/oidc/src/cleanup/cleanup.spec.ts | TypeScript |
ArrowFunction |
() => {
it("clears oidc-client storage", async () => {
// This is a bad test, but we can only test for internal behaviour of oidc-client,
// or test that the 'clearStaleState' function is called, which is done here.
const clearSpy = jest.spyOn(new OidcClient({}), "clearStaleState");
await clearOidcPersistentStorage();
expect(clearSpy).toHaveBeenCalled();
});
it("removes keys matching expected patterns as a stopgap solution", async () => {
window.localStorage.setItem("oidc.someOidcState", "a value");
window.localStorage.setItem(
"solidClientAuthenticationUser:someSessionId",
"a value"
);
window.localStorage.setItem("anArbitraryKey", "a value");
await clearOidcPersistentStorage();
expect(window.localStorage).toHaveLength(1);
});
it("doesn't fail if localstorage is empty", async () => {
window.localStorage.clear();
await clearOidcPersistentStorage();
expect(window.localStorage).toHaveLength(0);
});
} | CopChristophe/solid-client-authn-js | packages/oidc/src/cleanup/cleanup.spec.ts | TypeScript |
ArrowFunction |
async () => {
// This is a bad test, but we can only test for internal behaviour of oidc-client,
// or test that the 'clearStaleState' function is called, which is done here.
const clearSpy = jest.spyOn(new OidcClient({}), "clearStaleState");
await clearOidcPersistentStorage();
expect(clearSpy).toHaveBeenCalled();
} | CopChristophe/solid-client-authn-js | packages/oidc/src/cleanup/cleanup.spec.ts | TypeScript |
ArrowFunction |
async () => {
window.localStorage.setItem("oidc.someOidcState", "a value");
window.localStorage.setItem(
"solidClientAuthenticationUser:someSessionId",
"a value"
);
window.localStorage.setItem("anArbitraryKey", "a value");
await clearOidcPersistentStorage();
expect(window.localStorage).toHaveLength(1);
} | CopChristophe/solid-client-authn-js | packages/oidc/src/cleanup/cleanup.spec.ts | TypeScript |
ArrowFunction |
async () => {
window.localStorage.clear();
await clearOidcPersistentStorage();
expect(window.localStorage).toHaveLength(0);
} | CopChristophe/solid-client-authn-js | packages/oidc/src/cleanup/cleanup.spec.ts | TypeScript |
ClassDeclaration |
@Component({
selector: 'ab-checkbox',
host: { class: 'ab-checkbox' },
templateUrl: './checkbox.component.html'
})
export class CheckboxComponent {
@Input() public checked: boolean = false;
} | Brockhurst/connect | src/app/shared/components/checkbox/checkbox.component.ts | TypeScript |
InterfaceDeclaration | /**
* Test the generic Filter using collection.find<T>() method
*/
// a collection model for all possible MongoDB BSON types and TypeScript types
interface PetModel {
_id: ObjectId; // ObjectId field
name?: string; // optional field
family: string; // string field
age: number; // number field
type: 'dog' | 'cat' | 'fish'; // union field
isCute: boolean; // boolean field
bestFriend?: PetModel; // object field (Embedded/Nested Documents)
createdAt: Date; // date field
treats: string[]; // array of string
playTimePercent: Decimal128; // bson Decimal128 type
readonly friends?: ReadonlyArray<PetModel>; // readonly array of objects
playmates?: PetModel[]; // writable array of objects
} | LaudateCorpus1/node-mongodb-native | test/types/community/collection/filterQuery.test-d.ts | TypeScript |
ArrowFunction |
() => {
/* Check day popup disclaimer */
let showPopupDisclaimer = false;
if (localStorage.getItem('lastShownPopupDisclaimer')) {
if (moment().format('YYYY-MM-DD') !== moment(localStorage.getItem('lastShownPopupDisclaimer'), 'YYYY-MM-DD hh:mm:ss').format('YYYY-MM-DD')) {
showPopupDisclaimer = true;
localStorage.setItem('lastShownPopupDisclaimer', moment().format('YYYY-MM-DD hh:mm:ss'));
}
} else {
showPopupDisclaimer = true;
localStorage.setItem('lastShownPopupDisclaimer', moment().format('YYYY-MM-DD hh:mm:ss'));
}
// Get locale
const location = useLocation();
const match: any = matchPath(location.pathname, {
path: '/:locale',
strict: false
});
const locale = match ? match.params.locale : 'en';
return (
<>
<MobileLandscapeRequired locale={locale} />
<div className="body-container">
<Menu locale={locale}/>
<Body />
<Footer/>
<Popup
show={showPopupDisclaimer}
head={_i18n(locale, 'disclaimer_popup_title')}
body={_i18n(locale, 'disclaimer_popup_msg', true)}
/>
</div>
</> | Akarimichi/genshin-impact-utility | src/ui/root.tsx | TypeScript |
ArrowFunction |
({ store, history }: Props) => {
return (
<Provider store={store}>
<ConnectedRouter history={history}>
<App/>
</ConnectedRouter>
</Provider> | Akarimichi/genshin-impact-utility | src/ui/root.tsx | TypeScript |
TypeAliasDeclaration |
type Props = {
store: Store;
history: History;
}; | Akarimichi/genshin-impact-utility | src/ui/root.tsx | TypeScript |
MethodDeclaration |
_i18n(locale, 'disclaimer_popup_title') | Akarimichi/genshin-impact-utility | src/ui/root.tsx | TypeScript |
MethodDeclaration |
_i18n(locale, 'disclaimer_popup_msg', true) | Akarimichi/genshin-impact-utility | src/ui/root.tsx | TypeScript |
FunctionDeclaration |
function getHostLabel(labelService: ILabelService, item: ITrustedUriItem): string {
return item.uri.authority ? labelService.getHostLabel(item.uri.scheme, item.uri.authority) : localize('localAuthority', "Local");
} | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
ArrowFunction |
(item: ITrustedUriItem) => {
const hostLabel = getHostLabel(this.labelService, item);
if (hostLabel === undefined || hostLabel.length === 0) {
return localize('trustedFolderAriaLabel', "{0}, trusted", this.labelService.getUriLabel(item.uri));
}
return localize('trustedFolderWithHostAriaLabel', "{0} on {1}, trusted", this.labelService.getUriLabel(item.uri), hostLabel);
} | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
ArrowFunction |
() => localize('trustedFoldersAndWorkspaces', "Trusted Folders & Workspaces") | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
ArrowFunction |
item => {
// default prevented when input box is double clicked #125052
if (item && item.element && !item.browserEvent?.defaultPrevented) {
this.edit(item.element, true);
}
} | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
ArrowFunction |
async () => {
const uri = await this.fileDialogService.showOpenDialog({
canSelectFiles: false,
canSelectFolders: true,
canSelectMany: false,
defaultUri: this.currentWorkspaceUri,
openLabel: localize('trustUri', "Trust Folder"),
title: localize('selectTrustedUri', "Select Folder To Trust")
});
if (uri) {
this.workspaceTrustManagementService.setUrisTrust(uri, true);
}
} | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
ArrowFunction |
() => {
this.updateTable();
} | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
ArrowFunction |
folder => folder.uri | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
ArrowFunction |
uri => {
let relatedToCurrentWorkspace = false;
for (const workspaceUri of currentWorkspaceUris) {
relatedToCurrentWorkspace = relatedToCurrentWorkspace || this.uriService.extUri.isEqualOrParent(workspaceUri, uri);
}
return {
uri,
parentOfWorkspaceItem: relatedToCurrentWorkspace
};
} | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
ArrowFunction |
(a, b) => {
if (a.uri.scheme !== b.uri.scheme) {
if (a.uri.scheme === Schemas.file) {
return -1;
}
if (b.uri.scheme === Schemas.file) {
return 1;
}
}
const aIsWorkspace = a.uri.path.endsWith('.code-workspace');
const bIsWorkspace = b.uri.path.endsWith('.code-workspace');
if (aIsWorkspace !== bIsWorkspace) {
if (aIsWorkspace) {
return 1;
}
if (bIsWorkspace) {
return -1;
}
}
return a.uri.fsPath.localeCompare(b.uri.fsPath);
} | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
ArrowFunction |
s => s.length | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
ArrowFunction |
u => this.uriService.extUri.isEqual(u, item.uri) | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
ArrowFunction |
() => {
this.table.edit(item, false);
} | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
ArrowFunction |
() => {
this.table.edit(item, true);
} | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
ArrowFunction |
async () => {
await this.table.delete(item);
} | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
ArrowFunction |
value => this.table.validateUri(value, this.currentItem) | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
ArrowFunction |
async (e) => {
if (item === e) {
templateData.element.classList.add('input-mode');
templateData.pathInput.focus();
templateData.pathInput.select();
templateData.element.parentElement!.style.paddingLeft = '0px';
}
} | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
ArrowFunction |
e => {
EventHelper.stop(e);
} | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
ArrowFunction |
() => {
templateData.element.classList.remove('input-mode');
templateData.element.parentElement!.style.paddingLeft = '5px';
} | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
ArrowFunction |
() => {
hideInputBox();
const uri = item.uri.with({ path: templateData.pathInput.value });
templateData.pathLabel.innerText = templateData.pathInput.value;
if (uri) {
this.table.acceptEdit(item, uri);
}
} | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
ArrowFunction |
() => {
hideInputBox();
templateData.pathInput.value = stringValue;
this.table.rejectEdit(item);
} | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
ArrowFunction |
e => {
let handled = false;
if (e.equals(KeyCode.Enter)) {
accept();
handled = true;
} else if (e.equals(KeyCode.Escape)) {
reject();
handled = true;
}
if (handled) {
e.preventDefault();
e.stopPropagation();
}
} | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
ArrowFunction |
() => {
reject();
} | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
ArrowFunction |
() => { clearNode(templateData.buttonBarContainer); } | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
ArrowFunction |
colors => {
this.rootElement.style.setProperty('--workspace-trust-selected-color', colors.buttonBackground?.toString() || '');
this.rootElement.style.setProperty('--workspace-trust-unselected-color', colors.buttonSecondaryBackground?.toString() || '');
this.rootElement.style.setProperty('--workspace-trust-check-color', colors.debugIconStartForeground?.toString() || '');
this.rootElement.style.setProperty('--workspace-trust-x-color', colors.editorErrorForeground?.toString() || '');
} | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
ArrowFunction |
e => {
const event = new StandardKeyboardEvent(e);
if (event.equals(KeyCode.UpArrow) || event.equals(KeyCode.DownArrow)) {
const navOrder = [this.headerContainer, this.trustedContainer, this.untrustedContainer, this.configurationContainer];
const currentIndex = navOrder.findIndex(element => {
return isAncestor(document.activeElement, element);
});
let newIndex = currentIndex;
if (event.equals(KeyCode.DownArrow)) {
newIndex++;
} else if (event.equals(KeyCode.UpArrow)) {
newIndex = Math.max(0, newIndex);
newIndex--;
}
newIndex += navOrder.length;
newIndex %= navOrder.length;
navOrder[newIndex].focus();
} else if (event.equals(KeyCode.Escape)) {
this.rootElement.focus();
}
} | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
ArrowFunction |
element => {
return isAncestor(document.activeElement, element);
} | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
ArrowFunction |
() => this.render() | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
ArrowFunction |
key => {
const property = configurationRegistry.getConfigurationProperties()[key];
// cannot be configured in workspace
if (property.scope === ConfigurationScope.APPLICATION || property.scope === ConfigurationScope.MACHINE) {
return false;
}
// If deprecated include only those configured in the workspace
if (property.deprecationMessage || property.markdownDeprecationMessage) {
if (restrictedSettings.workspace?.includes(key)) {
return true;
}
if (restrictedSettings.workspaceFolder) {
for (const workspaceFolderSettings of restrictedSettings.workspaceFolder.values()) {
if (workspaceFolderSettings.includes(key)) {
return true;
}
}
}
return false;
}
return true;
} | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
ArrowFunction |
ext => ext.local | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
ArrowFunction |
ext => ext.local! | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
ArrowFunction |
ext => this.extensionManifestPropertiesService.getExtensionUntrustedWorkspaceSupportType(ext.manifest) === false | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
ArrowFunction |
e => {
if (e) {
EventHelper.stop(e, true);
}
action.run();
} | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
ArrowFunction |
async () => {
await this.workspaceTrustManagementService.setWorkspaceTrust(true);
} | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
ArrowFunction |
async () => {
await this.workspaceTrustManagementService.setParentFolderTrust(true);
} | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
ArrowFunction |
async () => {
await this.workspaceTrustManagementService.setWorkspaceTrust(false);
} | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
ArrowFunction |
participant => {
participant.layout();
} | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
ClassDeclaration |
class TrustedUriTableVirtualDelegate implements ITableVirtualDelegate<ITrustedUriItem> {
static readonly HEADER_ROW_HEIGHT = 30;
static readonly ROW_HEIGHT = 24;
readonly headerRowHeight = TrustedUriTableVirtualDelegate.HEADER_ROW_HEIGHT;
getHeight(item: ITrustedUriItem) {
return TrustedUriTableVirtualDelegate.ROW_HEIGHT;
}
} | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
ClassDeclaration |
class TrustedUriActionsColumnRenderer implements ITableRenderer<ITrustedUriItem, IActionsColumnTemplateData> {
static readonly TEMPLATE_ID = 'actions';
readonly templateId: string = TrustedUriActionsColumnRenderer.TEMPLATE_ID;
constructor(
private readonly table: WorkspaceTrustedUrisTable,
private readonly currentWorkspaceUri: URI,
@IUriIdentityService private readonly uriService: IUriIdentityService) { }
renderTemplate(container: HTMLElement): IActionsColumnTemplateData {
const element = container.appendChild($('.actions'));
const actionBar = new ActionBar(element, { animated: false });
return { actionBar };
}
renderElement(item: ITrustedUriItem, index: number, templateData: IActionsColumnTemplateData, height: number | undefined): void {
templateData.actionBar.clear();
const canUseOpenDialog = item.uri.scheme === Schemas.file ||
(
item.uri.scheme === this.currentWorkspaceUri.scheme &&
this.uriService.extUri.isEqualAuthority(this.currentWorkspaceUri.authority, item.uri.authority) &&
!isVirtualResource(item.uri)
);
const actions: IAction[] = [];
if (canUseOpenDialog) {
actions.push(this.createPickerAction(item));
}
actions.push(this.createEditAction(item));
actions.push(this.createDeleteAction(item));
templateData.actionBar.push(actions, { icon: true });
}
private createEditAction(item: ITrustedUriItem): IAction {
return <IAction>{
class: ThemeIcon.asClassName(settingsEditIcon),
enabled: true,
id: 'editTrustedUri',
tooltip: localize('editTrustedUri', "Edit Path"),
run: () => {
this.table.edit(item, false);
}
};
}
private createPickerAction(item: ITrustedUriItem): IAction {
return <IAction>{
class: ThemeIcon.asClassName(folderPickerIcon),
enabled: true,
id: 'pickerTrustedUri',
tooltip: localize('pickerTrustedUri', "Open File Picker"),
run: () => {
this.table.edit(item, true);
}
};
}
private createDeleteAction(item: ITrustedUriItem): IAction {
return <IAction>{
class: ThemeIcon.asClassName(settingsRemoveIcon),
enabled: true,
id: 'deleteTrustedUri',
tooltip: localize('deleteTrustedUri', "Delete Path"),
run: async () => {
await this.table.delete(item);
}
};
}
disposeTemplate(templateData: IActionsColumnTemplateData): void {
templateData.actionBar.dispose();
}
} | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
ClassDeclaration |
class TrustedUriPathColumnRenderer implements ITableRenderer<ITrustedUriItem, ITrustedUriPathColumnTemplateData> {
static readonly TEMPLATE_ID = 'path';
readonly templateId: string = TrustedUriPathColumnRenderer.TEMPLATE_ID;
private currentItem?: ITrustedUriItem;
constructor(
private readonly table: WorkspaceTrustedUrisTable,
@IContextViewService private readonly contextViewService: IContextViewService,
@IThemeService private readonly themeService: IThemeService,
) {
}
renderTemplate(container: HTMLElement): ITrustedUriPathColumnTemplateData {
const element = container.appendChild($('.path'));
const pathLabel = element.appendChild($('div.path-label'));
const pathInput = new InputBox(element, this.contextViewService, {
validationOptions: {
validation: value => this.table.validateUri(value, this.currentItem)
}
});
const disposables = new DisposableStore();
disposables.add(attachInputBoxStyler(pathInput, this.themeService));
const renderDisposables = disposables.add(new DisposableStore());
return {
element,
pathLabel,
pathInput,
disposables,
renderDisposables
};
}
renderElement(item: ITrustedUriItem, index: number, templateData: ITrustedUriPathColumnTemplateData, height: number | undefined): void {
templateData.renderDisposables.clear();
this.currentItem = item;
templateData.renderDisposables.add(this.table.onEdit(async (e) => {
if (item === e) {
templateData.element.classList.add('input-mode');
templateData.pathInput.focus();
templateData.pathInput.select();
templateData.element.parentElement!.style.paddingLeft = '0px';
}
}));
// stop double click action from re-rendering the element on the table #125052
templateData.renderDisposables.add(addDisposableListener(templateData.pathInput.element, EventType.DBLCLICK, e => {
EventHelper.stop(e);
}));
const hideInputBox = () => {
templateData.element.classList.remove('input-mode');
templateData.element.parentElement!.style.paddingLeft = '5px';
};
const accept = () => {
hideInputBox();
const uri = item.uri.with({ path: templateData.pathInput.value });
templateData.pathLabel.innerText = templateData.pathInput.value;
if (uri) {
this.table.acceptEdit(item, uri);
}
};
const reject = () => {
hideInputBox();
templateData.pathInput.value = stringValue;
this.table.rejectEdit(item);
};
templateData.renderDisposables.add(addStandardDisposableListener(templateData.pathInput.inputElement, EventType.KEY_DOWN, e => {
let handled = false;
if (e.equals(KeyCode.Enter)) {
accept();
handled = true;
} else if (e.equals(KeyCode.Escape)) {
reject();
handled = true;
}
if (handled) {
e.preventDefault();
e.stopPropagation();
}
}));
templateData.renderDisposables.add((addDisposableListener(templateData.pathInput.inputElement, EventType.BLUR, () => {
reject();
})));
const stringValue = item.uri.scheme === Schemas.file ? URI.revive(item.uri).fsPath : item.uri.path;
templateData.pathInput.value = stringValue;
templateData.pathLabel.innerText = stringValue;
templateData.element.classList.toggle('current-workspace-parent', item.parentOfWorkspaceItem);
// templateData.pathLabel.style.display = '';
}
disposeTemplate(templateData: ITrustedUriPathColumnTemplateData): void {
templateData.disposables.dispose();
templateData.renderDisposables.dispose();
}
} | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
ClassDeclaration |
class TrustedUriHostColumnRenderer implements ITableRenderer<ITrustedUriItem, ITrustedUriHostColumnTemplateData> {
static readonly TEMPLATE_ID = 'host';
readonly templateId: string = TrustedUriHostColumnRenderer.TEMPLATE_ID;
constructor(
@ILabelService private readonly labelService: ILabelService,
) { }
renderTemplate(container: HTMLElement): ITrustedUriHostColumnTemplateData {
const disposables = new DisposableStore();
const renderDisposables = disposables.add(new DisposableStore());
const element = container.appendChild($('.host'));
const hostContainer = element.appendChild($('div.host-label'));
const buttonBarContainer = element.appendChild($('div.button-bar'));
return {
element,
hostContainer,
buttonBarContainer,
disposables,
renderDisposables
};
}
renderElement(item: ITrustedUriItem, index: number, templateData: ITrustedUriHostColumnTemplateData, height: number | undefined): void {
templateData.renderDisposables.clear();
templateData.renderDisposables.add({ dispose: () => { clearNode(templateData.buttonBarContainer); } });
templateData.hostContainer.innerText = getHostLabel(this.labelService, item);
templateData.element.classList.toggle('current-workspace-parent', item.parentOfWorkspaceItem);
templateData.hostContainer.style.display = '';
templateData.buttonBarContainer.style.display = 'none';
}
disposeTemplate(templateData: ITrustedUriHostColumnTemplateData): void {
templateData.disposables.dispose();
}
} | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
InterfaceDeclaration |
interface ITrustedUriItem {
parentOfWorkspaceItem: boolean;
uri: URI;
} | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
InterfaceDeclaration |
interface IActionsColumnTemplateData {
readonly actionBar: ActionBar;
} | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
InterfaceDeclaration |
interface ITrustedUriPathColumnTemplateData {
element: HTMLElement;
pathLabel: HTMLElement;
pathInput: InputBox;
renderDisposables: DisposableStore;
disposables: DisposableStore;
} | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
InterfaceDeclaration |
interface ITrustedUriHostColumnTemplateData {
element: HTMLElement;
hostContainer: HTMLElement;
buttonBarContainer: HTMLElement;
disposables: DisposableStore;
renderDisposables: DisposableStore;
} | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
MethodDeclaration |
project(row: ITrustedUriItem): ITrustedUriItem { return row; } | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
MethodDeclaration |
private getIndexOfTrustedUriEntry(item: ITrustedUriItem): number {
const index = this.trustedUriEntries.indexOf(item);
if (index === -1) {
for (let i = 0; i < this.trustedUriEntries.length; i++) {
if (this.trustedUriEntries[i].uri === item.uri) {
return i;
}
}
}
return index;
} | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
MethodDeclaration |
private selectTrustedUriEntry(item: ITrustedUriItem, focus: boolean = true): void {
const index = this.getIndexOfTrustedUriEntry(item);
if (index !== -1) {
if (focus) {
this.table.domFocus();
this.table.setFocus([index]);
}
this.table.setSelection([index]);
}
} | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
MethodDeclaration |
layout(): void {
this.table.layout((this.trustedUriEntries.length * TrustedUriTableVirtualDelegate.ROW_HEIGHT) + TrustedUriTableVirtualDelegate.HEADER_ROW_HEIGHT, undefined);
} | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
MethodDeclaration |
updateTable(): void {
const entries = this.trustedUriEntries;
this.container.classList.toggle('empty', entries.length === 0);
this.descriptionElement.innerText = entries.length ?
localize('trustedFoldersDescription', "You trust the following folders, their subfolders, and workspace files.") :
localize('noTrustedFoldersDescriptions', "You haven't trusted any folders or workspace files yet.");
this.table.splice(0, Number.POSITIVE_INFINITY, this.trustedUriEntries);
this.layout();
} | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
MethodDeclaration |
validateUri(path: string, item?: ITrustedUriItem): IMessage | null {
if (!item) {
return null;
}
if (item.uri.scheme === 'vscode-vfs') {
const segments = path.split(posix.sep).filter(s => s.length);
if (segments.length === 0 && path.startsWith(posix.sep)) {
return {
type: MessageType.WARNING,
content: localize('trustAll', "You will trust all repositories on {0}.", getHostLabel(this.labelService, item))
};
}
if (segments.length === 1) {
return {
type: MessageType.WARNING,
content: localize('trustOrg', "You will trust all repositories and forks under '{0}' on {1}.", segments[0], getHostLabel(this.labelService, item))
};
}
if (segments.length > 2) {
return {
type: MessageType.ERROR,
content: localize('invalidTrust', "You cannot trust individual folders within a repository.", path)
};
}
}
return null;
} | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
MethodDeclaration |
acceptEdit(item: ITrustedUriItem, uri: URI) {
const trustedFolders = this.workspaceTrustManagementService.getTrustedUris();
const index = trustedFolders.findIndex(u => this.uriService.extUri.isEqual(u, item.uri));
if (index >= trustedFolders.length || index === -1) {
trustedFolders.push(uri);
} else {
trustedFolders[index] = uri;
}
this.workspaceTrustManagementService.setTrustedUris(trustedFolders);
this._onDidAcceptEdit.fire(item);
} | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
MethodDeclaration |
rejectEdit(item: ITrustedUriItem) {
this._onDidRejectEdit.fire(item);
} | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
MethodDeclaration |
async delete(item: ITrustedUriItem) {
await this.workspaceTrustManagementService.setUrisTrust([item.uri], false);
this._onDelete.fire(item);
} | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
MethodDeclaration |
async edit(item: ITrustedUriItem, usePickerIfPossible?: boolean) {
const canUseOpenDialog = item.uri.scheme === Schemas.file ||
(
item.uri.scheme === this.currentWorkspaceUri.scheme &&
this.uriService.extUri.isEqualAuthority(this.currentWorkspaceUri.authority, item.uri.authority) &&
!isVirtualResource(item.uri)
);
if (canUseOpenDialog && usePickerIfPossible) {
const uri = await this.fileDialogService.showOpenDialog({
canSelectFiles: false,
canSelectFolders: true,
canSelectMany: false,
defaultUri: item.uri,
openLabel: localize('trustUri', "Trust Folder"),
title: localize('selectTrustedUri', "Select Folder To Trust")
});
if (uri) {
this.acceptEdit(item, uri[0]);
} else {
this.rejectEdit(item);
}
} else {
this.selectTrustedUriEntry(item);
this._onEdit.fire(item);
}
} | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
MethodDeclaration |
getHeight(item: ITrustedUriItem) {
return TrustedUriTableVirtualDelegate.ROW_HEIGHT;
} | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
MethodDeclaration |
renderTemplate(container: HTMLElement): IActionsColumnTemplateData {
const element = container.appendChild($('.actions'));
const actionBar = new ActionBar(element, { animated: false });
return { actionBar };
} | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
MethodDeclaration |
renderElement(item: ITrustedUriItem, index: number, templateData: IActionsColumnTemplateData, height: number | undefined): void {
templateData.actionBar.clear();
const canUseOpenDialog = item.uri.scheme === Schemas.file ||
(
item.uri.scheme === this.currentWorkspaceUri.scheme &&
this.uriService.extUri.isEqualAuthority(this.currentWorkspaceUri.authority, item.uri.authority) &&
!isVirtualResource(item.uri)
);
const actions: IAction[] = [];
if (canUseOpenDialog) {
actions.push(this.createPickerAction(item));
}
actions.push(this.createEditAction(item));
actions.push(this.createDeleteAction(item));
templateData.actionBar.push(actions, { icon: true });
} | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
MethodDeclaration |
private createEditAction(item: ITrustedUriItem): IAction {
return <IAction>{
class: ThemeIcon.asClassName(settingsEditIcon),
enabled: true,
id: 'editTrustedUri',
tooltip: localize('editTrustedUri', "Edit Path"),
run: () => {
this.table.edit(item, false);
}
};
} | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
MethodDeclaration |
private createPickerAction(item: ITrustedUriItem): IAction {
return <IAction>{
class: ThemeIcon.asClassName(folderPickerIcon),
enabled: true,
id: 'pickerTrustedUri',
tooltip: localize('pickerTrustedUri', "Open File Picker"),
run: () => {
this.table.edit(item, true);
}
};
} | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
MethodDeclaration |
private createDeleteAction(item: ITrustedUriItem): IAction {
return <IAction>{
class: ThemeIcon.asClassName(settingsRemoveIcon),
enabled: true,
id: 'deleteTrustedUri',
tooltip: localize('deleteTrustedUri', "Delete Path"),
run: async () => {
await this.table.delete(item);
}
};
} | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
MethodDeclaration |
disposeTemplate(templateData: IActionsColumnTemplateData): void {
templateData.actionBar.dispose();
} | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
MethodDeclaration |
renderTemplate(container: HTMLElement): ITrustedUriPathColumnTemplateData {
const element = container.appendChild($('.path'));
const pathLabel = element.appendChild($('div.path-label'));
const pathInput = new InputBox(element, this.contextViewService, {
validationOptions: {
validation: value => this.table.validateUri(value, this.currentItem)
}
});
const disposables = new DisposableStore();
disposables.add(attachInputBoxStyler(pathInput, this.themeService));
const renderDisposables = disposables.add(new DisposableStore());
return {
element,
pathLabel,
pathInput,
disposables,
renderDisposables
};
} | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
MethodDeclaration |
renderElement(item: ITrustedUriItem, index: number, templateData: ITrustedUriPathColumnTemplateData, height: number | undefined): void {
templateData.renderDisposables.clear();
this.currentItem = item;
templateData.renderDisposables.add(this.table.onEdit(async (e) => {
if (item === e) {
templateData.element.classList.add('input-mode');
templateData.pathInput.focus();
templateData.pathInput.select();
templateData.element.parentElement!.style.paddingLeft = '0px';
}
}));
// stop double click action from re-rendering the element on the table #125052
templateData.renderDisposables.add(addDisposableListener(templateData.pathInput.element, EventType.DBLCLICK, e => {
EventHelper.stop(e);
}));
const hideInputBox = () => {
templateData.element.classList.remove('input-mode');
templateData.element.parentElement!.style.paddingLeft = '5px';
};
const accept = () => {
hideInputBox();
const uri = item.uri.with({ path: templateData.pathInput.value });
templateData.pathLabel.innerText = templateData.pathInput.value;
if (uri) {
this.table.acceptEdit(item, uri);
}
};
const reject = () => {
hideInputBox();
templateData.pathInput.value = stringValue;
this.table.rejectEdit(item);
};
templateData.renderDisposables.add(addStandardDisposableListener(templateData.pathInput.inputElement, EventType.KEY_DOWN, e => {
let handled = false;
if (e.equals(KeyCode.Enter)) {
accept();
handled = true;
} else if (e.equals(KeyCode.Escape)) {
reject();
handled = true;
}
if (handled) {
e.preventDefault();
e.stopPropagation();
}
}));
templateData.renderDisposables.add((addDisposableListener(templateData.pathInput.inputElement, EventType.BLUR, () => {
reject();
})));
const stringValue = item.uri.scheme === Schemas.file ? URI.revive(item.uri).fsPath : item.uri.path;
templateData.pathInput.value = stringValue;
templateData.pathLabel.innerText = stringValue;
templateData.element.classList.toggle('current-workspace-parent', item.parentOfWorkspaceItem);
// templateData.pathLabel.style.display = '';
} | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.