From cd1efd5109fb37b6f345fa6a675941182d40c410 Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Sun, 19 Jun 2016 15:16:21 -0700 Subject: [PATCH] docCommentTemplate --- src/server/session.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/server/session.ts b/src/server/session.ts index bdbd82dabbf..42ff097f31c 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -148,6 +148,7 @@ namespace ts.server { export const OutliningSpans = "outliningSpans"; export const TodoComments = "todoComments"; export const Indentation = "indentation"; + export const DocCommentTemplate = "docCommentTemplate"; } namespace Errors { @@ -713,6 +714,13 @@ namespace ts.server { return project.languageService.getTodoComments(file, args.descriptors); } + private getDocCommentTemplate(args: protocol.FileLocationRequestArgs) { + const { file, project } = this.getFileAndProject(args.file); + const scriptInfo = project.getScriptInfo(file); + const position = this.getPosition(args, scriptInfo); + return project.languageService.getDocCommentTemplateAtPosition(file, position); + } + private getIndentation(args: protocol.IndentationRequestArgs) { const { file, project } = this.getFileAndProject(args.file); const position = this.getPosition(args, project.getScriptInfo(file)); @@ -1271,6 +1279,9 @@ namespace ts.server { [CommandNames.Indentation]: (request: protocol.IndentationRequest) => { return this.requiredResponse(this.getIndentation(request.arguments)); }, + [CommandNames.DocCommentTemplate]: (request: protocol.FileLocationRequest) => { + return this.requiredResponse(this.getDocCommentTemplate(request.arguments)); + }, [CommandNames.Format]: (request: protocol.Request) => { const formatArgs = request.arguments; return this.requiredResponse(this.getFormattingEditsForRange(formatArgs.line, formatArgs.offset, formatArgs.endLine, formatArgs.endOffset, formatArgs.file));