Skip to content

Commit

Permalink
feat: poc of workspace/symbol request
Browse files Browse the repository at this point in the history
  • Loading branch information
mingxuanzhangsfdx committed Nov 13, 2024
1 parent ecf3568 commit e8e421c
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 2 deletions.
Binary file modified packages/salesforcedx-vscode-apex/out/apex-jorje-lsp.jar
Binary file not shown.
6 changes: 5 additions & 1 deletion packages/salesforcedx-vscode-apex/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ import {
getApexTests,
getExceptionBreakpointInfo,
getLineBreakpointInfo,
languageClientUtils
languageClientUtils,
getWorkspaceSymbols
} from './languageUtils';
import { nls } from './messages';
import { retrieveEnableSyncInitJobs } from './settings';
Expand Down Expand Up @@ -92,6 +93,7 @@ export const activate = async (extensionContext: vscode.ExtensionContext) => {
getLineBreakpointInfo,
getExceptionBreakpointInfo,
getApexTests,
getWorkspaceSymbols,
languageClientUtils
};

Expand Down Expand Up @@ -280,6 +282,8 @@ const createLanguageClient = async (
});
await indexerDoneHandler(retrieveEnableSyncInitJobs(), languageClient, languageServerStatusBarItem);
extensionContext.subscriptions.push(languageClientUtils.getClientInstance()!);
const apexMethods = await getWorkspaceSymbols('hello world!');
console.log(apexMethods);
} else {
languageClientUtils.setStatus(
ClientStatus.Error,
Expand Down
3 changes: 2 additions & 1 deletion packages/salesforcedx-vscode-apex/src/languageUtils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ export {
getLineBreakpointInfo,
getApexTests,
getExceptionBreakpointInfo,
LanguageClientStatus
LanguageClientStatus,
getWorkspaceSymbols
} from './languageClientUtils';

export { enableJavaDocSymbols } from './javaDocSymbols';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,12 @@ export const getExceptionBreakpointInfo = async (): Promise<{}> => {
}
return Promise.resolve(response);
};

export const getWorkspaceSymbols = async (query: string): Promise<any[]> => {
let response = new Array<any>();
const languageClient = LanguageClientUtils.getInstance().getClientInstance();
if (languageClient) {
response = await languageClient.sendRequest('workspace/symbol', { query });
}
return Promise.resolve(response);
};
7 changes: 7 additions & 0 deletions packages/salesforcedx-vscode-apex/src/views/lspConverter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ export type ApexTestMethod = {
location: vscode.Location;
};

// export type WorkspaceSymbol = {
// name: string;
// containerName: string; // its outer class
// modifier: string;
// location: LSPLocation;
// }

export class ApexLSPConverter {
public static toApexTestMethod(requestInfo: LSPApexTestMethod): ApexTestMethod {
const testLocation = ApexLSPConverter.toLocation(requestInfo.location);
Expand Down

0 comments on commit e8e421c

Please sign in to comment.