repo_name string | dataset string | owner string | lang string | func_name string | code string | docstring string | url string | sha string |
|---|---|---|---|---|---|---|---|---|
aide | github_2023 | codestoryai | typescript | QueryBuilder.expandSearchPathPatterns | private expandSearchPathPatterns(searchPaths: string[]): ISearchPathPattern[] {
if (!searchPaths || !searchPaths.length) {
// No workspace => ignore search paths
return [];
}
const expandedSearchPaths = searchPaths.flatMap(searchPath => {
// 1 open folder => just resolve the search paths to absolute pat... | /**
* Split search paths (./ or ../ or absolute paths in the includePatterns) into absolute paths and globs applied to those paths
*/ | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/search/common/queryBuilder.ts#L428-L467 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | QueryBuilder.expandOneSearchPath | private expandOneSearchPath(searchPath: string): IOneSearchPathPattern[] {
if (path.isAbsolute(searchPath)) {
const workspaceFolders = this.workspaceContextService.getWorkspace().folders;
if (workspaceFolders[0] && workspaceFolders[0].uri.scheme !== Schemas.file) {
return [{
searchPath: workspaceFolder... | /**
* Takes a searchPath like `./a/foo` or `../a/foo` and expands it to absolute paths for all the workspaces it matches.
*/ | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/search/common/queryBuilder.ts#L472-L534 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | expandGlobalGlob | function expandGlobalGlob(pattern: string): string[] {
const patterns = [
`**/${pattern}/**`,
`**/${pattern}`
];
return patterns.map(p => p.replace(/\*\*\/\*\*/g, '**'));
} | /**
* Note - we used {} here previously but ripgrep can't handle nested {} patterns. See https://github.com/microsoft/vscode/issues/32761
*/ | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/search/common/queryBuilder.ts#L665-L672 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | normalizeGlobPattern | function normalizeGlobPattern(pattern: string): string {
return normalizeSlashes(pattern)
.replace(/^\.\//, '')
.replace(/\/+$/g, '');
} | /**
* Normalize slashes, remove `./` and trailing slashes
*/ | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/search/common/queryBuilder.ts#L681-L685 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | escapeGlobPattern | function escapeGlobPattern(path: string): string {
return path.replace(/([?*[\]])/g, '[$1]');
} | /**
* Escapes a path for use as a glob pattern that would match the input precisely.
* Characters '?', '*', '[', and ']' are escaped into character range glob syntax
* (for example, '?' becomes '[?]').
* NOTE: This implementation makes no special cases for UNC paths. For example,
* given the input "//?/C:/A?.txt",... | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/search/common/queryBuilder.ts#L695-L697 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | ReplacePattern.getReplaceString | getReplaceString(text: string, preserveCase?: boolean): string | null {
this._regExp.lastIndex = 0;
const match = this._regExp.exec(text);
if (match) {
if (this.hasParameters) {
const replaceString = this.replaceWithCaseOperations(text, this._regExp, this.buildReplaceString(match, preserveCase));
if (m... | /**
* Returns the replace string for the first match in the given text.
* If text has no matches then returns null.
*/ | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/search/common/replace.ts#L61-L76 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | ReplacePattern.replaceWithCaseOperations | private replaceWithCaseOperations(text: string, regex: RegExp, replaceString: string): string {
// Short-circuit the common path.
if (!/\\[uUlL]/.test(replaceString)) {
return text.replace(regex, replaceString);
}
// Store the values of the search parameters.
const firstMatch = regex.exec(text);
if (firs... | /**
* replaceWithCaseOperations applies case operations to relevant replacement strings and applies
* the affected $N arguments. It then passes unaffected $N arguments through to string.replace().
*
* \u => upper-cases one character in a match.
* \U => upper-cases ALL remaining characters in a match.
* ... | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/search/common/replace.ts#L87-L154 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | ReplacePattern.parseReplaceString | private parseReplaceString(replaceString: string): void {
if (!replaceString || replaceString.length === 0) {
return;
}
let substrFrom = 0, result = '';
for (let i = 0, len = replaceString.length; i < len; i++) {
const chCode = replaceString.charCodeAt(i);
if (chCode === CharCode.Backslash) {
//... | /**
* \n => LF
* \t => TAB
* \\ => \
* $0 => $& (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace#Specifying_a_string_as_a_parameter)
* everything else stays untouched
*/ | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/search/common/replace.ts#L171-L279 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | QueryGlobTester.includedInQuerySync | includedInQuerySync(testPath: string, basename?: string, hasSibling?: (name: string) => boolean): boolean {
if (this._parsedExcludeExpression && this._evalParsedExcludeExpression(testPath, basename, hasSibling)) {
return false;
}
if (this._parsedIncludeExpression && !this._parsedIncludeExpression(testPath, ba... | /**
* Guaranteed sync - siblingsFn should not return a promise.
*/ | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/search/common/search.ts#L758-L768 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | QueryGlobTester.includedInQuery | includedInQuery(testPath: string, basename?: string, hasSibling?: (name: string) => boolean | Promise<boolean>): Promise<boolean> | boolean {
const isIncluded = () => {
return this._parsedIncludeExpression ?
!!(this._parsedIncludeExpression(testPath, basename, hasSibling)) :
true;
};
return Promise.a... | /**
* Evaluating the exclude expression is only async if it includes sibling clauses. As an optimization, avoid doing anything with Promises
* unless the expression is async.
*/ | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/search/common/search.ts#L774-L799 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | isTextSearchMatch | function isTextSearchMatch(object: any): object is TextSearchMatch {
return 'uri' in object && 'ranges' in object && 'preview' in object;
} | /**
* Checks if the given object is of type TextSearchMatch.
* @param object The object to check.
* @returns True if the object is a TextSearchMatch, false otherwise.
*/ | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/search/common/searchExtConversionTypes.ts#L315-L317 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | TextSearchMatch2.constructor | constructor(
public uri: URI,
public ranges: { sourceRange: Range; previewRange: Range }[],
public previewText: string) { } | /**
* @param uri The uri for the matching document.
* @param ranges The ranges associated with this match.
* @param previewText The text that is used to preview the match. The highlighted range in `previewText` is specified in `ranges`.
*/ | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/search/common/searchExtTypes.ts#L296-L299 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | TextSearchContext2.constructor | constructor(
public uri: URI,
public text: string,
public lineNumber: number) { } | /**
* @param uri The uri for the matching document.
* @param text The line of context text.
* @param lineNumber The line number of this line of context.
*/ | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/search/common/searchExtTypes.ts#L312-L315 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | FileWalker.spawnFindCmd | spawnFindCmd(folderQuery: IFolderQuery) {
const excludePattern = this.folderExcludePatterns.get(folderQuery.folder.fsPath)!;
const basenames = excludePattern.getBasenameTerms();
const pathTerms = excludePattern.getPathTerms();
const args = ['-L', '.'];
if (basenames.length || pathTerms.length) {
args.push(... | /**
* Public for testing.
*/ | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/search/node/fileSearch.ts#L281-L301 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | FileWalker.readStdout | readStdout(cmd: childProcess.ChildProcess, encoding: BufferEncoding, cb: (err: Error | null, stdout?: string) => void): void {
let all = '';
this.collectStdout(cmd, encoding, () => { }, (err: Error | null, stdout?: string, last?: boolean) => {
if (err) {
cb(err);
return;
}
all += stdout;
if (la... | /**
* Public for testing.
*/ | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/search/node/fileSearch.ts#L306-L319 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | FileWalker.getSearchPath | private getSearchPath(folderQuery: IFolderQuery, relativePath: string): string {
if (folderQuery.folderName) {
return path.join(folderQuery.folderName, relativePath);
}
return relativePath;
} | /**
* If we're searching for files in multiple workspace folders, then better prepend the
* name of the workspace folder to the path of the file. This way we'll be able to
* better filter files that are all on the top of a workspace folder and have all the
* same name. A typical example are `package.json` or `R... | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/search/node/fileSearch.ts#L627-L632 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | AbsoluteAndRelativeParsedExpression.init | private init(expr: glob.IExpression): void {
let absoluteGlobExpr: glob.IExpression | undefined;
let relativeGlobExpr: glob.IExpression | undefined;
Object.keys(expr)
.filter(key => expr[key])
.forEach(key => {
if (path.isAbsolute(key)) {
absoluteGlobExpr = absoluteGlobExpr || glob.getEmptyExpressi... | /**
* Split the IExpression into its absolute and relative components, and glob.parse them separately.
*/ | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/search/node/fileSearch.ts#L680-L697 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | SearchService.preventCancellation | private preventCancellation<C>(promise: CancelablePromise<C>): CancelablePromise<C> {
return new class implements CancelablePromise<C> {
get [Symbol.toStringTag]() { return this.toString(); }
cancel() {
// Do nothing
}
then<TResult1 = C, TResult2 = never>(resolve?: ((value: C) => TResult1 | Promise<TR... | /**
* Return a CancelablePromise which is not actually cancelable
* TODO@rob - Is this really needed?
*/ | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/search/node/rawSearchService.ts#L388-L404 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | rgErrorMsgForDisplay | function rgErrorMsgForDisplay(msg: string): Maybe<SearchError> {
const lines = msg.split('\n');
const firstLine = lines[0].trim();
if (lines.some(l => l.startsWith('regex parse error'))) {
return new SearchError(buildRegexParseError(lines), SearchErrorCode.regexParseError);
}
const match = firstLine.match(/gre... | /**
* Read the first line of stderr and return an error for display or undefined, based on a list of
* allowed properties.
* Ripgrep produces stderr output which is not from a fatal error, and we only want the search to be
* "failed" when a fatal error was produced.
*/ | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/search/node/ripgrepTextSearchEngine.ts#L159-L187 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | spreadGlobComponents | function spreadGlobComponents(globComponent: string): string[] {
const globComponentWithBraceExpansion = performBraceExpansionForRipgrep(globComponent);
return globComponentWithBraceExpansion.flatMap((globArg) => {
const components = splitGlobAware(globArg, '/');
return components.map((_, i) => components.slice(... | /**
* `"foo/*bar/something"` -> `["foo", "foo/*bar", "foo/*bar/something", "foo/*bar/something/**"]`
*/ | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/search/node/ripgrepTextSearchEngine.ts#L531-L539 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | getEscapeAwareSplitStringForRipgrep | function getEscapeAwareSplitStringForRipgrep(pattern: string): { fixedStart?: string; strInBraces: string; fixedEnd?: string } {
let inBraces = false;
let escaped = false;
let fixedStart = '';
let strInBraces = '';
for (let i = 0; i < pattern.length; i++) {
const char = pattern[i];
switch (char) {
case '\\'... | // brace expansion for ripgrep | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/search/node/ripgrepTextSearchEngine.ts#L679-L752 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | testGetRgArgs | function testGetRgArgs(includes: string[], expectedFromIncludes: string[]): void {
const query: TextSearchQuery2 = {
pattern: 'test'
};
const options: RipgrepTextSearchOptions = {
folderOptions: {
includes: includes,
excludes: [],
useIgnoreFiles: {
local: false,
gl... | // Only testing the args that come from includes. | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/search/test/node/ripgrepTextSearchEngineUtils.test.ts#L323-L359 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | isFolderExcluded | const isFolderExcluded = (path: string, basename: string, hasSibling: (query: string) => boolean) => {
path = path.slice(1);
if (evalFolderExcludes(path, basename, hasSibling)) { return true; }
if (pathExcludedInQuery(queryProps, path)) { return true; }
return false;
}; | // For folders, only check if the folder is explicitly excluded so walking continues. | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/search/worker/localFileSearch.ts#L191-L196 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | isFileIncluded | const isFileIncluded = (path: string, basename: string, hasSibling: (query: string) => boolean) => {
path = path.slice(1);
if (evalFolderExcludes(path, basename, hasSibling)) { return false; }
if (!pathIncludedInQuery(queryProps, path, extUri)) { return false; }
return true;
}; | // For files ensure the full check takes place. | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/search/worker/localFileSearch.ts#L199-L204 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | configureFont | const configureFont = () => {
const fontFeatureSettings = '';
const { fontFamily, fontSize, lineHeight, fontWeight, letterSpacing } = this._getFontInfo();
const fontSizePx = `${fontSize}px`;
const lineHeightPx = `${lineHeight}px`;
const letterSpacingPx = `${letterSpacing}px`;
root.style.fontSize = fo... | // const readMore = append(right, $('span.readMore' + ThemeIcon.asCSSSelector(suggestMoreInfoIcon))); | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/suggest/browser/simpleSuggestWidgetRenderer.ts#L97-L114 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | TelemetryService.initializeService | private initializeService(
environmentService: IBrowserWorkbenchEnvironmentService,
logService: ILogService,
loggerService: ILoggerService,
configurationService: IConfigurationService,
storageService: IStorageService,
productService: IProductService,
remoteAgentService: IRemoteAgentService
) {
const te... | /**
* Initializes the telemetry service to be a full fledged service.
* This is only done once and only when telemetry is enabled as this will also ping the endpoint to
* ensure its not adblocked and we can send telemetry
*/ | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/telemetry/browser/telemetryService.ts#L62-L97 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | cleanUserAgent | function cleanUserAgent(userAgent: string): string {
return userAgent.replace(/(\d+\.\d+)(\.\d+)+/g, '$1');
} | /**
* General function to help reduce the individuality of user agents
* @param userAgent userAgent from browser window
* @returns A simplified user agent with less detail
*/ | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/telemetry/browser/workbenchCommonProperties.ts#L19-L21 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | EmbedderTerminalProcess.input | input(): void {
// not supported
} | // they be optional? Should there be a base class for "external" consumers to implement? | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/terminal/common/embedderTerminalService.ts#L118-L120 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | MonotonousIndexTransformer.transform | transform(index: number): number | undefined {
let nextChange = this.transformation.edits[this.idx] as SingleArrayEdit | undefined;
while (nextChange && nextChange.offset + nextChange.length <= index) {
this.offset += nextChange.newLength - nextChange.length;
this.idx++;
nextChange = this.transformation.ed... | /**
* Precondition: index >= previous-value-of(index).
*/ | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/textMate/browser/arrayOperation.ts#L63-L78 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | TextMateWorkerTokenizerController.setTokensAndStates | public async setTokensAndStates(controllerId: number, versionId: number, rawTokens: ArrayBuffer, stateDeltas: StateDeltas[]): Promise<void> {
if (this.controllerId !== controllerId) {
// This event is for an outdated controller (the worker didn't receive the delete/create messages yet), ignore the event.
return... | /**
* This method is called from the worker through the worker host.
*/ | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/textMate/browser/backgroundTokenization/textMateWorkerTokenizerController.ts#L107-L218 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | ThreadedBackgroundTokenizerFactory.createBackgroundTokenizer | public createBackgroundTokenizer(textModel: ITextModel, tokenStore: IBackgroundTokenizationStore, maxTokenizationLineLength: IObservable<number>): IBackgroundTokenizer | undefined {
// fallback to default sync background tokenizer
if (!this._shouldTokenizeAsync() || textModel.isTooLargeForSyncing()) { return undefi... | // Will be recreated after worker is disposed (because tokenizer is re-registered when languages change) | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/textMate/browser/backgroundTokenization/threadedBackgroundTokenizerFactory.ts#L57-L106 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | TextMateTokenizationWorker.$acceptNewModel | public $acceptNewModel(data: IRawModelData): void {
const uri = URI.revive(data.uri);
const that = this;
this._models.set(data.controllerId, new TextMateWorkerTokenizer(uri, data.lines, data.EOL, data.versionId, {
async getOrCreateGrammar(languageId: string, encodedLanguageId: LanguageId): Promise<ICreateGramm... | // These methods are called by the renderer | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/textMate/browser/backgroundTokenization/worker/textMateTokenizationWorker.worker.ts#L102-L123 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | DecoderStream.create | static async create(encoding: string): Promise<DecoderStream> {
let decoder: IDecoderStream | undefined = undefined;
if (encoding !== UTF8) {
const iconv = await importAMDNodeModule<typeof import('@vscode/iconv-lite-umd')>('@vscode/iconv-lite-umd', 'lib/iconv-lite-umd.js');
decoder = iconv.getDecoder(toNodeEn... | /**
* This stream will only load iconv-lite lazily if the encoding
* is not UTF-8. This ensures that for most common cases we do
* not pay the price of loading the module from disk.
*
* We still need to be careful when converting UTF-8 to a string
* though because we read the file in chunks of Buffer and th... | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/textfile/common/encoding.ts#L82-L106 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | guessEncodingByBuffer | async function guessEncodingByBuffer(buffer: VSBuffer, candidateGuessEncodings?: string[]): Promise<string | null> {
const jschardet = await importAMDNodeModule<typeof import('jschardet')>('jschardet', 'dist/jschardet.min.js');
// ensure to limit buffer for guessing due to https://github.com/aadsm/jschardet/issues/5... | /**
* Guesses the encoding from buffer.
*/ | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/textfile/common/encoding.ts#L322-L352 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | TextFileEditorModel.backup | async backup(token: CancellationToken): Promise<IWorkingCopyBackup> {
// Fill in metadata if we are resolved
let meta: IBackupMetaData | undefined = undefined;
if (this.lastResolvedFileStat) {
meta = {
mtime: this.lastResolvedFileStat.mtime,
ctime: this.lastResolvedFileStat.ctime,
size: this.lastR... | //#region Backup | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/textfile/common/textFileEditorModel.ts#L216-L236 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | TextFileEditorModel.revert | async revert(options?: IRevertOptions): Promise<void> {
if (!this.isResolved()) {
return;
}
// Unset flags
const wasDirty = this.dirty;
const undo = this.doSetDirty(false);
// Force read from disk unless reverting soft
const softUndo = options?.soft;
if (!softUndo) {
try {
await this.forceRe... | //#region Revert | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/textfile/common/textFileEditorModel.ts#L242-L276 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | TextFileEditorModel.resolve | override async resolve(options?: ITextFileResolveOptions): Promise<void> {
this.trace('resolve() - enter');
mark('code/willResolveTextFileEditorModel');
// Return early if we are disposed
if (this.isDisposed()) {
this.trace('resolve() - exit - without resolving because model is disposed');
return;
}
... | //#region Resolve | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/textfile/common/textFileEditorModel.ts#L282-L306 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | TextFileEditorModel.isDirty | isDirty(): this is IResolvedTextFileEditorModel {
return this.dirty;
} | //#region Dirty | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/textfile/common/textFileEditorModel.ts#L678-L680 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | TextFileEditorModel.save | async save(options: ITextFileSaveAsOptions = Object.create(null)): Promise<boolean> {
if (!this.isResolved()) {
return false;
}
if (this.isReadonly()) {
this.trace('save() - ignoring request for readonly resource');
return false; // if model is readonly we do not attempt to save at all
}
if (
(... | //#region Save | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/textfile/common/textFileEditorModel.ts#L729-L755 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | TextFileEditorModel.hasState | hasState(state: TextFileEditorModelState): boolean {
switch (state) {
case TextFileEditorModelState.CONFLICT:
return this.inConflictMode;
case TextFileEditorModelState.DIRTY:
return this.dirty;
case TextFileEditorModelState.ERROR:
return this.inErrorMode;
case TextFileEditorModelState.ORPHAN:
... | //#endregion | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/textfile/common/textFileEditorModel.ts#L1035-L1050 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | TextFileEditorModel.onMaybeShouldChangeEncoding | private async onMaybeShouldChangeEncoding(): Promise<void> {
// This is a bit of a hack but there is a narrow case where
// per-language configured encodings are not working:
//
// On startup we may not yet have all languages resolved so
// we pick a wrong encoding. We never used to re-apply the
// encodin... | //#region Encoding | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/textfile/common/textFileEditorModel.ts#L1068-L1115 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | TextFileEditorModel.trace | private trace(msg: string): void {
this.logService.trace(`[text file model] ${msg}`, this.resource.toString());
} | //#endregion | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/textfile/common/textFileEditorModel.ts#L1189-L1191 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | TextFileEditorModelManager.canDispose | canDispose(model: TextFileEditorModel): true | Promise<true> {
// quick return if model already disposed or not dirty and not resolving
if (
model.isDisposed() ||
(!this.mapResourceToPendingModelResolvers.has(model.resource) && !model.isDirty())
) {
return true;
}
// promise based return in all oth... | //#endregion | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/textfile/common/textFileEditorModelManager.ts#L573-L585 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | FileIconThemeLoader.tryNormalizeFontSize | private tryNormalizeFontSize(size: string | undefined): string | undefined {
if (!size) {
return undefined;
}
const defaultFontSizeInPx = 13;
if (size.endsWith('px')) {
const value = parseInt(size, 10);
if (!isNaN(value)) {
return Math.round((value / defaultFontSizeInPx) * 100) + '%';
}
}
... | /**
* Try converting absolute font sizes to relative values.
*
* This allows them to be scaled nicely depending on where they are used.
*/ | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/themes/browser/fileIconThemeData.ts#L467-L482 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | initializeColorTheme | const initializeColorTheme = async () => {
const devThemes = this.colorThemeRegistry.findThemeByExtensionLocation(extDevLoc);
if (devThemes.length) {
const matchedColorTheme = devThemes.find(theme => theme.type === this.currentColorTheme.type);
return this.setColorTheme(matchedColorTheme ? matchedColorThe... | // in dev mode, switch to a theme provided by the extension under dev. | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/themes/browser/workbenchThemeService.ts#L196-L211 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | WorkbenchThemeService.installPreferredSchemeListener | private installPreferredSchemeListener() {
this._register(this.hostColorService.onDidChangeColorScheme(() => {
if (this.settings.isDetectingColorScheme()) {
this.restoreColorTheme();
}
}));
} | // preferred scheme handling | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/themes/browser/workbenchThemeService.ts#L357-L363 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | ColorThemeData.constructor | private constructor(id: string, label: string, settingsId: string) {
this.id = id;
this.label = label;
this.settingsId = settingsId;
this.isLoaded = false;
} | // created on demand | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/themes/common/colorThemeData.ts#L85-L90 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | ColorThemeData.resolveTokenStyleValue | public resolveTokenStyleValue(tokenStyleValue: TokenStyleValue | undefined): TokenStyle | undefined {
if (tokenStyleValue === undefined) {
return undefined;
} else if (typeof tokenStyleValue === 'string') {
const { type, modifiers, language } = parseClassifierString(tokenStyleValue, '');
return this.getTok... | /**
* @param tokenStyleValue Resolve a tokenStyleValue in the context of a theme
*/ | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/themes/common/colorThemeData.ts#L238-L248 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | ColorThemeData.createUnloadedThemeForThemeType | static createUnloadedThemeForThemeType(themeType: ColorScheme, colorMap?: { [id: string]: string }): ColorThemeData {
return ColorThemeData.createUnloadedTheme(getThemeTypeSelector(themeType), colorMap);
} | // constructors | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/themes/common/colorThemeData.ts#L606-L608 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | TreeSitterTokenizationSupport._handleTreeUpdate | private _handleTreeUpdate(e: TreeUpdateEvent) {
let rangeChanges: RangeChange[] = [];
const chunkSize = 10000;
for (let i = 0; i < e.ranges.length; i++) {
const rangeLength = e.ranges[i].newRangeEndOffset - e.ranges[i].newRangeStartOffset;
if (e.ranges[i].oldRangeLength === rangeLength) {
if (rangeLeng... | /**
* Do not await in this method, it will cause a race
*/ | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/treeSitter/browser/treeSitterTokenizationFeature.ts#L181-L232 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | TreeSitterTokenizationSupport.tokenizeEncoded | public tokenizeEncoded(lineNumber: number, textModel: ITextModel): Uint32Array | undefined {
return this._tokenizeEncoded(lineNumber, textModel)?.result;
} | /**
* Gets the tokens for a given line.
* Each token takes 2 elements in the array. The first element is the offset of the end of the token *in the line, not in the document*, and the second element is the metadata.
*
* @param lineNumber
* @returns
*/ | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/treeSitter/browser/treeSitterTokenizationFeature.ts#L366-L368 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | UntitledTextEditorModel.constructor | constructor(
readonly resource: URI,
readonly hasAssociatedFilePath: boolean,
private readonly initialValue: string | undefined,
private preferredLanguageId: string | undefined,
private preferredEncoding: string | undefined,
@ILanguageService languageService: ILanguageService,
@IModelService modelService:... | //#endregion | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/untitled/common/untitledTextEditorModel.ts#L128-L160 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | UntitledTextEditorModel.setLanguageId | override setLanguageId(languageId: string, source?: string): void {
const actualLanguage: string | undefined = languageId === UntitledTextEditorModel.ACTIVE_EDITOR_LANGUAGE_ID
? this.editorService.activeTextEditorLanguageId
: languageId;
this.preferredLanguageId = actualLanguage;
if (actualLanguage) {
s... | //#region Language | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/untitled/common/untitledTextEditorModel.ts#L197-L206 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | UntitledTextEditorModel.save | async save(options?: ISaveOptions): Promise<boolean> {
const target = await this.textFileService.save(this.resource, options);
// Emit as event
if (target) {
this._onDidSave.fire({ reason: options?.reason, source: options?.source });
}
return !!target;
} | //#region Save / Revert / Backup | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/untitled/common/untitledTextEditorModel.ts#L263-L272 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | UntitledTextEditorModel.isReadonly | override isReadonly(): boolean {
return false;
} | //#endregion | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/untitled/common/untitledTextEditorModel.ts#L448-L450 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | UserActivityService.markActive | markActive(opts?: IMarkActiveOptions): IDisposable {
if (opts?.whenHeldFor) {
const store = new DisposableStore();
store.add(disposableTimeout(() => store.add(this.markActive()), opts.whenHeldFor));
return store;
}
if (++this.active === 1) {
this.isActive = true;
this.changeEmitter.fire(true);
... | /** @inheritdoc */ | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/userActivity/common/userActivityService.ts#L73-L91 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | ViewDescriptorService.generateContainerId | private generateContainerId(location: ViewContainerLocation): string {
return `${ViewDescriptorService.COMMON_CONTAINER_ID_PREFIX}.${ViewContainerLocationToString(location)}.${generateUuid()}`;
} | // {Common Prefix}.{Uniqueness Id}.{Source View Id} | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/views/browser/viewDescriptorService.ts#L604-L606 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | ViewsService.isViewContainerVisible | isViewContainerVisible(id: string): boolean {
const viewContainer = this.viewDescriptorService.getViewContainerById(id);
if (!viewContainer) {
return false;
}
const viewContainerLocation = this.viewDescriptorService.getViewContainerLocation(viewContainer);
if (viewContainerLocation === null) {
return f... | // One view container can be visible at a time in a location | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/views/browser/viewsService.ts#L203-L215 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | ViewsService.isViewContainerActive | isViewContainerActive(id: string): boolean {
const viewContainer = this.viewDescriptorService.getViewContainerById(id);
if (!viewContainer) {
return false;
}
if (!viewContainer.hideIfEmpty) {
return true;
}
return this.viewDescriptorService.getViewContainerModel(viewContainer).activeViewDescriptors.... | // Multiple view containers can be active/inactive at a time in a location | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/views/browser/viewsService.ts#L218-L229 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | ViewContainerModel.allViewDescriptors | get allViewDescriptors(): ReadonlyArray<IViewDescriptor> { return this.viewDescriptorItems.map(item => item.viewDescriptor); } | // All View Descriptors | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/views/common/viewContainerModel.ts#L306-L306 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | ViewContainerModel.activeViewDescriptors | get activeViewDescriptors(): ReadonlyArray<IViewDescriptor> { return this.viewDescriptorItems.filter(item => item.state.active).map(item => item.viewDescriptor); } | // Active View Descriptors | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/views/common/viewContainerModel.ts#L311-L311 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | ViewContainerModel.visibleViewDescriptors | get visibleViewDescriptors(): ReadonlyArray<IViewDescriptor> { return this.viewDescriptorItems.filter(item => this.isViewDescriptorVisible(item)).map(item => item.viewDescriptor); } | // Visible View Descriptors | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/views/common/viewContainerModel.ts#L316-L316 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | FileWorkingCopyManager.provideDecorations | private provideDecorations(): void {
// File working copy decorations
const provider = this._register(new class extends Disposable implements IDecorationsProvider {
readonly label = localize('fileWorkingCopyDecorations', "File Working Copy Decorations");
private readonly _onDidChange = this._register(new E... | //#region decorations | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/workingCopy/common/fileWorkingCopyManager.ts#L201-L278 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | FileWorkingCopyManager.workingCopies | get workingCopies(): (IUntitledFileWorkingCopy<U> | IStoredFileWorkingCopy<S>)[] {
return [...this.stored.workingCopies, ...this.untitled.workingCopies];
} | //#region get / get all | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/workingCopy/common/fileWorkingCopyManager.ts#L284-L286 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | FileWorkingCopyManager.saveAs | async saveAs(source: URI, target?: URI, options?: IFileWorkingCopySaveAsOptions): Promise<IStoredFileWorkingCopy<S> | undefined> {
// Get to target resource
if (!target) {
const workingCopy = this.get(source);
if (workingCopy instanceof UntitledFileWorkingCopy && workingCopy.hasAssociatedFilePath) {
targ... | //#region Save | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/workingCopy/common/fileWorkingCopyManager.ts#L321-L371 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | FileWorkingCopyManager.destroy | async destroy(): Promise<void> {
await Promises.settled([
this.stored.destroy(),
this.untitled.destroy()
]);
} | //#region Lifecycle | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/workingCopy/common/fileWorkingCopyManager.ts#L553-L558 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | StoredFileWorkingCopy.constructor | constructor(
readonly typeId: string,
resource: URI,
readonly name: string,
private readonly modelFactory: IStoredFileWorkingCopyModelFactory<M>,
private readonly externalResolver: IStoredFileWorkingCopyResolver,
@IFileService fileService: IFileService,
@ILogService private readonly logService: ILogServic... | //#endregion | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopy.ts#L349-L373 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | StoredFileWorkingCopy.isResolved | isResolved(): this is IResolvedStoredFileWorkingCopy<M> {
return !!this.model;
} | // !!! DO NOT MARK PRIVATE! USED IN TESTS !!! | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopy.ts#L445-L447 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | StoredFileWorkingCopy.backupDelay | get backupDelay(): number | undefined {
return this.model?.configuration?.backupDelay;
} | //#region Backup | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopy.ts#L798-L800 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | StoredFileWorkingCopy.revert | async revert(options?: IRevertOptions): Promise<void> {
if (!this.isResolved() || (!this.dirty && !options?.force)) {
return; // ignore if not resolved or not dirty and not enforced
}
this.trace('revert()');
// Unset flags
const wasDirty = this.dirty;
const undoSetDirty = this.doSetDirty(false);
// ... | //#region Revert | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopy.ts#L1266-L1302 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | StoredFileWorkingCopy.isReadonly | isReadonly(): boolean | IMarkdownString {
return this.filesConfigurationService.isReadonly(this.resource, this.lastResolvedFileStat);
} | //#region Utilities | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopy.ts#L1336-L1338 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | StoredFileWorkingCopy.dispose | override dispose(): void {
this.trace('dispose()');
// State
this.inConflictMode = false;
this.inErrorMode = false;
// Free up model for GC
this._model = undefined;
super.dispose();
} | //#region Dispose | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopy.ts#L1348-L1359 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | StoredFileWorkingCopyManager.onDidChangeFileSystemProviderCapabilities | private onDidChangeFileSystemProviderCapabilities(e: IFileSystemProviderCapabilitiesChangeEvent): void {
// Resolve working copies again for file systems that changed
// capabilities to fetch latest metadata (e.g. readonly)
// into all working copies.
this.queueWorkingCopyReloads(e.scheme);
} | //#region Resolve from file or file provider changes | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopyManager.ts#L243-L249 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | StoredFileWorkingCopyManager.reload | private async reload(workingCopy: IStoredFileWorkingCopy<M>): Promise<void> {
// Await a pending working copy resolve first before proceeding
// to ensure that we never resolve a working copy more than once
// in parallel.
await this.joinPendingResolves(workingCopy.resource);
if (workingCopy.isDirty() || wo... | //#region Reload & Resolve | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopyManager.ts#L441-L454 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | StoredFileWorkingCopyManager.canDispose | canDispose(workingCopy: IStoredFileWorkingCopy<M>): true | Promise<true> {
// Quick return if working copy already disposed or not dirty and not resolving
if (
workingCopy.isDisposed() ||
(!this.mapResourceToPendingWorkingCopyResolve.has(workingCopy.resource) && !workingCopy.isDirty())
) {
return true;
... | //#region Lifecycle | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopyManager.ts#L659-L671 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | UntitledFileWorkingCopy.constructor | constructor(
readonly typeId: string,
readonly resource: URI,
readonly name: string,
readonly hasAssociatedFilePath: boolean,
private readonly isScratchpad: boolean,
private readonly initialContents: IUntitledFileWorkingCopyInitialContents | undefined,
private readonly modelFactory: IUntitledFileWorkingCo... | //#endregion | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopy.ts#L119-L136 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | UntitledFileWorkingCopy.resolve | async resolve(): Promise<void> {
this.trace('resolve()');
if (this.isResolved()) {
this.trace('resolve() - exit (already resolved)');
// return early if the untitled file working copy is already
// resolved assuming that the contents have meanwhile changed
// in the underlying model. we only resolve u... | //#region Resolve | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopy.ts#L166-L207 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | UntitledFileWorkingCopy.backupDelay | get backupDelay(): number | undefined {
return this.model?.configuration?.backupDelay;
} | //#region Backup | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopy.ts#L255-L257 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | UntitledFileWorkingCopy.save | async save(options?: ISaveOptions): Promise<boolean> {
this.trace('save()');
const result = await this.saveDelegate(this, options);
// Emit Save Event
if (result) {
this._onDidSave.fire({ reason: options?.reason, source: options?.source });
}
return result;
} | //#region Save | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopy.ts#L280-L291 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | UntitledFileWorkingCopy.revert | async revert(): Promise<void> {
this.trace('revert()');
// No longer modified
this.setModified(false);
// Emit as event
this._onDidRevert.fire();
// A reverted untitled file working copy is invalid
// because it has no actual source on disk to revert to.
// As such we dispose the model.
this.dispos... | //#region Revert | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopy.ts#L298-L311 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | UntitledFileWorkingCopy.dispose | override dispose(): void {
this.trace('dispose()');
this._onWillDispose.fire();
super.dispose();
} | //#endregion | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopy.ts#L315-L321 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | UntitledFileWorkingCopyManager.dispose | override dispose(): void {
super.dispose();
// Dispose the working copy change listeners
dispose(this.mapResourceToWorkingCopyListeners.values());
this.mapResourceToWorkingCopyListeners.clear();
} | //#region Lifecycle | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopyManager.ts#L291-L297 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | UntitledFileWorkingCopyManager.notifyDidSave | notifyDidSave(source: URI, target: URI): void {
this._onDidSave.fire({ source, target });
} | //#endregion | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopyManager.ts#L301-L303 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | WorkingCopyFileService.create | create(operations: ICreateFileOperation[], token: CancellationToken, undoInfo?: IFileOperationUndoRedoInfo): Promise<IFileStatWithMetadata[]> {
return this.doCreateFileOrFolder(operations, true, token, undoInfo);
} | //#region File operations | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/workingCopy/common/workingCopyFileService.ts#L329-L331 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | WorkingCopyService.workingCopies | get workingCopies(): IWorkingCopy[] { return Array.from(this._workingCopies.values()); } | //#region Registry | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/workingCopy/common/workingCopyService.ts#L166-L166 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | WorkingCopyService.hasDirty | get hasDirty(): boolean {
for (const workingCopy of this._workingCopies) {
if (workingCopy.isDirty()) {
return true;
}
}
return false;
} | //#region Dirty Tracking | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/workingCopy/common/workingCopyService.ts#L260-L268 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | BrowserWorkspacesService.getRecentlyOpened | async getRecentlyOpened(): Promise<IRecentlyOpened> {
const recentlyOpenedRaw = this.storageService.get(BrowserWorkspacesService.RECENTLY_OPENED_KEY, StorageScope.APPLICATION);
if (recentlyOpenedRaw) {
const recentlyOpened = restoreRecentlyOpened(JSON.parse(recentlyOpenedRaw), this.logService);
recentlyOpened... | //#region Workspaces History | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/workspaces/browser/workspacesService.ts#L86-L112 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | BrowserWorkspacesService.enterWorkspace | async enterWorkspace(workspaceUri: URI): Promise<IEnterWorkspaceResult | undefined> {
return { workspace: await this.getWorkspaceIdentifier(workspaceUri) };
} | //#region Workspace Management | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/workspaces/browser/workspacesService.ts#L163-L165 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | BrowserWorkspacesService.getDirtyWorkspaces | async getDirtyWorkspaces(): Promise<Array<IWorkspaceBackupInfo | IFolderBackupInfo>> {
return []; // Currently not supported in web
} | //#region Dirty Workspaces | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/workspaces/browser/workspacesService.ts#L205-L207 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | uriReplacer | const uriReplacer = (obj: any, depth = 0) => {
if (!obj || depth > 200) {
return obj;
}
if (obj instanceof VSBuffer || obj instanceof Uint8Array) {
return <any>obj;
}
if (URI.isUri(obj)) {
return convertUri(obj);
}
if (Array.isArray(obj)) {
for (let i = 0; i < obj.length; ++i) {
... | // Recursively look for any URIs in the provided object and | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/workspaces/common/workspaceIdentityService.ts#L110-L137 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | WorkspaceTrustManagementService.initializeWorkspaceTrust | private initializeWorkspaceTrust(): void {
// Resolve canonical Uris
this.resolveCanonicalUris()
.then(async () => {
this._canonicalUrisResolved = true;
await this.updateWorkspaceTrust();
})
.finally(() => {
this._workspaceResolvedPromiseResolve();
if (!this.environmentService.remoteAuthor... | //#region initialize | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/workspaces/common/workspaceTrust.ts#L146-L182 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | WorkspaceTrustManagementService.registerListeners | private registerListeners(): void {
this._register(this.workspaceService.onDidChangeWorkspaceFolders(async () => await this.updateWorkspaceTrust()));
this._register(this.storageService.onDidChangeValue(StorageScope.APPLICATION, this.storageKey, this._store)(async () => {
/* This will only execute if storage was ... | //#region private interface | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/workspaces/common/workspaceTrust.ts#L188-L199 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | WorkspaceTrustManagementService.workspaceResolved | get workspaceResolved(): Promise<void> {
return this._workspaceResolvedPromise;
} | //#region public interface | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/workspaces/common/workspaceTrust.ts#L476-L478 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | WorkspaceTrustRequestService.untrustedFilesSetting | private get untrustedFilesSetting(): 'prompt' | 'open' | 'newWindow' {
return this.configurationService.getValue(WORKSPACE_TRUST_UNTRUSTED_FILES);
} | //#region Open file(s) trust request | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/workspaces/common/workspaceTrust.ts#L684-L686 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | WorkspaceTrustRequestService.resolveWorkspaceTrustRequest | private resolveWorkspaceTrustRequest(trusted?: boolean): void {
if (this._workspaceTrustRequestResolver) {
this._workspaceTrustRequestResolver(trusted ?? this.workspaceTrustManagementService.isWorkspaceTrusted());
this._workspaceTrustRequestResolver = undefined;
this._workspaceTrustRequestPromise = undefine... | //#region Workspace trust request | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/services/workspaces/common/workspaceTrust.ts#L766-L773 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | stripOverrides | const stripOverrides = () => {
if (
!untypedResourceEditorInput.options ||
!untypedTextResourceEditorInput.options ||
!untypedUntitledResourceEditorinput.options ||
!untypedResourceDiffEditorInput.options ||
!untypedResourceMergeEditorInput.options
) {
throw new Error('Malformed options on untyped... | // Function to easily remove the overrides from the untyped inputs | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/test/browser/parts/editor/editorInput.test.ts#L37-L53 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | Debug.waitForVariableCount | async waitForVariableCount(count: number, alternativeCount: number): Promise<void> {
await this.code.waitForElements(VARIABLE, false, els => els.length === count || els.length === alternativeCount);
} | // Different node versions give different number of variables. As a workaround be more relaxed when checking for variable count | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/test/automation/src/debug.ts#L144-L146 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | getRandomValues | function getRandomValues(bucket: Uint8Array): Uint8Array {
for (let i = 0; i < bucket.length; i++) {
bucket[i] = Math.floor(Math.random() * 256);
}
return bucket;
} | // use `randomValues` if possible | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/test/automation/src/profiler.ts#L60-L65 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | getInstances | const getInstances = async (driver: PlaywrightDriver, classNames: string[]): Promise<{ [key: string]: number }> => {
await driver.collectGarbage();
const objectGroup = `og:${generateUuid()}`;
const prototypeDescriptor = await driver.evaluate({
expression: 'Object.prototype',
returnByValue: false,
objectGroup,
... | /*---------------------------------------------------------------------------------------------
* The MIT License (MIT)
* Copyright (c) 2023-present, Simon Siefke
*
* This code is derived from https://github.com/SimonSiefke/vscode-memory-leak-finder
*-------------------------------------------------------------... | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/test/automation/src/profiler.ts#L116-L208 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
aide | github_2023 | codestoryai | typescript | SettingsEditor.addUserSetting | async addUserSetting(setting: string, value: string): Promise<void> {
await this.openUserSettingsFile();
await this.code.dispatchKeybinding('right');
await this.editor.waitForEditorSelection('settings.json', s => s.selectionStart === 1 && s.selectionEnd === 1);
await this.editor.waitForTypeInEditor('settings.j... | /**
* Write a single setting key value pair.
*
* Warning: You may need to set `editor.wordWrap` to `"on"` if this is called with a really long
* setting.
*/ | https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/test/automation/src/settings.ts#L24-L31 | 1a8578f21ace8c9381461d295ed31c3500be43bf |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.