Skip to content

Commit

Permalink
SLVSCODE-873 crawl directory before listFilesInFolder is called
Browse files Browse the repository at this point in the history
  • Loading branch information
sophio-japharidze-sonarsource committed Nov 25, 2024
1 parent b93fd9c commit fd29382
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
3 changes: 0 additions & 3 deletions its/src/test/javaSuite/java.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,6 @@ suite('Java Test Suite', () => {
const rangeInMiddleOfThrowsMyException = new vscode.Range(8, 54, 8, 54);
const codeActionsResult = (await vscode.commands.executeCommand<(vscode.Command | vscode.CodeAction)[]>('vscode.executeCodeActionProvider', document.uri, rangeInMiddleOfThrowsMyException, vscode.CodeActionKind.QuickFix.value));
// With old versions of VSCode, code actions are not necessarily filtered on kind
console.log('+++++++', codeActionsResult[0].title)
console.log('+++++++', codeActionsResult[2].title)
console.log('+++++++', codeActionsResult[1].title)
const expectedActionTitles = [
"SonarQube: Deactivate rule 'java:S1130'",
"SonarQube: Remove \"MyException\"",
Expand Down
5 changes: 4 additions & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,10 @@ export async function activate(context: VSCode.ExtensionContext) {
});
FixSuggestionService.init(languageClient);

VSCode.workspace.workspaceFolders.map((folder) => {
FileSystemServiceImpl.instance.crawlDirectory(folder.uri);
});

installCustomRequestHandlers(context);

const referenceBranchStatusItem = VSCode.window.createStatusBarItem(VSCode.StatusBarAlignment.Left, 1);
Expand Down Expand Up @@ -568,7 +572,6 @@ function installCustomRequestHandlers(context: VSCode.ExtensionContext) {
languageClient.onNotification(protocol.ShowRuleDescriptionNotification.type, showRuleDescription(context));
languageClient.onNotification(protocol.SuggestBindingNotification.type, params => suggestBinding(params));
languageClient.onRequest(protocol.ListFilesInFolderRequest.type, async (params) => {
await FileSystemServiceImpl.instance.crawlDirectory(VSCode.Uri.parse(params.folderUri));
return AutoBindingService.instance.listAutobindingFilesInFolder(params);
}
);
Expand Down
4 changes: 2 additions & 2 deletions src/fileSystem/fileSystemServiceImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class FileSystemServiceImpl implements FileSystemService {
}

public async crawlDirectory(uri: Uri) {
await this.listFilesRecursively(uri, uri);
this.listFilesRecursively(uri, uri);
}

private async listFilesRecursively(configScopeUri: Uri, currentDirectory: Uri) {
Expand All @@ -45,7 +45,7 @@ export class FileSystemServiceImpl implements FileSystemService {
}
// .sonarlint folder is already handled separately, skipping it in recursive crawl
if (type === vscode.FileType.Directory && name !== '.sonarlint') {
await this.listFilesRecursively(configScopeUri, fullFileUri);
this.listFilesRecursively(configScopeUri, fullFileUri);
}
}
} catch (error) {
Expand Down

0 comments on commit fd29382

Please sign in to comment.