MCPcopy
hub / github.com/PowerShell/vscode-powershell / resolveFunc

Method resolveFunc

src/session.ts:512–559  ·  view source on GitHub ↗
(
            codeLensToFix: vscode.CodeLens,
        )

Source from the content-addressed store, hash-verified

510 ): vscode.ProviderResult<vscode.CodeLens> {
511 const resolvedCodeLens = next(codeLens, token);
512 const resolveFunc = (
513 codeLensToFix: vscode.CodeLens,
514 ): vscode.CodeLens => {
515 if (
516 codeLensToFix.command?.command ===
517 "editor.action.showReferences"
518 ) {
519 const oldArgs = codeLensToFix.command.arguments;
520 if (oldArgs === undefined || oldArgs.length < 3) {
521 this.logger.writeError(
522 "Code Lens arguments were malformed!",
523 );
524 return codeLensToFix;
525 }
526
527 // Our JSON objects don't get handled correctly by
528 // VS Code's built in editor.action.showReferences
529 // command so we need to convert them into the
530 // appropriate types to send them as command
531 // arguments.
532
533 codeLensToFix.command.arguments = [
534 vscode.Uri.parse(oldArgs[0]),
535 new vscode.Position(oldArgs[1].line, oldArgs[1].character),
536 oldArgs[2].map(
537 (position: {
538 uri: string;
539 range: {
540 start: { line: number; character: number };
541 end: { line: number; character: number };
542 };
543 }) => {
544 return new vscode.Location(
545 vscode.Uri.parse(position.uri),
546 new vscode.Range(
547 position.range.start.line,
548 position.range.start.character,
549 position.range.end.line,
550 position.range.end.character,
551 ),
552 );
553 },
554 ),
555 ];
556 }
557
558 return codeLensToFix;
559 };
560
561 // TODO: This makes zero sense, but appears to be "working" and copied by others per https://github.com/microsoft/vscode-languageserver-node/issues/495. Thing is, ESLint says these conditionals are always truthy.
562 // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition

Callers

nothing calls this directly

Calls 1

writeErrorMethod · 0.65

Tested by

no test coverage detected