Skip to content

Commit

Permalink
add missing value for up'ed default, better telemetry for indexSize #9
Browse files Browse the repository at this point in the history
  • Loading branch information
jrieken committed Nov 16, 2021
1 parent 04b7409 commit 5e29167
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
11 changes: 3 additions & 8 deletions client/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ async function _startServer(extensionUri: vscode.Uri, supportedLanguages: Suppor
...Object.keys(vscode.workspace.getConfiguration('files', null).get('exclude') ?? {})
].join(',')}}`;

let size: number | undefined = Math.max(0, vscode.workspace.getConfiguration('anycode').get<number>('symbolIndexSize', 500));
let size: number = Math.max(0, vscode.workspace.getConfiguration('anycode').get<number>('symbolIndexSize', 500));
// do not set a maxResults limit if RemoteHub has the full workspace contents
const remoteHub = vscode.extensions.getExtension('GitHub.remoteHub') ?? vscode.extensions.getExtension('GitHub.remoteHub-insiders');
const remoteHubApi = await remoteHub?.activate();
Expand All @@ -183,12 +183,7 @@ async function _startServer(extensionUri: vscode.Uri, supportedLanguages: Suppor
hasFullWorkspaceContents = hasFullWorkspaceContents && (await remoteHubApi.hasWorkspaceContents(folder.uri));
}
}
if (hasFullWorkspaceContents) {
size = undefined;
} else {
size += 1;
}
let init = Promise.resolve(vscode.workspace.findFiles(langPattern, exclude, size).then(async uris => {
let init = Promise.resolve(vscode.workspace.findFiles(langPattern, exclude, hasFullWorkspaceContents ? undefined : size + 1).then(async uris => {
console.info(`FOUND ${uris.length} files for ${langPattern}`);

const t1 = performance.now();
Expand All @@ -200,7 +195,7 @@ async function _startServer(extensionUri: vscode.Uri, supportedLanguages: Suppor
"duration" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }
}
*/
telemetry.sendTelemetryEvent('init', undefined, { numOfFiles: uris.length, indexSize: size ?? -1, duration: performance.now() - t1 });
telemetry.sendTelemetryEvent('init', undefined, { numOfFiles: uris.length, indexSize: hasFullWorkspaceContents ? -1 : size, duration: performance.now() - t1 });

}));
// stop on server-end
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"properties": {
"anycode.symbolIndexSize": {
"type": "number",
"default": 100,
"default": 500,
"minimum": 0,
"markdownDescription": "Size of the index that is used for features like symbol search and go to definition."
},
Expand Down

0 comments on commit 5e29167

Please sign in to comment.