MCPcopy Create free account
hub / github.com/angular/angular / openJsDocLinkCommand

Function openJsDocLinkCommand

vscode-ng-language-service/client/src/commands.ts:187–208  ·  view source on GitHub ↗

* Proxy command for opening links in jsdoc comments. * * This is needed to avoid VS Code incorrectly rewriting file names.

()

Source from the content-addressed store, hash-verified

185 * This is needed to avoid VS Code incorrectly rewriting file names.
186 */
187function openJsDocLinkCommand(): Command<OpenJsDocLinkCommand_Args> {
188 return {
189 id: OpenJsDocLinkCommandId,
190 isTextEditorCommand: false,
191 async execute(args) {
192 if (typeof args?.file !== 'string' || args.file.length === 0) {
193 return;
194 }
195 // Command URI arguments are untrusted. This value is a filesystem path, so use `Uri.file`
196 // to prevent URI schemes from selecting another VS Code resource provider.
197 // https://code.visualstudio.com/api/references/vscode-api#Uri.file
198 const uri = vscode.Uri.file(args.file);
199 const document = await vscode.workspace.openTextDocument(uri);
200 return await vscode.window.showTextDocument(document, {
201 selection: new vscode.Range(
202 new vscode.Position(args.position?.start.line ?? 0, args.position?.start.character ?? 0),
203 new vscode.Position(args.position?.end.line ?? 0, args.position?.end.character ?? 0),
204 ),
205 });
206 },
207 };
208}
209
210function applyCodeActionCommand(ngClient: AngularLanguageClient): Command {
211 return {

Callers 1

registerCommandsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected